1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-28 20:16:37 +02:00

Misc. fixes

This commit is contained in:
codemastr
2003-01-11 19:33:42 +00:00
parent fe9dc6d3c4
commit fed61efcdb
6 changed files with 27 additions and 22 deletions
+1
View File
@@ -1765,3 +1765,4 @@ seen. gmtime warning still there
is specified as encrypted. (#0000597)
- Fixed bug #0000601 reported by cate where specifying just a :port number for set::scan::endpoint
caused a seg fault.
- Added some patches by Syzop to fix a variety of different bugs
+2
View File
@@ -325,6 +325,7 @@ extern int parse(aClient *, char *, char *);
extern int do_numeric(int, aClient *, aClient *, int, char **);
extern int hunt_server(aClient *, aClient *, char *, int, int, char **);
extern int hunt_server_token(aClient *, aClient *, char *, char *, char *, int, int, char **);
extern int hunt_server_token_quiet(aClient *, aClient *, char *, char *, char *, int, int, char **);
extern aClient *next_client(aClient *, char *);
extern int m_umode(aClient *, aClient *, int, char **);
extern int m_names(aClient *, aClient *, int, char **);
@@ -525,6 +526,7 @@ extern u_long cres_mem(aClient *sptr, char *nick);
extern void flag_add(char *ch);
extern void flag_del(char ch);
extern void init_dynconf(void);
extern char *pretty_time_val(long);
extern int init_conf(char *filename, int rehash);
extern void validate_configuration(void);
extern void run_configuration(void);
+10 -3
View File
@@ -67,6 +67,10 @@ static inline int match2(char *mask, char *name)
}
else if (cm != '?' && lc(cm) != lc(*n))
return 1; /* most likely first chars won't match */
else if ((*m == '\0') && (*n == '\0'))
return 0; /* true: both are empty */
else if (*n == '\0')
return 1; /* false: name is empty */
else
{
m++;
@@ -98,6 +102,8 @@ static inline int match2(char *mask, char *name)
do
{
m++; /* go to the next char of both */
if (!*n)
return 1; /* false: no character left */
n++;
if (!*n) /* if end of test string... */
return (!*m ? 0 : 1); /* true if end of mask str, else false */
@@ -110,9 +116,9 @@ static inline int match2(char *mask, char *name)
cm = lc(cm);
while (lc(*n) != cm)
{ /* compare */
n++; /* go to next char of n */
if (!*n) /* if at end of n string */
return 1; /* function becomes false. */
n++; /* go to next char of n */
}
wsm = m; /* mark after where wildcard found */
cm = lc(*(++m)); /* go to next mask char */
@@ -123,6 +129,8 @@ static inline int match2(char *mask, char *name)
if (cm == '?') /* found ? wildcard */
{
cm = lc(*(++m)); /* just skip and go to next */
if (!*n)
return 1; /* false: no character left */
n++;
if (!*n) /* return true if end of both, */
return (cm ? 1 : 0); /* false if end of test str only */
@@ -131,7 +139,6 @@ static inline int match2(char *mask, char *name)
if (cm == '\\') /* next char will not be a wildcard. */
{ /* skip wild checking, don't continue */
cm = lc(*(++m));
n++;
}
/* Complicated to read, but to save CPU time. Every ounce counts. */
if (lc(*n) != cm) /* if the current chars don't equal, */
@@ -143,9 +150,9 @@ static inline int match2(char *mask, char *name)
cm = lc(*m);
while (cm != lc(*n))
{ /* compare them */
n++; /* go to next char of n */
if (!*n) /* if we reached end of n string, */
return 1; /* function becomes false. */
n++; /* go to next char of n */
}
wsn = n; /* mark spot first char was found */
}
+4 -3
View File
@@ -199,7 +199,7 @@ int Scan_IsBeingChecked(struct IN_ADDR *ia)
IRCMutexLock(Scannings_lock);
for (sr = Scannings; sr; sr = sr->next)
{
if (!bcmp(&sr->in, ia, sizeof(Scan_AddrStruct)))
if (!bcmp(&sr->in, ia, sizeof(struct IN_ADDR)))
{
ret = 1;
break;
@@ -347,7 +347,7 @@ DLLFUNC int h_scan_connect(aClient *sptr)
* };
*
*/
DLLFUNC h_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
DLLFUNC int h_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
ConfigEntry *cep;
int errors = 0;
@@ -439,7 +439,7 @@ DLLFUNC h_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
return 0;
}
DLLFUNC h_config_run(ConfigFile *cf, ConfigEntry *ce, int type) {
DLLFUNC int h_config_run(ConfigFile *cf, ConfigEntry *ce, int type) {
ConfigEntry *cep;
int errors = 0;
@@ -515,6 +515,7 @@ DLLFUNC int h_config_rehash()
{
if (scan_message)
MyFree(scan_message);
return 1;
}
DLLFUNC int h_stats_scan(aClient *sptr, char *stats) {
+2 -11
View File
@@ -135,20 +135,11 @@ struct _timeb nowt;
/* Grab OS specific "random" data */
#ifndef _WIN32
gettimeofday(&nowt, NULL);
fd = open("/dev/random", O_RDONLY);
fd = open("/dev/urandom", O_RDONLY);
if (fd) {
(void)read(fd, &xrnd, sizeof(int));
Debug((DEBUG_INFO, "init_random: read from /dev/random: 0x%.8x", xrnd));
Debug((DEBUG_INFO, "init_random: read from /dev/urandom: 0x%.8x", xrnd));
close(fd);
} else {
fd = open("/dev/urandom", O_RDONLY);
if (fd) {
(void)read(fd, &xrnd, sizeof(int));
Debug((DEBUG_INFO, "init_random: read from /dev/urandom: 0x%.8x", xrnd));
close(fd);
} else {
Debug((DEBUG_INFO, "init_random: [BAD] nothing read from random devices"));
}
}
#else
_ftime(&nowt);
+8 -5
View File
@@ -392,7 +392,7 @@ void ipport_seperate(char *string, char **ip, char **port)
/* handle ipv6 type of ip address */
if (*string == '[')
{
if (f = strrchr(string, ']'))
if ((f = strrchr(string, ']')))
{
*ip = string + 1; /* skip [ */
*f = '\0'; /* terminate the ip string */
@@ -404,7 +404,7 @@ void ipport_seperate(char *string, char **ip, char **port)
}
}
/* handle ipv4 and port */
else if (f = strchr(string, ':'))
else if ((f = strchr(string, ':')))
{
/* we found a colon... we may have ip:port or just :port */
if (f == string)
@@ -532,7 +532,8 @@ tolower(*(text+1)) == 'n') || *text == '1' || tolower(*text) == 't') {
break;
}
ret += atoi(sz+1)*mfactor;
if (*text == '\0')
break;
}
}
mfactor = 1;
@@ -1033,6 +1034,8 @@ void free_iConf(aConfiguration *i)
ircfree(i->network.x_stats_server);
}
int config_test();
int init_conf(char *rootconf, int rehash)
{
ConfigItem_include *inc, *next;
@@ -4027,8 +4030,8 @@ int _test_badword(ConfigFile *conf, ConfigEntry *ce) {
else
{
int errorcode, errorbufsize, regex;
char *errorbuf, *tmp, *tmpbuf;
int errorcode, errorbufsize, regex=0;
char *errorbuf, *tmp, *tmpbuf=NULL;
for (tmp = word->ce_vardata; *tmp; tmp++) {
if ((int)*tmp < 65 || (int)*tmp > 123) {
regex = 1;