0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-24 12:58:21 +02:00

Convert IRCd to C++

Happy 28th birthday. You're all grown up.
This commit is contained in:
Jason Volk 2016-07-12 22:17:21 -07:00
parent 7cea4c784d
commit 834964c659
268 changed files with 1865 additions and 1298 deletions

1
.gitignore vendored
View file

@ -8,6 +8,7 @@ Makefile
*.orig *.orig
*.log *.log
*.sw? *.sw?
*.gch
.deps .deps
.dirstamp .dirstamp
.libs .libs

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "boost"]
path = boost
url = https://github.com/boostorg/boost.git

View file

@ -1,28 +1,23 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
SUBDIRS = rb \ SUBDIRS = include/rb
ircd SUBDIRS += rb
SUBDIRS += ircd
if BUILD_LTDL if BUILD_LTDL
SUBDIRS += libltdl SUBDIRS += libltdl
endif endif
SUBDIRS += charybdis
SUBDIRS += authd
SUBDIRS += bandb
SUBDIRS += ssld
SUBDIRS += wsockd
SUBDIRS += modules
SUBDIRS += extensions
SUBDIRS += tools
SUBDIRS += help
SUBDIRS += doc
SUBDIRS += tools \
help \
doc \
ssld \
wsockd \
authd \
bandb \
modules \
extensions \
charybdis
logdir = @prefix@/var/log
install-data-hook:
test -d ${DESTDIR}${logdir} || mkdir -p ${DESTDIR}${logdir}
mrproper-local: mrproper-local:
rm -f aclocal.m4 rm -f aclocal.m4
@ -39,6 +34,8 @@ mrproper-local:
rm -f ylwrap rm -f ylwrap
rm -f */Makefile rm -f */Makefile
rm -f */Makefile.in rm -f */Makefile.in
rm -f include/*/Makefile
rm -f include/*/Makefile.in
rm -rf */.deps rm -rf */.deps
rm -f Makefile rm -f Makefile
rm -f Makefile.in rm -f Makefile.in

View file

