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

Diff for /src/usr.bin/ssh/channels.c between version 1.356 and 1.357

version 1.356, 2016/10/18 17:32:54 version 1.357, 2017/02/01 02:59:09
Line 3038 
Line 3038 
         }          }
         packet_check_eom();          packet_check_eom();
         c = channel_connect_to_port(host, host_port,          c = channel_connect_to_port(host, host_port,
             "connected socket", originator_string);              "connected socket", originator_string, NULL, NULL);
         free(originator_string);          free(originator_string);
         free(host);          free(host);
         if (c == NULL) {          if (c == NULL) {
Line 3993 
Line 3993 
         memset(cctx, 0, sizeof(*cctx));          memset(cctx, 0, sizeof(*cctx));
 }  }
   
 /* Return CONNECTING channel to remote host:port or local socket path */  /*
    * Return CONNECTING channel to remote host:port or local socket path,
    * passing back the failure reason if appropriate.
    */
 static Channel *  static Channel *
 connect_to(const char *name, int port, char *ctype, char *rname)  connect_to_reason(const char *name, int port, char *ctype, char *rname,
        int *reason, const char **errmsg)
 {  {
         struct addrinfo hints;          struct addrinfo hints;
         int gaierr;          int gaierr;
Line 4036 
Line 4040 
                 hints.ai_family = IPv4or6;                  hints.ai_family = IPv4or6;
                 hints.ai_socktype = SOCK_STREAM;                  hints.ai_socktype = SOCK_STREAM;
                 snprintf(strport, sizeof strport, "%d", port);                  snprintf(strport, sizeof strport, "%d", port);
                 if ((gaierr = getaddrinfo(name, strport, &hints, &cctx.aitop)) != 0) {                  if ((gaierr = getaddrinfo(name, strport, &hints, &cctx.aitop))
                       != 0) {
                           if (errmsg != NULL)
                                   *errmsg = ssh_gai_strerror(gaierr);
                           if (reason != NULL)
                                   *reason = SSH2_OPEN_CONNECT_FAILED;
                         error("connect_to %.100s: unknown host (%s)", name,                          error("connect_to %.100s: unknown host (%s)", name,
                             ssh_gai_strerror(gaierr));                              ssh_gai_strerror(gaierr));
                         return NULL;                          return NULL;
Line 4059 
Line 4068 
         return c;          return c;
 }  }
   
   /* Return CONNECTING channel to remote host:port or local socket path */
   static Channel *
   connect_to(const char *name, int port, char *ctype, char *rname)
   {
           return connect_to_reason(name, port, ctype, rname, NULL, NULL);
   }
   
 /*  /*
  * returns either the newly connected channel or the downstream channel   * returns either the newly connected channel or the downstream channel
  * that needs to deal with this connection.   * that needs to deal with this connection.
Line 4103 
Line 4119 
   
 /* Check if connecting to that port is permitted and connect. */  /* Check if connecting to that port is permitted and connect. */
 Channel *  Channel *
 channel_connect_to_port(const char *host, u_short port, char *ctype, char *rname)  channel_connect_to_port(const char *host, u_short port, char *ctype,
       char *rname, int *reason, const char **errmsg)
 {  {
         int i, permit, permit_adm = 1;          int i, permit, permit_adm = 1;
   
Line 4128 
Line 4145 
         if (!permit || !permit_adm) {          if (!permit || !permit_adm) {
                 logit("Received request to connect to host %.100s port %d, "                  logit("Received request to connect to host %.100s port %d, "
                     "but the request was denied.", host, port);                      "but the request was denied.", host, port);
                   if (reason != NULL)
                           *reason = SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED;
                 return NULL;                  return NULL;
         }          }
         return connect_to(host, port, ctype, rname);          return connect_to_reason(host, port, ctype, rname, reason, errmsg);
 }  }
   
 /* Check if connecting to that path is permitted and connect. */  /* Check if connecting to that path is permitted and connect. */

Legend:
Removed from v.1.356  
changed lines
  Added in v.1.357