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

Diff for /src/usr.bin/ssh/authfd.c between version 1.120 and 1.121

version 1.120, 2019/11/13 04:47:52 version 1.121, 2019/12/21 02:19:13
Line 81 
Line 81 
                 return SSH_ERR_INVALID_FORMAT;                  return SSH_ERR_INVALID_FORMAT;
 }  }
   
 /* Returns the number of the authentication fd, or -1 if there is none. */  /*
    * Opens an authentication socket at the provided path and stores the file
    * descriptor in fdp. Returns 0 on success and an error on failure.
    */
 int  int
 ssh_get_authentication_socket(int *fdp)  ssh_get_authentication_socket_path(const char *authsocket, int *fdp)
 {  {
         const char *authsocket;  
         int sock, oerrno;          int sock, oerrno;
         struct sockaddr_un sunaddr;          struct sockaddr_un sunaddr;
   
         if (fdp != NULL)  
                 *fdp = -1;  
   
         authsocket = getenv(SSH_AUTHSOCKET_ENV_NAME);  
         if (authsocket == NULL || *authsocket == '\0')  
                 return SSH_ERR_AGENT_NOT_PRESENT;  
   
         memset(&sunaddr, 0, sizeof(sunaddr));          memset(&sunaddr, 0, sizeof(sunaddr));
         sunaddr.sun_family = AF_UNIX;          sunaddr.sun_family = AF_UNIX;
         strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path));          strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path));
Line 116 
Line 111 
         else          else
                 close(sock);                  close(sock);
         return 0;          return 0;
   }
   
   /*
    * Opens the default authentication socket and stores the file descriptor in
    * fdp. Returns 0 on success and an error on failure.
    */
   int
   ssh_get_authentication_socket(int *fdp)
   {
           const char *authsocket;
   
           if (fdp != NULL)
                   *fdp = -1;
   
           authsocket = getenv(SSH_AUTHSOCKET_ENV_NAME);
           if (authsocket == NULL || *authsocket == '\0')
                   return SSH_ERR_AGENT_NOT_PRESENT;
   
           return ssh_get_authentication_socket_path(authsocket, fdp);
 }  }
   
 /* Communicate with agent: send request and read reply */  /* Communicate with agent: send request and read reply */

Legend:
Removed from v.1.120  
changed lines
  Added in v.1.121