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

Comparing ircd-hybrid-7.2/src/s_auth.c (file contents):
Revision 992 by michael, Mon Aug 17 19:19:16 2009 UTC vs.
Revision 1000 by michael, Mon Aug 24 13:37:39 2009 UTC

# Line 37 | Line 37
37   #include "list.h"
38   #include "s_auth.h"
39   #include "s_conf.h"
40 + #include "balloc.h"
41   #include "client.h"
42   #include "common.h"
43   #include "event.h"
# Line 77 | Line 78 | enum {
78  
79   #define sendheader(c, i) sendto_one((c), HeaderMessages[(i)], me.name)
80  
81 + static BlockHeap *auth_heap = NULL;
82   static dlink_list auth_doing_list = { NULL, NULL, 0 };
83  
84   static EVH timeout_auth_queries_event;
# Line 94 | Line 96 | struct Callback *auth_cb = NULL;
96   void
97   init_auth(void)
98   {
99 +  auth_heap = BlockHeapCreate("auth", sizeof(struct AuthRequest), AUTH_HEAP_SIZE);
100    auth_cb = register_callback("start_auth", start_auth);
101    eventAddIsh("timeout_auth_queries_event", timeout_auth_queries_event, NULL, 1);
102   }
# Line 104 | Line 107 | init_auth(void)
107   static struct AuthRequest *
108   make_auth_request(struct Client *client)
109   {
110 <  struct AuthRequest *request = MyMalloc(sizeof(struct AuthRequest));
110 >  struct AuthRequest *request = BlockHeapAlloc(auth_heap);
111  
112    client->localClient->auth = request;
113    request->client           = client;
# Line 128 | Line 131 | release_auth_client(struct AuthRequest *
131  
132    client->localClient->auth = NULL;
133    dlinkDelete(&auth->node, &auth_doing_list);
134 +  BlockHeapFree(auth_heap, auth);
135  
136    /*
137     * When a client has auth'ed, we want to start reading what it sends
# Line 147 | Line 151 | release_auth_client(struct AuthRequest *
151  
152   /*
153   * auth_dns_callback - called when resolver query finishes
154 < * if the query resulted in a successful search, hp will contain
155 < * a non-null pointer, otherwise hp will be null.
154 > * if the query resulted in a successful search, name will contain
155 > * a non-NULL pointer, otherwise name will be NULL.
156   * set the client on it's way to a connection completion, regardless
157   * of success of failure
158   */
# Line 367 | Line 371 | start_auth(va_list args)
371    assert(client != NULL);
372  
373    auth = make_auth_request(client);
374 +  dlinkAdd(auth, &auth->node, &auth_doing_list);
375  
376    sendheader(client, REPORT_DO_DNS);
377  
# Line 378 | Line 383 | start_auth(va_list args)
383      start_auth_query(auth);
384    }
385  
381  dlinkAdd(auth, &auth->node, &auth_doing_list);
382
386    gethost_byaddr(auth_dns_callback, auth, &client->localClient->ip);
387  
388    return NULL;
# Line 401 | Line 404 | timeout_auth_queries_event(void *notused
404      if (auth->timeout > CurrentTime)
405        continue;
406  
404    fd_close(&auth->fd);
405
407      if (IsDoingAuth(auth))
408      {  
409        ++ServerStats.is_abad;
410 +      fd_close(&auth->fd);
411 +      ClearAuth(auth);
412        sendheader(auth->client, REPORT_FAIL_ID);
413      }
414  
415      if (IsDNSPending(auth))
416      {
417        delete_resolver_queries(auth);
418 +      ClearDNSPending(auth);
419        sendheader(auth->client, REPORT_FAIL_DNS);
420      }
421  
# Line 593 | Line 597 | delete_auth(struct AuthRequest *auth)
597    if (IsDNSPending(auth))
598      delete_resolver_queries(auth);
599  
600 <  fd_close(&auth->fd);
600 >  if (IsDoingAuth(auth))
601 >    fd_close(&auth->fd);
602 >
603    dlinkDelete(&auth->node, &auth_doing_list);
604 <  MyFree(auth);
604 >  BlockHeapFree(auth_heap, auth);
605   }

Diff Legend

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