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

Diff for /src/usr.bin/ssh/sftp-server.c between version 1.30.2.3 and 1.30.2.4

version 1.30.2.3, 2002/06/26 18:22:36 version 1.30.2.4, 2002/10/11 14:53:07
Line 675 
Line 675 
         xfree(path);          xfree(path);
 }  }
   
 /*  
  * drwxr-xr-x    5 markus   markus       1024 Jan 13 18:39 .ssh  
  */  
 static char *  
 ls_file(char *name, struct stat *st)  
 {  
         int ulen, glen, sz = 0;  
         struct passwd *pw;  
         struct group *gr;  
         struct tm *ltime = localtime(&st->st_mtime);  
         char *user, *group;  
         char buf[1024], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1];  
   
         strmode(st->st_mode, mode);  
         if ((pw = getpwuid(st->st_uid)) != NULL) {  
                 user = pw->pw_name;  
         } else {  
                 snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid);  
                 user = ubuf;  
         }  
         if ((gr = getgrgid(st->st_gid)) != NULL) {  
                 group = gr->gr_name;  
         } else {  
                 snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid);  
                 group = gbuf;  
         }  
         if (ltime != NULL) {  
                 if (time(NULL) - st->st_mtime < (365*24*60*60)/2)  
                         sz = strftime(tbuf, sizeof tbuf, "%b %e %H:%M", ltime);  
                 else  
                         sz = strftime(tbuf, sizeof tbuf, "%b %e  %Y", ltime);  
         }  
         if (sz == 0)  
                 tbuf[0] = '\0';  
         ulen = MAX(strlen(user), 8);  
         glen = MAX(strlen(group), 8);  
         snprintf(buf, sizeof buf, "%s %3d %-*s %-*s %8llu %s %s", mode,  
             st->st_nlink, ulen, user, glen, group,  
             (unsigned long long)st->st_size, tbuf, name);  
         return xstrdup(buf);  
 }  
   
 static void  static void
 process_readdir(void)  process_readdir(void)
 {  {
Line 752 
Line 710 
                                 continue;                                  continue;
                         stat_to_attrib(&st, &(stats[count].attrib));                          stat_to_attrib(&st, &(stats[count].attrib));
                         stats[count].name = xstrdup(dp->d_name);                          stats[count].name = xstrdup(dp->d_name);
                         stats[count].long_name = ls_file(dp->d_name, &st);                          stats[count].long_name = ls_file(dp->d_name, &st, 0);
                         count++;                          count++;
                         /* send up to 100 entries in one message */                          /* send up to 100 entries in one message */
                         /* XXX check packet size instead */                          /* XXX check packet size instead */

Legend:
Removed from v.1.30.2.3  
changed lines
  Added in v.1.30.2.4