[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.85.2.1 and 1.85.2.2

version 1.85.2.1, 2002/06/26 15:30:39 version 1.85.2.2, 2002/10/11 14:51:53
Line 103 
Line 103 
 extern char *__progname;  extern char *__progname;
   
 static void  static void
   close_socket(SocketEntry *e)
   {
           close(e->fd);
           e->fd = -1;
           e->type = AUTH_UNUSED;
           buffer_free(&e->input);
           buffer_free(&e->output);
           buffer_free(&e->request);
   }
   
   static void
 idtab_init(void)  idtab_init(void)
 {  {
         int i;          int i;
Line 613 
Line 624 
         cp = buffer_ptr(&e->input);          cp = buffer_ptr(&e->input);
         msg_len = GET_32BIT(cp);          msg_len = GET_32BIT(cp);
         if (msg_len > 256 * 1024) {          if (msg_len > 256 * 1024) {
                 shutdown(e->fd, SHUT_RDWR);                  close_socket(e);
                 close(e->fd);  
                 e->fd = -1;  
                 e->type = AUTH_UNUSED;  
                 buffer_free(&e->input);  
                 buffer_free(&e->output);  
                 buffer_free(&e->request);  
                 return;                  return;
         }          }
         if (buffer_len(&e->input) < msg_len + 4)          if (buffer_len(&e->input) < msg_len + 4)
Line 801 
Line 806 
         char buf[1024];          char buf[1024];
         int len, sock;          int len, sock;
         u_int i;          u_int i;
           uid_t euid;
           gid_t egid;
   
         for (i = 0; i < sockets_alloc; i++)          for (i = 0; i < sockets_alloc; i++)
                 switch (sockets[i].type) {                  switch (sockets[i].type) {
Line 816 
Line 823 
                                             strerror(errno));                                              strerror(errno));
                                         break;                                          break;
                                 }                                  }
                                   if (getpeereid(sock, &euid, &egid) < 0) {
                                           error("getpeereid %d failed: %s",
                                               sock, strerror(errno));
                                           close(sock);
                                           break;
                                   }
                                   if ((euid != 0) && (getuid() != euid)) {
                                           error("uid mismatch: "
                                               "peer euid %u != uid %u",
                                               (u_int) euid, (u_int) getuid());
                                           close(sock);
                                           break;
                                   }
                                 new_socket(AUTH_CONNECTION, sock);                                  new_socket(AUTH_CONNECTION, sock);
                         }                          }
                         break;                          break;
Line 832 
Line 852 
                                         break;                                          break;
                                 } while (1);                                  } while (1);
                                 if (len <= 0) {                                  if (len <= 0) {
                                         shutdown(sockets[i].fd, SHUT_RDWR);                                          close_socket(&sockets[i]);
                                         close(sockets[i].fd);  
                                         sockets[i].fd = -1;  
                                         sockets[i].type = AUTH_UNUSED;  
                                         buffer_free(&sockets[i].input);  
                                         buffer_free(&sockets[i].output);  
                                         buffer_free(&sockets[i].request);  
                                         break;                                          break;
                                 }                                  }
                                 buffer_consume(&sockets[i].output, len);                                  buffer_consume(&sockets[i].output, len);
Line 852 
Line 866 
                                         break;                                          break;
                                 } while (1);                                  } while (1);
                                 if (len <= 0) {                                  if (len <= 0) {
                                         shutdown(sockets[i].fd, SHUT_RDWR);                                          close_socket(&sockets[i]);
                                         close(sockets[i].fd);  
                                         sockets[i].fd = -1;  
                                         sockets[i].type = AUTH_UNUSED;  
                                         buffer_free(&sockets[i].input);  
                                         buffer_free(&sockets[i].output);  
                                         buffer_free(&sockets[i].request);  
                                         break;                                          break;
                                 }                                  }
                                 buffer_append(&sockets[i].input, buf, len);                                  buffer_append(&sockets[i].input, buf, len);
Line 930 
Line 938 
         struct sockaddr_un sunaddr;          struct sockaddr_un sunaddr;
         struct rlimit rlim;          struct rlimit rlim;
         extern int optind;          extern int optind;
           extern char *optarg;
         pid_t pid;          pid_t pid;
         char pidstrbuf[1 + 3 * sizeof pid];          char pidstrbuf[1 + 3 * sizeof pid];
   
           /* drop */
           setegid(getgid());
           setgid(getgid());
   
         SSLeay_add_all_algorithms();          SSLeay_add_all_algorithms();
   
         while ((ch = getopt(ac, av, "cdksa:")) != -1) {          while ((ch = getopt(ac, av, "cdksa:")) != -1) {
Line 1029 
Line 1042 
                 perror("bind");                  perror("bind");
                 cleanup_exit(1);                  cleanup_exit(1);
         }          }
         if (listen(sock, 5) < 0) {          if (listen(sock, 128) < 0) {
                 perror("listen");                  perror("listen");
                 cleanup_exit(1);                  cleanup_exit(1);
         }          }

Legend:
Removed from v.1.85.2.1  
changed lines
  Added in v.1.85.2.2