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

Diff for /src/usr.bin/ssh/sftp.c between version 1.75.2.2 and 1.76

version 1.75.2.2, 2006/11/08 00:17:14 version 1.76, 2006/03/19 02:22:56
Line 1 
Line 1 
 /* $OpenBSD$ */  
 /*  /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>   * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *   *
Line 15 
Line 14 
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */   */
   
 #include <sys/types.h>  #include "includes.h"
   RCSID("$OpenBSD$");
   
 #include <sys/ioctl.h>  #include <sys/ioctl.h>
   #include <sys/types.h>
 #include <sys/wait.h>  #include <sys/wait.h>
 #include <sys/stat.h>  #include <sys/stat.h>
 #include <sys/socket.h>  
 #include <sys/param.h>  
   
 #include <errno.h>  
 #include <glob.h>  #include <glob.h>
 #include <histedit.h>  #include <histedit.h>
 #include <paths.h>  #include <paths.h>
 #include <signal.h>  #include <signal.h>
 #include <stdlib.h>  
 #include <stdio.h>  
 #include <string.h>  
 #include <unistd.h>  
 #include <stdarg.h>  
   
   #include "buffer.h"
 #include "xmalloc.h"  #include "xmalloc.h"
 #include "log.h"  #include "log.h"
 #include "pathnames.h"  #include "pathnames.h"
 #include "misc.h"  #include "misc.h"
   
 #include "sftp.h"  #include "sftp.h"
 #include "buffer.h"  
 #include "sftp-common.h"  #include "sftp-common.h"
 #include "sftp-client.h"  #include "sftp-client.h"
   
Line 242 
Line 236 
                 if (errno != EINTR)                  if (errno != EINTR)
                         fatal("Couldn't wait for child: %s", strerror(errno));                          fatal("Couldn't wait for child: %s", strerror(errno));
         if (!WIFEXITED(status))          if (!WIFEXITED(status))
                 error("Shell exited abnormally");                  error("Shell exited abormally");
         else if (WEXITSTATUS(status))          else if (WEXITSTATUS(status))
                 error("Shell exited with status %d", WEXITSTATUS(status));                  error("Shell exited with status %d", WEXITSTATUS(status));
 }  }
Line 481 
Line 475 
         if (stat(path, &sb) == -1)          if (stat(path, &sb) == -1)
                 return(0);                  return(0);
   
         return(S_ISDIR(sb.st_mode));          return(sb.st_mode & S_IFDIR);
 }  }
   
 static int  static int
Line 505 
Line 499 
                 return(0);                  return(0);
         if (!(a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS))          if (!(a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS))
                 return(0);                  return(0);
         return(S_ISDIR(a->perm));          return(a->perm & S_IFDIR);
 }  }
   
 static int  static int
Line 545 
Line 539 
   
                 if (g.gl_matchc == 1 && dst) {                  if (g.gl_matchc == 1 && dst) {
                         /* If directory specified, append filename */                          /* If directory specified, append filename */
                         xfree(tmp);  
                         if (is_dir(dst)) {                          if (is_dir(dst)) {
                                 if (infer_path(g.gl_pathv[0], &tmp)) {                                  if (infer_path(g.gl_pathv[0], &tmp)) {
                                         err = 1;                                          err = 1;
Line 570 
Line 563 
   
 out:  out:
         xfree(abs_src);          xfree(abs_src);
           if (abs_dst)
                   xfree(abs_dst);
         globfree(&g);          globfree(&g);
         return(err);          return(err);
 }  }
Line 965 
Line 960 
         case I_CHOWN:          case I_CHOWN:
         case I_CHGRP:          case I_CHGRP:
                 /* Get numeric arg (mandatory) */                  /* Get numeric arg (mandatory) */
                 errno = 0;  
                 l = strtol(cp, &cp2, base);                  l = strtol(cp, &cp2, base);
                 if (cp2 == cp || ((l == LONG_MIN || l == LONG_MAX) &&                  if (cp2 == cp || ((l == LONG_MIN || l == LONG_MAX) &&
                     errno == ERANGE) || l < 0) {                      errno == ERANGE) || l < 0) {
Line 1367 
Line 1361 
 {  {
         int c_in, c_out;          int c_in, c_out;
   
   #ifdef USE_PIPES
           int pin[2], pout[2];
   
           if ((pipe(pin) == -1) || (pipe(pout) == -1))
                   fatal("pipe: %s", strerror(errno));
           *in = pin[0];
           *out = pout[1];
           c_in = pout[0];
           c_out = pin[1];
   #else /* USE_PIPES */
         int inout[2];          int inout[2];
   
         if (socketpair(AF_UNIX, SOCK_STREAM, 0, inout) == -1)          if (socketpair(AF_UNIX, SOCK_STREAM, 0, inout) == -1)
                 fatal("socketpair: %s", strerror(errno));                  fatal("socketpair: %s", strerror(errno));
         *in = *out = inout[0];          *in = *out = inout[0];
         c_in = c_out = inout[1];          c_in = c_out = inout[1];
   #endif /* USE_PIPES */
   
         if ((sshpid = fork()) == -1)          if ((sshpid = fork()) == -1)
                 fatal("fork: %s", strerror(errno));                  fatal("fork: %s", strerror(errno));
Line 1439 
Line 1444 
   
         memset(&args, '\0', sizeof(args));          memset(&args, '\0', sizeof(args));
         args.list = NULL;          args.list = NULL;
         addargs(&args, "%s", ssh_program);          addargs(&args, ssh_program);
         addargs(&args, "-oForwardX11 no");          addargs(&args, "-oForwardX11 no");
         addargs(&args, "-oForwardAgent no");          addargs(&args, "-oForwardAgent no");
         addargs(&args, "-oPermitLocalCommand no");          addargs(&args, "-oPermitLocalCommand no");

Legend:
Removed from v.1.75.2.2  
changed lines
  Added in v.1.76