[BACK]Return to session.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/session.c between version 1.178 and 1.179

version 1.178, 2004/07/11 17:48:47 version 1.179, 2004/07/17 05:31:41
Line 94 
Line 94 
 extern u_int utmp_len;  extern u_int utmp_len;
 extern int startup_pipe;  extern int startup_pipe;
 extern void destroy_sensitive_data(void);  extern void destroy_sensitive_data(void);
   extern Buffer loginmsg;
   
 /* original command from peer. */  /* original command from peer. */
 const char *original_command = NULL;  const char *original_command = NULL;
Line 189 
Line 190 
         return 1;          return 1;
 }  }
   
   static void
   display_loginmsg(void)
   {
           if (buffer_len(&loginmsg) > 0) {
                   buffer_append(&loginmsg, "\0", 1);
                   printf("%s", (char *)buffer_ptr(&loginmsg));
                   buffer_clear(&loginmsg);
           }
   }
   
 void  void
 do_authenticated(Authctxt *authctxt)  do_authenticated(Authctxt *authctxt)
Line 586 
Line 596 
                 do_exec_no_pty(s, command);                  do_exec_no_pty(s, command);
   
         original_command = NULL;          original_command = NULL;
   
           /*
            * Clear loginmsg: it's the child's responsibility to display
            * it to the user, otherwise multiple sessions may accumulate
            * multiple copies of the login messages.
            */
           buffer_clear(&loginmsg);
 }  }
   
   
Line 593 
Line 610 
 void  void
 do_login(Session *s, const char *command)  do_login(Session *s, const char *command)
 {  {
         char *time_string;  
         socklen_t fromlen;          socklen_t fromlen;
         struct sockaddr_storage from;          struct sockaddr_storage from;
         struct passwd * pw = s->pw;          struct passwd * pw = s->pw;
Line 623 
Line 639 
         if (check_quietlogin(s, command))          if (check_quietlogin(s, command))
                 return;                  return;
   
         if (options.print_lastlog && s->last_login_time != 0) {          display_loginmsg();
                 time_string = ctime(&s->last_login_time);  
                 if (strchr(time_string, '\n'))  
                         *strchr(time_string, '\n') = 0;  
                 if (strcmp(s->hostname, "") == 0)  
                         printf("Last login: %s\r\n", time_string);  
                 else  
                         printf("Last login: %s from %s\r\n", time_string,  
                             s->hostname);  
         }  
   
         do_motd();          do_motd();
 }  }
Line 1017 
Line 1024 
 static void  static void
 do_pwchange(Session *s)  do_pwchange(Session *s)
 {  {
           fflush(NULL);
         fprintf(stderr, "WARNING: Your password has expired.\n");          fprintf(stderr, "WARNING: Your password has expired.\n");
         if (s->ttyfd != -1) {          if (s->ttyfd != -1) {
                 fprintf(stderr,                  fprintf(stderr,
Line 1377 
Line 1385 
         if (s->ttyfd != -1) {          if (s->ttyfd != -1) {
                 packet_disconnect("Protocol error: you already have a pty.");                  packet_disconnect("Protocol error: you already have a pty.");
                 return 0;                  return 0;
         }  
         /* Get the time and hostname when the user last logged in. */  
         if (options.print_lastlog) {  
                 s->hostname[0] = '\0';  
                 s->last_login_time = get_last_login_time(s->pw->pw_uid,  
                     s->pw->pw_name, s->hostname, sizeof(s->hostname));  
         }          }
   
         s->term = packet_get_string(&len);          s->term = packet_get_string(&len);

Legend:
Removed from v.1.178  
changed lines
  Added in v.1.179