/[svn]/ircd-hybrid-7.2/src/s_auth.c
ViewVC logotype

Diff of /ircd-hybrid-7.2/src/s_auth.c

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

revision 997 by michael, Mon Aug 17 19:19:16 2009 UTC revision 998 by michael, Sun Aug 23 12:43:17 2009 UTC
# Line 37  Line 37 
37  #include "list.h"  #include "list.h"
38  #include "s_auth.h"  #include "s_auth.h"
39  #include "s_conf.h"  #include "s_conf.h"
40    #include "balloc.h"
41  #include "client.h"  #include "client.h"
42  #include "common.h"  #include "common.h"
43  #include "event.h"  #include "event.h"
# Line 77  enum { Line 78  enum {
78    
79  #define sendheader(c, i) sendto_one((c), HeaderMessages[(i)], me.name)  #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 };  static dlink_list auth_doing_list = { NULL, NULL, 0 };
83    
84  static EVH timeout_auth_queries_event;  static EVH timeout_auth_queries_event;
# Line 94  struct Callback *auth_cb = NULL; Line 96  struct Callback *auth_cb = NULL;
96  void  void
97  init_auth(void)  init_auth(void)
98  {  {
99      auth_heap = BlockHeapCreate("auth", sizeof(struct AuthRequest), AUTH_HEAP_SIZE);
100    auth_cb = register_callback("start_auth", start_auth);    auth_cb = register_callback("start_auth", start_auth);
101    eventAddIsh("timeout_auth_queries_event", timeout_auth_queries_event, NULL, 1);    eventAddIsh("timeout_auth_queries_event", timeout_auth_queries_event, NULL, 1);
102  }  }
# Line 104  init_auth(void) Line 107  init_auth(void)
107  static struct AuthRequest *  static struct AuthRequest *
108  make_auth_request(struct Client *client)  make_auth_request(struct Client *client)
109  {  {
110    struct AuthRequest *request = MyMalloc(sizeof(struct AuthRequest));    struct AuthRequest *request = BlockHeapAlloc(auth_heap);
111    
112    client->localClient->auth = request;    client->localClient->auth = request;
113    request->client           = client;    request->client           = client;
# Line 128  release_auth_client(struct AuthRequest * Line 131  release_auth_client(struct AuthRequest *
131    
132    client->localClient->auth = NULL;    client->localClient->auth = NULL;
133    dlinkDelete(&auth->node, &auth_doing_list);    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     * When a client has auth'ed, we want to start reading what it sends
# Line 147  release_auth_client(struct AuthRequest * Line 151  release_auth_client(struct AuthRequest *
151    
152  /*  /*
153   * auth_dns_callback - called when resolver query finishes   * auth_dns_callback - called when resolver query finishes
154   * if the query resulted in a successful search, hp will contain   * if the query resulted in a successful search, name will contain
155   * a non-null pointer, otherwise hp will be null.   * a non-NULL pointer, otherwise name will be NULL.
156   * set the client on it's way to a connection completion, regardless   * set the client on it's way to a connection completion, regardless
157   * of success of failure   * of success of failure
158   */   */
# Line 406  timeout_auth_queries_event(void *notused Line 410  timeout_auth_queries_event(void *notused
410      if (IsDoingAuth(auth))      if (IsDoingAuth(auth))
411      {        {  
412        ++ServerStats.is_abad;        ++ServerStats.is_abad;
413          ClearAuth(auth);
414        sendheader(auth->client, REPORT_FAIL_ID);        sendheader(auth->client, REPORT_FAIL_ID);
415      }      }
416    
417      if (IsDNSPending(auth))      if (IsDNSPending(auth))
418      {      {
419        delete_resolver_queries(auth);        delete_resolver_queries(auth);
420          ClearDNSPending(auth);
421        sendheader(auth->client, REPORT_FAIL_DNS);        sendheader(auth->client, REPORT_FAIL_DNS);
422      }      }
423    
# Line 595  delete_auth(struct AuthRequest *auth) Line 601  delete_auth(struct AuthRequest *auth)
601    
602    fd_close(&auth->fd);    fd_close(&auth->fd);
603    dlinkDelete(&auth->node, &auth_doing_list);    dlinkDelete(&auth->node, &auth_doing_list);
604    MyFree(auth);    BlockHeapFree(auth_heap, auth);
605  }  }

Legend:
Removed from v.997  
changed lines
  Added in v.998

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