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

Comparing ircd-hybrid-7.2/src/s_bsd.c (file contents):
Revision 451 by michael, Sun Feb 12 16:19:54 2006 UTC vs.
Revision 549 by michael, Thu Apr 20 12:46:18 2006 UTC

# Line 322 | Line 322 | ssl_handshake(int fd, struct Client *cli
322   * any client list yet.
323   */
324   void
325 < add_connection(struct Listener* listener, int fd)
325 > add_connection(struct Listener *listener, struct irc_ssaddr *irn, int fd)
326   {
327    struct Client *new_client;
328  socklen_t len = sizeof(struct irc_ssaddr);
329  struct irc_ssaddr irn;
330  assert(NULL != listener);
331
332  /*
333   * get the client socket name from the socket
334   * the client has already been checked out in accept_connection
335   */
328  
329 <  memset(&irn, 0, sizeof(irn));
338 <  if (getpeername(fd, (struct sockaddr *)&irn, (socklen_t *)&len))
339 <  {
340 < #ifdef _WIN32
341 <    errno = WSAGetLastError();
342 < #endif
343 <    report_error(L_ALL, "Failed in adding new connection %s :%s",
344 <            get_listener_name(listener), errno);
345 <    ServerStats->is_ref++;
346 < #ifdef _WIN32
347 <    closesocket(fd);
348 < #else
349 <    close(fd);
350 < #endif
351 <    return;
352 <  }
329 >  assert(NULL != listener);
330  
354 #ifdef IPV6
355  remove_ipv6_mapping(&irn);
356 #else
357  irn.ss_len = len;
358 #endif
331    new_client = make_client(NULL);
332 +
333    fd_open(&new_client->localClient->fd, fd, 1,
334            (listener->flags & LISTENER_SSL) ?
335            "Incoming SSL connection" : "Incoming connection");
363  memset(&new_client->localClient->ip, 0, sizeof(struct irc_ssaddr));
336  
337    /*
338     * copy address to 'sockhost' as a string, copy it to host too
339     * so we have something valid to put into error messages...
340     */
341 <  memcpy(&new_client->localClient->ip, &irn, sizeof(struct irc_ssaddr));
341 >  memcpy(&new_client->localClient->ip, irn, sizeof(struct irc_ssaddr));
342  
343    irc_getnameinfo((struct sockaddr*)&new_client->localClient->ip,
344          new_client->localClient->ip.ss_len,  new_client->sockhost,
345          HOSTIPLEN, NULL, 0, NI_NUMERICHOST);
346    new_client->localClient->aftype = new_client->localClient->ip.ss.ss_family;
375
376  *new_client->host = '\0';
347   #ifdef IPV6
348 <  if (*new_client->sockhost == ':')
348 >  if (new_client->sockhost[0] == ':')
349      strlcat(new_client->host, "0", HOSTLEN+1);
350  
351    if (new_client->localClient->aftype == AF_INET6 &&
# Line 383 | Line 353 | add_connection(struct Listener* listener
353    {
354      strlcat(new_client->host, new_client->sockhost,HOSTLEN+1);
355      strlcat(new_client->host, ".", HOSTLEN+1);
356 <  } else
356 >  }
357 >  else
358   #endif
359      strlcat(new_client->host, new_client->sockhost,HOSTLEN+1);
360  
361 +  new_client->connect_id = ++connect_id;
362    new_client->localClient->listener = listener;
363    ++listener->ref_count;
364  
393  connect_id++;
394  new_client->connect_id = connect_id;
395
365   #ifdef HAVE_LIBCRYPTO
366 <  if ((listener->flags & LISTENER_SSL))
366 >  if (listener->flags & LISTENER_SSL)
367    {
368      if ((new_client->localClient->fd.ssl = SSL_new(ServerInfo.ctx)) == NULL)
369      {

Diff Legend

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