diff --git a/CREDITS b/CREDITS index 7db8cc560..af2df0bea 100644 --- a/CREDITS +++ b/CREDITS @@ -26,6 +26,7 @@ in nick-alphabetical order: AndroSyn, Aaron Sethman anfl, Lee Hardy beu, Elfyn McBratney +BlindSight, Matt Ullman Entrope, Michael Poole gxti, Michael Tharp Taros, Brett Greenham diff --git a/Makefile.am b/Makefile.am index 4bc92d554..7463c147c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,3 +45,6 @@ install-exec-hook: rm -f ${DESTDIR}${moduledir}/*.dll.a rm -f ${DESTDIR}${moduledir}/autoload/*.dll.a rm -f ${DESTDIR}${moduledir}/extensions/*.dll.a + +clean-local: + rm -f include/serno.h diff --git a/authd/getaddrinfo.c b/authd/getaddrinfo.c index f76428752..43384c426 100644 --- a/authd/getaddrinfo.c +++ b/authd/getaddrinfo.c @@ -30,8 +30,7 @@ #ifdef _WIN32 #include #include "getaddrinfo.h" - -/* $Id$ */ +#include "stdinc.h" static const char in_addrany[] = { 0, 0, 0, 0 }; static const char in_loopback[] = { 127, 0, 0, 1 }; @@ -94,7 +93,7 @@ static const struct explore explore[] = { #define PTON_MAX 16 -static int str_isnumber(const char *); +static bool str_isnumber(const char *); static int explore_null(const struct rb_addrinfo *, const char *, struct rb_addrinfo **); static int explore_numeric(const struct rb_addrinfo *, const char *, @@ -183,20 +182,21 @@ rb_freeaddrinfo(struct rb_addrinfo *ai) } while (ai); } -static int +static bool str_isnumber(const char *p) { char *ep; if (*p == '\0') - return NO; + return false; + ep = NULL; errno = 0; (void)strtoul(p, &ep, 10); if (errno == 0 && ep && *ep == '\0') - return YES; + return true; else - return NO; + return false; } int @@ -497,7 +497,7 @@ get_ai(const struct rb_addrinfo *pai, const struct afd *afd, const char *addr) { char *p; struct rb_addrinfo *ai; - + ai = (struct rb_addrinfo *)rb_malloc(sizeof(struct rb_addrinfo) + (afd->a_socklen)); if (ai == NULL) @@ -517,7 +517,7 @@ static int get_portmatch(const struct rb_addrinfo *ai, const char *servname) { struct rb_addrinfo xai; - memcpy(&xai, ai, sizeof(struct rb_addrinfo)); + memcpy(&xai, ai, sizeof(struct rb_addrinfo)); return(get_port(&xai, servname, 1)); } diff --git a/authd/getaddrinfo.h b/authd/getaddrinfo.h index 746db142a..9916629b2 100644 --- a/authd/getaddrinfo.h +++ b/authd/getaddrinfo.h @@ -26,7 +26,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ */ struct rb_addrinfo { @@ -94,8 +93,6 @@ void rb_freeaddrinfo(struct rb_addrinfo *ai); #define SUCCESS 0 #define ANY 0 -#define YES 1 -#define NO 0 #undef EAI_ADDRFAMILY #undef EAI_AGAIN diff --git a/authd/getnameinfo.c b/authd/getnameinfo.c index f34fffcf8..39e296af2 100644 --- a/authd/getnameinfo.c +++ b/authd/getnameinfo.c @@ -46,8 +46,6 @@ #include "getaddrinfo.h" #include "getnameinfo.h" -/* $Id$ */ - static const struct afd { int a_af; int a_addrlen; diff --git a/authd/getnameinfo.h b/authd/getnameinfo.h index 26b965ab4..d7a919a4d 100644 --- a/authd/getnameinfo.h +++ b/authd/getnameinfo.h @@ -26,7 +26,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ */ int rb_getnameinfo(const struct sockaddr *sa, rb_socklen_t salen, char *host, diff --git a/authd/reslib.h b/authd/reslib.h index 38f7b8f39..e8917130c 100644 --- a/authd/reslib.h +++ b/authd/reslib.h @@ -78,24 +78,24 @@ typedef struct */ #define IRC_NS_GET16(s, cp) { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ - (s) = ((u_int16_t)t_cp[0] << 8) \ - | ((u_int16_t)t_cp[1]) \ + (s) = ((uint16_t)t_cp[0] << 8) \ + | ((uint16_t)t_cp[1]) \ ; \ (cp) += NS_INT16SZ; \ } #define IRC_NS_GET32(l, cp) { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ - (l) = ((u_int32_t)t_cp[0] << 24) \ - | ((u_int32_t)t_cp[1] << 16) \ - | ((u_int32_t)t_cp[2] << 8) \ - | ((u_int32_t)t_cp[3]) \ + (l) = ((uint32_t)t_cp[0] << 24) \ + | ((uint32_t)t_cp[1] << 16) \ + | ((uint32_t)t_cp[2] << 8) \ + | ((uint32_t)t_cp[3]) \ ; \ (cp) += NS_INT32SZ; \ } #define IRC_NS_PUT16(s, cp) { \ - u_int16_t t_s = (u_int16_t)(s); \ + uint16_t t_s = (uint16_t)(s); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_s >> 8; \ *t_cp = t_s; \ @@ -103,7 +103,7 @@ typedef struct } #define IRC_NS_PUT32(l, cp) { \ - u_int32_t t_l = (u_int32_t)(l); \ + uint32_t t_l = (uint32_t)(l); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_l >> 24; \ *t_cp++ = t_l >> 16; \ diff --git a/autogen.sh b/autogen.sh index 175e0ff53..fd14128a4 100755 --- a/autogen.sh +++ b/autogen.sh @@ -81,7 +81,7 @@ parse_options "$@" echo "Building librb autotools files." cd "$TOP_DIR"/librb -bash autogen.sh +sh autogen.sh echo "Building main autotools files." diff --git a/configure.ac b/configure.ac index 333a793d8..a36786254 100644 --- a/configure.ac +++ b/configure.ac @@ -121,7 +121,8 @@ AS_IF([test "x$enable_fhs_paths" = "xyes"], pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}' rundir=${rundir-'${prefix}/run'} pkgrundir='${rundir}/${PACKAGE_TARNAME}' - pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'], + pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}' + AC_DEFINE([ENABLE_FHS_PATHS], [1], [Uncomment if FHS pathnames are enabled])], [libexecdir='${bindir}' pkglibexecdir='${libexecdir}' rundir='${sysconfdir}' @@ -188,34 +189,8 @@ dnl Check for stdarg.h - if we can't find it, halt configure AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])]) AC_CHECK_FUNCS([strlcat strlcpy]) -AC_CHECK_TYPE([u_int32_t], [], -[ - AC_CHECK_TYPE([uint32_t], - [ - AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.]) - ], - [ - AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int]) - AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.]) - ]) -]) - -AC_CHECK_TYPE([u_int16_t], [], -[ - AC_CHECK_TYPE([uint16_t], - [ - AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute]) - ], - [ - AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int]) - AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.]) - ]) -]) - -AC_CHECK_TYPE([in_port_t], [], -[AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])], -[[#include -#include ]]) +AC_TYPE_INT16_T +AC_TYPE_INT32_T AC_CHECK_TYPE([sa_family_t], [], [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], diff --git a/include/channel.h b/include/channel.h index 9069296e1..ddbb951df 100644 --- a/include/channel.h +++ b/include/channel.h @@ -213,7 +213,7 @@ extern void destroy_channel(struct Channel *); extern int can_send(struct Channel *chptr, struct Client *who, struct membership *); -extern int flood_attack_channel(int p_or_n, struct Client *source_p, +extern bool flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr, char *chname); extern int is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr, const char *, const char *, const char **); @@ -231,7 +231,7 @@ extern void invalidate_bancache_user(struct Client *); extern void free_channel_list(rb_dlink_list *); -extern int check_channel_name(const char *name); +extern bool check_channel_name(const char *name); extern void channel_member_names(struct Channel *chptr, struct Client *, int show_eon); @@ -264,7 +264,7 @@ extern void set_channel_mlock(struct Client *client_p, struct Client *source_p, extern struct ChannelMode chmode_table[256]; -extern int add_id(struct Client *source_p, struct Channel *chptr, const char *banid, +extern bool add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const char *forward, rb_dlink_list * list, long mode_type); extern struct Ban * del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list, diff --git a/include/defaults.h b/include/defaults.h index 29b05cfb3..599b2611f 100644 --- a/include/defaults.h +++ b/include/defaults.h @@ -36,6 +36,27 @@ * First, set other fd limits based on values from user */ +typedef enum { + IRCD_PATH_PREFIX, + IRCD_PATH_MODULES, + IRCD_PATH_AUTOLOAD_MODULES, + IRCD_PATH_ETC, + IRCD_PATH_LOG, + IRCD_PATH_USERHELP, + IRCD_PATH_OPERHELP, + IRCD_PATH_IRCD_EXEC, + IRCD_PATH_IRCD_CONF, + IRCD_PATH_IRCD_MOTD, + IRCD_PATH_IRCD_LOG, + IRCD_PATH_IRCD_PID, + IRCD_PATH_IRCD_OMOTD, + IRCD_PATH_BANDB, + IRCD_PATH_BIN, + IRCD_PATH_LIBEXEC, + IRCD_PATH_COUNT +} ircd_path_t; + +extern const char *ircd_paths[IRCD_PATH_COUNT]; #define MAXCONNECTIONS 65535 /* default max connections if getrlimit doesn't work */ /* class {} default values */ diff --git a/include/hash.h b/include/hash.h index 4aba22ccf..c2d220dbb 100644 --- a/include/hash.h +++ b/include/hash.h @@ -65,10 +65,10 @@ struct ConfItem; struct cachefile; struct nd_entry; -extern u_int32_t fnv_hash_upper(const unsigned char *s, int bits); -extern u_int32_t fnv_hash(const unsigned char *s, int bits); -extern u_int32_t fnv_hash_len(const unsigned char *s, int bits, int len); -extern u_int32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len); +extern uint32_t fnv_hash_upper(const unsigned char *s, int bits); +extern uint32_t fnv_hash(const unsigned char *s, int bits); +extern uint32_t fnv_hash_len(const unsigned char *s, int bits, int len); +extern uint32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len); extern void init_hash(void); diff --git a/include/match.h b/include/match.h index c49e12e9f..151ad4bf6 100644 --- a/include/match.h +++ b/include/match.h @@ -46,8 +46,8 @@ extern int match_ips(const char *mask, const char *name); /* * comp_with_mask - compares to IP address */ -int comp_with_mask(void *addr, void *dest, u_int mask); -int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, u_int mask); +int comp_with_mask(void *addr, void *dest, unsigned int mask); +int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, unsigned int mask); /* * collapse - collapse a string in place, converts multiple adjacent *'s diff --git a/ircd/authd.c b/ircd/authd.c index 491d02379..30dd30cbb 100644 --- a/ircd/authd.c +++ b/ircd/authd.c @@ -55,20 +55,20 @@ start_authd(void) #endif if(authd_path == NULL) { - snprintf(fullpath, sizeof(fullpath), "%s/authd%s", PKGLIBEXECDIR, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cauthd%s", ircd_paths[IRCD_PATH_LIBEXEC], RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { - snprintf(fullpath, sizeof(fullpath), "%s/libexec/charybdis/authd%s", - ConfigFileEntry.dpath, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cbin%cauthd%s", + ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { ilog(L_MAIN, - "Unable to execute authd in %s or %s/libexec/charybdis", - PKGLIBEXECDIR, ConfigFileEntry.dpath); + "Unable to execute authd in %s or %s/bin", + ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath); sendto_realops_snomask(SNO_GENERAL, L_ALL, - "Unable to execute authd in %s or %s/libexec/charybdis", - PKGLIBEXECDIR, ConfigFileEntry.dpath); + "Unable to execute authd in %s or %s/bin", + ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath); return 1; } diff --git a/ircd/bandbi.c b/ircd/bandbi.c index aa9410d29..15171b646 100644 --- a/ircd/bandbi.c +++ b/ircd/bandbi.c @@ -80,21 +80,21 @@ start_bandb(void) const char *suffix = ""; #endif - rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1); + rb_setenv("BANDB_DBPATH", ircd_paths[IRCD_PATH_BANDB], 1); if(bandb_path == NULL) { - snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cbandb%s", ircd_paths[IRCD_PATH_LIBEXEC], RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { - snprintf(fullpath, sizeof(fullpath), "%s/bin/bandb%s", - ConfigFileEntry.dpath, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cbin%cbandb%s", + ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { ilog(L_MAIN, "Unable to execute bandb%s in %s or %s/bin", - suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath); + suffix, ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath); return 0; } } diff --git a/ircd/cache.c b/ircd/cache.c index 1a2cb14fa..b5581f520 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -64,8 +64,8 @@ init_cache(void) user_motd_changed[0] = '\0'; - user_motd = cache_file(MPATH, "ircd.motd", 0); - oper_motd = cache_file(OPATH, "opers.motd", 0); + user_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_MOTD], "ircd.motd", 0); + oper_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_OMOTD], "opers.motd", 0); memset(&links_cache_list, 0, sizeof(links_cache_list)); help_dict_oper = rb_dictionary_create("oper help", strcasecmp); @@ -253,7 +253,7 @@ load_help(void) free_cachefile(cacheptr); } - helpfile_dir = opendir(HPATH); + helpfile_dir = opendir(ircd_paths[IRCD_PATH_OPERHELP]); if(helpfile_dir == NULL) return; @@ -262,13 +262,13 @@ load_help(void) { if(ldirent->d_name[0] == '.') continue; - snprintf(filename, sizeof(filename), "%s/%s", HPATH, ldirent->d_name); + snprintf(filename, sizeof(filename), "%s%c%s", ircd_paths[IRCD_PATH_OPERHELP], RB_PATH_SEPARATOR, ldirent->d_name); cacheptr = cache_file(filename, ldirent->d_name, HELP_OPER); rb_dictionary_add(help_dict_oper, cacheptr->name, cacheptr); } closedir(helpfile_dir); - helpfile_dir = opendir(UHPATH); + helpfile_dir = opendir(ircd_paths[IRCD_PATH_USERHELP]); if(helpfile_dir == NULL) return; @@ -277,7 +277,7 @@ load_help(void) { if(ldirent->d_name[0] == '.') continue; - snprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name); + snprintf(filename, sizeof(filename), "%s%c%s", ircd_paths[IRCD_PATH_USERHELP], RB_PATH_SEPARATOR, ldirent->d_name); #if defined(S_ISLNK) && defined(HAVE_LSTAT) if(lstat(filename, &sb) < 0) @@ -341,7 +341,7 @@ cache_user_motd(void) struct stat sb; struct tm *local_tm; - if(stat(MPATH, &sb) == 0) + if(stat(ircd_paths[IRCD_PATH_IRCD_MOTD], &sb) == 0) { local_tm = localtime(&sb.st_mtime); @@ -355,7 +355,7 @@ cache_user_motd(void) } } free_cachefile(user_motd); - user_motd = cache_file(MPATH, "ircd.motd", 0); + user_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_MOTD], "ircd.motd", 0); } diff --git a/ircd/channel.c b/ircd/channel.c index 717df263e..4609325ab 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -336,23 +336,23 @@ invalidate_bancache_user(struct Client *client_p) /* check_channel_name() * * input - channel name - * output - 1 if valid channel name, else 0 + * output - true if valid channel name, else false * side effects - */ -int +bool check_channel_name(const char *name) { s_assert(name != NULL); if(name == NULL) - return 0; + return false; for (; *name; ++name) { if(!IsChanChar(*name)) - return 0; + return false; } - return 1; + return true; } /* free_channel_list() @@ -901,11 +901,11 @@ can_send(struct Channel *chptr, struct Client *source_p, struct membership *mspt * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC * says NOTICE must not auto reply * - pointer to source Client - * - pointer to target channel - * output - 1 if target is under flood attack + * - pointer to target channel + * output - true if target is under flood attack * side effects - check for flood attack on target chptr */ -int +bool flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr, char *chname) { int delta; @@ -943,13 +943,13 @@ flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr, sendto_one(source_p, ":%s NOTICE %s :*** Message to %s throttled due to flooding", me.name, source_p->name, chptr->chname); - return 1; + return true; } else chptr->received_number_of_privmsgs++; } - return 0; + return false; } /* find_bannickchange_channel() diff --git a/ircd/chmode.c b/ircd/chmode.c index 6ec2f497a..c3182d1fd 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -202,10 +202,10 @@ get_channel_access(struct Client *source_p, struct Channel *chptr, struct member * Checks if mlock and chanops permit a mode change. * * inputs - client, channel, access level, errors pointer, mode char - * outputs - 0 on failure, 1 on success + * outputs - false on failure, true on success * side effects - error message sent on failure */ -static int +static bool allow_mode_change(struct Client *source_p, struct Channel *chptr, int alevel, int *errors, char c) { @@ -220,7 +220,7 @@ allow_mode_change(struct Client *source_p, struct Channel *chptr, int alevel, c, chptr->mode_lock); *errors |= SM_ERR_MLOCK; - return 0; + return false; } if(alevel < CHFL_CHANOP) { @@ -228,18 +228,18 @@ allow_mode_change(struct Client *source_p, struct Channel *chptr, int alevel, sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), me.name, source_p->name, chptr->chname); *errors |= SM_ERR_NOOPS; - return 0; + return false; } - return 1; + return true; } /* add_id() * * inputs - client, channel, id to add, type, forward - * outputs - 0 on failure, 1 on success + * outputs - false on failure, true on success * side effects - given id is added to the appropriate list */ -int +bool add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const char *forward, rb_dlink_list * list, long mode_type) { @@ -257,14 +257,14 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const { sendto_one(source_p, form_str(ERR_BANLISTFULL), me.name, source_p->name, chptr->chname, realban); - return 0; + return false; } RB_DLINK_FOREACH(ptr, list->head) { actualBan = ptr->data; if(mask_match(actualBan->banstr, realban)) - return 0; + return false; } } /* dont let remotes set duplicates */ @@ -274,7 +274,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const { actualBan = ptr->data; if(!irccmp(actualBan->banstr, realban)) - return 0; + return false; } } @@ -293,7 +293,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const if(mode_type == CHFL_BAN || mode_type == CHFL_QUIET || mode_type == CHFL_EXCEPTION) chptr->bants++; - return 1; + return true; } /* del_id() @@ -486,7 +486,7 @@ pretty_mask(const char *idmask) * output - true if forwarding should be allowed * side effects - numeric sent if not allowed */ -static int +static bool check_forward(struct Client *source_p, struct Channel *chptr, const char *forward) { @@ -497,20 +497,20 @@ check_forward(struct Client *source_p, struct Channel *chptr, (MyClient(source_p) && (strlen(forward) > LOC_CHANNELLEN || hash_find_resv(forward)))) { sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), forward); - return 0; + return false; } /* don't forward to inconsistent target -- jilles */ if(chptr->chname[0] == '#' && forward[0] == '&') { sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), forward); - return 0; + return false; } if(MyClient(source_p) && (targptr = find_channel(forward)) == NULL) { sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), forward); - return 0; + return false; } if(MyClient(source_p) && !(targptr->mode.mode & MODE_FREETARGET)) { @@ -519,10 +519,10 @@ check_forward(struct Client *source_p, struct Channel *chptr, { sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), me.name, source_p->name, targptr->chname); - return 0; + return false; } } - return 1; + return true; } /* fix_key() @@ -535,9 +535,9 @@ check_forward(struct Client *source_p, struct Channel *chptr, static char * fix_key(char *arg) { - u_char *s, *t, c; + unsigned char *s, *t, c; - for(s = t = (u_char *) arg; (c = *s); s++) + for(s = t = (unsigned char *) arg; (c = *s); s++) { c &= 0x7f; if(c != ':' && c != ',' && c > ' ') @@ -558,9 +558,9 @@ fix_key(char *arg) static char * fix_key_remote(char *arg) { - u_char *s, *t, c; + unsigned char *s, *t, c; - for(s = t = (u_char *) arg; (c = *s); s++) + for(s = t = (unsigned char *) arg; (c = *s); s++) { c &= 0x7f; if((c != 0x0a) && (c != ':') && (c != ',') && (c != 0x0d) && (c != ' ')) diff --git a/ircd/hash.c b/ircd/hash.c index c1ef81cbc..172734d3a 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -70,10 +70,10 @@ init_hash(void) hostname_tree = rb_radixtree_create("hostname", irccasecanon); } -u_int32_t +uint32_t fnv_hash_upper(const unsigned char *s, int bits) { - u_int32_t h = FNV1_32_INIT; + uint32_t h = FNV1_32_INIT; while (*s) { @@ -85,10 +85,10 @@ fnv_hash_upper(const unsigned char *s, int bits) return h; } -u_int32_t +uint32_t fnv_hash(const unsigned char *s, int bits) { - u_int32_t h = FNV1_32_INIT; + uint32_t h = FNV1_32_INIT; while (*s) { @@ -100,10 +100,10 @@ fnv_hash(const unsigned char *s, int bits) return h; } -u_int32_t +uint32_t fnv_hash_len(const unsigned char *s, int bits, int len) { - u_int32_t h = FNV1_32_INIT; + uint32_t h = FNV1_32_INIT; const unsigned char *x = s + len; while (*s && s < x) { @@ -115,10 +115,10 @@ fnv_hash_len(const unsigned char *s, int bits, int len) return h; } -u_int32_t +uint32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len) { - u_int32_t h = FNV1_32_INIT; + uint32_t h = FNV1_32_INIT; const unsigned char *x = s + len; while (*s && s < x) { diff --git a/ircd/ircd.c b/ircd/ircd.c index b3f1b5d0b..627d469ba 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -94,9 +94,6 @@ rb_dlink_list global_serv_list; /* global servers on the network */ rb_dlink_list local_oper_list; /* our opers, duplicated in lclient_list */ rb_dlink_list oper_list; /* network opers */ -const char *logFileName = LPATH; -const char *pidFileName = PPATH; - char **myargv; bool dorehash = false; bool dorehashbans = false; @@ -118,6 +115,28 @@ int split_users; int split_servers; int eob_count; +const char *ircd_paths[IRCD_PATH_COUNT] = { + [IRCD_PATH_PREFIX] = DPATH, + [IRCD_PATH_MODULES] = MODPATH, + [IRCD_PATH_AUTOLOAD_MODULES] = AUTOMODPATH, + [IRCD_PATH_ETC] = ETCPATH, + [IRCD_PATH_LOG] = LOGPATH, + [IRCD_PATH_USERHELP] = UHPATH, + [IRCD_PATH_OPERHELP] = HPATH, + [IRCD_PATH_IRCD_EXEC] = SPATH, + [IRCD_PATH_IRCD_CONF] = CPATH, + [IRCD_PATH_IRCD_MOTD] = MPATH, + [IRCD_PATH_IRCD_LOG] = LPATH, + [IRCD_PATH_IRCD_PID] = PPATH, + [IRCD_PATH_IRCD_OMOTD] = OPATH, + [IRCD_PATH_BANDB] = DBPATH, + [IRCD_PATH_BIN] = BINPATH, + [IRCD_PATH_LIBEXEC] = PKGLIBEXECDIR, +}; + +const char *logFileName = NULL; +const char *pidFileName = NULL; + void ircd_shutdown(const char *reason) { @@ -370,6 +389,83 @@ initialize_server_capabs(void) default_server_capabs &= ~CAP_ZIP; } +/* + * relocate_paths + * + * inputs - none + * output - none + * side effects - items in ircd_paths[] array are relocated + */ +static void +relocate_paths(void) +{ + char prefix[PATH_MAX], workbuf[PATH_MAX]; + char *p; + + rb_strlcpy(prefix, rb_path_to_self(), sizeof prefix); + + ircd_paths[IRCD_PATH_IRCD_EXEC] = rb_strdup(prefix); + + /* if we're running from inside the source tree, we probably do not want to relocate any other paths */ + if (strstr(prefix, ".libs") != NULL) + return; + + /* prefix = /home/kaniini/ircd/bin/ircd */ + p = strrchr(prefix, RB_PATH_SEPARATOR); + if (rb_unlikely(p == NULL)) + return; + *p = 0; + + /* prefix = /home/kaniini/ircd/bin */ + p = strrchr(prefix, RB_PATH_SEPARATOR); + if (rb_unlikely(p == NULL)) + return; + *p = 0; + + /* prefix = /home/kaniini/ircd */ + ircd_paths[IRCD_PATH_PREFIX] = rb_strdup(prefix); + + /* now that we have our prefix, we can relocate the other paths... */ + snprintf(workbuf, sizeof workbuf, "%s%cmodules", prefix, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_MODULES] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cmodules%cautoload", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_AUTOLOAD_MODULES] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc", prefix, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_ETC] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%clog", prefix, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_LOG] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%chelp%cusers", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_USERHELP] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%chelp%copers", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_OPERHELP] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%circd.conf", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_CONF] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%circd.motd", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_MOTD] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%copers.motd", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_OMOTD] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%cban.db", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_BANDB] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%circd.pid", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_PID] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%clogs%circd.log", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_LOG] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cbin", prefix, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_BIN] = rb_strdup(workbuf); + ircd_paths[IRCD_PATH_LIBEXEC] = rb_strdup(workbuf); +} /* * write_pidfile @@ -560,12 +656,19 @@ charybdis_main(int argc, char *argv[]) } #endif - init_sys(); +#ifndef ENABLE_FHS_PATHS + relocate_paths(); +#endif - ConfigFileEntry.dpath = DPATH; - ConfigFileEntry.configfile = CPATH; /* Server configuration file */ + logFileName = ircd_paths[IRCD_PATH_IRCD_LOG]; + pidFileName = ircd_paths[IRCD_PATH_IRCD_PID]; + + ConfigFileEntry.dpath = ircd_paths[IRCD_PATH_PREFIX]; + ConfigFileEntry.configfile = ircd_paths[IRCD_PATH_IRCD_CONF]; /* Server configuration file */ ConfigFileEntry.connect_timeout = 30; /* Default to 30 */ + init_sys(); + umask(077); /* better safe than sorry --SRB */ myargv = argv; diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index 4ccee128d..ae96b407d 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -193,10 +193,10 @@ void cinclude(void) if (tmp_fbfile_in == NULL) { - /* if its not found in PREFIX, look in ETCPATH */ + /* if its not found in PREFIX, look in IRCD_PATH_ETC */ char fnamebuf[BUFSIZE]; - snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", ETCPATH, c); + snprintf(fnamebuf, sizeof(fnamebuf), "%s%c%s", IRCD_PATH_ETC, RB_PATH_SEPARATOR, c); tmp_fbfile_in = fopen(fnamebuf, "r"); /* wasnt found there either.. error. */ diff --git a/ircd/match.c b/ircd/match.c index 87a1c7eff..66ffe2364 100644 --- a/ircd/match.c +++ b/ircd/match.c @@ -308,13 +308,13 @@ match_esc(const char *mask, const char *name) return 0; } -int comp_with_mask(void *addr, void *dest, u_int mask) +int comp_with_mask(void *addr, void *dest, unsigned int mask) { if (memcmp(addr, dest, mask / 8) == 0) { int n = mask / 8; int m = ((-1) << (8 - (mask % 8))); - if (mask % 8 == 0 || (((u_char *) addr)[n] & m) == (((u_char *) dest)[n] & m)) + if (mask % 8 == 0 || (((unsigned char *) addr)[n] & m) == (((unsigned char *) dest)[n] & m)) { return (1); } @@ -322,7 +322,7 @@ int comp_with_mask(void *addr, void *dest, u_int mask) return (0); } -int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, u_int mask) +int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, unsigned int mask) { void *iaddr = NULL; void *idest = NULL; diff --git a/ircd/modules.c b/ircd/modules.c index da3da9471..2173dd69f 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -129,8 +129,8 @@ modules_init(void) mod_add_cmd(&modrestart_msgtab); /* Add the default paths we look in to the module system --nenolod */ - mod_add_path(MODPATH); - mod_add_path(AUTOMODPATH); + mod_add_path(ircd_paths[IRCD_PATH_MODULES]); + mod_add_path(ircd_paths[IRCD_PATH_AUTOLOAD_MODULES]); } /* mod_find_path() @@ -243,11 +243,11 @@ load_all_modules(int warn) max_mods = MODS_INCREMENT; - system_module_dir = opendir(AUTOMODPATH); + system_module_dir = opendir(ircd_paths[IRCD_PATH_AUTOLOAD_MODULES]); if(system_module_dir == NULL) { - ilog(L_MAIN, "Could not load modules from %s: %s", AUTOMODPATH, strerror(errno)); + ilog(L_MAIN, "Could not load modules from %s: %s", ircd_paths[IRCD_PATH_AUTOLOAD_MODULES], strerror(errno)); return; } @@ -258,7 +258,7 @@ load_all_modules(int warn) len = strlen(ldirent->d_name); if(len > module_ext_len && !strcasecmp(ldirent->d_name + (len - module_ext_len), LT_MODULE_EXT)) { - (void) snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name); + (void) snprintf(module_fq_name, sizeof(module_fq_name), "%s%c%s", ircd_paths[IRCD_PATH_AUTOLOAD_MODULES], RB_PATH_SEPARATOR, ldirent->d_name); (void) load_a_module(module_fq_name, warn, MAPI_ORIGIN_CORE, 0); } @@ -281,7 +281,7 @@ load_core_modules(int warn) for (i = 0; core_module_table[i]; i++) { - snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, + snprintf(module_name, sizeof(module_name), "%s%c%s%s", ircd_paths[IRCD_PATH_MODULES], RB_PATH_SEPARATOR, core_module_table[i], LT_MODULE_EXT); if(load_a_module(module_name, warn, MAPI_ORIGIN_CORE, 1) == -1) diff --git a/ircd/restart.c b/ircd/restart.c index 1a63b5726..f91f9293c 100644 --- a/ircd/restart.c +++ b/ircd/restart.c @@ -72,10 +72,10 @@ server_reboot(void) close(i); unlink(pidFileName); - execv(SPATH, (void *)myargv); + execv(ircd_paths[IRCD_PATH_IRCD_EXEC], (void *)myargv); /* use this if execv of SPATH fails */ - snprintf(path, sizeof(path), "%s/bin/ircd", ConfigFileEntry.dpath); + snprintf(path, sizeof(path), "%s%cbin%circd", ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); execv(path, (void *)myargv); exit(-1); diff --git a/ircd/sslproc.c b/ircd/sslproc.c index 6d53caf3a..2edd091eb 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -278,17 +278,17 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co if(ssld_path == NULL) { - snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cssld%s", ircd_paths[IRCD_PATH_LIBEXEC], RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { - snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld%s", - ConfigFileEntry.dpath, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cbin%cssld%s", + ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { ilog(L_MAIN, "Unable to execute ssld%s in %s or %s/bin", - suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath); + suffix, ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath); return 0; } } diff --git a/ircd/version.c.SH b/ircd/version.c.SH index c02158a3b..ff055ffaa 100644 --- a/ircd/version.c.SH +++ b/ircd/version.c.SH @@ -7,7 +7,7 @@ echo "Extracting $package/src/version.c..." if test -r version.c.last then - generation=`sed -n 's/^char \*generation = \"\(.*\)\";/\1/p' < version.c.last` + generation=`sed -n 's/^const char \*generation = \"\(.*\)\";/\1/p' < version.c.last` if test ! "$generation" ; then generation=0; fi else generation=0 @@ -63,7 +63,7 @@ const char *infotext[] = "$package --", "Based on the original code written by Jarkko Oikarinen", "Copyright 1988, 1989, 1990, 1991 University of Oulu, Computing Center", - "Copyright (c) 1996-2001 Hybrid Development Team", + "Copyright (c) 1996-2001 Hybrid Development Team", "Copyright (c) 2002-2009 ircd-ratbox Development Team", "Copyright (c) 2005-2016 charybdis development team", " ", diff --git a/librb/Makefile.am b/librb/Makefile.am index a21a3026f..cfddf5d73 100644 --- a/librb/Makefile.am +++ b/librb/Makefile.am @@ -16,3 +16,5 @@ include/serno.h: echo '#define DATECODE 0UL' >>include/serno.h; \ fi +clean-local: + rm -f include/serno.h diff --git a/librb/acinclude.m4 b/librb/acinclude.m4 index e0474339b..eaa270e06 100644 --- a/librb/acinclude.m4 +++ b/librb/acinclude.m4 @@ -1,4 +1,3 @@ -# $Id: acinclude.m4 23020 2006-09-01 18:20:19Z androsyn $ - aclocal.m4 - Autoconf fun... AC_DEFUN([AC_DEFINE_DIR], [ test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' @@ -34,7 +33,7 @@ AC_DEFUN([AC_SUBST_DIR], [ dnl IPv6 support macros..pretty much swiped from wget dnl RB_PROTO_INET6 - + AC_DEFUN([RB_PROTO_INET6],[ AC_CACHE_CHECK([for INET6 protocol support], [rb_cv_proto_inet6],[ AC_TRY_CPP([ @@ -57,14 +56,14 @@ AC_DEFUN([RB_PROTO_INET6],[ ],[ rb_cv_proto_inet6=no ]) - ]) + ]) if test "X$rb_cv_proto_inet6" = "Xyes"; then : $1 else : - $2 - fi -]) + $2 + fi +]) AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[ @@ -93,7 +92,7 @@ AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[ AC_DEFUN([RB_CHECK_TIMER_CREATE], - [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], + [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], [rb__cv_timer_create_works], [AC_TRY_RUN([ #ifdef HAVE_TIME_H @@ -126,7 +125,7 @@ int main(int argc, char *argv[]) [rb__cv_timer_create_works=no]) ]) case $rb__cv_timer_create_works in - yes) AC_DEFINE([USE_TIMER_CREATE], 1, + yes) AC_DEFINE([USE_TIMER_CREATE], 1, [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; esac ]) @@ -134,7 +133,7 @@ esac AC_DEFUN([RB_CHECK_TIMERFD_CREATE], - [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)], + [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)], [rb__cv_timerfd_create_works], [AC_TRY_RUN([ #ifdef HAVE_TIME_H @@ -166,7 +165,7 @@ int main(int argc, char *argv[]) [rb__cv_timerfd_create_works=no]) ]) case $rb__cv_timerfd_create_works in - yes) AC_DEFINE([USE_TIMERFD_CREATE], 1, + yes) AC_DEFINE([USE_TIMERFD_CREATE], 1, [Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...)]);; esac ]) diff --git a/librb/include/commio-int.h b/librb/include/commio-int.h index 6a4bfb874..da2833a42 100644 --- a/librb/include/commio-int.h +++ b/librb/include/commio-int.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio.h 24059 2007-07-24 17:25:41Z androsyn $ */ #ifndef _COMMIO_INT_H diff --git a/librb/include/commio-ssl.h b/librb/include/commio-ssl.h index 6e2bd69f0..adcce1ae3 100644 --- a/librb/include/commio-ssl.h +++ b/librb/include/commio-ssl.h @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio-ssl.h 26280 2008-12-10 20:25:29Z androsyn $ */ #ifndef _COMMIO_SSL_H diff --git a/librb/include/event-int.h b/librb/include/event-int.h index 993a78d00..4cabd3169 100644 --- a/librb/include/event-int.h +++ b/librb/include/event-int.h @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: event-int.h 26272 2008-12-10 05:55:10Z androsyn $ */ struct ev_entry diff --git a/librb/include/rb_balloc.h b/librb/include/rb_balloc.h index 7ca7857d6..ff6652001 100644 --- a/librb/include/rb_balloc.h +++ b/librb/include/rb_balloc.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_balloc.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_commio.h b/librb/include/rb_commio.h index 09317ce95..f51e04b17 100644 --- a/librb/include/rb_commio.h +++ b/librb/include/rb_commio.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_commio.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_event.h b/librb/include/rb_event.h index 61b6efaef..84d9d1725 100644 --- a/librb/include/rb_event.h +++ b/librb/include/rb_event.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_event.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_helper.h b/librb/include/rb_helper.h index 3287e8d9a..0b4a90865 100644 --- a/librb/include/rb_helper.h +++ b/librb/include/rb_helper.h @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_helper.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_lib.h b/librb/include/rb_lib.h index bc4eb502a..4003a832d 100644 --- a/librb/include/rb_lib.h +++ b/librb/include/rb_lib.h @@ -69,9 +69,11 @@ char *alloca(); #ifdef _WIN32 #define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0) typedef SOCKET rb_platform_fd_t; +#define RB_PATH_SEPARATOR '\\' #else #define rb_get_errno() typedef int rb_platform_fd_t; +#define RB_PATH_SEPARATOR '/' #endif #ifdef _WIN32 @@ -113,7 +115,7 @@ char *rb_strerror(int error); #define EAFNOSUPPORT WSAEAFNOSUPPORT #define pipe(x) _pipe(x, 1024, O_BINARY) -#define ioctl(x,y,z) ioctlsocket(x,y, (u_long *)z) +#define ioctl(x,y,z) ioctlsocket(x,y, (unsigned long *)z) #define WNOHANG 1 diff --git a/librb/include/rb_linebuf.h b/librb/include/rb_linebuf.h index b1d8c847f..d0e0b9883 100644 --- a/librb/include/rb_linebuf.h +++ b/librb/include/rb_linebuf.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_linebuf.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_memory.h b/librb/include/rb_memory.h index d4dd6f0c2..1bc7af098 100644 --- a/librb/include/rb_memory.h +++ b/librb/include/rb_memory.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_memory.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_patricia.h b/librb/include/rb_patricia.h index 6ea803a96..79b9fecb4 100644 --- a/librb/include/rb_patricia.h +++ b/librb/include/rb_patricia.h @@ -1,5 +1,4 @@ /* - * $Id: patricia.h 23020 2006-09-01 18:20:19Z androsyn $ * Dave Plonka * * This product includes software developed by the University of Michigan, @@ -25,7 +24,6 @@ #define INET6_ADDRSTRLEN 46 #endif -/* typedef unsigned int u_int; */ #define rb_prefix_touchar(prefix) ((unsigned char *)&(prefix)->add.sin) #define MAXLINE 1024 #define BIT_TEST(f, b) ((f) & (b)) diff --git a/librb/include/rb_rawbuf.h b/librb/include/rb_rawbuf.h index 523a17b10..91242e82a 100644 --- a/librb/include/rb_rawbuf.h +++ b/librb/include/rb_rawbuf.h @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id$ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_tools.h b/librb/include/rb_tools.h index 31edb9f12..c60a483c0 100644 --- a/librb/include/rb_tools.h +++ b/librb/include/rb_tools.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_tools.h 26170 2008-10-26 20:59:07Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/serno.h b/librb/include/serno.h deleted file mode 100644 index 7ab979503..000000000 --- a/librb/include/serno.h +++ /dev/null @@ -1,2 +0,0 @@ -#define SERNO "20160307-81204be" -#define DATECODE 1457395822UL diff --git a/librb/src/Makefile.am b/librb/src/Makefile.am index 7e1acd696..cd13ff69e 100644 --- a/librb/src/Makefile.am +++ b/librb/src/Makefile.am @@ -1,4 +1,3 @@ -# $Id: Makefile.am 26046 2008-09-09 16:37:30Z androsyn $ AUTOMAKE_OPTIONS = foreign diff --git a/librb/src/arc4random.c b/librb/src/arc4random.c index f65bab1be..f6f53c76f 100644 --- a/librb/src/arc4random.c +++ b/librb/src/arc4random.c @@ -1,4 +1,3 @@ -/* $Id: arc4random.c 26092 2008-09-19 15:13:52Z androsyn $ */ /* $$$: arc4random.c 2005/02/08 robert */ /* $NetBSD: arc4random.c,v 1.5.2.1 2004/03/26 22:52:50 jmc Exp $ */ /* $OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $ */ diff --git a/librb/src/balloc.c b/librb/src/balloc.c index b7b036445..71b36cabf 100644 --- a/librb/src/balloc.c +++ b/librb/src/balloc.c @@ -28,7 +28,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: balloc.c 26100 2008-09-20 01:27:19Z androsyn $ */ /* diff --git a/librb/src/commio.c b/librb/src/commio.c index 1029d1caa..9fe8689c3 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -21,8 +21,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio.c 26254 2008-12-10 04:04:38Z androsyn $ */ + #include #include #include diff --git a/librb/src/crypt.c b/librb/src/crypt.c index 206027fda..9344e988d 100644 --- a/librb/src/crypt.c +++ b/librb/src/crypt.c @@ -754,7 +754,7 @@ rb_des_crypt(const char *key, const char *setting) #define MD5_SIZE 16 static void -_crypt_to64(char *s, u_long v, int n) +_crypt_to64(char *s, unsigned long v, int n) { while (--n >= 0) { *s++ = ascii64[v&0x3f]; @@ -1072,8 +1072,8 @@ rb_md5_crypt(const char *pw, const char *salt) MD5_CTX ctx,ctx1; unsigned long l; int sl, pl; - u_int i; - u_char final[MD5_SIZE]; + unsigned int i; + unsigned char final[MD5_SIZE]; static const char *sp, *ep; static char passwd[120], *p; static const char *magic = "$1$"; @@ -1095,23 +1095,23 @@ rb_md5_crypt(const char *pw, const char *salt) MD5Init(&ctx); /* The password first, since that is what is most unknown */ - MD5Update(&ctx, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx, (const unsigned char *)pw, strlen(pw)); /* Then our magic string */ - MD5Update(&ctx, (const u_char *)magic, strlen(magic)); + MD5Update(&ctx, (const unsigned char *)magic, strlen(magic)); /* Then the raw salt */ - MD5Update(&ctx, (const u_char *)sp, (u_int)sl); + MD5Update(&ctx, (const unsigned char *)sp, (unsigned int)sl); /* Then just as many characters of the MD5(pw,salt,pw) */ MD5Init(&ctx1); - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); - MD5Update(&ctx1, (const u_char *)sp, (u_int)sl); - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)sp, (unsigned int)sl); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); MD5Final(final, &ctx1); for(pl = (int)strlen(pw); pl > 0; pl -= MD5_SIZE) - MD5Update(&ctx, (const u_char *)final, - (u_int)(pl > MD5_SIZE ? MD5_SIZE : pl)); + MD5Update(&ctx, (const unsigned char *)final, + (unsigned int)(pl > MD5_SIZE ? MD5_SIZE : pl)); /* Don't leave anything around in vm they could use. */ memset(final, 0, sizeof(final)); @@ -1119,13 +1119,13 @@ rb_md5_crypt(const char *pw, const char *salt) /* Then something really weird... */ for (i = strlen(pw); i; i >>= 1) if(i & 1) - MD5Update(&ctx, (const u_char *)final, 1); + MD5Update(&ctx, (const unsigned char *)final, 1); else - MD5Update(&ctx, (const u_char *)pw, 1); + MD5Update(&ctx, (const unsigned char *)pw, 1); /* Now make the output string */ rb_strlcpy(passwd, magic, sizeof(passwd)); - strncat(passwd, sp, (u_int)sl); + strncat(passwd, sp, (unsigned int)sl); rb_strlcat(passwd, "$", sizeof(passwd)); MD5Final(final, &ctx); @@ -1138,20 +1138,20 @@ rb_md5_crypt(const char *pw, const char *salt) for(i = 0; i < 1000; i++) { MD5Init(&ctx1); if(i & 1) - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); else - MD5Update(&ctx1, (const u_char *)final, MD5_SIZE); + MD5Update(&ctx1, (const unsigned char *)final, MD5_SIZE); if(i % 3) - MD5Update(&ctx1, (const u_char *)sp, (u_int)sl); + MD5Update(&ctx1, (const unsigned char *)sp, (unsigned int)sl); if(i % 7) - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); if(i & 1) - MD5Update(&ctx1, (const u_char *)final, MD5_SIZE); + MD5Update(&ctx1, (const unsigned char *)final, MD5_SIZE); else - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); MD5Final(final, &ctx1); } diff --git a/librb/src/devpoll.c b/librb/src/devpoll.c index 2e99c092b..06d34ec04 100644 --- a/librb/src/devpoll.c +++ b/librb/src/devpoll.c @@ -22,8 +22,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: devpoll.c 26254 2008-12-10 04:04:38Z androsyn $ */ + #include #include #include diff --git a/librb/src/epoll.c b/librb/src/epoll.c index ac7c6be52..1d4d62723 100644 --- a/librb/src/epoll.c +++ b/librb/src/epoll.c @@ -23,8 +23,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: epoll.c 26294 2008-12-13 03:01:19Z androsyn $ */ + #define _GNU_SOURCE 1 #include diff --git a/librb/src/event.c b/librb/src/event.c index 1e1248305..cdf41474b 100644 --- a/librb/src/event.c +++ b/librb/src/event.c @@ -39,7 +39,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: event.c 26272 2008-12-10 05:55:10Z androsyn $ */ #include diff --git a/librb/src/gnutls.c b/librb/src/gnutls.c index 3bd65f80f..4038dc3dd 100644 --- a/librb/src/gnutls.c +++ b/librb/src/gnutls.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: gnutls.c 26296 2008-12-13 03:36:00Z androsyn $ */ #include diff --git a/librb/src/helper.c b/librb/src/helper.c index 0e653deaf..a8dabf3d9 100644 --- a/librb/src/helper.c +++ b/librb/src/helper.c @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: helper.c 26092 2008-09-19 15:13:52Z androsyn $ */ + #include #include #include diff --git a/librb/src/kqueue.c b/librb/src/kqueue.c index 7ab9cd72f..98e286b75 100644 --- a/librb/src/kqueue.c +++ b/librb/src/kqueue.c @@ -22,7 +22,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: kqueue.c 26092 2008-09-19 15:13:52Z androsyn $ */ #include diff --git a/librb/src/linebuf.c b/librb/src/linebuf.c index 51c97cd95..f14d4a982 100644 --- a/librb/src/linebuf.c +++ b/librb/src/linebuf.c @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: linebuf.c 26092 2008-09-19 15:13:52Z androsyn $ */ #include diff --git a/librb/src/mbedtls.c b/librb/src/mbedtls.c index a31b12e8e..0cf4330e0 100644 --- a/librb/src/mbedtls.c +++ b/librb/src/mbedtls.c @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id$ */ #include diff --git a/librb/src/nossl.c b/librb/src/nossl.c index 4cc9a06ef..e97843b93 100644 --- a/librb/src/nossl.c +++ b/librb/src/nossl.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio.c 24808 2008-01-02 08:17:05Z androsyn $ */ diff --git a/librb/src/openssl.c b/librb/src/openssl.c index eea76c6f9..a8d998c4d 100644 --- a/librb/src/openssl.c +++ b/librb/src/openssl.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio.c 24808 2008-01-02 08:17:05Z androsyn $ */ #include diff --git a/librb/src/patricia.c b/librb/src/patricia.c index 88f22077a..9db07138d 100644 --- a/librb/src/patricia.c +++ b/librb/src/patricia.c @@ -4,7 +4,6 @@ * This was then yanked out of the ratbox/devel/src tree and stuffed into * librb and had function names changed, but otherwise not really altered. * - * $Id: patricia.c 24244 2007-08-22 19:04:55Z androsyn $ * Dave Plonka * * This product includes software developed by the University of Michigan, diff --git a/librb/src/poll.c b/librb/src/poll.c index f53851b51..0356776cf 100644 --- a/librb/src/poll.c +++ b/librb/src/poll.c @@ -22,7 +22,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: poll.c 26092 2008-09-19 15:13:52Z androsyn $ */ #include #include diff --git a/librb/src/ports.c b/librb/src/ports.c index 2963aef0b..1527a915b 100644 --- a/librb/src/ports.c +++ b/librb/src/ports.c @@ -23,7 +23,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: ports.c 26286 2008-12-10 23:28:53Z androsyn $ */ #include diff --git a/librb/src/rawbuf.c b/librb/src/rawbuf.c index 29b06fbfd..4e83270ba 100644 --- a/librb/src/rawbuf.c +++ b/librb/src/rawbuf.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id$ */ #include #include diff --git a/librb/src/rb_lib.c b/librb/src/rb_lib.c index 54fe3bf52..041200f91 100644 --- a/librb/src/rb_lib.c +++ b/librb/src/rb_lib.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_lib.c 26282 2008-12-10 20:33:21Z androsyn $ */ #include diff --git a/librb/src/rb_memory.c b/librb/src/rb_memory.c index 3caa06ca9..32b2689a0 100644 --- a/librb/src/rb_memory.c +++ b/librb/src/rb_memory.c @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_memory.c 26092 2008-09-19 15:13:52Z androsyn $ */ #include #include diff --git a/librb/src/select.c b/librb/src/select.c index 6425e49d2..61d464a4e 100644 --- a/librb/src/select.c +++ b/librb/src/select.c @@ -22,8 +22,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: select.c 26092 2008-09-19 15:13:52Z androsyn $ */ + #define FD_SETSIZE 65535 #include #include diff --git a/librb/src/sigio.c b/librb/src/sigio.c index b847d0b02..d5faa171e 100644 --- a/librb/src/sigio.c +++ b/librb/src/sigio.c @@ -23,7 +23,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: sigio.c 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef _GNU_SOURCE diff --git a/librb/src/tools.c b/librb/src/tools.c index 03dd632e5..b42fdbaad 100644 --- a/librb/src/tools.c +++ b/librb/src/tools.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: tools.c 26170 2008-10-26 20:59:07Z androsyn $ * * Here is the original header: * @@ -32,6 +31,7 @@ * defined, tools.h will build inlined versions of the functions * on supported compilers */ + #define _GNU_SOURCE 1 #include #include diff --git a/librb/src/unix.c b/librb/src/unix.c index d1ae702e3..521f53298 100644 --- a/librb/src/unix.c +++ b/librb/src/unix.c @@ -21,8 +21,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: unix.c 26180 2008-11-11 00:00:12Z androsyn $ */ + #include #include diff --git a/librb/src/version.c.SH b/librb/src/version.c.SH index 6d0bf4426..22cb63f21 100644 --- a/librb/src/version.c.SH +++ b/librb/src/version.c.SH @@ -1,6 +1,5 @@ #!/bin/sh -# $Id: version.c.SH 24870 2008-01-10 16:51:01Z androsyn $ spitshell=cat package=librb @@ -21,7 +20,7 @@ $spitshell >version.c < @@ -415,7 +414,7 @@ rb_setup_fd_win32(rb_fde_t *F) { case RB_FD_SOCKET: { - u_long nonb = 1; + unsigned long nonb = 1; if(ioctlsocket((SOCKET) F->fd, FIONBIO, &nonb) == -1) { rb_get_errno(); diff --git a/modules/m_rehash.c b/modules/m_rehash.c index bd6670aaa..3151abfa8 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.c @@ -117,7 +117,7 @@ rehash_omotd(struct Client *source_p) remote_rehash_oper_p = source_p; free_cachefile(oper_motd); - oper_motd = cache_file(OPATH, "opers.motd", 0); + oper_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_OMOTD], "opers.motd", 0); } static void diff --git a/modules/m_starttls.c b/modules/m_starttls.c index dbbc71391..f49abb46d 100644 --- a/modules/m_starttls.c +++ b/modules/m_starttls.c @@ -95,7 +95,7 @@ mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou sendto_one_numeric(client_p, RPL_STARTTLS, form_str(RPL_STARTTLS)); send_queued(client_p); - ctl = start_ssld_accept(client_p->localClient->F, F[1], rb_get_fd(F[0])); + ctl = start_ssld_accept(client_p->localClient->F, F[1], client_p->localClient->connid); if (ctl != NULL) { client_p->localClient->F = F[0]; diff --git a/ssld/ssld.c b/ssld/ssld.c index 403a71a15..7a0dc20f5 100644 --- a/ssld/ssld.c +++ b/ssld/ssld.c @@ -459,7 +459,7 @@ common_zlib_inflate(conn_t * conn, void *buf, size_t len) } #endif -static int +static bool plain_check_cork(conn_t * conn) { if(rb_rawbuf_length(conn->modbuf_out) >= 4096) @@ -470,9 +470,9 @@ plain_check_cork(conn_t * conn) rb_setselect(conn->plain_fd, RB_SELECT_READ, NULL, NULL); /* try to write */ conn_mod_write_sendq(conn->mod_fd, conn); - return 1; + return true; } - return 0; + return false; }