[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.80 and 1.81

version 1.80, 2002/02/04 00:53:39 version 1.81, 2002/02/05 15:50:12
Line 712 
Line 712 
                                 sock = accept(sockets[i].fd,                                  sock = accept(sockets[i].fd,
                                     (struct sockaddr *) &sunaddr, &slen);                                      (struct sockaddr *) &sunaddr, &slen);
                                 if (sock < 0) {                                  if (sock < 0) {
                                         perror("accept from AUTH_SOCKET");                                          error("accept from AUTH_SOCKET: %s",
                                               strerror(errno));
                                         break;                                          break;
                                 }                                  }
                                 new_socket(AUTH_CONNECTION, sock);                                  new_socket(AUTH_CONNECTION, sock);
Line 766 
Line 767 
 }  }
   
 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 777 
Line 778 
 static 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 933 
Line 934 
         pid = fork();          pid = fork();
         if (pid == -1) {          if (pid == -1) {
                 perror("fork");                  perror("fork");
                 exit(1);                  cleanup_exit(1);
         }          }
         if (pid != 0) {         /* Parent - execute the given command. */          if (pid != 0) {         /* Parent - execute the given command. */
                 close(sock);                  close(sock);
Line 956 
Line 957 
                 perror(av[0]);                  perror(av[0]);
                 exit(1);                  exit(1);
         }          }
           /* child */
           log_init(__progname, SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_AUTH, 0);
   
         if (setsid() == -1) {          if (setsid() == -1) {
                 perror("setsid");                  error("setsid: %s", strerror(errno));
                 cleanup_exit(1);                  cleanup_exit(1);
         }          }
   
Line 970 
Line 973 
         /* deny core dumps, since memory contains unencrypted private keys */          /* deny core dumps, since memory contains unencrypted private keys */
         rlim.rlim_cur = rlim.rlim_max = 0;          rlim.rlim_cur = rlim.rlim_max = 0;
         if (setrlimit(RLIMIT_CORE, &rlim) < 0) {          if (setrlimit(RLIMIT_CORE, &rlim) < 0) {
                 perror("setrlimit rlimit_core failed");                  error("setrlimit RLIMIT_CORE: %s", strerror(errno));
                 cleanup_exit(1);                  cleanup_exit(1);
         }          }
   
 skip:  skip:
         if (atexit(cleanup_socket) < 0) {          fatal_add_cleanup(cleanup_socket, NULL);
                 perror("atexit");  
                 cleanup_exit(1);  
         }  
         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);
Line 997 
Line 997 
                 if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) {                  if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) {
                         if (errno == EINTR)                          if (errno == EINTR)
                                 continue;                                  continue;
                         exit(1);                          fatal("select: %s", strerror(errno));
                 }                  }
                 after_select(readsetp, writesetp);                  after_select(readsetp, writesetp);
         }          }

Legend:
Removed from v.1.80  
changed lines
  Added in v.1.81