Merge pull request #175 from staticfox/datatypes
Move away from BSD data types
This commit is contained in:
commit
5ee46e5127
4 changed files with 28 additions and 28 deletions
|
@ -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
|
||||
|
|
|
@ -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 != ' '))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue