*
*/
#include "stdinc.h"
-#include "config.h"
+#include "defaults.h"
#include "client.h"
#include "ircd.h"
#include "match.h"
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))
+ unsigned char m = (0xFF << (8 - (mask % 8)));
+ if (mask % 8 == 0 || (((unsigned char *) addr)[n] & m) == (((unsigned char *) dest)[n] & m))
{
return (1);
}
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;
iaddr = &((struct sockaddr_in *)(void *)addr)->sin_addr;
idest = &((struct sockaddr_in *)(void *)dest)->sin_addr;
}
-#ifdef RB_IPV6
else
{
iaddr = &((struct sockaddr_in6 *)(void *)addr)->sin6_addr;
idest = &((struct sockaddr_in6 *)(void *)dest)->sin6_addr;
}
-#endif
return (comp_with_mask(iaddr, idest, mask));
}
void *ipptr, *maskptr;
int cidrlen, aftype;
- strcpy(mask, s1);
- strcpy(address, s2);
+ rb_strlcpy(mask, s1, sizeof(mask));
+ rb_strlcpy(address, s2, sizeof(address));
len = strrchr(mask, '/');
if (len == NULL)
if (cidrlen <= 0)
return 0;
-#ifdef RB_IPV6
if (strchr(mask, ':') && strchr(address, ':'))
{
if (cidrlen > 128)
ipptr = &((struct sockaddr_in6 *)&ipaddr)->sin6_addr;
maskptr = &((struct sockaddr_in6 *)&maskaddr)->sin6_addr;
}
- else
-#endif
- if (!strchr(mask, ':') && !strchr(address, ':'))
+ else if (!strchr(mask, ':') && !strchr(address, ':'))
{
if (cidrlen > 32)
return 0;
void *ipptr, *maskptr;
int cidrlen, aftype;
- strcpy(mask, s1);
- strcpy(address, s2);
+ rb_strlcpy(mask, s1, sizeof(mask));
+ rb_strlcpy(address, s2, sizeof(address));
ipmask = strrchr(mask, '@');
if (ipmask == NULL)
if (cidrlen <= 0)
return 0;
-#ifdef RB_IPV6
if (strchr(ip, ':') && strchr(ipmask, ':'))
{
if (cidrlen > 128)
ipptr = &((struct sockaddr_in6 *)&ipaddr)->sin6_addr;
maskptr = &((struct sockaddr_in6 *)&maskaddr)->sin6_addr;
}
- else
-#endif
- if (!strchr(ip, ':') && !strchr(ipmask, ':'))
+ else if (!strchr(ip, ':') && !strchr(ipmask, ':'))
{
if (cidrlen > 32)
return 0;
* NOTE: RFC 1459 sez: anything but a ^G, comma, or space is allowed
* for channel names
*/
-const unsigned int CharAttrs[] = {
+unsigned int CharAttrs[] = {
/* 0 */ CNTRL_C,
/* 1 */ CNTRL_C | CHAN_C | NONEOS_C,
/* 2 */ CNTRL_C | CHAN_C | FCHAN_C | NONEOS_C,