[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.72 and 1.73

version 1.72, 2001/04/14 16:33:20 version 1.73, 2001/04/16 08:19:31
Line 93 
Line 93 
 void    do_exec_no_pty(Session *s, const char *command);  void    do_exec_no_pty(Session *s, const char *command);
 void    do_login(Session *s, const char *command);  void    do_login(Session *s, const char *command);
 void    do_child(Session *s, const char *command);  void    do_child(Session *s, const char *command);
   void    do_motd(void);
   int     check_quietlogin(Session *s, const char *command);
   
 void    do_authenticated1(Authctxt *authctxt);  void    do_authenticated1(Authctxt *authctxt);
 void    do_authenticated2(Authctxt *authctxt);  void    do_authenticated2(Authctxt *authctxt);
Line 624 
Line 626 
 void  void
 do_login(Session *s, const char *command)  do_login(Session *s, const char *command)
 {  {
         FILE *f;  
         char *time_string;          char *time_string;
         char buf[256];  
         char hostname[MAXHOSTNAMELEN];          char hostname[MAXHOSTNAMELEN];
         socklen_t fromlen;          socklen_t fromlen;
         struct sockaddr_storage from;          struct sockaddr_storage from;
         struct stat st;  
         time_t last_login_time;          time_t last_login_time;
         struct passwd * pw = s->pw;          struct passwd * pw = s->pw;
         pid_t pid = getpid();          pid_t pid = getpid();
Line 661 
Line 660 
             get_remote_name_or_ip(utmp_len, options.reverse_mapping_check),              get_remote_name_or_ip(utmp_len, options.reverse_mapping_check),
             (struct sockaddr *)&from);              (struct sockaddr *)&from);
   
         /* Done if .hushlogin exists or a command given. */          if (check_quietlogin(s, command))
         if (command != NULL)  
                 return;                  return;
         snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir);  
 #ifdef HAVE_LOGIN_CAP  
         if (login_getcapbool(lc, "hushlogin", 0) || stat(buf, &st) >= 0)  
 #else  
         if (stat(buf, &st) >= 0)  
 #endif  
                 return;  
         if (options.print_lastlog && last_login_time != 0) {          if (options.print_lastlog && last_login_time != 0) {
                 time_string = ctime(&last_login_time);                  time_string = ctime(&last_login_time);
                 if (strchr(time_string, '\n'))                  if (strchr(time_string, '\n'))
Line 680 
Line 672 
                 else                  else
                         printf("Last login: %s from %s\r\n", time_string, hostname);                          printf("Last login: %s from %s\r\n", time_string, hostname);
         }          }
   
           do_motd();
   }
   
   /*
    * Display the message of the day.
    */
   void
   do_motd(void)
   {
           FILE *f;
           char buf[256];
   
         if (options.print_motd) {          if (options.print_motd) {
 #ifdef HAVE_LOGIN_CAP  #ifdef HAVE_LOGIN_CAP
                 f = fopen(login_getcapstr(lc, "welcome", "/etc/motd",                  f = fopen(login_getcapstr(lc, "welcome", "/etc/motd",
Line 693 
Line 698 
                         fclose(f);                          fclose(f);
                 }                  }
         }          }
   }
   
   
   /*
    * Check for quiet login, either .hushlogin or command given.
    */
   int
   check_quietlogin(Session *s, const char *command)
   {
           char buf[256];
           struct passwd * pw = s->pw;
           struct stat st;
   
           /* Return 1 if .hushlogin exists or a command given. */
           if (command != NULL)
                   return 1;
           snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir);
   #ifdef HAVE_LOGIN_CAP
           if (login_getcapbool(lc, "hushlogin", 0) || stat(buf, &st) >= 0)
                   return 1;
   #else
           if (stat(buf, &st) >= 0)
                   return 1;
   #endif
           return 0;
 }  }
   
 /*  /*

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73