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

Diff for /src/usr.bin/ssh/readpass.c between version 1.30 and 1.30.2.2

version 1.30, 2004/06/17 15:10:14 version 1.30.2.2, 2005/09/02 03:45:00
Line 108 
Line 108 
         if (flags & RP_USE_ASKPASS)          if (flags & RP_USE_ASKPASS)
                 use_askpass = 1;                  use_askpass = 1;
         else if (flags & RP_ALLOW_STDIN) {          else if (flags & RP_ALLOW_STDIN) {
                 if (!isatty(STDIN_FILENO))                  if (!isatty(STDIN_FILENO)) {
                           debug("read_passphrase: stdin is not a tty");
                         use_askpass = 1;                          use_askpass = 1;
                   }
         } else {          } else {
                 rppflags |= RPP_REQUIRE_TTY;                  rppflags |= RPP_REQUIRE_TTY;
                 ttyfd = open(_PATH_TTY, O_RDWR);                  ttyfd = open(_PATH_TTY, O_RDWR);
                 if (ttyfd >= 0)                  if (ttyfd >= 0)
                         close(ttyfd);                          close(ttyfd);
                 else                  else {
                           debug("read_passphrase: can't open %s: %s", _PATH_TTY,
                               strerror(errno));
                         use_askpass = 1;                          use_askpass = 1;
                   }
         }          }
   
         if ((flags & RP_USE_ASKPASS) && getenv("DISPLAY") == NULL)          if ((flags & RP_USE_ASKPASS) && getenv("DISPLAY") == NULL)
Line 142 
Line 147 
         ret = xstrdup(buf);          ret = xstrdup(buf);
         memset(buf, 'x', sizeof buf);          memset(buf, 'x', sizeof buf);
         return ret;          return ret;
   }
   
   int
   ask_permission(const char *fmt, ...)
   {
           va_list args;
           char *p, prompt[1024];
           int allowed = 0;
   
           va_start(args, fmt);
           vsnprintf(prompt, sizeof(prompt), fmt, args);
           va_end(args);
   
           p = read_passphrase(prompt, RP_USE_ASKPASS|RP_ALLOW_EOF);
           if (p != NULL) {
                   /*
                    * Accept empty responses and responses consisting
                    * of the word "yes" as affirmative.
                    */
                   if (*p == '\0' || *p == '\n' ||
                       strcasecmp(p, "yes") == 0)
                           allowed = 1;
                   xfree(p);
           }
   
           return (allowed);
 }  }

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.30.2.2