@ -1,23 +1,27 @@
bin_PROGRAMS = authd bin_PROGRAMS = authd
AM_CFLAGS=$(WARNFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/include AM_CPPFLAGS = $(WARNFLAGS)
AM_CPPFLAGS += -I$(top_srcdir)/include
AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include
AM_LDFLAGS = -L$(top_srcdir)/boost/lib
authd_SOURCES = \ authd_SOURCES = \
authd.c \ authd.cc \
dns.c \ dns.cc \
getaddrinfo.c \ getaddrinfo.cc \
getnameinfo.c \ getnameinfo.cc \
notice.c \ notice.cc \
provider.c \ provider.cc \
res.c \ res.cc \
reslib.c \ reslib.cc \
reslist.c \ reslist.cc \
providers/blacklist.c \ providers/blacklist.cc \
providers/ident.c \ providers/ident.cc \
providers/rdns.c \ providers/rdns.cc \
providers/opm.c providers/opm.cc
authd_LDADD = $(top_srcdir)/rb/librb.la authd_LDADD = $(top_srcdir)/rb/librb.la
authd_LDADD += -lboost_system
mrproper-local: mrproper-local:
rm -rf providers/.deps rm -rf providers/.deps

View file

@ -31,22 +31,31 @@ static void handle_stat(int parc, char *parv[]);
static void handle_options(int parc, char *parv[]); static void handle_options(int parc, char *parv[]);
rb_helper *authd_helper = NULL; rb_helper *authd_helper = NULL;
authd_cmd_handler authd_cmd_handlers[256] = { std::array<authd_cmd_handler, 256> authd_cmd_handlers
['C'] = handle_new_connection, {[]{
['D'] = handle_resolve_dns, std::array<authd_cmd_handler, 256> ret;
['E'] = handle_cancel_connection, ret['C'] = handle_new_connection;
['O'] = handle_options, ret['D'] = handle_resolve_dns;
['R'] = handle_reload, ret['E'] = handle_cancel_connection;
['S'] = handle_stat, ret['O'] = handle_options;
}; ret['R'] = handle_reload;
ret['S'] = handle_stat;
return ret;
}()};
authd_stat_handler authd_stat_handlers[256] = { std::array<authd_stat_handler, 256> authd_stat_handlers
['D'] = enumerate_nameservers, {[]{
}; std::array<authd_stat_handler, 256> ret;
ret['D'] = enumerate_nameservers;
return ret;
}()};
authd_reload_handler authd_reload_handlers[256] = { std::array<authd_reload_handler, 256> authd_reload_handlers
['D'] = reload_nameservers, {[]{
}; std::array<authd_reload_handler, 256> ret;
ret['D'] = reload_nameservers;
return ret;
}()};
rb_dictionary *authd_option_handlers; rb_dictionary *authd_option_handlers;
@ -85,7 +94,7 @@ handle_options(int parc, char *parv[])
return; return;
} }
if((handler = rb_dictionary_retrieve(authd_option_handlers, parv[1])) == NULL) if((handler = (auth_opts_handler *)rb_dictionary_retrieve(authd_option_handlers, parv[1])) == NULL)
{ {
warn_opers(L_CRIT, "BUG: handle_options got a bad option type %s", parv[1]); warn_opers(L_CRIT, "BUG: handle_options got a bad option type %s", parv[1]);
return; return;
@ -203,7 +212,7 @@ main(int argc, char *argv[])
rb_set_time(); rb_set_time();
setup_signals(); setup_signals();
authd_option_handlers = rb_dictionary_create("authd options handlers", rb_strcasecmp); authd_option_handlers = rb_dictionary_create("authd options handlers", reinterpret_cast<int (*)(const void *, const void *)>(rb_strcasecmp));
init_resolver(); init_resolver();
init_providers(); init_providers();

View file

@ -45,9 +45,9 @@ typedef void (*authd_cmd_handler)(int parc, char *parv[]);
typedef void (*authd_stat_handler)(uint32_t rid, const char letter); typedef void (*authd_stat_handler)(uint32_t rid, const char letter);
typedef void (*authd_reload_handler)(const char letter); typedef void (*authd_reload_handler)(const char letter);
extern authd_cmd_handler authd_cmd_handlers[256]; extern std::array<authd_cmd_handler, 256> authd_cmd_handlers;
extern authd_stat_handler authd_stat_handlers[256]; extern std::array<authd_stat_handler, 256> authd_stat_handlers;
extern authd_reload_handler authd_reload_handlers[256]; extern std::array<authd_reload_handler, 256> authd_reload_handlers;
extern rb_dictionary *authd_option_handlers; extern rb_dictionary *authd_option_handlers;

View file

@ -35,7 +35,7 @@ uint64_t query_count = 0;
struct dns_query * struct dns_query *
lookup_ip(const char *host, int aftype, DNSCB callback, void *data) lookup_ip(const char *host, int aftype, DNSCB callback, void *data)
{ {
struct dns_query *query = rb_malloc(sizeof(struct dns_query)); struct dns_query *query = (dns_query *)rb_malloc(sizeof(struct dns_query));
int g_type; int g_type;
if(aftype == AF_INET) if(aftype == AF_INET)
@ -72,7 +72,7 @@ lookup_ip(const char *host, int aftype, DNSCB callback, void *data)
struct dns_query * struct dns_query *
lookup_hostname(const char *ip, DNSCB callback, void *data) lookup_hostname(const char *ip, DNSCB callback, void *data)
{ {
struct dns_query *query = rb_malloc(sizeof(struct dns_query)); struct dns_query *query = (dns_query *)rb_malloc(sizeof(struct dns_query));
int aftype; int aftype;
if(!rb_inet_pton_sock(ip, (struct sockaddr *)&query->addr)) if(!rb_inet_pton_sock(ip, (struct sockaddr *)&query->addr))
@ -111,14 +111,15 @@ lookup_hostname(const char *ip, DNSCB callback, void *data)
void void
cancel_query(struct dns_query *query) cancel_query(struct dns_query *query)
{ {
query->callback = query->data = NULL; query->callback = NULL;
query->data = NULL;
} }
/* Callback from gethost_byname_type */ /* Callback from gethost_byname_type */
static void static void
handle_lookup_ip_reply(void *data, struct DNSReply *reply) handle_lookup_ip_reply(void *data, struct DNSReply *reply)
{ {
struct dns_query *query = data; struct dns_query *query = (dns_query *)data;
char ip[HOSTIPLEN] = "*"; char ip[HOSTIPLEN] = "*";
if(query == NULL) if(query == NULL)
@ -167,7 +168,7 @@ end:
static void static void
handle_lookup_hostname_reply(void *data, struct DNSReply *reply) handle_lookup_hostname_reply(void *data, struct DNSReply *reply)
{ {
struct dns_query *query = data; struct dns_query *query = (dns_query *)data;
char *hostname = NULL; char *hostname = NULL;
if(query == NULL) if(query == NULL)
@ -217,7 +218,7 @@ end:
static void static void
submit_dns_answer(const char *reply, bool status, query_type type, void *data) submit_dns_answer(const char *reply, bool status, query_type type, void *data)
{ {
char *id = data; char *id = (char *)data;
if(!id || type == QUERY_INVALID) if(!id || type == QUERY_INVALID)
{ {
@ -252,14 +253,14 @@ handle_resolve_dns(int parc, char *parv[])
#endif #endif
case '4': case '4':
if(!lookup_ip(record, aftype, submit_dns_answer, id)) if(!lookup_ip(record, aftype, submit_dns_answer, id))
submit_dns_answer(NULL, false, qtype, NULL); submit_dns_answer(NULL, false, query_type(qtype), NULL);
break; break;
#ifdef RB_IPV6 #ifdef RB_IPV6
case 'S': case 'S':
#endif #endif
case 'R': case 'R':
if(!lookup_hostname(record, submit_dns_answer, id)) if(!lookup_hostname(record, submit_dns_answer, id))
submit_dns_answer(NULL, false, qtype, NULL); submit_dns_answer(NULL, false, query_type(qtype), NULL);
break; break;
default: default:
warn_opers(L_CRIT, "DNS: handle_resolve_dns got an unknown query: %c", qtype); warn_opers(L_CRIT, "DNS: handle_resolve_dns got an unknown query: %c", qtype);

View file

@ -82,8 +82,10 @@ destroy_providers(void)
struct auth_client *auth; struct auth_client *auth;
/* Cancel outstanding connections */ /* Cancel outstanding connections */
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
auth = (auth_client *)elem;
auth_client_ref(auth); auth_client_ref(auth);
/* TBD - is this the right thing? */ /* TBD - is this the right thing? */
@ -95,7 +97,7 @@ destroy_providers(void)
RB_DLINK_FOREACH_SAFE(ptr, nptr, auth_providers.head) RB_DLINK_FOREACH_SAFE(ptr, nptr, auth_providers.head)
{ {
struct auth_provider *provider = ptr->data; struct auth_provider *provider = (auth_provider *)ptr->data;
if(provider->destroy) if(provider->destroy)
provider->destroy(); provider->destroy();
@ -192,7 +194,7 @@ cancel_providers(struct auth_client *auth)
RB_DLINK_FOREACH(ptr, auth_providers.head) RB_DLINK_FOREACH(ptr, auth_providers.head)
{ {
struct auth_provider *provider = ptr->data; struct auth_provider *provider = (auth_provider *)ptr->data;
if(provider->cancel != NULL && is_provider_running(auth, provider->id)) if(provider->cancel != NULL && is_provider_running(auth, provider->id))
/* Cancel if required */ /* Cancel if required */
@ -222,7 +224,7 @@ provider_done(struct auth_client *auth, uint32_t id)
RB_DLINK_FOREACH(ptr, auth_providers.head) RB_DLINK_FOREACH(ptr, auth_providers.head)
{ {
struct auth_provider *provider = ptr->data; struct auth_provider *provider = (auth_provider *)ptr->data;
if(provider->completed != NULL && is_provider_running(auth, provider->id)) if(provider->completed != NULL && is_provider_running(auth, provider->id))
/* Notify pending clients who asked for it */ /* Notify pending clients who asked for it */
@ -275,7 +277,7 @@ start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_
if(lcid == 0 || lcid > UINT32_MAX) if(lcid == 0 || lcid > UINT32_MAX)
return; return;
auth = rb_malloc(sizeof(struct auth_client)); auth = (auth_client *)rb_malloc(sizeof(struct auth_client));
auth_client_ref(auth); auth_client_ref(auth);
auth->cid = (uint32_t)lcid; auth->cid = (uint32_t)lcid;
@ -300,12 +302,12 @@ start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_
rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname)); rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname));
rb_strlcpy(auth->username, "*", sizeof(auth->username)); rb_strlcpy(auth->username, "*", sizeof(auth->username));
auth->data = rb_malloc(allocated_pids * sizeof(struct auth_client_data)); auth->data = (auth_client_data *)rb_malloc(allocated_pids * sizeof(struct auth_client_data));
auth->providers_starting = true; auth->providers_starting = true;
RB_DLINK_FOREACH(ptr, auth_providers.head) RB_DLINK_FOREACH(ptr, auth_providers.head)
{ {
struct auth_provider *provider = ptr->data; struct auth_provider *provider = (auth_provider *)ptr->data;
auth->data[provider->id].provider = provider; auth->data[provider->id].provider = provider;
@ -361,7 +363,7 @@ handle_cancel_connection(int parc, char *parv[])
exit(EX_PROVIDER_ERROR); exit(EX_PROVIDER_ERROR);
} }
if((auth = rb_dictionary_retrieve(auth_clients, RB_UINT_TO_POINTER((uint32_t)lcid))) == NULL) if((auth = (auth_client *)rb_dictionary_retrieve(auth_clients, RB_UINT_TO_POINTER((uint32_t)lcid))) == NULL)
{ {
/* This could happen as a race if we've accepted/rejected but they cancel, so don't die here. /* This could happen as a race if we've accepted/rejected but they cancel, so don't die here.
* --Elizafox */ * --Elizafox */
@ -380,15 +382,17 @@ provider_timeout_event(void *notused __unused)
rb_dictionary_iter iter; rb_dictionary_iter iter;
const time_t curtime = rb_current_time(); const time_t curtime = rb_current_time();
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
rb_dlink_node *ptr; rb_dlink_node *ptr;
auth = (auth_client *)elem;
auth_client_ref(auth); auth_client_ref(auth);
RB_DLINK_FOREACH(ptr, auth_providers.head) RB_DLINK_FOREACH(ptr, auth_providers.head)
{ {
struct auth_provider *provider = ptr->data; struct auth_provider *provider = (auth_provider *)ptr->data;
const time_t timeout = get_provider_timeout(auth, provider->id); const time_t timeout = get_provider_timeout(auth, provider->id);
if(is_provider_running(auth, provider->id) && provider->timeout != NULL && if(is_provider_running(auth, provider->id) && provider->timeout != NULL &&

View file

@ -145,7 +145,7 @@ find_provider(const char *name)
RB_DLINK_FOREACH(ptr, auth_providers.head) RB_DLINK_FOREACH(ptr, auth_providers.head)
{ {
struct auth_provider *provider = ptr->data; struct auth_provider *provider = (auth_provider *)ptr->data;
if(strcasecmp(provider->name, name) == 0) if(strcasecmp(provider->name, name) == 0)
return provider; return provider;

View file

@ -62,7 +62,7 @@ struct blacklist
uint8_t iptype; /* IP types supported */ uint8_t iptype; /* IP types supported */
rb_dlink_list filters; /* Filters for queries */ rb_dlink_list filters; /* Filters for queries */
bool delete; /* If true delete when no clients */ bool delete_; /* If true delete when no clients */
int refcount; /* When 0 and delete is set, remove this blacklist */ int refcount; /* When 0 and delete is set, remove this blacklist */
unsigned int hits; unsigned int hits;
@ -123,7 +123,7 @@ unref_blacklist(struct blacklist *bl)
rb_dlink_node *ptr, *nptr; rb_dlink_node *ptr, *nptr;
bl->refcount--; bl->refcount--;
if (bl->delete && bl->refcount <= 0) if (bl->delete_ && bl->refcount <= 0)
{ {
RB_DLINK_FOREACH_SAFE(ptr, nptr, bl->filters.head) RB_DLINK_FOREACH_SAFE(ptr, nptr, bl->filters.head)
{ {
@ -146,11 +146,11 @@ new_blacklist(const char *name, const char *reason, uint8_t iptype, rb_dlink_lis
if((bl = find_blacklist(name)) == NULL) if((bl = find_blacklist(name)) == NULL)
{ {
bl = rb_malloc(sizeof(struct blacklist)); bl = (blacklist *)rb_malloc(sizeof(struct blacklist));
rb_dlinkAddAlloc(bl, &blacklist_list); rb_dlinkAddAlloc(bl, &blacklist_list);
} }
else else
bl->delete = false; bl->delete_ = false;
rb_strlcpy(bl->host, name, IRCD_RES_HOSTLEN + 1); rb_strlcpy(bl->host, name, IRCD_RES_HOSTLEN + 1);
rb_strlcpy(bl->reason, reason, BUFSIZE); rb_strlcpy(bl->reason, reason, BUFSIZE);
@ -196,7 +196,7 @@ blacklist_check_reply(struct blacklist_lookup *bllookup, const char *ipaddr)
RB_DLINK_FOREACH(ptr, bl->filters.head) RB_DLINK_FOREACH(ptr, bl->filters.head)
{ {
struct blacklist_filter *filter = ptr->data; struct blacklist_filter *filter = (blacklist_filter *)ptr->data;
const char *cmpstr; const char *cmpstr;
if (filter->type == FILTER_ALL) if (filter->type == FILTER_ALL)
@ -241,7 +241,7 @@ blacklist_dns_callback(const char *result, bool status, query_type type, void *d
bl = bllookup->bl; bl = bllookup->bl;
auth = bllookup->auth; auth = bllookup->auth;
if((bluser = get_provider_data(auth, SELF_PID)) == NULL) if((bluser = (blacklist_user *)get_provider_data(auth, SELF_PID)) == NULL)
return; return;
if (result != NULL && status && blacklist_check_reply(bllookup, result)) if (result != NULL && status && blacklist_check_reply(bllookup, result))
@ -275,8 +275,8 @@ blacklist_dns_callback(const char *result, bool status, query_type type, void *d
static void static void
initiate_blacklist_dnsquery(struct blacklist *bl, struct auth_client *auth) initiate_blacklist_dnsquery(struct blacklist *bl, struct auth_client *auth)
{ {
struct blacklist_lookup *bllookup = rb_malloc(sizeof(struct blacklist_lookup)); struct blacklist_lookup *bllookup = (blacklist_lookup *)rb_malloc(sizeof(struct blacklist_lookup));
struct blacklist_user *bluser = get_provider_data(auth, SELF_PID); struct blacklist_user *bluser = (blacklist_user *)get_provider_data(auth, SELF_PID);
char buf[IRCD_RES_HOSTLEN + 1]; char buf[IRCD_RES_HOSTLEN + 1];
int aftype; int aftype;
@ -302,7 +302,7 @@ initiate_blacklist_dnsquery(struct blacklist *bl, struct auth_client *auth)
static inline bool static inline bool
lookup_all_blacklists(struct auth_client *auth) lookup_all_blacklists(struct auth_client *auth)
{ {
struct blacklist_user *bluser = get_provider_data(auth, SELF_PID); struct blacklist_user *bluser = (blacklist_user *)get_provider_data(auth, SELF_PID);
rb_dlink_node *ptr; rb_dlink_node *ptr;
int iptype; int iptype;
@ -323,7 +323,7 @@ lookup_all_blacklists(struct auth_client *auth)
{ {
struct blacklist *bl = (struct blacklist *)ptr->data; struct blacklist *bl = (struct blacklist *)ptr->data;
if (!bl->delete && (bl->iptype & iptype)) if (!bl->delete_ && (bl->iptype & iptype))
initiate_blacklist_dnsquery(bl, auth); initiate_blacklist_dnsquery(bl, auth);
} }
@ -340,7 +340,7 @@ static inline void
delete_blacklist(struct blacklist *bl) delete_blacklist(struct blacklist *bl)
{ {
if (bl->refcount > 0) if (bl->refcount > 0)
bl->delete = true; bl->delete_ = true;
else else
{ {
rb_dlinkFindDestroy(bl, &blacklist_list); rb_dlinkFindDestroy(bl, &blacklist_list);
@ -355,7 +355,7 @@ delete_all_blacklists(void)
RB_DLINK_FOREACH_SAFE(ptr, nptr, blacklist_list.head) RB_DLINK_FOREACH_SAFE(ptr, nptr, blacklist_list.head)
{ {
delete_blacklist(ptr->data); delete_blacklist((blacklist *)ptr->data);
} }
} }
@ -394,7 +394,7 @@ blacklists_start(struct auth_client *auth)
static void static void
blacklists_initiate(struct auth_client *auth, uint32_t provider) blacklists_initiate(struct auth_client *auth, uint32_t provider)
{ {
struct blacklist_user *bluser = get_provider_data(auth, SELF_PID); struct blacklist_user *bluser = (blacklist_user *)get_provider_data(auth, SELF_PID);
uint32_t rdns_pid, ident_pid; uint32_t rdns_pid, ident_pid;
lrb_assert(provider != SELF_PID); lrb_assert(provider != SELF_PID);
@ -421,7 +421,7 @@ static inline void
blacklists_generic_cancel(struct auth_client *auth, const char *message) blacklists_generic_cancel(struct auth_client *auth, const char *message)
{ {
rb_dlink_node *ptr, *nptr; rb_dlink_node *ptr, *nptr;
struct blacklist_user *bluser = get_provider_data(auth, SELF_PID); struct blacklist_user *bluser = (blacklist_user *)get_provider_data(auth, SELF_PID);
if(bluser == NULL) if(bluser == NULL)
return; return;
@ -432,7 +432,7 @@ blacklists_generic_cancel(struct auth_client *auth, const char *message)
RB_DLINK_FOREACH_SAFE(ptr, nptr, bluser->queries.head) RB_DLINK_FOREACH_SAFE(ptr, nptr, bluser->queries.head)
{ {
struct blacklist_lookup *bllookup = ptr->data; struct blacklist_lookup *bllookup = (blacklist_lookup *)ptr->data;
cancel_query(bllookup->query); cancel_query(bllookup->query);
unref_blacklist(bllookup->bl); unref_blacklist(bllookup->bl);
@ -474,8 +474,10 @@ blacklists_destroy(void)
rb_dictionary_iter iter; rb_dictionary_iter iter;
struct auth_client *auth; struct auth_client *auth;
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
auth = (auth_client *)elem;
blacklists_cancel(auth); blacklists_cancel(auth);
/* auth is now invalid as we have no reference */ /* auth is now invalid as we have no reference */
} }
@ -495,7 +497,7 @@ add_conf_blacklist(const char *key, int parc, const char **parv)
for(char *elem = rb_strtok_r(elemlist, ",", &tmp); elem; elem = rb_strtok_r(NULL, ",", &tmp)) for(char *elem = rb_strtok_r(elemlist, ",", &tmp); elem; elem = rb_strtok_r(NULL, ",", &tmp))
{ {
struct blacklist_filter *filter = rb_malloc(sizeof(struct blacklist_filter)); struct blacklist_filter *filter = (blacklist_filter *)rb_malloc(sizeof(struct blacklist_filter));
int dot_c = 0; int dot_c = 0;
filter_t type = FILTER_LAST; filter_t type = FILTER_LAST;
@ -584,7 +586,7 @@ blacklist_stats(uint32_t rid, char letter)
RB_DLINK_FOREACH(ptr, blacklist_list.head) RB_DLINK_FOREACH(ptr, blacklist_list.head)
{ {
struct blacklist *bl = ptr->data; struct blacklist *bl = (blacklist *)ptr->data;
if(bl->delete) if(bl->delete)
continue; continue;
@ -606,14 +608,16 @@ struct auth_opts_handler blacklist_options[] =
}; };
struct auth_provider blacklist_provider = struct auth_provider blacklist_provider =
{ {[]{
.name = "blacklist", auth_provider ret {0};
.letter = 'B', ret.name = "blacklist";
.destroy = blacklists_destroy, ret.letter = 'B';
.start = blacklists_start, ret.destroy = blacklists_destroy;
.cancel = blacklists_cancel, ret.start = blacklists_start;
.timeout = blacklists_timeout, ret.cancel = blacklists_cancel;
.completed = blacklists_initiate, ret.timeout = blacklists_timeout;
.opt_handlers = blacklist_options, ret.completed = blacklists_initiate;
ret.opt_handlers = blacklist_options;
/* .stats_handler = { 'B', blacklist_stats }, */ /* .stats_handler = { 'B', blacklist_stats }, */
}; return ret;
}()};

View file

@ -84,13 +84,13 @@ static bool ident_enable = true;
static void static void
ident_connected(rb_fde_t *F __unused, int error, void *data) ident_connected(rb_fde_t *F __unused, int error, void *data)
{ {
struct auth_client *auth = data; struct auth_client *auth = (auth_client *)data;
struct ident_query *query; struct ident_query *query;
char authbuf[32]; char authbuf[32];
int authlen; int authlen;
lrb_assert(auth != NULL); lrb_assert(auth != NULL);
query = get_provider_data(auth, SELF_PID); query = (ident_query *)get_provider_data(auth, SELF_PID);
lrb_assert(query != NULL); lrb_assert(query != NULL);
/* Check the error */ /* Check the error */
@ -117,7 +117,7 @@ ident_connected(rb_fde_t *F __unused, int error, void *data)
static void static void
read_ident_reply(rb_fde_t *F, void *data) read_ident_reply(rb_fde_t *F, void *data)
{ {
struct auth_client *auth = data; struct auth_client *auth = (auth_client *)data;
struct ident_query *query; struct ident_query *query;
char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */ char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */
ident_message message = REPORT_FAIL; ident_message message = REPORT_FAIL;
@ -127,7 +127,7 @@ read_ident_reply(rb_fde_t *F, void *data)
int count; int count;
lrb_assert(auth != NULL); lrb_assert(auth != NULL);
query = get_provider_data(auth, SELF_PID); query = (ident_query *)get_provider_data(auth, SELF_PID);
lrb_assert(query != NULL); lrb_assert(query != NULL);
len = rb_read(F, buf, IDENT_BUFSIZE); len = rb_read(F, buf, IDENT_BUFSIZE);
@ -172,7 +172,7 @@ read_ident_reply(rb_fde_t *F, void *data)
static void static void
client_fail(struct auth_client *auth, ident_message report) client_fail(struct auth_client *auth, ident_message report)
{ {
struct ident_query *query = get_provider_data(auth, SELF_PID); struct ident_query *query = (ident_query *)get_provider_data(auth, SELF_PID);
lrb_assert(query != NULL); lrb_assert(query != NULL);
@ -194,7 +194,7 @@ client_fail(struct auth_client *auth, ident_message report)
static void static void
client_success(struct auth_client *auth) client_success(struct auth_client *auth)
{ {
struct ident_query *query = get_provider_data(auth, SELF_PID); struct ident_query *query = (ident_query *)get_provider_data(auth, SELF_PID);
lrb_assert(query != NULL); lrb_assert(query != NULL);
@ -282,8 +282,10 @@ ident_destroy(void)
rb_dictionary_iter iter; rb_dictionary_iter iter;
/* Nuke all ident queries */ /* Nuke all ident queries */
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
auth = (auth_client *)elem;
if(get_provider_data(auth, SELF_PID) != NULL) if(get_provider_data(auth, SELF_PID) != NULL)
client_fail(auth, REPORT_FAIL); client_fail(auth, REPORT_FAIL);
/* auth is now invalid as we have no reference */ /* auth is now invalid as we have no reference */
@ -293,7 +295,7 @@ ident_destroy(void)
static bool static bool
ident_start(struct auth_client *auth) ident_start(struct auth_client *auth)
{ {
struct ident_query *query = rb_malloc(sizeof(struct ident_query)); struct ident_query *query = (ident_query *)rb_malloc(sizeof(struct ident_query));
struct rb_sockaddr_storage l_addr, c_addr; struct rb_sockaddr_storage l_addr, c_addr;
int family = GET_SS_FAMILY(&auth->c_addr); int family = GET_SS_FAMILY(&auth->c_addr);
@ -341,7 +343,7 @@ ident_start(struct auth_client *auth)
static void static void
ident_cancel(struct auth_client *auth) ident_cancel(struct auth_client *auth)
{ {
struct ident_query *query = get_provider_data(auth, SELF_PID); struct ident_query *query = (ident_query *)get_provider_data(auth, SELF_PID);
if(query != NULL) if(query != NULL)
client_fail(auth, REPORT_FAIL); client_fail(auth, REPORT_FAIL);
@ -375,13 +377,15 @@ struct auth_opts_handler ident_options[] =
}; };
struct auth_provider ident_provider = struct auth_provider ident_provider
{ {[]{
.name = "ident", auth_provider ap {0};
.letter = 'I', ap.name = "ident";
.start = ident_start, ap.letter = 'I';
.destroy = ident_destroy, ap.start = ident_start;
.cancel = ident_cancel, ap.destroy = ident_destroy;
.timeout = ident_cancel, ap.cancel = ident_cancel;
.opt_handlers = ident_options, ap.timeout = ident_cancel;
}; ap.opt_handlers = ident_options;
return ap;
}()};

View file

@ -127,7 +127,7 @@ find_proxy_scanner(protocol_t proto, uint16_t port)
RB_DLINK_FOREACH(ptr, proxy_scanners.head) RB_DLINK_FOREACH(ptr, proxy_scanners.head)
{ {
struct opm_proxy *proxy = ptr->data; struct opm_proxy *proxy = (opm_proxy *)ptr->data;
if(proxy->proto == proto && proxy->port == port) if(proxy->proto == proto && proxy->port == port)
return proxy; return proxy;
@ -141,13 +141,13 @@ static void
read_opm_reply(rb_fde_t *F, void *data) read_opm_reply(rb_fde_t *F, void *data)
{ {
rb_dlink_node *ptr; rb_dlink_node *ptr;
struct auth_client *auth = data; struct auth_client *auth = (auth_client *)data;
struct opm_lookup *lookup; struct opm_lookup *lookup;
char readbuf[OPM_READSIZE]; char readbuf[OPM_READSIZE];
ssize_t len; ssize_t len;
lrb_assert(auth != NULL); lrb_assert(auth != NULL);
lookup = get_provider_data(auth, SELF_PID); lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
lrb_assert(lookup != NULL); lrb_assert(lookup != NULL);
if((len = rb_read(F, readbuf, sizeof(readbuf))) < 0 && rb_ignore_errno(errno)) if((len = rb_read(F, readbuf, sizeof(readbuf))) < 0 && rb_ignore_errno(errno))
@ -164,7 +164,7 @@ read_opm_reply(rb_fde_t *F, void *data)
RB_DLINK_FOREACH(ptr, proxy_scanners.head) RB_DLINK_FOREACH(ptr, proxy_scanners.head)
{ {
struct opm_proxy *proxy = ptr->data; struct opm_proxy *proxy = (opm_proxy *)ptr->data;
if(strncmp(proxy->note, readbuf, strlen(proxy->note)) == 0) if(strncmp(proxy->note, readbuf, strlen(proxy->note)) == 0)
{ {
@ -173,7 +173,7 @@ read_opm_reply(rb_fde_t *F, void *data)
/* Cancel outstanding lookups */ /* Cancel outstanding lookups */
RB_DLINK_FOREACH_SAFE(ptr, nptr, lookup->scans.head) RB_DLINK_FOREACH_SAFE(ptr, nptr, lookup->scans.head)
{ {
struct opm_scan *scan = ptr->data; struct opm_scan *scan = (opm_scan *)ptr->data;
rb_close(scan->F); rb_close(scan->F);
rb_free(scan); rb_free(scan);
@ -194,7 +194,7 @@ static void
accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, void *data) accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, void *data)
{ {
struct auth_client *auth = NULL; struct auth_client *auth = NULL;
struct opm_listener *listener = data; struct opm_listener *listener = (opm_listener *)data;
struct rb_sockaddr_storage localaddr; struct rb_sockaddr_storage localaddr;
unsigned int llen = sizeof(struct rb_sockaddr_storage); unsigned int llen = sizeof(struct rb_sockaddr_storage);
rb_dictionary_iter iter; rb_dictionary_iter iter;
@ -213,8 +213,10 @@ accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, voi
} }
/* Correlate connection with client(s) */ /* Correlate connection with client(s) */
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
auth = (auth_client *)elem;
if(GET_SS_FAMILY(&auth->c_addr) != GET_SS_FAMILY(&localaddr)) if(GET_SS_FAMILY(&auth->c_addr) != GET_SS_FAMILY(&localaddr))
continue; continue;
@ -261,10 +263,10 @@ accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, voi
static void static void
opm_connected(rb_fde_t *F, int error, void *data) opm_connected(rb_fde_t *F, int error, void *data)
{ {
struct opm_scan *scan = data; struct opm_scan *scan = (opm_scan *)data;
struct opm_proxy *proxy = scan->proxy; struct opm_proxy *proxy = scan->proxy;
struct auth_client *auth = scan->auth; struct auth_client *auth = scan->auth;
struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
if(error || !opm_enable) if(error || !opm_enable)
{ {
@ -308,7 +310,7 @@ static void
socks4_connected(struct opm_scan *scan) socks4_connected(struct opm_scan *scan)
{ {
struct auth_client *auth = scan->auth; struct auth_client *auth = scan->auth;
struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
uint8_t sendbuf[9]; /* Size we're building */ uint8_t sendbuf[9]; /* Size we're building */
uint8_t *c = sendbuf; uint8_t *c = sendbuf;
@ -330,12 +332,12 @@ static void
socks5_connected(struct opm_scan *scan) socks5_connected(struct opm_scan *scan)
{ {
struct auth_client *auth = scan->auth; struct auth_client *auth = scan->auth;
struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
uint8_t sendbuf[25]; /* Size we're building */ uint8_t sendbuf[25]; /* Size we're building */
uint8_t *c = sendbuf; uint8_t *c = sendbuf;
auth = scan->auth; auth = scan->auth;
lookup = get_provider_data(auth, SELF_PID); lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
/* Build the version header and socks request /* Build the version header and socks request
* version header (3 bytes): version, number of auth methods, auth type (0 for none) * version header (3 bytes): version, number of auth methods, auth type (0 for none)
@ -374,7 +376,7 @@ static void
http_connect_connected(struct opm_scan *scan) http_connect_connected(struct opm_scan *scan)
{ {
struct auth_client *auth = scan->auth; struct auth_client *auth = scan->auth;
struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
char sendbuf[128]; /* A bit bigger than we need but better safe than sorry */ char sendbuf[128]; /* A bit bigger than we need but better safe than sorry */
char *c = sendbuf; char *c = sendbuf;
@ -398,8 +400,8 @@ http_connect_connected(struct opm_scan *scan)
static inline void static inline void
establish_connection(struct auth_client *auth, struct opm_proxy *proxy) establish_connection(struct auth_client *auth, struct opm_proxy *proxy)
{ {
struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
struct opm_scan *scan = rb_malloc(sizeof(struct opm_scan)); struct opm_scan *scan = (opm_scan *)rb_malloc(sizeof(struct opm_scan));
struct opm_listener *listener; struct opm_listener *listener;
struct rb_sockaddr_storage c_a, l_a; struct rb_sockaddr_storage c_a, l_a;
int opt = 1; int opt = 1;
@ -557,8 +559,10 @@ create_listener(const char *ip, uint16_t port)
/* Cancel clients that may be on old listener /* Cancel clients that may be on old listener
* XXX - should rescan clients that need it * XXX - should rescan clients that need it
*/ */
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
auth = (auth_client *)elem;
opm_cancel(auth); opm_cancel(auth);
/* auth is now invalid as we have no reference */ /* auth is now invalid as we have no reference */
} }
@ -581,14 +585,14 @@ opm_scan(struct auth_client *auth)
lrb_assert(auth != NULL); lrb_assert(auth != NULL);
lookup = get_provider_data(auth, SELF_PID); lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
set_provider_timeout_relative(auth, SELF_PID, opm_timeout); set_provider_timeout_relative(auth, SELF_PID, opm_timeout);
lookup->in_progress = true; lookup->in_progress = true;
RB_DLINK_FOREACH(ptr, proxy_scanners.head) RB_DLINK_FOREACH(ptr, proxy_scanners.head)
{ {
struct opm_proxy *proxy = ptr->data; struct opm_proxy *proxy = (opm_proxy *)ptr->data;
//notice_client(auth->cid, "*** Scanning for proxy type %s", proxy->note); //notice_client(auth->cid, "*** Scanning for proxy type %s", proxy->note);
establish_connection(auth, proxy); establish_connection(auth, proxy);
} }
@ -600,7 +604,7 @@ opm_scan(struct auth_client *auth)
static void static void
opm_initiate(struct auth_client *auth, uint32_t provider) opm_initiate(struct auth_client *auth, uint32_t provider)
{ {
struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
uint32_t rdns_pid, ident_pid; uint32_t rdns_pid, ident_pid;
lrb_assert(provider != SELF_PID); lrb_assert(provider != SELF_PID);
@ -647,7 +651,7 @@ opm_start(struct auth_client *auth)
static void static void
opm_cancel(struct auth_client *auth) opm_cancel(struct auth_client *auth)
{ {
struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
if(lookup != NULL) if(lookup != NULL)
{ {
@ -657,7 +661,7 @@ opm_cancel(struct auth_client *auth)
RB_DLINK_FOREACH_SAFE(ptr, nptr, lookup->scans.head) RB_DLINK_FOREACH_SAFE(ptr, nptr, lookup->scans.head)
{ {
struct opm_scan *scan = ptr->data; struct opm_scan *scan = (struct opm_scan *)ptr->data;
rb_close(scan->F); rb_close(scan->F);
rb_free(scan); rb_free(scan);
@ -680,8 +684,10 @@ opm_destroy(void)
rb_dictionary_iter iter; rb_dictionary_iter iter;
/* Nuke all opm lookups */ /* Nuke all opm lookups */
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
auth = (auth_client *)elem;
opm_cancel(auth); opm_cancel(auth);
/* auth is now invalid as we have no reference */ /* auth is now invalid as we have no reference */
} }
@ -723,8 +729,10 @@ set_opm_enabled(const char *key __unused, int parc __unused, const char **parv)
listeners[LISTEN_IPV4].F = listeners[LISTEN_IPV6].F = NULL; listeners[LISTEN_IPV4].F = listeners[LISTEN_IPV6].F = NULL;
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
auth = (auth_client *)elem;
opm_cancel(auth); opm_cancel(auth);
/* auth is now invalid as we have no reference */ /* auth is now invalid as we have no reference */
} }
@ -769,7 +777,7 @@ static void
create_opm_scanner(const char *key __unused, int parc __unused, const char **parv) create_opm_scanner(const char *key __unused, int parc __unused, const char **parv)
{ {
int iport = atoi(parv[1]); int iport = atoi(parv[1]);
struct opm_proxy *proxy = rb_malloc(sizeof(struct opm_proxy)); struct opm_proxy *proxy = (opm_proxy *)rb_malloc(sizeof(struct opm_proxy));
if(iport <= 0 || iport > 65535) if(iport <= 0 || iport > 65535)
{ {
@ -843,10 +851,12 @@ delete_opm_scanner(const char *key __unused, int parc __unused, const char **par
} }
/* Abort remaining clients on this scanner */ /* Abort remaining clients on this scanner */
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
rb_dlink_node *ptr; rb_dlink_node *ptr;
struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); auth = (auth_client *)elem;
struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID);
if(lookup == NULL) if(lookup == NULL)
continue; continue;
@ -855,7 +865,7 @@ delete_opm_scanner(const char *key __unused, int parc __unused, const char **par
RB_DLINK_FOREACH(ptr, lookup->scans.head) RB_DLINK_FOREACH(ptr, lookup->scans.head)
{ {
struct opm_scan *scan = ptr->data; struct opm_scan *scan = (struct opm_scan *)ptr->data;
if(scan->proxy->port == proxy->port && scan->proxy->proto == proxy->proto) if(scan->proxy->port == proxy->port && scan->proxy->proto == proxy->proto)
{ {
@ -893,8 +903,10 @@ delete_opm_scanner_all(const char *key __unused, int parc __unused, const char *
rb_dlinkDelete(ptr, &proxy_scanners); rb_dlinkDelete(ptr, &proxy_scanners);
} }
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
auth = (auth_client *)elem;
opm_cancel(auth); opm_cancel(auth);
/* auth is now invalid as we have no reference */ /* auth is now invalid as we have no reference */
} }
@ -929,14 +941,16 @@ struct auth_opts_handler opm_options[] =
{ NULL, 0, NULL }, { NULL, 0, NULL },
}; };
struct auth_provider opm_provider = struct auth_provider opm_provider
{ {[]{
.name = "opm", auth_provider ap {0};
.letter = 'O', ap.name = "opm";
.destroy = opm_destroy, ap.letter = 'O';
.start = opm_start, ap.destroy = opm_destroy;
.cancel = opm_cancel, ap.start = opm_start;
.timeout = opm_cancel, ap.cancel = opm_cancel;
.completed = opm_initiate, ap.timeout = opm_cancel;
.opt_handlers = opm_options, ap.completed = opm_initiate;
}; ap.opt_handlers = opm_options;
return ap;
}()};

View file

@ -56,8 +56,8 @@ static int rdns_timeout = RDNS_TIMEOUT_DEFAULT;
static void static void
dns_answer_callback(const char *res, bool status, query_type type, void *data) dns_answer_callback(const char *res, bool status, query_type type, void *data)
{ {
struct auth_client *auth = data; struct auth_client *auth = (auth_client *)data;
struct user_query *query = get_provider_data(auth, SELF_PID); struct user_query *query = (user_query *)get_provider_data(auth, SELF_PID);
lrb_assert(query != NULL); lrb_assert(query != NULL);
@ -75,7 +75,7 @@ dns_answer_callback(const char *res, bool status, query_type type, void *data)
static void static void
client_fail(struct auth_client *auth, dns_message report) client_fail(struct auth_client *auth, dns_message report)
{ {
struct user_query *query = get_provider_data(auth, SELF_PID); struct user_query *query = (user_query *)get_provider_data(auth, SELF_PID);
lrb_assert(query != NULL); lrb_assert(query != NULL);
@ -96,7 +96,7 @@ client_fail(struct auth_client *auth, dns_message report)
static void static void
client_success(struct auth_client *auth) client_success(struct auth_client *auth)
{ {
struct user_query *query = get_provider_data(auth, SELF_PID); struct user_query *query = (user_query *)get_provider_data(auth, SELF_PID);
lrb_assert(query != NULL); lrb_assert(query != NULL);
@ -118,8 +118,10 @@ rdns_destroy(void)
struct auth_client *auth; struct auth_client *auth;
rb_dictionary_iter iter; rb_dictionary_iter iter;
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) void *elem;
RB_DICTIONARY_FOREACH(elem, &iter, auth_clients)
{ {
auth = (auth_client *)elem;
if(get_provider_data(auth, SELF_PID) != NULL) if(get_provider_data(auth, SELF_PID) != NULL)
client_fail(auth, REPORT_FAIL); client_fail(auth, REPORT_FAIL);
/* auth is now invalid as we have no reference */ /* auth is now invalid as we have no reference */
@ -129,7 +131,7 @@ rdns_destroy(void)
static bool static bool
rdns_start(struct auth_client *auth) rdns_start(struct auth_client *auth)
{ {
struct user_query *query = rb_malloc(sizeof(struct user_query)); struct user_query *query = (user_query *)rb_malloc(sizeof(struct user_query));
auth_client_ref(auth); auth_client_ref(auth);
@ -146,7 +148,7 @@ rdns_start(struct auth_client *auth)
static void static void
rdns_cancel(struct auth_client *auth) rdns_cancel(struct auth_client *auth)
{ {
struct user_query *query = get_provider_data(auth, SELF_PID); struct user_query *query = (user_query *)get_provider_data(auth, SELF_PID);
if(query != NULL) if(query != NULL)
client_fail(auth, REPORT_FAIL); client_fail(auth, REPORT_FAIL);
@ -172,13 +174,15 @@ struct auth_opts_handler rdns_options[] =
{ NULL, 0, NULL }, { NULL, 0, NULL },
}; };
struct auth_provider rdns_provider = struct auth_provider rdns_provider
{ {[]{
.name = "rdns", auth_provider ap {0};
.letter = 'R', ap.name = "rdns";
.destroy = rdns_destroy, ap.letter = 'R';
.start = rdns_start, ap.destroy = rdns_destroy;
.cancel = rdns_cancel, ap.start = rdns_start;
.timeout = rdns_cancel, ap.cancel = rdns_cancel;
.opt_handlers = rdns_options, ap.timeout = rdns_cancel;
}; ap.opt_handlers = rdns_options;
return ap;
}()};

View file

@ -172,7 +172,7 @@ static time_t timeout_query_list(time_t now)
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, request_list.head) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, request_list.head)
{ {
request = ptr->data; request = (reslist *)ptr->data;
timeout = request->sentat + request->timeout; timeout = request->sentat + request->timeout;
if (now >= timeout) if (now >= timeout)
@ -287,7 +287,7 @@ static void rem_request(struct reslist *request)
*/ */
static struct reslist *make_request(struct DNSQuery *query) static struct reslist *make_request(struct DNSQuery *query)
{ {
struct reslist *request = rb_malloc(sizeof(struct reslist)); struct reslist *request = (reslist *)rb_malloc(sizeof(struct reslist));
request->sentat = rb_current_time(); request->sentat = rb_current_time();
request->retries = 3; request->retries = 3;
@ -386,7 +386,7 @@ static struct reslist *find_id(int id)
RB_DLINK_FOREACH(ptr, request_list.head) RB_DLINK_FOREACH(ptr, request_list.head)
{ {
request = ptr->data; request = (reslist *)ptr->data;
if (request->id == id) if (request->id == id)
return (request); return (request);

View file

@ -744,7 +744,7 @@ irc_ns_name_pton(const char *src, unsigned char *dst, size_t dstsiz)
while ((c = *src++) != 0) { while ((c = *src++) != 0) {
if (escaped) { if (escaped) {
if (c == '[') { /* start a bit string label */ if (c == '[') { /* start a bit string label */
if ((cp = strchr(src, ']')) == NULL) { if ((cp = (char *)strchr(src, ']')) == NULL) {
errno = EINVAL; /* ??? */ errno = EINVAL; /* ??? */
return(-1); return(-1);
} }
@ -767,16 +767,16 @@ irc_ns_name_pton(const char *src, unsigned char *dst, size_t dstsiz)
} }
continue; continue;
} }
else if ((cp = strchr(digits, c)) != NULL) { else if ((cp = (char *)strchr(digits, c)) != NULL) {
n = (cp - digits) * 100; n = (cp - digits) * 100;
if ((c = *src++) == 0 || if ((c = *src++) == 0 ||
(cp = strchr(digits, c)) == NULL) { (cp = (char *)strchr(digits, c)) == NULL) {
errno = EMSGSIZE; errno = EMSGSIZE;
return (-1); return (-1);
} }
n += (cp - digits) * 10; n += (cp - digits) * 10;
if ((c = *src++) == 0 || if ((c = *src++) == 0 ||
(cp = strchr(digits, c)) == NULL) { (cp = (char *)strchr(digits, c)) == NULL) {
errno = EMSGSIZE; errno = EMSGSIZE;
return (-1); return (-1);
} }
@ -1174,7 +1174,7 @@ mklower(int ch)
int int
irc_res_mkquery( irc_res_mkquery(
const char *dname, /* domain name */ const char *dname, /* domain name */
int class, int type, /* class and type of query */ int class_, int type, /* class and type of query */
unsigned char *buf, /* buffer to put query */ unsigned char *buf, /* buffer to put query */
int buflen) /* size of buffer */ int buflen) /* size of buffer */
{ {
@ -1210,7 +1210,7 @@ irc_res_mkquery(
cp += n; cp += n;
buflen -= n; buflen -= n;
IRC_NS_PUT16(type, cp); IRC_NS_PUT16(type, cp);
IRC_NS_PUT16(class, cp); IRC_NS_PUT16(class_, cp);
hp->qdcount = htons(1); hp->qdcount = htons(1);
return (cp - buf); return (cp - buf);

View file

@ -119,7 +119,7 @@ extern unsigned int irc_ns_get16(const unsigned char *src);
extern unsigned long irc_ns_get32(const unsigned char *src); extern unsigned long irc_ns_get32(const unsigned char *src);
extern void irc_ns_put16(unsigned int src, unsigned char *dst); extern void irc_ns_put16(unsigned int src, unsigned char *dst);
extern void irc_ns_put32(unsigned long src, unsigned char *dst); extern void irc_ns_put32(unsigned long src, unsigned char *dst);
extern int irc_res_mkquery(const char *dname, int class, int type, unsigned char *buf, int buflen); extern int irc_res_mkquery(const char *dname, int class_, int type, unsigned char *buf, int buflen);
extern char irc_domain[IRCD_RES_HOSTLEN + 1]; extern char irc_domain[IRCD_RES_HOSTLEN + 1];

View file

@ -50,7 +50,7 @@ const char *get_windows_nameservers(void);
static int static int
get_iphlpapi_dns_info(char *ret_buf, size_t ret_size) get_iphlpapi_dns_info(char *ret_buf, size_t ret_size)
{ {
FIXED_INFO *fi = alloca(sizeof(*fi)); FIXED_INFO *fi = (FIXED_INFO *)alloca(sizeof(*fi));
DWORD size = sizeof(*fi); DWORD size = sizeof(*fi);
typedef DWORD(WINAPI * get_net_param_func) (FIXED_INFO *, DWORD *); typedef DWORD(WINAPI * get_net_param_func) (FIXED_INFO *, DWORD *);
get_net_param_func xxGetNetworkParams; /* available only on Win-98/2000+ */ get_net_param_func xxGetNetworkParams; /* available only on Win-98/2000+ */
@ -78,7 +78,7 @@ get_iphlpapi_dns_info(char *ret_buf, size_t ret_size)
if((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS)) if((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS))
goto quit; goto quit;
fi = alloca(size); fi = (FIXED_INFO *)alloca(size);
if(!fi || (*xxGetNetworkParams) (fi, &size) != ERROR_SUCCESS) if(!fi || (*xxGetNetworkParams) (fi, &size) != ERROR_SUCCESS)
goto quit; goto quit;
@ -134,7 +134,7 @@ get_res_nt(HKEY hKey, const char *subkey, char **obuf)
result = RegQueryValueEx(hKey, subkey, 0, NULL, NULL, &size); result = RegQueryValueEx(hKey, subkey, 0, NULL, NULL, &size);
if((result != ERROR_SUCCESS && result != ERROR_MORE_DATA) || !size) if((result != ERROR_SUCCESS && result != ERROR_MORE_DATA) || !size)
return 0; return 0;
*obuf = rb_malloc(size + 1); *obuf = (char *)rb_malloc(size + 1);
if(!*obuf) if(!*obuf)
return 0; return 0;

View file

@ -1,15 +1,21 @@
bin_PROGRAMS = bandb bantool bin_PROGRAMS = bandb bantool
AM_CFLAGS=$(WARNFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/include @SQLITE_INCLUDES@ AM_CPPFLAGS = $(WARNFLAGS)
AM_CPPFLAGS += -I$(top_srcdir)/include
AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include
AM_CPPFLAGS += @SQLITE_INCLUDES@
AM_CPPFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION AM_CPPFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
bandb_SOURCES = bandb.c rsdb_sqlite3.c rsdb_snprintf.c AM_LDFLAGS = -L$(top_srcdir)/rb
AM_LDFLAGS += -L$(top_srcdir)/ircd
AM_LDFLAGS += -L$(top_srcdir)/boost/lib
bandb_SOURCES = bandb.cc rsdb_sqlite3.c rsdb_snprintf.c
EXTRA_bandb_SOURCES = sqlite3.c EXTRA_bandb_SOURCES = sqlite3.c
bandb_LDADD = $(top_srcdir)/rb/librb.la @SQLITE_LD@ @SQLITE_OBJ@ bandb_LDADD = -lrb @SQLITE_LD@ @SQLITE_OBJ@ -lboost_system
bandb_DEPENDENCIES = @SQLITE_OBJ@ bandb_DEPENDENCIES = @SQLITE_OBJ@
bantool_SOURCES = bantool.c rsdb_sqlite3.c rsdb_snprintf.c bantool_SOURCES = bantool.cc rsdb_sqlite3.c rsdb_snprintf.c
EXTRA_bantool_SOURCES = sqlite3.c EXTRA_bantool_SOURCES = sqlite3.c
bantool_LDADD = $(top_srcdir)/rb/librb.la @SQLITE_LD@ @SQLITE_OBJ@ bantool_LDADD = -lrb @SQLITE_LD@ @SQLITE_OBJ@ -lboost_system
bantool_DEPENDENCIES = @SQLITE_OBJ@ bantool_DEPENDENCIES = @SQLITE_OBJ@

View file

@ -29,7 +29,7 @@
*/ */
#include <rb/rb.h> #include <rb/rb.h>
#include "rsdb.h" #include "rsdb.h"
#include <ircd/ircd_defs.h> #include <ircd/defaults.h>
#define MAXPARA 10 #define MAXPARA 10

View file

@ -92,7 +92,7 @@ struct counter
struct flags struct flags
{ {
bool none; bool none;
bool export; bool export_;
bool import; bool import;
bool verify; bool verify;
bool vacuum; bool vacuum;
@ -148,7 +148,7 @@ main(int argc, char *argv[])
break; break;
case 'e': case 'e':
flag.none = false; flag.none = false;
flag.export = true; flag.export_ = true;
break; break;
case 'u': case 'u':
flag.none = false; flag.none = false;
@ -179,11 +179,11 @@ main(int argc, char *argv[])
if(flag.none) if(flag.none)
print_help(EXIT_FAILURE); print_help(EXIT_FAILURE);
if((flag.import && flag.export) || (flag.export && flag.wipe) if((flag.import && flag.export_) || (flag.export_ && flag.wipe)
|| (flag.verify && flag.pretend) || (flag.export && flag.pretend)) || (flag.verify && flag.pretend) || (flag.export_ && flag.pretend))
{ {
fprintf(stderr, "* Error: Conflicting flags.\n"); fprintf(stderr, "* Error: Conflicting flags.\n");
if(flag.export && flag.pretend) if(flag.export_ && flag.pretend)
fprintf(stderr, "* There is nothing to 'pretend' when exporting.\n"); fprintf(stderr, "* There is nothing to 'pretend' when exporting.\n");
fprintf(stderr, "* For an explination of commands, run: %s -h\n", me); fprintf(stderr, "* For an explination of commands, run: %s -h\n", me);
@ -239,7 +239,7 @@ main(int argc, char *argv[])
if(flag.import) if(flag.import)
import_config(conf, i); import_config(conf, i);
if(flag.export) if(flag.export_)
export_config(conf, i); export_config(conf, i);
if(flag.import && flag.pretend == false) if(flag.import && flag.pretend == false)

View file

@ -1,6 +1,10 @@
#ifndef INCLUDED_rsdb_h #ifndef INCLUDED_rsdb_h
#define INCLUDED_rsdb_h #define INCLUDED_rsdb_h
#ifdef __cplusplus
extern "C" {
#endif
/* error handler callback */ /* error handler callback */
typedef void rsdb_error_cb(const char *); typedef void rsdb_error_cb(const char *);
@ -37,5 +41,8 @@ void rsdb_transaction(rsdb_transtype type);
int rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args); int rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args);
int rs_snprintf(char *dest, const size_t bytes, const char *format, ...); int rs_snprintf(char *dest, const size_t bytes, const char *format, ...);
#ifdef __cplusplus
}
#endif
#endif #endif

1
boost Submodule

@ -0,0 +1 @@
Subproject commit ea0209516426e4b358204b8b50d093d001c00f54

View file

@ -1,5 +1,7 @@
prefix = @prefix@ prefix = @prefix@
AM_CPPFLAGS = @LTDLINCL@ -I$(top_srcdir)/include AM_CPPFLAGS = @LTDLINCL@
AM_CPPFLAGS += -I$(top_srcdir)/include
AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include
if MINGW if MINGW
EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*'
@ -7,6 +9,11 @@ endif
bin_PROGRAMS = charybdis bin_PROGRAMS = charybdis
charybdis_SOURCES = charybdis.cc charybdis_SOURCES = charybdis.cc
charybdis_LDFLAGS = $(EXTRA_FLAGS) -dlopen self
charybdis_LDADD = -L$(top_srcdir)/ircd -lircd charybdis_LDFLAGS = $(EXTRA_FLAGS)
charybdis_LDADD += -L$(top_srcdir)/rb -lrb charybdis_LDFLAGS += -dlopen self
charybdis_LDFLAGS += -L$(top_srcdir)/ircd
charybdis_LDFLAGS += -L$(top_srcdir)/rb
charybdis_LDFLAGS += -L$(top_srcdir)/boost/lib
charybdis_LDADD = -lircd -lrb -lboost_system

View file

@ -20,9 +20,10 @@
*/ */
#include <rb/rb.h> #include <rb/rb.h>
#include <ircd/ircd.h>
extern "C" int charybdis_main(int argc, char *argv[]); extern int charybdis_main(int argc, char *const argv[]);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {

View file

@ -3,7 +3,7 @@ dnl the most major changes have already been made and it looks like
dnl said functions need to be just about as complex as they already are. dnl said functions need to be just about as complex as they already are.
AC_PREREQ(2.63) AC_PREREQ(2.63)
AUTOMAKE_OPTIONS = 1.10 AUTOMAKE_OPTIONS = 1.14
AC_INIT([charybdis], [5-dev]) AC_INIT([charybdis], [5-dev])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
@ -38,20 +38,22 @@ AC_PATH_PROG(TOUCH, touch)
LT_CONFIG_LTDL_DIR([libltdl]) LT_CONFIG_LTDL_DIR([libltdl])
LT_INIT([dlopen disable-static]) LT_INIT([dlopen disable-static])
LT_LANG([C++])
LTDL_INIT LTDL_INIT
#LIBTOOL="$LIBTOOL --silent" #LIBTOOL="$LIBTOOL --silent"
AC_CONFIG_FILES(\ AC_CONFIG_FILES(\
Makefile \ Makefile \
include/rb/Makefile \
rb/Makefile \
authd/Makefile \ authd/Makefile \
bandb/Makefile \
charybdis/Makefile \ charybdis/Makefile \
ircd/Makefile \
bandb/Makefile \
doc/Makefile \ doc/Makefile \
extensions/Makefile \ extensions/Makefile \
help/Makefile \ help/Makefile \
ircd/Makefile \
modules/Makefile \ modules/Makefile \
rb/Makefile \
ssld/Makefile \ ssld/Makefile \
tools/Makefile \ tools/Makefile \
tools/genssl \ tools/genssl \
@ -59,7 +61,9 @@ AC_CONFIG_FILES(\
) )
AM_INIT_AUTOMAKE([subdir-objects]) AM_INIT_AUTOMAKE([subdir-objects])
AM_EXTRA_RECURSIVE_TARGETS([mrproper]) AM_EXTRA_RECURSIVE_TARGETS([
mrproper \
])
VERSION_CMD="git describe --tags" VERSION_CMD="git describe --tags"
DATESTR_CMD="date -R" DATESTR_CMD="date -R"
@ -69,9 +73,14 @@ RB_VERSION=`$VERSION_CMD`
RB_DATESTR=`$DATESTR_CMD` RB_DATESTR=`$DATESTR_CMD`
RB_DATECODE=`$DATECODE_CMD` RB_DATECODE=`$DATECODE_CMD`
AC_DEFINE_UNQUOTED([RB_VERSION], ["$RB_VERSION"], [Version generated at configuration time.]) AC_DEFUN([RB_DEFINE], [AC_DEFINE([RB_$1], [$2], [$3])])
AC_DEFINE_UNQUOTED([RB_DATESTR], ["$RB_DATESTR"], [Readable date string of configuration time.]) AC_DEFUN([RB_DEFINE_UNQUOTED], [AC_DEFINE_UNQUOTED([RB_$1], [$2], [$3])])
AC_DEFINE_UNQUOTED([RB_DATECODE], [$RB_DATECODE], [UNIX epoch time at configuration time.]) AC_DEFUN([IRCD_DEFINE], [AC_DEFINE([IRCD_$1], [$2], [$3])])
AC_DEFUN([IRCD_DEFINE_UNQUOTED], [AC_DEFINE_UNQUOTED([IRCD_$1], [$2], [$3])])
RB_DEFINE_UNQUOTED([VERSION], ["$RB_VERSION"], [Version generated at configuration time.])
RB_DEFINE_UNQUOTED([DATESTR], ["$RB_DATESTR"], [Readable date string of configuration time.])
RB_DEFINE_UNQUOTED([DATECODE], [$RB_DATECODE], [UNIX epoch time at configuration time.])
AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.]) AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.]) AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
@ -90,60 +99,6 @@ AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.]) AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.])
AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.]) AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.])
dnl Checks for header files.
AC_DEFUN([RB_CHK_SYSHEADER], \
[
AC_CHECK_HEADER([$1], \
[
AC_DEFINE([HAVE_$2], [1], [ Indication $1 is available. ])
AC_DEFINE_UNQUOTED([RB_INC_$2], [$1>], [ The computed-include location of $1. ])
],[
AC_DEFINE_UNQUOTED([RB_INC_$2], [/dev/null>], [ The computed-include location of $1. ])
])
])
RB_CHK_SYSHEADER([errno.h])
#RB_CHK_SYSHEADER([errno.h], [ERRNO_H])
RB_CHK_SYSHEADER([assert.h], [ASSERT_H])
RB_CHK_SYSHEADER([stddef.h], [STDDEF_H])
RB_CHK_SYSHEADER([stdarg.h], [STDARG_H])
RB_CHK_SYSHEADER([stdint.h], [STDINT_H])
RB_CHK_SYSHEADER([inttypes.h], [INTTYPES_H])
RB_CHK_SYSHEADER([ctype.h], [CTYPE_H])
RB_CHK_SYSHEADER([limits.h], [LIMITS_H])
RB_CHK_SYSHEADER([stdlib.h], [STDLIB_H])
RB_CHK_SYSHEADER([unistd.h], [UNISTD_H])
RB_CHK_SYSHEADER([time.h], [TIME_H])
RB_CHK_SYSHEADER([fcntl.h], [FCNTL_H])
RB_CHK_SYSHEADER([signal.h], [SIGNAL_H])
RB_CHK_SYSHEADER([sys/types.h], [SYS_TYPES_H])
RB_CHK_SYSHEADER([sys/time.h], [SYS_TIME_H])
RB_CHK_SYSHEADER([sys/stat.h], [SYS_STAT_H])
RB_CHK_SYSHEADER([sys/socket.h], [SYS_SOCKET_H])
RB_CHK_SYSHEADER([arpa/inet.h], [ARPA_INET_H])
RB_CHK_SYSHEADER([netinet/in.h], [NETINET_IN_H])
RB_CHK_SYSHEADER([netinet/tcp.h], [NETINET_TCP_H])
RB_CHK_SYSHEADER([string.h], [STRING_H])
RB_CHK_SYSHEADER([stdio.h], [STDIO_H])
RB_CHK_SYSHEADER([crypt.h], [CRYPT_H])
RB_CHK_SYSHEADER([sys/uio.h], [SYS_UIO_H])
RB_CHK_SYSHEADER([spawn.h], [SPAWN_H])
RB_CHK_SYSHEADER([sys/poll.h], [SYS_POLL_H])
RB_CHK_SYSHEADER([sys/epoll.h], [SYS_EPOLL_H])
RB_CHK_SYSHEADER([sys/select.h], [SYS_SELECT_H])
RB_CHK_SYSHEADER([sys/devpoll.h], [SYS_DEVPOLL_H])
RB_CHK_SYSHEADER([sys/event.h], [SYS_EVENT_H])
RB_CHK_SYSHEADER([port.h], [PORT_H])
RB_CHK_SYSHEADER([sys/signalfd.h], [SYS_SIGNALFD_H])
RB_CHK_SYSHEADER([sys/timerfd.h], [SYS_TIMERFD_H])
RB_CHK_SYSHEADER([execinfo.h], [EXECINFO_H])
RB_CHK_SYSHEADER([windows.h], [WINDOWS_H])
RB_CHK_SYSHEADER([winsock2.h], [WINSOCK2_H])
RB_CHK_SYSHEADER([ws2tcpip.h], [WS2TCPIP_H])
RB_CHK_SYSHEADER([iphlpapi.h], [IPHLPAPI_H])
CFLAGS="$IRC_CFLAGS $CFLAGS"
case "$host_os" in case "$host_os" in
*cygwin*) *cygwin*)
@ -161,10 +116,10 @@ case "$host_os" in
is_mingw="yes" is_mingw="yes"
;; ;;
*interix*) *interix*)
CPPFLAGS="$CFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=500" CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=500"
;; ;;
*solaris*) *solaris*)
CPPFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2" CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2"
;; ;;
*) *)
;; ;;
@ -173,6 +128,110 @@ esac
AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"])
dnl Checks for system header files.
AC_DEFUN([RB_CHK_SYSHEADER], \
[
AC_CHECK_HEADER([$1], \
[
AC_DEFINE([HAVE_$2], [1], [ Indication $1 is available. ])
RB_DEFINE_UNQUOTED([INC_$2], [$1>], [ The computed-include location of $1. ])
],[
if test "$is_mingw" = "yes"; then
RB_DEFINE_UNQUOTED([INC_$2], [stdint.h>], [ The dead-header in place of $1. ])
else
RB_DEFINE_UNQUOTED([INC_$2], [/dev/null>], [ The dead-header in place of $1. ])
fi
])
])
RB_CHK_SYSHEADER([errno.h], [ERRNO_H])
RB_CHK_SYSHEADER([assert.h], [ASSERT_H])
RB_CHK_SYSHEADER([stddef.h], [STDDEF_H])
RB_CHK_SYSHEADER([stdarg.h], [STDARG_H])
RB_CHK_SYSHEADER([stdint.h], [STDINT_H])
RB_CHK_SYSHEADER([inttypes.h], [INTTYPES_H])
RB_CHK_SYSHEADER([ctype.h], [CTYPE_H])
RB_CHK_SYSHEADER([limits.h], [LIMITS_H])
RB_CHK_SYSHEADER([stdlib.h], [STDLIB_H])
RB_CHK_SYSHEADER([unistd.h], [UNISTD_H])
RB_CHK_SYSHEADER([time.h], [TIME_H])
RB_CHK_SYSHEADER([fcntl.h], [FCNTL_H])
RB_CHK_SYSHEADER([signal.h], [SIGNAL_H])
RB_CHK_SYSHEADER([dirent.h], [DIRENT_H])
RB_CHK_SYSHEADER([sys/types.h], [SYS_TYPES_H])
RB_CHK_SYSHEADER([sys/time.h], [SYS_TIME_H])
RB_CHK_SYSHEADER([sys/stat.h], [SYS_STAT_H])
RB_CHK_SYSHEADER([sys/file.h], [SYS_FILE_H])
RB_CHK_SYSHEADER([sys/param.h], [SYS_PARAM_H])
RB_CHK_SYSHEADER([sys/resource.h], [SYS_RESOURCE_H])
RB_CHK_SYSHEADER([sys/socket.h], [SYS_SOCKET_H])
RB_CHK_SYSHEADER([arpa/inet.h], [ARPA_INET_H])
RB_CHK_SYSHEADER([netinet/in.h], [NETINET_IN_H])
RB_CHK_SYSHEADER([netinet/tcp.h], [NETINET_TCP_H])
RB_CHK_SYSHEADER([string.h], [STRING_H])
RB_CHK_SYSHEADER([strings.h], [STRINGS_H])
RB_CHK_SYSHEADER([stdio.h], [STDIO_H])
RB_CHK_SYSHEADER([crypt.h], [CRYPT_H])
RB_CHK_SYSHEADER([sys/uio.h], [SYS_UIO_H])
RB_CHK_SYSHEADER([spawn.h], [SPAWN_H])
RB_CHK_SYSHEADER([sys/poll.h], [SYS_POLL_H])
RB_CHK_SYSHEADER([sys/epoll.h], [SYS_EPOLL_H])
RB_CHK_SYSHEADER([sys/select.h], [SYS_SELECT_H])
RB_CHK_SYSHEADER([sys/devpoll.h], [SYS_DEVPOLL_H])
RB_CHK_SYSHEADER([sys/event.h], [SYS_EVENT_H])
RB_CHK_SYSHEADER([port.h], [PORT_H])
RB_CHK_SYSHEADER([sys/signalfd.h], [SYS_SIGNALFD_H])
RB_CHK_SYSHEADER([sys/timerfd.h], [SYS_TIMERFD_H])
RB_CHK_SYSHEADER([execinfo.h], [EXECINFO_H])
RB_CHK_SYSHEADER([cstddef], [CSTDDEF])
RB_CHK_SYSHEADER([cstdint], [CSTDINT])
RB_CHK_SYSHEADER([limits], [LIMITS])
RB_CHK_SYSHEADER([type_traits], [TYPE_TRAITS])
RB_CHK_SYSHEADER([utility], [UTILITY])
RB_CHK_SYSHEADER([functional], [FUNCTIONAL])
RB_CHK_SYSHEADER([algorithm], [ALGORITHM])
RB_CHK_SYSHEADER([memory], [MEMORY])
RB_CHK_SYSHEADER([exception], [EXCEPTION])
RB_CHK_SYSHEADER([cerrno], [CERRNO])
RB_CHK_SYSHEADER([system_error], [SYSTEM_ERROR])
RB_CHK_SYSHEADER([map], [MAP])
RB_CHK_SYSHEADER([set], [SET])
RB_CHK_SYSHEADER([list], [LIST])
RB_CHK_SYSHEADER([deque], [DEQUE])
RB_CHK_SYSHEADER([array], [ARRAY])
RB_CHK_SYSHEADER([vector], [VECTOR])
RB_CHK_SYSHEADER([forward_list], [FORWARD_LIST])
RB_CHK_SYSHEADER([unordered_map], [UNORDERED_MAP])
RB_CHK_SYSHEADER([string], [STRING])
RB_CHK_SYSHEADER([sstream], [SSTREAM])
RB_CHK_SYSHEADER([fstream], [FSTREAM])
RB_CHK_SYSHEADER([iostream], [IOSTREAM])
RB_CHK_SYSHEADER([cstdio], [CSTDIO])
RB_CHK_SYSHEADER([windows.h], [WINDOWS_H])
RB_CHK_SYSHEADER([winsock2.h], [WINSOCK2_H])
RB_CHK_SYSHEADER([ws2tcpip.h], [WS2TCPIP_H])
RB_CHK_SYSHEADER([iphlpapi.h], [IPHLPAPI_H])
dnl todo
AC_DEFINE([HAVE_BOOST_ASIO_HPP], [1], [ boost asio. ])
RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_HPP], [boost/asio.hpp>], [ boost asio. ])
AC_DEFINE([HAVE_BOOST_CONTEXT_ALL_HPP], [1], [ boost context. ])
RB_DEFINE_UNQUOTED([INC_BOOST_CONTEXT_ALL_HPP], [boost/context/all.hpp>], [ boost context. ])
AC_DEFINE([HAVE_BOOST_ASIO_SPAWN_HPP], [1], [ boost asio spawn. ])
RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_SPAWN_HPP], [boost/asio/spawn.hpp>], [ boost asio spawn. ])
AC_DEFINE([HAVE_BOOST_LEXICAL_CAST_HPP], [1], [ boost asio. ])
RB_DEFINE_UNQUOTED([INC_BOOST_LEXICAL_CAST_HPP], [boost/lexical_cast.hpp>], [ boost lexical_cast. ])
AC_DEFINE([HAVE_BOOST_TOKENIZER_HPP], [1], [ boost tokenizer. ])
RB_DEFINE_UNQUOTED([INC_BOOST_TOKENIZER_HPP], [boost/tokenizer.hpp>], [ boost tokenizer. ])
dnl use directory structure of cached as default (hack) dnl use directory structure of cached as default (hack)
if test "$libexecdir" = '${exec_prefix}/libexec' && if test "$libexecdir" = '${exec_prefix}/libexec' &&
test "$localstatedir" = '${prefix}/var'; then test "$localstatedir" = '${prefix}/var'; then
@ -577,7 +636,7 @@ AC_HELP_STRING([--enable-profile],[Enable profiling]),
if test "$profile" = yes; then if test "$profile" = yes; then
if test "$ac_cv_c_compiler_gnu" = yes; then if test "$ac_cv_c_compiler_gnu" = yes; then
CFLAGS="$CFLAGS -pg -static" CPPFLAGS="$CPPFLAGS -pg -static"
AC_MSG_RESULT([yes, adding -pg -static]) AC_MSG_RESULT([yes, adding -pg -static])
AC_DEFINE(RB_PROFILE, 1, [Defined to mark profiling is enabled]) AC_DEFINE(RB_PROFILE, 1, [Defined to mark profiling is enabled])
else else
@ -589,11 +648,10 @@ fi
AC_ARG_ENABLE(warnings, AC_ARG_ENABLE(warnings,
AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
[CFLAGS="$CFLAGS -Wall -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -W -Wno-unused -Wunused-function -Wunused-variable"],[]) [CPPFLAGS="$CPPFLAGS -Wall -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wwrite-strings -W -Wno-unused -Wunused-function -Wunused-variable"],[])
AC_SUBST(LDFLAGS) AC_SUBST(LDFLAGS)
AC_SUBST(PICFLAGS) AC_SUBST(PICFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(SEDOBJ) AC_SUBST(SEDOBJ)
AC_SUBST(SSL_CFLAGS) AC_SUBST(SSL_CFLAGS)
AC_SUBST(SSL_LIBS) AC_SUBST(SSL_LIBS)
@ -604,7 +662,6 @@ AC_SUBST(MBEDTLS_LIBS)
if test "$prefix" = "NONE"; then if test "$prefix" = "NONE"; then
AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where librb is installed.]) AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where librb is installed.])
else else
dnl Don't get bitten by Cygwin's stupidity if the user specified dnl Don't get bitten by Cygwin's stupidity if the user specified
@ -640,15 +697,6 @@ esac
AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"])
if test "$ac_cv_c_compiler_gnu" = yes; then
IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall"
fi
dnl If we support -g, use it!
if test "$ac_cv_prog_cc_g" = yes; then
IRC_CFLAGS="$IRC_CFLAGS -g"
fi
dnl check for /dev/null so we can use it to hold evil fd's dnl check for /dev/null so we can use it to hold evil fd's
AC_MSG_CHECKING([for /dev/null]) AC_MSG_CHECKING([for /dev/null])
if test -c /dev/null ; then if test -c /dev/null ; then
@ -659,13 +707,6 @@ else
AC_MSG_RESULT(no - using devnull.log) AC_MSG_RESULT(no - using devnull.log)
fi fi
dnl jdc -- If CFLAGS is defined, best use it everywhere...
dnl NOTE: jv says it must be added to the *END*, because things like
dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
if test ! -z "$CFLAGS"; then
IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
fi
AC_PROG_YACC AC_PROG_YACC
dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
@ -949,8 +990,26 @@ AC_ARG_WITH([confdir],
[AC_HELP_STRING([--with-confdir=DIR], [AC_HELP_STRING([--with-confdir=DIR],
[Directory to install config files [deprecated, use --sysconfdir instead].])], [Directory to install config files [deprecated, use --sysconfdir instead].])],
[ sysconfdir=`echo $withval | sed 's/\/$//'` ], [ sysconfdir=`echo $withval | sed 's/\/$//'` ],
[ confdir='${sysconfdir}' ]) [ confdir='etc' ])
AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.]) RB_DEFINE_UNQUOTED([ETC_DIR], ["${prefix}/${confdir}"], [Prefix where config files are installed.])
dnl **********************************************************************
dnl Check for --with-bindir
dnl **********************************************************************
AC_MSG_CHECKING([whether to modify binary directory])
AC_ARG_WITH(bindir,
AC_HELP_STRING([--with-bindir=DIR],
[Directory where binary executables are placed.]),
[ logdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes)],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[bindir="${prefix}/bin"],
[bindir="${prefix}/bin"])
AC_MSG_RESULT(no)])
RB_DEFINE_UNQUOTED([BIN_DIR], ["${bindir}"], [Directory where binary executables are to be found.])
AC_SUBST_DIR([bindir])
dnl ********************************************************************** dnl **********************************************************************
dnl Check for --with-logdir dnl Check for --with-logdir
@ -963,10 +1022,10 @@ AC_HELP_STRING([--with-logdir=DIR],
[ logdir=`echo $withval | sed 's/\/$//'` [ logdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes)], AC_MSG_RESULT(yes)],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"], [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[logdir='${localstatedir}/log/${PACKAGE_TARNAME}'], [logdir="${prefix}/var/log"],
[logdir='${prefix}/logs']) [logdir="${prefix}/var/${PACKAGE_TARNAME}/log"])
AC_MSG_RESULT(no)]) AC_MSG_RESULT(no)])
AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.]) RB_DEFINE_UNQUOTED([LOG_DIR], ["${logdir}"], [Prefix where to write logfiles.])
AC_SUBST_DIR([logdir]) AC_SUBST_DIR([logdir])
dnl ********************************************************************** dnl **********************************************************************
@ -980,10 +1039,10 @@ AC_HELP_STRING([--with-helpdir=DIR],
[ helpdir=`echo $withval | sed 's/\/$//'` [ helpdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes) ], AC_MSG_RESULT(yes) ],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"], [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[helpdir='${datadir}/${PACKAGE_TARNAME}/help'], [helpdir="${prefix}/share/help"],
[helpdir='${prefix}/help']) [helpdir="${prefix}/share/${PACKAGE_TARNAME}/help"])
AC_MSG_RESULT(no) ]) AC_MSG_RESULT(no) ])
AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.]) RB_DEFINE_UNQUOTED([HELP_DIR], ["${helpdir}"], [Prefix where help files are installed.])
AC_SUBST_DIR([helpdir]) AC_SUBST_DIR([helpdir])
dnl ********************************************************************** dnl **********************************************************************
@ -997,11 +1056,11 @@ AC_ARG_WITH(moduledir,
[ moduledir=`echo $withval | sed 's/\/$//'` [ moduledir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes)], AC_MSG_RESULT(yes)],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"], [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[moduledir='${pkglibdir}/modules'], [moduledir="${prefix}/lib/modules"],
[moduledir='${prefix}/modules']) [moduledir="${prefix}/lib/${PACKAGE_TARNAME}/modules"])
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
]) ])
AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.]) RB_DEFINE_UNQUOTED([MODULE_DIR], ["${moduledir}"], [Prefix where modules are installed.])
AC_SUBST_DIR([moduledir]) AC_SUBST_DIR([moduledir])
dnl Check for --with-rundir dnl Check for --with-rundir
@ -1014,10 +1073,10 @@ AC_ARG_WITH([rundir],
rundir=`echo $withval | sed 's/\/$//'`], rundir=`echo $withval | sed 's/\/$//'`],
[AC_MSG_RESULT([no]) [AC_MSG_RESULT([no])
AS_IF([test "x$enable_fhs_paths" = "xyes"], AS_IF([test "x$enable_fhs_paths" = "xyes"],
[rundir='${prefix}/run'], [rundir="${prefix}/var/run"],
[rundir='${sysconfdir}'])]) [rundir="${prefix}/${PACKAGE_TARNAME}/run"])])
AC_SUBST([rundir]) AC_SUBST([rundir])
AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.]) AC_DEFINE_DIR([PKGRUNDIR], ["${rundir}"], [Directory to store pidfile in.])
dnl Installed utility program prefixes (does not affect binaries dnl Installed utility program prefixes (does not affect binaries
dnl installed into pkglibexecdir) dnl installed into pkglibexecdir)
@ -1097,7 +1156,7 @@ AC_HELP_STRING([--enable-profile],[Enable profiling]),
if test "$profile" = yes; then if test "$profile" = yes; then
if test "$ac_cv_c_compiler_gnu" = yes; then if test "$ac_cv_c_compiler_gnu" = yes; then
IRC_CFLAGS="$IRC_CFLAGS -pg" CPPFLAGS="$CPPFLAGS -pg"
AC_MSG_RESULT([yes, adding -pg]) AC_MSG_RESULT([yes, adding -pg])
AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.]) AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
else else
@ -1140,14 +1199,14 @@ AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
# rpath, for finding librb.so at run time # rpath, for finding librb.so at run time
hold_ldflags=$LDFLAGS hold_ldflags=$LDFLAGS
AC_MSG_CHECKING(for the ld -rpath flag) #AC_MSG_CHECKING(for the ld -rpath flag)
LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}" #LDFLAGS="${LDFLAGS} -Wl,-rpath=${prefix}/${libdir}"
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[int i;])], found=yes, found=no) #AC_LINK_IFELSE([AC_LANG_PROGRAM([],[int i;])], found=yes, found=no)
LDFLAGS=$hold_ldflags #LDFLAGS=$hold_ldflags
AC_MSG_RESULT($found) #AC_MSG_RESULT($found)
if test "$found" = yes; then #if test "$found" = yes; then
LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}" # LDFLAGS="${LDFLAGS} -Wl,-rpath=${prefix}/${libdir}"
fi #fi
# This must be down here, or it will mess up checks like the ones # This must be down here, or it will mess up checks like the ones
# for -Wl,-export-dynamic # for -Wl,-export-dynamic
@ -1156,9 +1215,6 @@ CWARNS=""
AC_ARG_ENABLE(warnings, AC_ARG_ENABLE(warnings,
AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
[ [
IRC_CFLAGS="$IRC_CFLAGS -O0"
CFLAGS="$IRC_CFLAGS"
CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all) CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith) CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit) CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
@ -1178,12 +1234,11 @@ CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_extern
CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused) CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls) CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal) CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
CHARYBDIS_C_GCC_TRY_FLAGS([-Winvalid-pch], charybdis_cv_c_gcc_w_invalid_pch)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format) CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format)
IRC_CFLAGS="$CFLAGS"
],[]) ],[])
IRC_CFLAGS="$IRC_CFLAGS $CWARNS" CPPFLAGS="$CPPFLAGS $CWARNS"
AC_SUBST(MODULES_LIBS) AC_SUBST(MODULES_LIBS)
AC_SUBST(MOD_TARGET) AC_SUBST(MOD_TARGET)
@ -1192,9 +1247,10 @@ AC_SUBST(SSL_SRCS_ENABLE)
AC_SUBST(SSL_INCLUDES) AC_SUBST(SSL_INCLUDES)
AC_SUBST(SSL_LIBS) AC_SUBST(SSL_LIBS)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS) AC_SUBST(LDFLAGS)
AC_SUBST(PICFLAGS) AC_SUBST(PICFLAGS)
AC_SUBST(IRC_CFLAGS)
AC_SUBST(SEDOBJ) AC_SUBST(SEDOBJ)

View file

@ -1,10 +1,83 @@
AM_CPPFLAGS = -I$(top_srcdir)/include $(LTDLINCL) AM_CPPFLAGS = -I$(top_srcdir)/include $(LTDLINCL)
AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include
AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared
AM_LDFLAGS += -export-symbols-regex _mheader AM_LDFLAGS += -export-symbols-regex _mheader
LIBS += $(top_srcdir)/rb/librb.la $(top_srcdir)/ircd/libircd.la AM_LDFLAGS += -L$(top_srcdir)/boost/lib -lboost_system
AM_LDFLAGS += -L$(top_srcdir)/ircd -lircd
AM_LDFLAGS += -L$(top_srcdir)/rb -lrb
extensiondir=@moduledir@/extensions extensiondir=@moduledir@/extensions
chm_adminonly_la_SOURCES = chm_adminonly.cc
chm_operonly_la_SOURCES = chm_operonly.cc
chm_operonly_compat_la_SOURCES = chm_operonly_compat.cc
chm_insecure_la_SOURCES = chm_insecure.cc
chm_nonotice_la_SOURCES = chm_nonotice.cc
chm_operpeace_la_SOURCES = chm_operpeace.cc
chm_quietunreg_compat_la_SOURCES = chm_quietunreg_compat.cc
chm_spamfilter_la_SOURCES = chm_spamfilter.cc
chm_sslonly_la_SOURCES = chm_sslonly.cc
chm_sslonly_compat_la_SOURCES = chm_sslonly_compat.cc
createauthonly_la_SOURCES = createauthonly.cc
createoperonly_la_SOURCES = createoperonly.cc
extb_account_la_SOURCES = extb_account.cc
extb_canjoin_la_SOURCES = extb_canjoin.cc
extb_channel_la_SOURCES = extb_channel.cc
extb_hostmask_la_SOURCES = extb_hostmask.cc
extb_oper_la_SOURCES = extb_oper.cc
extb_server_la_SOURCES = extb_server.cc
extb_ssl_la_SOURCES = extb_ssl.cc
extb_realname_la_SOURCES = extb_realname.cc
extb_usermode_la_SOURCES = extb_usermode.cc
extb_extgecos_la_SOURCES = extb_extgecos.cc
extb_combi_la_SOURCES = extb_combi.cc
force_user_invis_la_SOURCES = force_user_invis.cc
helpops_la_SOURCES = helpops.cc
hurt_la_SOURCES = hurt.cc
ip_cloaking_la_SOURCES = ip_cloaking.cc
ip_cloaking_old_la_SOURCES = ip_cloaking_old.cc
ip_cloaking_3_0_la_SOURCES = ip_cloaking_3.0.cc
ip_cloaking_4_0_la_SOURCES = ip_cloaking_4.0.cc
override_la_SOURCES = override.cc
restrict_unauthenticated_la_SOURCES = restrict-unauthenticated.cc
sno_channelcreate_la_SOURCES = sno_channelcreate.cc
sno_farconnect_la_SOURCES = sno_farconnect.cc
sno_globalkline_la_SOURCES = sno_globalkline.cc
sno_globalnickchange_la_SOURCES = sno_globalnickchange.cc
sno_globaloper_la_SOURCES = sno_globaloper.cc
sno_whois_la_SOURCES = sno_whois.cc
umode_noctcp_la_SOURCES = umode_noctcp.cc
m_adminwall_la_SOURCES = m_adminwall.cc
m_echotags_la_SOURCES = m_echotags.cc
m_extendchans_la_SOURCES = m_extendchans.cc
m_findforwards_la_SOURCES = m_findforwards.cc
m_identify_la_SOURCES = m_identify.cc
m_locops_la_SOURCES = m_locops.cc
m_mkpasswd_la_SOURCES = m_mkpasswd.cc
m_ojoin_la_SOURCES = m_ojoin.cc
m_okick_la_SOURCES = m_okick.cc
m_omode_la_SOURCES = m_omode.cc
m_opme_la_SOURCES = m_opme.cc
m_sendbans_la_SOURCES = m_sendbans.cc
m_webirc_la_SOURCES = m_webirc.cc
m_remove_la_SOURCES = m_remove.cc
m_roleplay_la_SOURCES = m_roleplay.cc
hide_uncommon_channels_la_SOURCES = hide_uncommon_channels.cc
no_kill_services_la_SOURCES = no_kill_services.cc
no_locops_la_SOURCES = no_locops.cc
no_oper_invis_la_SOURCES = no_oper_invis.cc
spamfilter_nicks_la_SOURCES = spamfilter_nicks.cc
spy_admin_notice_la_SOURCES = spy_admin_notice.cc
spy_info_notice_la_SOURCES = spy_info_notice.cc
spy_links_notice_la_SOURCES = spy_links_notice.cc
spy_motd_notice_la_SOURCES = spy_motd_notice.cc
spy_stats_notice_la_SOURCES = spy_stats_notice.cc
spy_stats_p_notice_la_SOURCES = spy_stats_p_notice.cc
spy_trace_notice_la_SOURCES = spy_trace_notice.cc
example_module_la_SOURCES = example_module.cc
extension_LTLIBRARIES = \ extension_LTLIBRARIES = \
chm_adminonly.la \ chm_adminonly.la \
chm_operonly.la \ chm_operonly.la \
@ -77,6 +150,7 @@ extension_LTLIBRARIES = \
if PCRE if PCRE
extension_LTLIBRARIES += spamfilter_expr.la extension_LTLIBRARIES += spamfilter_expr.la
spamfilter_expr_la_SOURCES = spamfilter_expr.cc
spamfilter_expr_la_CPPFLAGS = $(AM_CPPFLAGS) $(PCRE_CFLAGS) spamfilter_expr_la_CPPFLAGS = $(AM_CPPFLAGS) $(PCRE_CFLAGS)
spamfilter_expr_la_LIBADD = $(PCRE_LIBS) spamfilter_expr_la_LIBADD = $(PCRE_LIBS)

View file

@ -25,7 +25,7 @@ _modinit(void)
{ {
chmode_table['O'].set_func = chm_operonly; chmode_table['O'].set_func = chm_operonly;
chmode_table['O'].mode_type = 0; chmode_table['O'].mode_type = 0;
chmode_table['O'].mode_class = CHM_D; chmode_table['O'].mode_class = ChmClass{CHM_D};
return 0; return 0;
} }
@ -35,7 +35,7 @@ _moddeinit(void)
{ {
chmode_table['O'].set_func = chm_nosuch; chmode_table['O'].set_func = chm_nosuch;
chmode_table['O'].mode_type = 0; chmode_table['O'].mode_type = 0;
chmode_table['O'].mode_class = 0; chmode_table['O'].mode_class = ChmClass(0);
} }
static void static void

View file

@ -36,7 +36,7 @@ _moddeinit(void)
{ {
chmode_table['R'].set_func = chm_nosuch; chmode_table['R'].set_func = chm_nosuch;
chmode_table['R'].mode_type = 0; chmode_table['R'].mode_type = 0;
chmode_table['R'].mode_class = 0; chmode_table['R'].mode_class = ChmClass(0);
} }
static void static void

View file

@ -100,7 +100,7 @@ void substitute_reject_reason(void)
static static
void set_reject_reason(void *const str) void set_reject_reason(void *const str)
{ {
rb_strlcpy(reject_reason, str, sizeof(reject_reason)); rb_strlcpy(reject_reason, (const char *)str, sizeof(reject_reason));
substitute_reject_reason(); substitute_reject_reason();
} }

View file

@ -25,7 +25,7 @@ _modinit(void)
{ {
chmode_table['S'].set_func = chm_sslonly; chmode_table['S'].set_func = chm_sslonly;
chmode_table['S'].mode_type = 0; chmode_table['S'].mode_type = 0;
chmode_table['S'].mode_class = CHM_D; chmode_table['S'].mode_class = ChmClass{CHM_D};
return 0; return 0;
} }
@ -35,7 +35,7 @@ _moddeinit(void)
{ {
chmode_table['S'].set_func = chm_nosuch; chmode_table['S'].set_func = chm_nosuch;
chmode_table['S'].mode_type = 0; chmode_table['S'].mode_type = 0;
chmode_table['S'].mode_class = 0; chmode_table['S'].mode_class = ChmClass(0);
} }
static void static void

View file

@ -132,7 +132,7 @@ h_hdl_stats_request(hook_data_int *hdata)
RB_DLINK_FOREACH (helper_ptr, helper_list.head) RB_DLINK_FOREACH (helper_ptr, helper_list.head)
{ {
target_p = helper_ptr->data; target_p = (Client *)helper_ptr->data;
if(target_p->user->away) if(target_p->user->away)
continue; continue;

View file

@ -123,11 +123,8 @@ DECLARE_MODULE_AV2(
); );
/* }}} */ /* }}} */
hurt_state_t hurt_state = {
.cutoff = HURT_CUTOFF, hurt_state_t hurt_state;
.default_expire = HURT_DEFAULT_EXPIRE,
.exit_reason = HURT_EXIT_REASON,
};
/* /*
* Module constructor/destructor. * Module constructor/destructor.
@ -143,6 +140,9 @@ modinit(void)
{ {
/* set-up hurt_state. */ /* set-up hurt_state. */
hurt_state.start_time = rb_current_time(); hurt_state.start_time = rb_current_time();
hurt_state.cutoff = HURT_CUTOFF;
hurt_state.default_expire = HURT_DEFAULT_EXPIRE;
hurt_state.exit_reason = HURT_EXIT_REASON;
/* add our event handlers. */ /* add our event handlers. */
hurt_expire_ev = rb_event_add("hurt_expire", hurt_expire_event, NULL, 60); hurt_expire_ev = rb_event_add("hurt_expire", hurt_expire_event, NULL, 60);
@ -390,7 +390,7 @@ hurt_check_event(void *arg)
struct Client *client_p; struct Client *client_p;
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) { RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) {
client_p = ptr->data; client_p = (Client *)ptr->data;
if (!EmptyString(client_p->user->suser)) if (!EmptyString(client_p->user->suser))
{ {
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients); rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
@ -534,7 +534,7 @@ hurt_new(time_t expire, const char *ip, const char *reason)
{ {
hurt_t *hurt; hurt_t *hurt;
hurt = rb_malloc(sizeof(hurt_t)); hurt = (hurt_t *)rb_malloc(sizeof(hurt_t));
hurt->ip = rb_strdup(ip); hurt->ip = rb_strdup(ip);
hurt->reason = rb_strdup(reason); hurt->reason = rb_strdup(reason);

View file

@ -203,14 +203,14 @@ check_umode_change(void *vdata)
static void static void
check_new_user(void *vdata) check_new_user(void *vdata)
{ {
struct Client *source_p = (void *)vdata; struct Client *source_p = (Client *)vdata;
if (IsIPSpoof(source_p)) if (IsIPSpoof(source_p))
{ {
source_p->umodes &= ~user_modes['h']; source_p->umodes &= ~user_modes['h'];
return; return;
} }
source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1); source_p->localClient->mangledhost = (char *)rb_malloc(HOSTLEN + 1);
if (!irccmp(source_p->orighost, source_p->sockhost)) if (!irccmp(source_p->orighost, source_p->sockhost))
do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost); do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost);
else else

View file

@ -209,14 +209,14 @@ check_umode_change(void *vdata)
static void static void
check_new_user(void *vdata) check_new_user(void *vdata)
{ {
struct Client *source_p = (void *)vdata; struct Client *source_p = (Client *)vdata;
if (IsIPSpoof(source_p)) if (IsIPSpoof(source_p))
{ {
source_p->umodes &= ~user_modes['h']; source_p->umodes &= ~user_modes['h'];
return; return;
} }
source_p->localClient->mangledhost = rb_malloc(HOSTLEN); source_p->localClient->mangledhost = (char *)rb_malloc(HOSTLEN);
if (!irccmp(source_p->orighost, source_p->sockhost)) if (!irccmp(source_p->orighost, source_p->sockhost))
do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost); do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost);
else else

View file

@ -203,14 +203,14 @@ check_umode_change(void *vdata)
static void static void
check_new_user(void *vdata) check_new_user(void *vdata)
{ {
struct Client *source_p = (void *)vdata; struct Client *source_p = (Client *)vdata;
if (IsIPSpoof(source_p)) if (IsIPSpoof(source_p))
{ {
source_p->umodes &= ~user_modes['x']; source_p->umodes &= ~user_modes['x'];
return; return;
} }
source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1); source_p->localClient->mangledhost = (char *)rb_malloc(HOSTLEN + 1);
if (!irccmp(source_p->orighost, source_p->sockhost)) if (!irccmp(source_p->orighost, source_p->sockhost))
do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost); do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost);
else else

View file

@ -151,14 +151,14 @@ check_umode_change(void *vdata)
static void static void
check_new_user(void *vdata) check_new_user(void *vdata)
{ {
struct Client *source_p = (void *)vdata; struct Client *source_p = (Client *)vdata;
if (IsIPSpoof(source_p)) if (IsIPSpoof(source_p))
{ {
source_p->umodes &= ~user_modes['h']; source_p->umodes &= ~user_modes['h'];
return; return;
} }
source_p->localClient->mangledhost = rb_malloc(HOSTLEN); source_p->localClient->mangledhost = (char *)rb_malloc(HOSTLEN);
if (!irccmp(source_p->orighost, source_p->sockhost)) if (!irccmp(source_p->orighost, source_p->sockhost))
do_host_cloak(source_p->orighost, source_p->localClient->mangledhost, 1); do_host_cloak(source_p->orighost, source_p->localClient->mangledhost, 1);
else else

View file

@ -92,7 +92,7 @@ m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
RB_DLINK_FOREACH(ptr, global_channel_list.head) RB_DLINK_FOREACH(ptr, global_channel_list.head)
{ {
chptr = ptr->data; chptr = (Channel *)ptr->data;
if(!irccmp(chptr->mode.forward, parv[1])) if(!irccmp(chptr->mode.forward, parv[1]))
{ {
if(p + strlen(chptr->chname) >= end - 13) if(p + strlen(chptr->chname) >= end - 13)

View file

@ -206,7 +206,7 @@ generate_random_salt(char *salt, int length)
{ {
return (generate_poor_salt(salt, length)); return (generate_poor_salt(salt, length));
} }
buf = calloc(1, length); buf = (char *)calloc(1, length);
if(read(fd, buf, length) != length) if(read(fd, buf, length) != length)
{ {
free(buf); free(buf);

View file

@ -85,7 +85,7 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
comment[TOPICLEN] = '\0'; comment[TOPICLEN] = '\0';
*buf = '\0'; *buf = '\0';
if((p = strchr(parv[1], ','))) if((p = (char *)strchr(parv[1], ',')))
*p = '\0'; *p = '\0';
name = LOCAL_COPY(parv[1]); name = LOCAL_COPY(parv[1]);
@ -98,7 +98,7 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
} }
if((p = strchr(parv[2], ','))) if((p = (char *)strchr(parv[2], ',')))
*p = '\0'; *p = '\0';
user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ","); user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ",");
if(!(who = find_chasing(source_p, user, &chasing))) if(!(who = find_chasing(source_p, user, &chasing)))

View file

@ -74,7 +74,7 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
RB_DLINK_FOREACH(ptr, chptr->members.head) RB_DLINK_FOREACH(ptr, chptr->members.head)
{ {
msptr = ptr->data; msptr = (membership *)ptr->data;
if(is_chanop(msptr)) if(is_chanop(msptr))
{ {

View file

@ -81,7 +81,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
flood_endgrace(source_p); flood_endgrace(source_p);
*buf = '\0'; *buf = '\0';
if((p = strchr(parv[1], ','))) if((p = (char *)strchr(parv[1], ',')))
*p = '\0'; *p = '\0';
name = parv[1]; name = parv[1];
@ -144,7 +144,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
*/ */
} }
if((p = strchr(parv[2], ','))) if((p = (char *)strchr(parv[2], ',')))
*p = '\0'; *p = '\0';
user = parv[2]; /* strtoken(&p2, parv[2], ","); */ user = parv[2]; /* strtoken(&p2, parv[2], ","); */

View file

@ -117,7 +117,7 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
count = 0; count = 0;
RB_DLINK_FOREACH(ptr, global_serv_list.head) RB_DLINK_FOREACH(ptr, global_serv_list.head)
{ {
server_p = ptr->data; server_p = (Client *)ptr->data;
if (IsMe(server_p)) if (IsMe(server_p))
continue; continue;
if (match(target, server_p->name)) if (match(target, server_p->name))
@ -137,7 +137,7 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
RB_DLINK_FOREACH(ptr, resv_conf_list.head) RB_DLINK_FOREACH(ptr, resv_conf_list.head)
{ {
aconf = ptr->data; aconf = (ConfItem *)ptr->data;
if (aconf->hold) if (aconf->hold)
continue; continue;
sendto_match_servs(source_p, target, sendto_match_servs(source_p, target,
@ -146,8 +146,10 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
target, aconf->host, aconf->passwd); target, aconf->host, aconf->passwd);
} }
RB_RADIXTREE_FOREACH(aconf, &state, resv_tree) void *elem;
RB_RADIXTREE_FOREACH(elem, &state, resv_tree)
{ {
aconf = (ConfItem *)elem;
if (aconf->hold) if (aconf->hold)
continue; continue;
sendto_match_servs(source_p, target, sendto_match_servs(source_p, target,
@ -158,7 +160,7 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
RB_DLINK_FOREACH(ptr, xline_conf_list.head) RB_DLINK_FOREACH(ptr, xline_conf_list.head)
{ {
aconf = ptr->data; aconf = (ConfItem *)ptr->data;
if (aconf->hold) if (aconf->hold)
continue; continue;
mask2 = expand_xline(aconf->host); mask2 = expand_xline(aconf->host);

View file

@ -63,7 +63,7 @@ update_session_deadline(struct Client *source_p, struct OverrideSession *session
RB_DLINK_FOREACH(n, overriding_opers.head) RB_DLINK_FOREACH(n, overriding_opers.head)
{ {
struct OverrideSession *s = n->data; struct OverrideSession *s = (OverrideSession *)n->data;
if (s->client == source_p) if (s->client == source_p)
{ {
@ -75,7 +75,7 @@ update_session_deadline(struct Client *source_p, struct OverrideSession *session
if (session_p == NULL) if (session_p == NULL)
{ {
session_p = rb_malloc(sizeof(struct OverrideSession)); session_p = (OverrideSession *)rb_malloc(sizeof(struct OverrideSession));
session_p->client = source_p; session_p->client = source_p;
} }
@ -92,7 +92,7 @@ expire_override_deadlines(void *unused)
RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head) RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head)
{ {
struct OverrideSession *session_p = n->data; struct OverrideSession *session_p = (OverrideSession *)n->data;
if (session_p->deadline > rb_current_time()) if (session_p->deadline > rb_current_time())
break; break;
@ -140,7 +140,7 @@ check_umode_change(void *vdata)
RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head) RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head)
{ {
struct OverrideSession *session_p = n->data; struct OverrideSession *session_p = (OverrideSession *)n->data;
if (session_p->client != source_p) if (session_p->client != source_p)
continue; continue;
@ -246,7 +246,7 @@ handle_client_exit(void *vdata)
RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head) RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head)
{ {
struct OverrideSession *session_p = n->data; struct OverrideSession *session_p = (OverrideSession *)n->data;
if (session_p->client != source_p) if (session_p->client != source_p)
continue; continue;

View file

@ -37,8 +37,8 @@ static void
h_gnc_nick_change(hook_data *data) h_gnc_nick_change(hook_data *data)
{ {
struct Client *source_p = data->client; struct Client *source_p = data->client;
const char *oldnick = data->arg1; const char *oldnick = (const char *)data->arg1;
const char *newnick = data->arg2; const char *newnick = (const char *)data->arg2;
sendto_realops_snomask_from(SNO_NCHANGE, L_ALL, source_p->servptr, sendto_realops_snomask_from(SNO_NCHANGE, L_ALL, source_p->servptr,
"Nick change: From %s to %s [%s@%s]", "Nick change: From %s to %s [%s@%s]",

View file

@ -152,7 +152,7 @@ struct Expr *new_expr(const char *const pattern,
int *const errcode, int *const errcode,
PCRE2_SIZE *const erroff) PCRE2_SIZE *const erroff)
{ {
struct Expr *const ret = rb_malloc(sizeof(struct Expr)); const auto ret((Expr *)rb_malloc(sizeof(Expr)));
ret->id = hash_pattern(pattern); ret->id = hash_pattern(pattern);
ret->comp_opts = comp_opts; ret->comp_opts = comp_opts;
ret->match_opts = match_opts; ret->match_opts = match_opts;
@ -199,7 +199,7 @@ struct Expr *new_expr(const char *const pattern,
static static
struct Expr *find_expr(const unsigned int id) struct Expr *find_expr(const unsigned int id)
{ {
return rb_dictionary_retrieve(exprs, &id); return (Expr *)rb_dictionary_retrieve(exprs, &id);
} }
@ -257,7 +257,7 @@ int activate_expr(struct Expr *const expr,
static static
struct Expr *deactivate_expr(const unsigned int id) struct Expr *deactivate_expr(const unsigned int id)
{ {
return rb_dictionary_delete(exprs, &id); return (Expr *)rb_dictionary_delete(exprs, &id);
} }
@ -295,7 +295,7 @@ struct Expr *activate_new_expr(const char *const pattern,
static static
int deactivate_and_free_expr(const unsigned int id) int deactivate_and_free_expr(const unsigned int id)
{ {
struct Expr *const expr = rb_dictionary_delete(exprs, &id); struct Expr *const expr = (Expr *)rb_dictionary_delete(exprs, &id);
free_expr(expr); free_expr(expr);
return expr != NULL; return expr != NULL;
} }
@ -607,10 +607,11 @@ struct Expr *match_any_expr(const char *const text,
const size_t off, const size_t off,
const unsigned int options) const unsigned int options)
{ {
struct Expr *expr; void *elem;
rb_dictionary_iter state; rb_dictionary_iter state;
RB_DICTIONARY_FOREACH(expr, &state, exprs) RB_DICTIONARY_FOREACH(elem, &state, exprs)
{ {
auto *const expr(reinterpret_cast<Expr *>(elem));
if(match_expr(expr, text, len, off, options) > 0) if(match_expr(expr, text, len, off, options) > 0)
return expr; return expr;
} }
@ -637,7 +638,7 @@ int dump_pcre_config(struct Client *client_p, struct Client *source_p, int parc,
if((v.v_ulong = pcre2_config(PCRE2_CONFIG_VERSION, NULL)) > 0) if((v.v_ulong = pcre2_config(PCRE2_CONFIG_VERSION, NULL)) > 0)
{ {
v.v_ulong *= (PCRE2_CODE_UNIT_WIDTH / 8); v.v_ulong *= (PCRE2_CODE_UNIT_WIDTH / 8);
v.v_buf = rb_malloc(v.v_ulong); v.v_buf = (char *)rb_malloc(v.v_ulong);
pcre2_config(PCRE2_CONFIG_VERSION, v.v_buf); pcre2_config(PCRE2_CONFIG_VERSION, v.v_buf);
sendto_one_notice(source_p, ":\2%-30s\2: (%s)", "PCRE2 VERSION", v.v_buf); sendto_one_notice(source_p, ":\2%-30s\2: (%s)", "PCRE2 VERSION", v.v_buf);
rb_free(v.v_buf); rb_free(v.v_buf);
@ -658,7 +659,7 @@ int dump_pcre_config(struct Client *client_p, struct Client *source_p, int parc,
if((v.v_ulong = pcre2_config(PCRE2_CONFIG_JITTARGET, NULL)) > 0) if((v.v_ulong = pcre2_config(PCRE2_CONFIG_JITTARGET, NULL)) > 0)
{ {
v.v_ulong *= (PCRE2_CODE_UNIT_WIDTH / 8); v.v_ulong *= (PCRE2_CODE_UNIT_WIDTH / 8);
v.v_buf = rb_malloc(v.v_ulong); v.v_buf = (char *)rb_malloc(v.v_ulong);
pcre2_config(PCRE2_CONFIG_JITTARGET, v.v_buf); pcre2_config(PCRE2_CONFIG_JITTARGET, v.v_buf);
sendto_one_notice(source_p, ":\2%-30s\2: (%s)", "PCRE2 JITTARGET", v.v_buf); sendto_one_notice(source_p, ":\2%-30s\2: (%s)", "PCRE2 JITTARGET", v.v_buf);
rb_free(v.v_buf); rb_free(v.v_buf);
@ -697,7 +698,7 @@ int dump_pcre_config(struct Client *client_p, struct Client *source_p, int parc,
if((v.v_ulong = pcre2_config(PCRE2_CONFIG_UNICODE_VERSION, NULL)) > 0) if((v.v_ulong = pcre2_config(PCRE2_CONFIG_UNICODE_VERSION, NULL)) > 0)
{ {
v.v_ulong *= (PCRE2_CODE_UNIT_WIDTH / 8); v.v_ulong *= (PCRE2_CODE_UNIT_WIDTH / 8);
v.v_buf = rb_malloc(v.v_ulong); v.v_buf = (char *)rb_malloc(v.v_ulong);
pcre2_config(PCRE2_CONFIG_UNICODE_VERSION, v.v_buf); pcre2_config(PCRE2_CONFIG_UNICODE_VERSION, v.v_buf);
sendto_one_notice(source_p, ":\2%-30s\2: (%s)", "PCRE2 UNICODE_VERSION", v.v_buf); sendto_one_notice(source_p, ":\2%-30s\2: (%s)", "PCRE2 UNICODE_VERSION", v.v_buf);
rb_free(v.v_buf); rb_free(v.v_buf);
@ -774,10 +775,11 @@ int spamexpr_list(struct Client *client_p, struct Client *source_p, int parc, co
for(size_t i = 0; i < parc; i++) for(size_t i = 0; i < parc; i++)
nparv[i+1] = parv[i]; nparv[i+1] = parv[i];
struct Expr *expr; void *elem;
rb_dictionary_iter state; rb_dictionary_iter state;
RB_DICTIONARY_FOREACH(expr, &state, exprs) RB_DICTIONARY_FOREACH(elem, &state, exprs)
{ {
auto *const expr(reinterpret_cast<Expr *>(elem));
snprintf(id, sizeof(id), "%u", expr->id); snprintf(id, sizeof(id), "%u", expr->id);
spamexpr_info(client_p, source_p, parc+1, nparv); spamexpr_info(client_p, source_p, parc+1, nparv);
} }
@ -926,10 +928,11 @@ int spamexpr_test(struct Client *client_p, struct Client *source_p, int parc, co
return 0; return 0;
} }
struct Expr *expr; void *elem;
rb_dictionary_iter state; rb_dictionary_iter state;
RB_DICTIONARY_FOREACH(expr, &state, exprs) RB_DICTIONARY_FOREACH(elem, &state, exprs)
{ {
auto *const expr(reinterpret_cast<Expr *>(elem));
const int ret = match_expr(expr, parv[1], len, 0, 0); const int ret = match_expr(expr, parv[1], len, 0, 0);
sendto_one_notice(source_p, ":#%-2d: (%d) %s", id, ret, ret > 0? "POSITIVE" : "NEGATIVE"); sendto_one_notice(source_p, ":#%-2d: (%d) %s", id, ret, ret > 0? "POSITIVE" : "NEGATIVE");
} }
@ -947,10 +950,11 @@ int spamexpr_sync(struct Client *client_p, struct Client *source_p, int parc, co
return 0; return 0;
} }
struct Expr *expr; void *elem;
rb_dictionary_iter state; rb_dictionary_iter state;
RB_DICTIONARY_FOREACH(expr, &state, exprs) RB_DICTIONARY_FOREACH(elem, &state, exprs)
{ {
auto *const expr(reinterpret_cast<Expr *>(elem));
char comp_opts[128] = {0}, match_opts[128] = {0}, jit_opts[128] = {0}; char comp_opts[128] = {0}, match_opts[128] = {0}, jit_opts[128] = {0};
strlcat_pcre_opts(expr->comp_opts, comp_opts, sizeof(comp_opts), str_pcre_comp); strlcat_pcre_opts(expr->comp_opts, comp_opts, sizeof(comp_opts), str_pcre_comp);
strlcat_pcre_opts(expr->match_opts, match_opts, sizeof(match_opts), str_pcre_match); strlcat_pcre_opts(expr->match_opts, match_opts, sizeof(match_opts), str_pcre_match);
@ -1060,10 +1064,11 @@ void hook_doing_stats(hook_data_int *const data)
if(statchar != STATCHAR_SPAMFILTER) if(statchar != STATCHAR_SPAMFILTER)
return; return;
struct Expr *expr; void *elem;
rb_dictionary_iter state; rb_dictionary_iter state;
RB_DICTIONARY_FOREACH(expr, &state, exprs) RB_DICTIONARY_FOREACH(elem, &state, exprs)
{ {
auto *const expr(reinterpret_cast<Expr *>(elem));
char comp_opts[128] = {0}, match_opts[128] = {0}; char comp_opts[128] = {0}, match_opts[128] = {0};
strlcat_pcre_opts(expr->comp_opts, comp_opts, sizeof(comp_opts), str_pcre_comp); strlcat_pcre_opts(expr->comp_opts, comp_opts, sizeof(comp_opts), str_pcre_comp);
strlcat_pcre_opts(expr->match_opts, match_opts, sizeof(match_opts), str_pcre_match); strlcat_pcre_opts(expr->match_opts, match_opts, sizeof(match_opts), str_pcre_match);
@ -1105,15 +1110,15 @@ void hook_server_introduced(hook_data_client *const data)
*/ */
static static
int exprs_comparator(const unsigned int *const a, const unsigned int *const b) int exprs_comparator(const void *const a, const void *const b)
{ {
return *b - *a; return *reinterpret_cast<const unsigned int *>(b) - *reinterpret_cast<const unsigned int *>(a);
} }
static static
void exprs_destructor(rb_dictionary_element *const ptr, void *const priv) void exprs_destructor(rb_dictionary_element *const ptr, void *const priv)
{ {
free_expr(ptr->data); free_expr((Expr *)ptr->data);
} }
@ -1137,12 +1142,12 @@ int set_parm_opt(const conf_parm_t *const parm,
static static
void set_parm_opts(const conf_parm_t *const val, void set_parm_opts(const void *const val,
unsigned int *const dest, unsigned int *const dest,
long (*const reflector)(const char *), long (*const reflector)(const char *),
const char *const optname) const char *const optname)
{ {
for(const conf_parm_t *parm = val; parm; parm = parm->next) for(const auto *parm((conf_parm_t *)val); parm; parm = parm->next)
if(!set_parm_opt(parm, dest, reflector)) if(!set_parm_opt(parm, dest, reflector))
conf_report_error("Unrecognized PCRE %s option: %s", optname, parm->v.string); conf_report_error("Unrecognized PCRE %s option: %s", optname, parm->v.string);
} }
@ -1214,7 +1219,7 @@ void conf_spamexpr_jit_opts(void *const val)
static static
void conf_spamexpr_pattern(void *const val) void conf_spamexpr_pattern(void *const val)
{ {
const char *const pattern = val; const char *const pattern = (const char *)val;
rb_strlcpy(conf_spamexpr_cur.pattern, pattern, sizeof(conf_spamexpr_cur.pattern)); rb_strlcpy(conf_spamexpr_cur.pattern, pattern, sizeof(conf_spamexpr_cur.pattern));
} }

View file

@ -96,7 +96,7 @@ void bloom_destroy(void)
{ {
for(size_t i = 0; i < NUM_HASHES; i++) for(size_t i = 0; i < NUM_HASHES; i++)
{ {
rb_free(bloom[i]); delete bloom[i];
bloom[i] = NULL; bloom[i] = NULL;
} }
@ -111,7 +111,7 @@ void bloom_create(const size_t size)
return; return;
for(size_t i = 0; i < NUM_HASHES; i++) for(size_t i = 0; i < NUM_HASHES; i++)
bloom[i] = rb_malloc(size); bloom[i] = new uint8_t[size];
bloom_size = size; bloom_size = size;
bloom_flush(); bloom_flush();
@ -171,7 +171,7 @@ int chans_add(struct Channel *const chptr)
rb_dlink_node *ptr; rb_dlink_node *ptr;
RB_DLINK_FOREACH(ptr, chptr->members.head) RB_DLINK_FOREACH(ptr, chptr->members.head)
{ {
const struct membership *const msptr = ptr->data; const auto msptr(reinterpret_cast<membership *>(ptr->data));
bloom_add_str(msptr->client_p->name); bloom_add_str(msptr->client_p->name);
} }

View file

@ -40,7 +40,7 @@ DECLARE_MODULE_AV2(links_spy, NULL, NULL, NULL, NULL, links_hfnlist, NULL, NULL,
void void
show_links(hook_data *data) show_links(hook_data *data)
{ {
const char *mask = data->arg1; const char *mask = (const char *)data->arg1;
sendto_realops_snomask(SNO_SPY, L_ALL, sendto_realops_snomask(SNO_SPY, L_ALL,
"LINKS '%s' requested by %s (%s@%s) [%s]", "LINKS '%s' requested by %s (%s@%s) [%s]",

View file

@ -44,7 +44,7 @@ show_stats(hook_data_int *data)
if(statchar == 'L' || statchar == 'l') if(statchar == 'L' || statchar == 'l')
{ {
const char *name = data->arg1; const char *name = (const char *)data->arg1;
if(!EmptyString(name)) if(!EmptyString(name))
sendto_realops_snomask(SNO_SPY, L_ALL, sendto_realops_snomask(SNO_SPY, L_ALL,

View file

@ -16,4 +16,5 @@ void bandb_add(bandb_type, struct Client *source_p, const char *mask1,
const char *mask2, const char *reason, const char *oper_reason, int perm); const char *mask2, const char *reason, const char *oper_reason, int perm);
void bandb_del(bandb_type, const char *mask1, const char *mask2); void bandb_del(bandb_type, const char *mask1, const char *mask2);
void bandb_rehash_bans(void); void bandb_rehash_bans(void);
#endif #endif

View file

@ -45,5 +45,5 @@ void cache_user_motd(void);
extern rb_dictionary *help_dict_oper; extern rb_dictionary *help_dict_oper;
extern rb_dictionary *help_dict_user; extern rb_dictionary *help_dict_user;
#endif
#endif

View file

@ -202,5 +202,4 @@ ircd_path_t;
extern const char *ircd_paths[IRCD_PATH_COUNT]; extern const char *ircd_paths[IRCD_PATH_COUNT];
#endif // _IRCD_SYSTEM_H #endif // _IRCD_SYSTEM_H

Some files were not shown because too many files have changed in this diff Show more