Clean up s_auth a little. No functional changes.
This commit is contained in:
parent
b69b8b0870
commit
1a53072881
2 changed files with 33 additions and 48 deletions
|
@ -27,57 +27,9 @@
|
|||
#ifndef INCLUDED_s_auth_h
|
||||
#define INCLUDED_s_auth_h
|
||||
|
||||
#include "config.h"
|
||||
#include "res.h"
|
||||
/*
|
||||
* How many auth allocations to allocate in a block. I'm guessing that
|
||||
* a good number here is 64, because these are temporary and don't live
|
||||
* as long as clients do.
|
||||
* -- adrian
|
||||
*/
|
||||
#define AUTH_BLOCK_SIZE 64
|
||||
|
||||
struct Client;
|
||||
|
||||
struct AuthRequest
|
||||
{
|
||||
rb_dlink_node node;
|
||||
struct Client *client; /* pointer to client struct for request */
|
||||
struct DNSQuery dns_query; /* DNS Query */
|
||||
unsigned int flags; /* current state of request */
|
||||
rb_fde_t *F; /* file descriptor for auth queries */
|
||||
time_t timeout; /* time when query expires */
|
||||
};
|
||||
|
||||
/*
|
||||
* flag values for AuthRequest
|
||||
* NAMESPACE: AM_xxx - Authentication Module
|
||||
*/
|
||||
#define AM_AUTH_CONNECTING (1 << 0)
|
||||
#define AM_AUTH_PENDING (1 << 1)
|
||||
#define AM_DNS_PENDING (1 << 2)
|
||||
|
||||
#define SetDNSPending(x) ((x)->flags |= AM_DNS_PENDING)
|
||||
#define ClearDNSPending(x) ((x)->flags &= ~AM_DNS_PENDING)
|
||||
#define IsDNSPending(x) ((x)->flags & AM_DNS_PENDING)
|
||||
|
||||
#define SetAuthConnect(x) ((x)->flags |= AM_AUTH_CONNECTING)
|
||||
#define ClearAuthConnect(x) ((x)->flags &= ~AM_AUTH_CONNECTING)
|
||||
#define IsAuthConnect(x) ((x)->flags & AM_AUTH_CONNECTING)
|
||||
|
||||
#define SetAuthPending(x) ((x)->flags |= AM_AUTH_PENDING)
|
||||
#define ClearAuthPending(x) ((x)->flags &= AM_AUTH_PENDING)
|
||||
#define IsAuthPending(x) ((x)->flags & AM_AUTH_PENDING)
|
||||
|
||||
#define ClearAuth(x) ((x)->flags &= ~(AM_AUTH_PENDING | AM_AUTH_CONNECTING))
|
||||
#define IsDoingAuth(x) ((x)->flags & (AM_AUTH_PENDING | AM_AUTH_CONNECTING))
|
||||
/* #define SetGotId(x) ((x)->flags |= FLAGS_GOTID) */
|
||||
|
||||
|
||||
|
||||
extern void start_auth(struct Client *);
|
||||
extern void send_auth_query(struct AuthRequest *req);
|
||||
extern void remove_auth_request(struct AuthRequest *req);
|
||||
extern void init_auth(void);
|
||||
extern void delete_auth_queries(struct Client *);
|
||||
|
||||
|
|
33
src/s_auth.c
33
src/s_auth.c
|
@ -50,6 +50,39 @@
|
|||
#include "hook.h"
|
||||
#include "blacklist.h"
|
||||
|
||||
struct AuthRequest
|
||||
{
|
||||
rb_dlink_node node;
|
||||
struct Client *client; /* pointer to client struct for request */
|
||||
struct DNSQuery dns_query; /* DNS Query */
|
||||
unsigned int flags; /* current state of request */
|
||||
rb_fde_t *F; /* file descriptor for auth queries */
|
||||
time_t timeout; /* time when query expires */
|
||||
};
|
||||
|
||||
/*
|
||||
* flag values for AuthRequest
|
||||
* NAMESPACE: AM_xxx - Authentication Module
|
||||
*/
|
||||
#define AM_AUTH_CONNECTING (1 << 0)
|
||||
#define AM_AUTH_PENDING (1 << 1)
|
||||
#define AM_DNS_PENDING (1 << 2)
|
||||
|
||||
#define SetDNSPending(x) ((x)->flags |= AM_DNS_PENDING)
|
||||
#define ClearDNSPending(x) ((x)->flags &= ~AM_DNS_PENDING)
|
||||
#define IsDNSPending(x) ((x)->flags & AM_DNS_PENDING)
|
||||
|
||||
#define SetAuthConnect(x) ((x)->flags |= AM_AUTH_CONNECTING)
|
||||
#define ClearAuthConnect(x) ((x)->flags &= ~AM_AUTH_CONNECTING)
|
||||
#define IsAuthConnect(x) ((x)->flags & AM_AUTH_CONNECTING)
|
||||
|
||||
#define SetAuthPending(x) ((x)->flags |= AM_AUTH_PENDING)
|
||||
#define ClearAuthPending(x) ((x)->flags &= AM_AUTH_PENDING)
|
||||
#define IsAuthPending(x) ((x)->flags & AM_AUTH_PENDING)
|
||||
|
||||
#define ClearAuth(x) ((x)->flags &= ~(AM_AUTH_PENDING | AM_AUTH_CONNECTING))
|
||||
#define IsDoingAuth(x) ((x)->flags & (AM_AUTH_PENDING | AM_AUTH_CONNECTING))
|
||||
|
||||
/*
|
||||
* a bit different approach
|
||||
* this replaces the original sendheader macros
|
||||
|
|
Loading…
Reference in a new issue