do_pre_login() used before declared

Wendy Palm wendyp at cray.com
Wed Aug 8 07:34:41 EST 2001


or better yet (why do we think of these things AFTER "send"?)

add the prototype where it belongs:

% diff  -u session.c.orig session.c.mod
@@ -129,6 +129,7 @@
 void   do_exec_no_pty(Session *, const char *);
 void   do_exec(Session *, const char *);
 void   do_login(Session *, const char *);
+void   do_pre_login(Session *)
 void   do_child(Session *, const char *);
 void   do_motd(void);
 int    check_quietlogin(Session *, const char *);


Wendy Palm wrote:
> 
> do_pre_login() in session.c is used (in do_exec_pty()) before
> it's declared, which is causing some problems for me.
> 
> please move it up a couple hundred lines in the file.
> 
> patch included for 0807 snapshot.
> 
> thanks,
> wendy
> 
> % diff -u session.c.orig session.c.mod
> --- session.c.orig      Tue Aug  7 13:11:51 2001
> +++ session.c.mod       Tue Aug  7 16:21:07 2001
> @@ -397,6 +397,34 @@
>         }
>  }
> 
> +#ifdef LOGIN_NEEDS_UTMPX
> +void
> +do_pre_login(Session *s)
> +{
> +       socklen_t fromlen;
> +       struct sockaddr_storage from;
> +       pid_t pid = getpid();
> +
> +       /*
> +        * Get IP address of client. If the connection is not a socket, let
> +        * the address be 0.0.0.0.
> +        */
> +       memset(&from, 0, sizeof(from));
> +       if (packet_connection_is_on_socket()) {
> +               fromlen = sizeof(from);
> +               if (getpeername(packet_get_connection_in(),
> +                    (struct sockaddr *) & from, &fromlen) < 0) {
> +                       debug("getpeername: %.100s", strerror(errno));
> +                       fatal_cleanup();
> +               }
> +       }
> +
> +       record_utmp_only(pid, s->tty, s->pw->pw_name,
> +           get_remote_name_or_ip(utmp_len, options.reverse_mapping_check),
> +           (struct sockaddr *)&from);
> +}
> +#endif
> +
>  /*
>   * This is called to fork and execute a command when we have no tty.  This
>   * will call do_child from the child, and server_loop from the parent after
> @@ -621,34 +649,6 @@
>                 /* server_loop _has_ closed ptyfd and fdout. */
>         }
>  }
> -
> -#ifdef LOGIN_NEEDS_UTMPX
> -void
> -do_pre_login(Session *s)
> -{
> -       socklen_t fromlen;
> -       struct sockaddr_storage from;
> -       pid_t pid = getpid();
> -
> -       /*
> -        * Get IP address of client. If the connection is not a socket, let
> -        * the address be 0.0.0.0.
> -        */
> -       memset(&from, 0, sizeof(from));
> -       if (packet_connection_is_on_socket()) {
> -               fromlen = sizeof(from);
> -               if (getpeername(packet_get_connection_in(),
> -                    (struct sockaddr *) & from, &fromlen) < 0) {
> -                       debug("getpeername: %.100s", strerror(errno));
> -                       fatal_cleanup();
> -               }
> -       }
> -
> -       record_utmp_only(pid, s->tty, s->pw->pw_name,
> -           get_remote_name_or_ip(utmp_len, options.reverse_mapping_check),
> -           (struct sockaddr *)&from);
> -}
> -#endif
> 
>  /*
>   * This is called to fork and execute a command.  If another command is
> 
> --
> wendy palm
> Cray OS Sustaining Engineering, Cray Inc.
> wendyp at cray.com, 651-605-9154

-- 
wendy palm
Cray OS Sustaining Engineering, Cray Inc.
wendyp at cray.com, 651-605-9154



More information about the openssh-unix-dev mailing list