commit
1135330418
16 changed files with 61 additions and 163 deletions
|
@ -50,7 +50,7 @@ handle_stat(int parc, char *parv[])
|
|||
/* XXX Should log this somehow */
|
||||
return;
|
||||
|
||||
if (!(handler = authd_stat_handlers[parv[2][0]]))
|
||||
if (!(handler = authd_stat_handlers[(unsigned char)parv[2][0]]))
|
||||
return;
|
||||
|
||||
handler(parv[1], parv[2][0]);
|
||||
|
@ -65,7 +65,7 @@ handle_reload(int parc, char *parv[])
|
|||
/* XXX Should log this somehow */
|
||||
return;
|
||||
|
||||
if (!(handler = authd_reload_handlers[parv[1][0]]))
|
||||
if (!(handler = authd_reload_handlers[(unsigned char)parv[1][0]]))
|
||||
return;
|
||||
|
||||
handler(parv[1][0]);
|
||||
|
@ -87,7 +87,7 @@ parse_request(rb_helper *helper)
|
|||
if(parc < 1)
|
||||
continue;
|
||||
|
||||
handler = authd_cmd_handlers[parv[0][0]];
|
||||
handler = authd_cmd_handlers[(unsigned char)parv[0][0]];
|
||||
if (handler != NULL)
|
||||
handler(parc, parv);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ handle_lookup_ip_reply(void *data, struct DNSReply *reply)
|
|||
if(!query)
|
||||
/* Shouldn't happen */
|
||||
exit(2);
|
||||
|
||||
|
||||
type = query->type;
|
||||
|
||||
if(!reply)
|
||||
|
@ -163,14 +163,11 @@ handle_lookup_hostname_reply(void *data, struct DNSReply *reply)
|
|||
{
|
||||
struct dns_query *query = data;
|
||||
char *hostname = NULL;
|
||||
query_type type = QUERY_INVALID;
|
||||
|
||||
if(!query)
|
||||
/* Shouldn't happen */
|
||||
exit(4);
|
||||
|
||||
type = query->type;
|
||||
|
||||
if(!reply)
|
||||
goto end;
|
||||
|
||||
|
|
64
authd/res.c
64
authd/res.c
|
@ -98,7 +98,6 @@ static int check_question(struct reslist *request, HEADER * header, char *buf, c
|
|||
static int proc_answer(struct reslist *request, HEADER * header, char *, char *);
|
||||
static struct reslist *find_id(int id);
|
||||
static struct DNSReply *make_dnsreply(struct reslist *request);
|
||||
static int generate_random_port(void);
|
||||
static uint16_t generate_random_id(void);
|
||||
|
||||
#ifdef RES_MIN
|
||||
|
@ -107,55 +106,6 @@ static uint16_t generate_random_id(void);
|
|||
|
||||
#define RES_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
static rb_fde_t *
|
||||
random_socket(int family)
|
||||
{
|
||||
rb_fde_t *F;
|
||||
int nport;
|
||||
int i;
|
||||
rb_socklen_t len;
|
||||
struct rb_sockaddr_storage sockaddr;
|
||||
F = rb_socket(family, SOCK_DGRAM, 0, "UDP resolver socket");
|
||||
if(F == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||
|
||||
SET_SS_FAMILY(&sockaddr, family);
|
||||
|
||||
#ifdef RB_IPV6
|
||||
if(family == AF_INET6)
|
||||
{
|
||||
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&sockaddr;
|
||||
memcpy(&in6->sin6_addr, &ipv6_addr, sizeof(struct in6_addr));
|
||||
len = (rb_socklen_t) sizeof(struct sockaddr_in6);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
struct sockaddr_in *in = (struct sockaddr_in *)&sockaddr;
|
||||
in->sin_addr.s_addr = ipv4_addr.s_addr;
|
||||
len = (rb_socklen_t) sizeof(struct sockaddr_in);
|
||||
}
|
||||
|
||||
for(i = 0; i < 10; i++)
|
||||
{
|
||||
nport = htons(generate_random_port());
|
||||
|
||||
if(family == AF_INET)
|
||||
((struct sockaddr_in *)&sockaddr)->sin_port = nport;
|
||||
#ifdef RB_IPV6
|
||||
else
|
||||
((struct sockaddr_in6 *)&sockaddr)->sin6_port = nport;
|
||||
|
||||
#endif
|
||||
if(bind(rb_get_fd(F), (struct sockaddr *)&sockaddr, len) == 0)
|
||||
return F;
|
||||
}
|
||||
rb_close(F);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* int
|
||||
* res_ourserver(inp)
|
||||
|
@ -467,20 +417,6 @@ generate_random_id(void)
|
|||
return id;
|
||||
}
|
||||
|
||||
static int
|
||||
generate_random_port(void)
|
||||
{
|
||||
uint16_t port;
|
||||
|
||||
while(1)
|
||||
{
|
||||
rb_get_random(&port, sizeof(port));
|
||||
if(port > 1024)
|
||||
break;
|
||||
}
|
||||
return (int)port;
|
||||
}
|
||||
|
||||
/*
|
||||
* gethost_byname_type - get host address from name, adding domain if needed
|
||||
*/
|
||||
|
|
|
@ -91,7 +91,7 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
|
|||
{
|
||||
struct ConfItem *aconf;
|
||||
rb_dlink_node *ptr;
|
||||
int i, count;
|
||||
int count;
|
||||
const char *target, *mask2;
|
||||
struct Client *server_p;
|
||||
struct rb_radixtree_iteration_state state;
|
||||
|
|
|
@ -228,7 +228,7 @@ dns_stats_results_callback(const char *callid, const char *status, int resc, con
|
|||
{
|
||||
struct dnsstatreq *req;
|
||||
uint32_t qid;
|
||||
int st, i;
|
||||
int st;
|
||||
long lqid = strtol(callid, NULL, 16);
|
||||
|
||||
if(lqid > UINT32_MAX)
|
||||
|
|
|
@ -253,7 +253,6 @@ load_all_modules(int warn)
|
|||
|
||||
while ((ldirent = readdir(system_module_dir)) != NULL)
|
||||
{
|
||||
struct stat s;
|
||||
size_t len;
|
||||
|
||||
len = strlen(ldirent->d_name);
|
||||
|
|
|
@ -162,8 +162,6 @@ msgbuf_unparse_tags(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned in
|
|||
void
|
||||
msgbuf_unparse_prefix(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int capmask)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(buf, 0, buflen);
|
||||
|
||||
if (msgbuf->n_tags > 0)
|
||||
|
|
|
@ -45,9 +45,6 @@
|
|||
struct Dictionary *cmd_dict = NULL;
|
||||
struct Dictionary *alias_dict = NULL;
|
||||
|
||||
/* parv[0] is not used, and parv[LAST] == NULL */
|
||||
static char *para[MAXPARA + 2];
|
||||
|
||||
static void cancel_clients(struct Client *, struct Client *);
|
||||
static void remove_unknown(struct Client *, const char *, char *);
|
||||
|
||||
|
@ -82,7 +79,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend)
|
|||
{
|
||||
struct Client *from = client_p;
|
||||
char *end;
|
||||
int i = 1, res;
|
||||
int res;
|
||||
int numeric = 0;
|
||||
struct Message *mptr;
|
||||
struct MsgBuf msgbuf;
|
||||
|
|
|
@ -685,7 +685,6 @@ expire_temp_rxlines(void *unused)
|
|||
struct ConfItem *aconf;
|
||||
rb_dlink_node *ptr;
|
||||
rb_dlink_node *next_ptr;
|
||||
int i;
|
||||
struct rb_radixtree_iteration_state state;
|
||||
|
||||
RB_RADIXTREE_FOREACH(aconf, &state, resv_tree)
|
||||
|
|
|
@ -2223,6 +2223,7 @@ rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasiz
|
|||
|
||||
if(count > 0)
|
||||
{
|
||||
size_t ucount = (size_t)count;
|
||||
int len = CMSG_SPACE(sizeof(int) * count);
|
||||
char buf[len];
|
||||
|
||||
|
@ -2233,7 +2234,7 @@ rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasiz
|
|||
cmsg->cmsg_type = SCM_RIGHTS;
|
||||
cmsg->cmsg_len = CMSG_LEN(sizeof(int) * count);
|
||||
|
||||
for(unsigned int i = 0; i < count; i++)
|
||||
for(size_t i = 0; i < ucount; i++)
|
||||
{
|
||||
((int *)CMSG_DATA(cmsg))[i] = rb_get_fd(F[i]);
|
||||
}
|
||||
|
|
|
@ -210,12 +210,10 @@ rb_strnlen(const char *s, size_t count)
|
|||
int
|
||||
rb_snprintf_append(char *str, size_t len, const char *format, ...)
|
||||
{
|
||||
int x;
|
||||
|
||||
if(len == 0)
|
||||
return 0;
|
||||
|
||||
x = strlen(str);
|
||||
size_t x = strlen(str);
|
||||
|
||||
if(len < x)
|
||||
{
|
||||
|
@ -225,10 +223,10 @@ rb_snprintf_append(char *str, size_t len, const char *format, ...)
|
|||
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
x = (vsnprintf(str + x, len - x, format, ap) + (int)x);
|
||||
int y = (vsnprintf(str + x, len - x, format, ap) + (int)x);
|
||||
va_end(ap);
|
||||
|
||||
return (x);
|
||||
return (y);
|
||||
}
|
||||
|
||||
/* rb_basename
|
||||
|
|
|
@ -155,7 +155,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags)
|
|||
char buf[BUFSIZE] = { 0 };
|
||||
char capbuf[BUFSIZE] = { 0 };
|
||||
int buflen = 0;
|
||||
int curlen, mlen;
|
||||
int mlen;
|
||||
struct CapabilityEntry *entry;
|
||||
struct DictionaryIter iter;
|
||||
|
||||
|
|
|
@ -200,7 +200,6 @@ rehash_tresvs(struct Client *source_p)
|
|||
struct rb_radixtree_iteration_state iter;
|
||||
rb_dlink_node *ptr;
|
||||
rb_dlink_node *next_ptr;
|
||||
int i;
|
||||
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s is clearing temp resvs",
|
||||
get_oper_name(source_p));
|
||||
|
|
|
@ -59,10 +59,6 @@ DECLARE_MODULE_AV2(restart, NULL, NULL, restart_clist, NULL, NULL, NULL, NULL, r
|
|||
static void
|
||||
mo_restart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
rb_dlink_node *ptr;
|
||||
struct Client *target_p;
|
||||
|
||||
if(!IsOperDie(source_p))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||
|
|
|
@ -142,53 +142,53 @@ static void stats_capability(struct Client *);
|
|||
*/
|
||||
static struct stats_cmd stats_cmd_table[256] = {
|
||||
/* letter handler/handler_parv parv oper admin */
|
||||
['a'] = { stats_dns_servers, false, true, true, },
|
||||
['A'] = { stats_dns_servers, false, true, true, },
|
||||
['b'] = { stats_delay, false, true, true, },
|
||||
['B'] = { stats_hash, false, true, true, },
|
||||
['c'] = { stats_connect, false, false, false, },
|
||||
['C'] = { stats_capability, false, true, false, },
|
||||
['d'] = { stats_tdeny, false, true, false, },
|
||||
['D'] = { stats_deny, false, true, false, },
|
||||
['e'] = { stats_exempt, false, true, false, },
|
||||
['E'] = { stats_events, false, true, true, },
|
||||
['f'] = { stats_comm, false, true, true, },
|
||||
['F'] = { stats_comm, false, true, true, },
|
||||
['g'] = { stats_prop_klines, false, true, false, },
|
||||
['h'] = { stats_hubleaf, false, false, false, },
|
||||
['H'] = { stats_hubleaf, false, false, false, },
|
||||
['i'] = { stats_auth, false, false, false, },
|
||||
['I'] = { stats_auth, false, false, false, },
|
||||
['k'] = { stats_tklines, false, false, false, },
|
||||
['K'] = { stats_klines, false, false, false, },
|
||||
['l'] = { .handler_parv = stats_ltrace, true, false, false, },
|
||||
['L'] = { .handler_parv = stats_ltrace, true, false, false, },
|
||||
['m'] = { stats_messages, false, false, false, },
|
||||
['M'] = { stats_messages, false, false, false, },
|
||||
['n'] = { stats_dnsbl, false, false, false, },
|
||||
['o'] = { stats_oper, false, false, false, },
|
||||
['O'] = { stats_privset, false, true, false, },
|
||||
['p'] = { stats_operedup, false, false, false, },
|
||||
['P'] = { stats_ports, false, false, false, },
|
||||
['q'] = { stats_tresv, false, true, false, },
|
||||
['Q'] = { stats_resv, false, true, false, },
|
||||
['r'] = { stats_usage, false, true, false, },
|
||||
['R'] = { stats_usage, false, true, false, },
|
||||
['s'] = { stats_ssld, false, true, true, },
|
||||
['S'] = { stats_ssld, false, true, true, },
|
||||
['t'] = { stats_tstats, false, true, false, },
|
||||
['T'] = { stats_tstats, false, true, false, },
|
||||
['u'] = { stats_uptime, false, false, false, },
|
||||
['U'] = { stats_shared, false, true, false, },
|
||||
['v'] = { stats_servers, false, false, false, },
|
||||
['V'] = { stats_servers, false, false, false, },
|
||||
['x'] = { stats_tgecos, false, true, false, },
|
||||
['X'] = { stats_gecos, false, true, false, },
|
||||
['y'] = { stats_class, false, false, false, },
|
||||
['Y'] = { stats_class, false, false, false, },
|
||||
['z'] = { stats_memory, false, true, false, },
|
||||
['Z'] = { stats_ziplinks, false, true, false, },
|
||||
['?'] = { stats_servlinks, false, false, false, },
|
||||
['a'] = { { stats_dns_servers }, false, true, true, },
|
||||
['A'] = { { stats_dns_servers }, false, true, true, },
|
||||
['b'] = { { stats_delay }, false, true, true, },
|
||||
['B'] = { { stats_hash }, false, true, true, },
|
||||
['c'] = { { stats_connect }, false, false, false, },
|
||||
['C'] = { { stats_capability }, false, true, false, },
|
||||
['d'] = { { stats_tdeny }, false, true, false, },
|
||||
['D'] = { { stats_deny }, false, true, false, },
|
||||
['e'] = { { stats_exempt }, false, true, false, },
|
||||
['E'] = { { stats_events }, false, true, true, },
|
||||
['f'] = { { stats_comm }, false, true, true, },
|
||||
['F'] = { { stats_comm }, false, true, true, },
|
||||
['g'] = { { stats_prop_klines }, false, true, false, },
|
||||
['h'] = { { stats_hubleaf }, false, false, false, },
|
||||
['H'] = { { stats_hubleaf }, false, false, false, },
|
||||
['i'] = { { stats_auth }, false, false, false, },
|
||||
['I'] = { { stats_auth }, false, false, false, },
|
||||
['k'] = { { stats_tklines }, false, false, false, },
|
||||
['K'] = { { stats_klines }, false, false, false, },
|
||||
['l'] = { { .handler_parv = stats_ltrace }, true, false, false, },
|
||||
['L'] = { { .handler_parv = stats_ltrace }, true, false, false, },
|
||||
['m'] = { { stats_messages }, false, false, false, },
|
||||
['M'] = { { stats_messages }, false, false, false, },
|
||||
['n'] = { { stats_dnsbl }, false, false, false, },
|
||||
['o'] = { { stats_oper }, false, false, false, },
|
||||
['O'] = { { stats_privset }, false, true, false, },
|
||||
['p'] = { { stats_operedup }, false, false, false, },
|
||||
['P'] = { { stats_ports }, false, false, false, },
|
||||
['q'] = { { stats_tresv }, false, true, false, },
|
||||
['Q'] = { { stats_resv }, false, true, false, },
|
||||
['r'] = { { stats_usage }, false, true, false, },
|
||||
['R'] = { { stats_usage }, false, true, false, },
|
||||
['s'] = { { stats_ssld }, false, true, true, },
|
||||
['S'] = { { stats_ssld }, false, true, true, },
|
||||
['t'] = { { stats_tstats }, false, true, false, },
|
||||
['T'] = { { stats_tstats }, false, true, false, },
|
||||
['u'] = { { stats_uptime }, false, false, false, },
|
||||
['U'] = { { stats_shared }, false, true, false, },
|
||||
['v'] = { { stats_servers }, false, false, false, },
|
||||
['V'] = { { stats_servers }, false, false, false, },
|
||||
['x'] = { { stats_tgecos }, false, true, false, },
|
||||
['X'] = { { stats_gecos }, false, true, false, },
|
||||
['y'] = { { stats_class }, false, false, false, },
|
||||
['Y'] = { { stats_class }, false, false, false, },
|
||||
['z'] = { { stats_memory }, false, true, false, },
|
||||
['Z'] = { { stats_ziplinks }, false, true, false, },
|
||||
['?'] = { { stats_servlinks }, false, false, false, },
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -204,9 +204,8 @@ static void
|
|||
m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
static time_t last_used = 0;
|
||||
int i;
|
||||
struct stats_cmd *cmd;
|
||||
char statchar;
|
||||
unsigned char statchar;
|
||||
int did_stats = 0;
|
||||
|
||||
statchar = parv[1][0];
|
||||
|
@ -873,7 +872,6 @@ stats_tresv(struct Client *source_p)
|
|||
struct ConfItem *aconf;
|
||||
struct rb_radixtree_iteration_state state;
|
||||
rb_dlink_node *ptr;
|
||||
int i;
|
||||
|
||||
RB_DLINK_FOREACH(ptr, resv_conf_list.head)
|
||||
{
|
||||
|
@ -900,7 +898,6 @@ stats_resv(struct Client *source_p)
|
|||
struct ConfItem *aconf;
|
||||
struct rb_radixtree_iteration_state state;
|
||||
rb_dlink_node *ptr;
|
||||
int i;
|
||||
|
||||
RB_DLINK_FOREACH(ptr, resv_conf_list.head)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,6 @@ static char *make_sha512_salt(int);
|
|||
static char *make_sha512_salt_para(char *);
|
||||
static char *make_bf_salt(int, int);
|
||||
static char *make_bf_salt_para(int, char *);
|
||||
static char *int_to_base64(int);
|
||||
static char *generate_random_salt(char *, int);
|
||||
static char *generate_poor_salt(char *, int);
|
||||
|
||||
|
@ -209,24 +208,6 @@ main(int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
int_to_base64(int value)
|
||||
{
|
||||
static char buf[5];
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
buf[i] = saltChars[value & 63];
|
||||
value >>= 6; /* Right shifting 6 places is the same as dividing by 64 */
|
||||
}
|
||||
|
||||
buf[i] = '\0'; /* not REALLY needed as it's static, and thus initialized
|
||||
** to \0.
|
||||
*/
|
||||
return buf;
|
||||
}
|
||||
|
||||
char *
|
||||
make_md5_salt_para(char *saltpara)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue