/[svn]/ircd-hybrid/trunk/src/auth.c
ViewVC logotype

Diff of /ircd-hybrid/trunk/src/auth.c

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

revision 8892 by michael, Fri Apr 19 12:38:51 2019 UTC revision 8893 by michael, Sun Apr 21 14:12:35 2019 UTC
# Line 82  static const char *const HeaderMessages[ Line 82  static const char *const HeaderMessages[
82    
83  #define auth_sendheader(c, i) sendto_one_notice((c), &me, "%s", HeaderMessages[(i)])  #define auth_sendheader(c, i) sendto_one_notice((c), &me, "%s", HeaderMessages[(i)])
84    
 static dlink_list auth_list;  
85    
86    
87  /*! \brief Allocate a new auth request.  /*! \brief Allocate a new auth request.
# Line 96  auth_make(struct Client *client) Line 95  auth_make(struct Client *client)
95    
96    auth->client = client;    auth->client = client;
97    auth->client->connection->auth = auth;    auth->client->connection->auth = auth;
   auth->timeout = CurrentTime + CONNECTTIMEOUT;  
98    
99    return auth;    return auth;
100  }  }
101    
102  /*! \brief Unlink auth request from auth_list and free memory  /*! \brief Free memory
103   * \param auth The allocated auth request to cleanup.   * \param auth The allocated auth request to cleanup.
104   */   */
105  static void  static void
106  auth_free(struct AuthRequest *auth)  auth_free(struct AuthRequest *auth)
107  {  {
   assert(dlinkFind(&auth_list, auth));  
   
   dlinkDelete(&auth->node, &auth_list);  
   
   assert(dlinkFind(&auth_list, auth) == NULL);  
   
108    auth->client = NULL;    auth->client = NULL;
109    xfree(auth);    xfree(auth);
110  }  }
# Line 464  auth_start_query(struct AuthRequest *aut Line 456  auth_start_query(struct AuthRequest *aut
456    v6 = (struct sockaddr_in6 *)&localaddr;    v6 = (struct sockaddr_in6 *)&localaddr;
457    v6->sin6_port = htons(0);    v6->sin6_port = htons(0);
458    
459    comm_connect_tcp(auth->fd, &auth->client->ip, RFC1413_PORT,    comm_connect_tcp(auth->fd, &auth->client->ip, RFC1413_PORT, &localaddr,
460                     &localaddr, auth_connect_callback, auth,                     auth_connect_callback, auth, 5);
                    GlobalSetOptions.ident_timeout);  
461  }  }
462    
463  /*  /*
# Line 484  auth_start(struct Client *client_p) Line 475  auth_start(struct Client *client_p)
475    assert(client_p);    assert(client_p);
476    assert(client_p->connection);    assert(client_p->connection);
477    
   dlinkAddTail(auth, &auth->node, &auth_list);  
   
478    auth_sendheader(client_p, REPORT_DO_DNS);    auth_sendheader(client_p, REPORT_DO_DNS);
479    
480    auth->dns_pending = true;    auth->dns_pending = true;
# Line 520  auth_delete(struct AuthRequest *auth) Line 509  auth_delete(struct AuthRequest *auth)
509    
510    auth_free(auth);    auth_free(auth);
511  }  }
   
 /*  
  * auth_timeout_queries - timeout resolver and identd requests  
  * allow clients through if requests failed  
  */  
 static void  
 auth_timeout_queries(void *notused)  
 {  
   dlink_node *node, *node_next;  
   
   DLINK_FOREACH_SAFE(node, node_next, auth_list.head)  
   {  
     struct AuthRequest *auth = node->data;  
   
     assert(auth->client);  
     assert(auth->client->connection);  
   
     if (auth->timeout > CurrentTime)  
       break;  
   
     if (auth->ident_pending == true)  
     {  
       ++ServerStats.is_abad;  
   
       fd_close(auth->fd);  
       auth->fd = NULL;  
       auth->ident_pending = false;  
   
       auth_sendheader(auth->client, REPORT_FAIL_ID);  
     }  
   
     if (auth->dns_pending == true)  
     {  
       delete_resolver_queries(auth);  
       auth->dns_pending = false;  
   
       auth_sendheader(auth->client, REPORT_FAIL_DNS);  
     }  
   
     auth_release_client(auth);  
   }  
 }  
   
 /* auth_init  
  *  
  * Initialise the auth code  
  */  
 void  
 auth_init(void)  
 {  
   static struct event timeout_auth_queries =  
   {  
     .name = "auth_timeout_queries",  
     .handler = auth_timeout_queries,  
     .when = 1  
   };  
   
   event_add(&timeout_auth_queries, NULL);  
 }  

Legend:
Removed from v.8892  
changed lines
  Added in v.8893

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