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

Diff for /src/usr.bin/ssh/ssh-agent.c between version 1.111.2.2 and 1.112

version 1.111.2.2, 2004/08/19 22:37:32 version 1.112, 2003/09/18 08:49:45
Line 50 
Line 50 
 #include "authfd.h"  #include "authfd.h"
 #include "compat.h"  #include "compat.h"
 #include "log.h"  #include "log.h"
   #include "readpass.h"
 #include "misc.h"  #include "misc.h"
   
 #ifdef SMARTCARD  #ifdef SMARTCARD
Line 174 
Line 175 
         p = read_passphrase(prompt, RP_ALLOW_EOF);          p = read_passphrase(prompt, RP_ALLOW_EOF);
         if (p != NULL) {          if (p != NULL) {
                 /*                  /*
                  * Accept empty responses and responses consisting                   * Accept empty responses and responses consisting
                  * of the word "yes" as affirmative.                   * of the word "yes" as affirmative.
                  */                   */
                 if (*p == '\0' || *p == '\n' || strcasecmp(p, "yes") == 0)                  if (*p == '\0' || *p == '\n' || strcasecmp(p, "yes") == 0)
Line 781 
Line 782 
 {  {
         u_int i, old_alloc, new_alloc;          u_int i, old_alloc, new_alloc;
   
         set_nonblock(fd);          if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
                   error("fcntl O_NONBLOCK: %s", strerror(errno));
   
         if (fd > max_fd)          if (fd > max_fd)
                 max_fd = fd;                  max_fd = fd;
Line 812 
Line 814 
 }  }
   
 static int  static int
 prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, u_int *nallocp)  prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, int *nallocp)
 {  {
         u_int i, sz;          u_int i, sz;
         int n = 0;          int n = 0;
Line 943 
Line 945 
 }  }
   
 static void  static void
 cleanup_socket(void)  cleanup_socket(void *p)
 {  {
         if (socket_name[0])          if (socket_name[0])
                 unlink(socket_name);                  unlink(socket_name);
Line 951 
Line 953 
                 rmdir(socket_dir);                  rmdir(socket_dir);
 }  }
   
 void  static void
 cleanup_exit(int i)  cleanup_exit(int i)
 {  {
         cleanup_socket();          cleanup_socket(NULL);
         _exit(i);          exit(i);
 }  }
   
 static void  static void
 cleanup_handler(int sig)  cleanup_handler(int sig)
 {  {
         cleanup_socket();          cleanup_socket(NULL);
         _exit(2);          _exit(2);
 }  }
   
Line 998 
Line 1000 
 main(int ac, char **av)  main(int ac, char **av)
 {  {
         int c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0;          int c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0;
         int sock, fd,  ch;          int sock, fd,  ch, nalloc;
         u_int nalloc;  
         char *shell, *format, *pidstr, *agentsocket = NULL;          char *shell, *format, *pidstr, *agentsocket = NULL;
         fd_set *readsetp = NULL, *writesetp = NULL;          fd_set *readsetp = NULL, *writesetp = NULL;
         struct sockaddr_un sunaddr;          struct sockaddr_un sunaddr;
Line 1086 
Line 1087 
   
         if (agentsocket == NULL) {          if (agentsocket == NULL) {
                 /* Create private directory for agent socket */                  /* Create private directory for agent socket */
                 strlcpy(socket_dir, "/tmp/ssh-XXXXXXXXXX", sizeof socket_dir);                  strlcpy(socket_dir, "/tmp/ssh-XXXXXXXX", sizeof socket_dir);
                 if (mkdtemp(socket_dir) == NULL) {                  if (mkdtemp(socket_dir) == NULL) {
                         perror("mkdtemp: private socket dir");                          perror("mkdtemp: private socket dir");
                         exit(1);                          exit(1);
Line 1115 
Line 1116 
                 perror("bind");                  perror("bind");
                 cleanup_exit(1);                  cleanup_exit(1);
         }          }
         if (listen(sock, SSH_LISTEN_BACKLOG) < 0) {          if (listen(sock, 128) < 0) {
                 perror("listen");                  perror("listen");
                 cleanup_exit(1);                  cleanup_exit(1);
         }          }
Line 1184 
Line 1185 
         }          }
   
 skip:  skip:
           fatal_add_cleanup(cleanup_socket, NULL);
         new_socket(AUTH_SOCKET, sock);          new_socket(AUTH_SOCKET, sock);
         if (ac > 0) {          if (ac > 0) {
                 signal(SIGALRM, check_parent_exists);                  signal(SIGALRM, check_parent_exists);

Legend:
Removed from v.1.111.2.2  
changed lines
  Added in v.1.112