0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

Merge branch 'master' into authd-framework-2

This commit is contained in:
Elizabeth Myers 2016-03-25 11:49:38 -05:00
commit 800ff2ca9d
72 changed files with 292 additions and 226 deletions

View file

@ -26,6 +26,7 @@ in nick-alphabetical order:
AndroSyn, Aaron Sethman <androsyn -at- ratbox.org>
anfl, Lee Hardy <lee -at- leeh.co.uk>
beu, Elfyn McBratney <elfyn.mcbratney -at- gmail.com>
BlindSight, Matt Ullman <matt -at- airraidsirens.com>
Entrope, Michael Poole <mdpoole -at- trolius.org>
gxti, Michael Tharp <gxti -at- partiallystapled.com>
Taros, Brett Greenham <taros -at- shadowircd.net>

View file

@ -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

View file

@ -30,8 +30,7 @@
#ifdef _WIN32
#include <rb_lib.h>
#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));
}

View file

@ -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

View file

@ -46,8 +46,6 @@
#include "getaddrinfo.h"
#include "getnameinfo.h"
/* $Id$ */
static const struct afd {
int a_af;
int a_addrlen;

View file

@ -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,

View file

@ -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; \

View file

@ -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."

View file

@ -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 <sys/types.h>
#include <netinet/in.h>]])
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.])],

View file

@ -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,

View file

@ -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 */

View file

@ -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);

View file

@ -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

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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);
}

View file

@ -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()

View file

@ -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 != ' '))

View file

@ -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)
{

View file

@ -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;

View file

@ -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. */

View file

@ -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;

View file

@ -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)

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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",
" ",

View file

@ -16,3 +16,5 @@ include/serno.h:
echo '#define DATECODE 0UL' >>include/serno.h; \
fi
clean-local:
rm -f include/serno.h

View file

@ -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
])

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,5 +1,4 @@
/*
* $Id: patricia.h 23020 2006-09-01 18:20:19Z androsyn $
* Dave Plonka <plonka@doit.wisc.edu>
*
* 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))

View file

@ -20,7 +20,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id$
*/
#ifndef RB_LIB_H

View file

@ -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

View file

@ -1,2 +0,0 @@
#define SERNO "20160307-81204be"
#define DATECODE 1457395822UL

View file

@ -1,4 +1,3 @@
# $Id: Makefile.am 26046 2008-09-09 16:37:30Z androsyn $
AUTOMAKE_OPTIONS = foreign

View file

@ -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 $ */

View file

@ -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 $
*/
/*

View file

@ -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 <librb_config.h>
#include <rb_lib.h>
#include <commio-int.h>

View file

@ -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);
}

View file

@ -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 <librb_config.h>
#include <rb_lib.h>
#include <commio-int.h>

View file

@ -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 <librb_config.h>

View file

@ -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 <librb_config.h>

View file

@ -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 <librb_config.h>

View file

@ -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 <librb_config.h>
#include <rb_lib.h>
#include <commio-int.h>

View file

@ -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 <librb_config.h>

View file

@ -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 <librb_config.h>

View file

@ -21,7 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id$
*/
#include <librb_config.h>

View file

@ -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 $
*/

View file

@ -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 <librb_config.h>

View file

@ -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 <plonka@doit.wisc.edu>
*
* This product includes software developed by the University of Michigan,

View file

@ -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 <librb_config.h>
#include <rb_lib.h>

View file

@ -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 <librb_config.h>

View file

@ -20,7 +20,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id$
*/
#include <librb_config.h>
#include <rb_lib.h>

View file

@ -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 <librb_config.h>

View file

@ -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 <librb_config.h>
#include <rb_lib.h>

View file

@ -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 <librb_config.h>
#include <rb_lib.h>

View file

@ -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

View file

@ -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 <librb_config.h>
#include <rb_lib.h>

View file

@ -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 <librb_config.h>
#include <rb_lib.h>

View file

@ -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 <<!SUB!THIS!
/*
* librb: a library used by charybdis and other things
* src/version.c
*
*
* Copyright (C) 1990 Chelsea Ashley Dyerman
* Copyright (C) 2008 ircd-ratbox development team
*
@ -55,7 +54,7 @@ const char *librb_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-2008 ircd-ratbox Development Team",
"",
"This program is free software; you can redistribute it and/or",

View file

@ -23,7 +23,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: win32.c 26092 2008-09-19 15:13:52Z androsyn $
*/
#include <librb_config.h>
@ -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();

View file

@ -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

View file

@ -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];

View file

@ -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;
}