#ifdef INTERNET_DOMAIN_SOCKETS
struct entry {
- u_long host_addr;
+ unsigned long host_addr;
struct entry *next;
};
permitted -- return whether a given host is allowed to connect to the server.
*/
static int
-permitted (u_long host_addr, int fd)
+permitted (unsigned long host_addr, int fd)
{
int key;
struct entry *entry;
char auth_protocol[128];
char buf[1024];
int auth_data_len;
- int auth_data_pos;
- int auth_mismatches;
if (fd > 0)
{
auth_data_len = atoi(buf);
- if (auth_data_len <= 0 || auth_data_len > sizeof(buf))
+ if (auth_data_len <= 0 || auth_data_len > (int) sizeof(buf))
{
return FALSE;
}
#ifdef AUTH_MAGIC_COOKIE
if (server_xauth && server_xauth->data)
- {
+ {
/* Do a compare without comprising info about
the size of the cookie */
- auth_mismatches =
+ int auth_data_pos;
+ int auth_mismatches =
( auth_data_len ^
server_xauth->data_length );
return TRUE;
for(;rand() % 1000;);
- }
+ }
#else
printf ("client tried Xauth, but server is not compiled with Xauth\n");
already there.
*/
static void
-add_host (u_long host_addr)
+add_host (unsigned long host_addr)
{
int key;
struct entry *new_entry;
FILE *host_file;
char *file_name;
char hostname[HOSTNAMSZ];
- u_int host_addr;
+ unsigned int host_addr;
int i, hosts=0;
+ int t;
/* Make sure every entry is null */
for (i=0; i<TABLE_SIZE; i++)
gethostname(hostname,HOSTNAMSZ);
- if ((host_addr = internet_addr(hostname)) == -1)
- {
+ if ((t = internet_addr(hostname)) == -1) {
fprintf(stderr,"%s: unable to find %s in /etc/hosts or from YP",
progname,hostname);
exit(1);
- } /* if */
-
+ } else {
+ host_addr = t;
+ } /* if */
+
#ifdef AUTH_MAGIC_COOKIE
server_xauth = XauGetAuthByAddr (FamilyInternet,
if (((file_name = getenv("GNU_SECURE")) != NULL && /* security file */
(host_file = fopen(file_name,"r")) != NULL)) /* opened ok */
{
- while ((fscanf(host_file,"%s",hostname) != EOF)) /* find a host */
- if ((host_addr = internet_addr(hostname)) != -1)/* get its addr */
+ while ((fscanf(host_file,"%s",hostname) != EOF)) { /* find a host */
+ t = internet_addr(hostname);
+ if (t != -1)/* get its addr */
{
+ host_addr = t;
add_host(host_addr); /* add the addr */
hosts++;
}
+ }
fclose(host_file);
} /* if */