ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/s_bsd.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/s_bsd.c (file contents):
Revision 2916 by michael, Sat Jan 25 21:09:18 2014 UTC vs.
Revision 3171 by michael, Sun Mar 16 11:51:48 2014 UTC

# Line 242 | Line 242 | ssl_handshake(int fd, struct Client *cli
242    {
243      if ((CurrentTime - client_p->localClient->firsttime) > 30)
244      {
245 <      exit_client(client_p, client_p, "Timeout during SSL handshake");
245 >      exit_client(client_p, "Timeout during SSL handshake");
246        return;
247      }
248  
# Line 259 | Line 259 | ssl_handshake(int fd, struct Client *cli
259          return;
260  
261        default:
262 <        exit_client(client_p, client_p, "Error during SSL handshake");
262 >        exit_client(client_p, "Error during SSL handshake");
263          return;
264      }
265    }
# Line 305 | Line 305 | ssl_handshake(int fd, struct Client *cli
305   void
306   add_connection(struct Listener *listener, struct irc_ssaddr *irn, int fd)
307   {
308 <  struct Client *new_client = make_client(NULL);
308 >  struct Client *client_p = make_client(NULL);
309  
310 <  fd_open(&new_client->localClient->fd, fd, 1,
310 >  fd_open(&client_p->localClient->fd, fd, 1,
311            (listener->flags & LISTENER_SSL) ?
312            "Incoming SSL connection" : "Incoming connection");
313  
# Line 315 | Line 315 | add_connection(struct Listener *listener
315     * copy address to 'sockhost' as a string, copy it to host too
316     * so we have something valid to put into error messages...
317     */
318 <  memcpy(&new_client->localClient->ip, irn, sizeof(struct irc_ssaddr));
318 >  memcpy(&client_p->localClient->ip, irn, sizeof(struct irc_ssaddr));
319  
320 <  getnameinfo((struct sockaddr *)&new_client->localClient->ip,
321 <              new_client->localClient->ip.ss_len, new_client->sockhost,
322 <              sizeof(new_client->sockhost), NULL, 0, NI_NUMERICHOST);
323 <  new_client->localClient->aftype = new_client->localClient->ip.ss.ss_family;
320 >  getnameinfo((struct sockaddr *)&client_p->localClient->ip,
321 >              client_p->localClient->ip.ss_len, client_p->sockhost,
322 >              sizeof(client_p->sockhost), NULL, 0, NI_NUMERICHOST);
323 >  client_p->localClient->aftype = client_p->localClient->ip.ss.ss_family;
324  
325   #ifdef HAVE_LIBGEOIP
326    /* XXX IPV6 SUPPORT XXX */
327    if (irn->ss.ss_family == AF_INET && geoip_ctx)
328    {
329 <    const struct sockaddr_in *v4 = (const struct sockaddr_in *)&new_client->localClient->ip;
330 <    new_client->localClient->country_id = GeoIP_id_by_ipnum(geoip_ctx, (unsigned long)ntohl(v4->sin_addr.s_addr));
329 >    const struct sockaddr_in *v4 = (const struct sockaddr_in *)&client_p->localClient->ip;
330 >    client_p->localClient->country_id = GeoIP_id_by_ipnum(geoip_ctx, (unsigned long)ntohl(v4->sin_addr.s_addr));
331    }
332   #endif
333  
334 <  if (new_client->sockhost[0] == ':' && new_client->sockhost[1] == ':')
334 >  if (client_p->sockhost[0] == ':' && client_p->sockhost[1] == ':')
335    {
336 <    strlcpy(new_client->host, "0", sizeof(new_client->host));
337 <    strlcpy(new_client->host+1, new_client->sockhost, sizeof(new_client->host)-1);
338 <    memmove(new_client->sockhost+1, new_client->sockhost, sizeof(new_client->sockhost)-1);
339 <    new_client->sockhost[0] = '0';
336 >    strlcpy(client_p->host, "0", sizeof(client_p->host));
337 >    strlcpy(client_p->host+1, client_p->sockhost, sizeof(client_p->host)-1);
338 >    memmove(client_p->sockhost+1, client_p->sockhost, sizeof(client_p->sockhost)-1);
339 >    client_p->sockhost[0] = '0';
340    }
341    else
342 <    strlcpy(new_client->host, new_client->sockhost, sizeof(new_client->host));
342 >    strlcpy(client_p->host, client_p->sockhost, sizeof(client_p->host));
343  
344 <  new_client->localClient->listener = listener;
344 >  client_p->localClient->listener = listener;
345    ++listener->ref_count;
346  
347   #ifdef HAVE_LIBCRYPTO
348    if (listener->flags & LISTENER_SSL)
349    {
350 <    if ((new_client->localClient->fd.ssl = SSL_new(ServerInfo.server_ctx)) == NULL)
350 >    if ((client_p->localClient->fd.ssl = SSL_new(ServerInfo.server_ctx)) == NULL)
351      {
352        ilog(LOG_TYPE_IRCD, "SSL_new() ERROR! -- %s",
353             ERR_error_string(ERR_get_error(), NULL));
354  
355 <      SetDead(new_client);
356 <      exit_client(new_client, new_client, "SSL_new failed");
355 >      SetDead(client_p);
356 >      exit_client(client_p, "SSL_new failed");
357        return;
358      }
359  
360 <    AddFlag(new_client, FLAGS_SSL);
361 <    SSL_set_fd(new_client->localClient->fd.ssl, fd);
362 <    ssl_handshake(0, new_client);
360 >    AddFlag(client_p, FLAGS_SSL);
361 >    SSL_set_fd(client_p->localClient->fd.ssl, fd);
362 >    ssl_handshake(0, client_p);
363    }
364    else
365   #endif
366 <    start_auth(new_client);
366 >    start_auth(client_p);
367   }
368  
369   /*

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)