[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.28 and 1.28.6.2

version 1.28, 2003/01/23 13:50:27 version 1.28.6.2, 2005/03/10 17:15:04
Line 28 
Line 28 
 #include <readpassphrase.h>  #include <readpassphrase.h>
   
 #include "xmalloc.h"  #include "xmalloc.h"
 #include "readpass.h"  #include "misc.h"
 #include "pathnames.h"  #include "pathnames.h"
 #include "log.h"  #include "log.h"
 #include "ssh.h"  #include "ssh.h"
Line 105 
Line 105 
         int rppflags, use_askpass = 0, ttyfd;          int rppflags, use_askpass = 0, ttyfd;
   
         rppflags = (flags & RP_ECHO) ? RPP_ECHO_ON : RPP_ECHO_OFF;          rppflags = (flags & RP_ECHO) ? RPP_ECHO_ON : RPP_ECHO_OFF;
         if (flags & RP_ALLOW_STDIN) {          if (flags & RP_USE_ASKPASS)
                   use_askpass = 1;
           else if (flags & RP_ALLOW_STDIN) {
                 if (!isatty(STDIN_FILENO))                  if (!isatty(STDIN_FILENO))
                         use_askpass = 1;                          use_askpass = 1;
         } else {          } else {
Line 117 
Line 119 
                         use_askpass = 1;                          use_askpass = 1;
         }          }
   
           if ((flags & RP_USE_ASKPASS) && getenv("DISPLAY") == NULL)
                   return (flags & RP_ALLOW_EOF) ? NULL : xstrdup("");
   
         if (use_askpass && getenv("DISPLAY")) {          if (use_askpass && getenv("DISPLAY")) {
                 if (getenv(SSH_ASKPASS_ENV))                  if (getenv(SSH_ASKPASS_ENV))
                         askpass = getenv(SSH_ASKPASS_ENV);                          askpass = getenv(SSH_ASKPASS_ENV);
Line 137 
Line 142 
         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.28  
changed lines
  Added in v.1.28.6.2