version 1.4, 1999/09/30 05:43:33 |
version 1.5, 1999/10/03 20:09:18 |
|
|
#include "xmalloc.h" |
#include "xmalloc.h" |
#include "uidswap.h" |
#include "uidswap.h" |
|
|
/* Returns true if the strings are equal, ignoring case (a-z only). */ |
|
|
|
static int casefold_equal(const char *a, const char *b) |
|
{ |
|
unsigned char cha, chb; |
|
for (; *a; a++, b++) |
|
{ |
|
cha = *a; |
|
chb = *b; |
|
if (!chb) |
|
return 0; |
|
if (cha >= 'a' && cha <= 'z') |
|
cha -= 32; |
|
if (chb >= 'a' && chb <= 'z') |
|
chb -= 32; |
|
if (cha != chb) |
|
return 0; |
|
} |
|
return !*b; |
|
} |
|
|
|
/* This function processes an rhosts-style file (.rhosts, .shosts, or |
/* This function processes an rhosts-style file (.rhosts, .shosts, or |
/etc/hosts.equiv). This returns true if authentication can be granted |
/etc/hosts.equiv). This returns true if authentication can be granted |
based on the file, and returns zero otherwise. */ |
based on the file, and returns zero otherwise. */ |
|
|
continue; |
continue; |
} |
} |
else |
else |
if (!casefold_equal(host, hostname) && strcmp(host, ipaddr) != 0) |
if (strcasecmp(host, hostname) && strcmp(host, ipaddr) != 0) |
continue; /* Different hostname. */ |
continue; /* Different hostname. */ |
|
|
/* Verify that user name matches. */ |
/* Verify that user name matches. */ |