/[svn]/ircd-hybrid/branches/8.2.x/src/auth.c
ViewVC logotype

Diff of /ircd-hybrid/branches/8.2.x/src/auth.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8215 by michael, Sun Apr 16 11:42:51 2017 UTC revision 8216 by michael, Sun Apr 16 12:18:38 2017 UTC
# Line 62  enum Line 62  enum
62    REPORT_FIN_ID,    REPORT_FIN_ID,
63    REPORT_FAIL_ID,    REPORT_FAIL_ID,
64    REPORT_IP_MISMATCH,    REPORT_IP_MISMATCH,
65    REPORT_HOST_TOOLONG    REPORT_HOST_TOOLONG,
66      REPORT_HOST_INVALID
67  };  };
68    
69  static const char *const HeaderMessages[] =  static const char *const HeaderMessages[] =
# Line 74  static const char *const HeaderMessages[ Line 75  static const char *const HeaderMessages[
75    [REPORT_FIN_ID] = ":*** Got Ident response",    [REPORT_FIN_ID] = ":*** Got Ident response",
76    [REPORT_FAIL_ID] = ":*** No Ident response",    [REPORT_FAIL_ID] = ":*** No Ident response",
77    [REPORT_IP_MISMATCH] = ":*** Your forward and reverse DNS do not match, ignoring hostname",    [REPORT_IP_MISMATCH] = ":*** Your forward and reverse DNS do not match, ignoring hostname",
78    [REPORT_HOST_TOOLONG] = ":*** Your hostname is too long, ignoring hostname"    [REPORT_HOST_TOOLONG] = ":*** Your hostname is too long, ignoring hostname",
79      [REPORT_HOST_INVALID] = ":*** Your hostname contains illegal characters, ignoring hostname"
80  };  };
81    
82  #define sendheader(c, i) sendto_one_notice((c), &me, "%s", HeaderMessages[(i)])  #define sendheader(c, i) sendto_one_notice((c), &me, "%s", HeaderMessages[(i)])
# Line 137  release_auth_client(struct AuthRequest * Line 139  release_auth_client(struct AuthRequest *
139    read_packet(&client->connection->fd, client);    read_packet(&client->connection->fd, client);
140  }  }
141    
142    static int
143    auth_verify_hostname(const char *hostname)
144    {
145      const char *p = hostname;
146    
147      assert(p);
148    
149      if (EmptyString(p) || *p == '.' || *p == ':')
150        return 0;
151    
152      for (; *p; ++p)
153        if (!IsHostChar(*p))
154          return 0;
155    
156      return 1;
157    }
158    
159  /*  /*
160   * auth_dns_callback - called when resolver query finishes   * auth_dns_callback - called when resolver query finishes
161   * if the query resulted in a successful search, name will contain   * if the query resulted in a successful search, name will contain
# Line 180  auth_dns_callback(void *vptr, const stru Line 199  auth_dns_callback(void *vptr, const stru
199    
200      if (namelength > HOSTLEN)      if (namelength > HOSTLEN)
201        sendheader(auth->client, REPORT_HOST_TOOLONG);        sendheader(auth->client, REPORT_HOST_TOOLONG);
202        else if (!auth_verify_hostname(name))
203          sendheader(auth->client, REPORT_HOST_INVALID);
204      else      else
205      {      {
206        strlcpy(auth->client->host, name, sizeof(auth->client->host));        strlcpy(auth->client->host, name, sizeof(auth->client->host));

Legend:
Removed from v.8215  
changed lines
  Added in v.8216

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28