diff --git a/lib/kafs/afskrb.c b/lib/kafs/afskrb.c index 3d4af8db1..8103cefc8 100644 --- a/lib/kafs/afskrb.c +++ b/lib/kafs/afskrb.c @@ -36,51 +36,10 @@ * SUCH DAMAGE. */ -#include "config.h" -#include "protos.h" +#include "kafs_locl.h" RCSID("$Id$"); -#include -#include -#include -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_IOCTL_H -#include -#endif -#ifdef HAVE_SYS_FILIO_H -#include -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif - -#ifdef HAVE_ARPA_NAMESER_H -#include -#endif -#ifdef HAVE_RESOLV_H -#include -#endif - -#include -#include - -#include - -#include "afssysdefs.h" - #define AUTH_SUPERUSER "afs" /* @@ -172,40 +131,37 @@ dns_find_cell(char *cell, char *dbserver) static char* realm_of_cell(char *cell) { - FILE *F; - char buf[1024]; - u_int32_t addr; - struct hostent *hp; - char *realm = NULL; + FILE *F; + char buf[1024]; + u_int32_t addr; + struct hostent *hp; + char *realm = NULL; - F = fopen(_PATH_CELLSERVDB, "r"); - while(F && !feof(F)){ - fgets(buf, 1024, F); - if(buf[0] != '>') - continue; - if(strncmp(buf+1, cell, strlen(cell)) == 0){ - fgets(buf, 1024, F); - if(feof(F)) - break; - addr = ip_aton(buf); - if(addr == 0) - break; - hp = gethostbyaddr((char*)&addr, 4, AF_INET); - if(hp == NULL) - break; - strcpy(buf, hp->h_name); - realm = krb_realmofhost(buf); - break; + if((F = fopen(_PATH_CELLSERVDB, "r"))){ + while(fgets(buf, sizeof(buf), F)){ + if(buf[0] != '>') + continue; + if(strncmp(buf + 1, cell, strlen(cell)) == 0){ + if(fgets(buf, sizeof(buf), F) == NULL) + break; + addr = ip_aton(buf); + if(addr == 0) + break; + hp = gethostbyaddr((char*)&addr, 4, AF_INET); + if(hp == NULL) + break; + strcpy(buf, hp->h_name); + realm = krb_realmofhost(buf); + break; + } + } + fclose(F); } - } - if(F) - fclose(F); - - if(realm == NULL){ - if(dns_find_cell(cell, buf) == 0) - realm = krb_realmofhost(buf); - } - return realm; + if(realm == NULL){ + if(dns_find_cell(cell, buf) == 0) + realm = krb_realmofhost(buf); + } + return realm; } /* diff --git a/lib/kafs/afslib.c b/lib/kafs/afslib.c index e9499aad2..6528b74b0 100644 --- a/lib/kafs/afslib.c +++ b/lib/kafs/afslib.c @@ -40,14 +40,9 @@ * This file is only used with AIX */ -#ifdef HAVE_CONFIG_H -#include -RCSID("$Id$"); -#endif +#include "kafs_locl.h" -#include -#include "kafs.h" -#include "afssysdefs.h" +RCSID("$Id$"); int aix_pioctl(char *a_path, diff --git a/lib/kafs/afssys.c b/lib/kafs/afssys.c index 610a0e696..0fc2efb98 100644 --- a/lib/kafs/afssys.c +++ b/lib/kafs/afssys.c @@ -36,39 +36,10 @@ * SUCH DAMAGE. */ -#include "config.h" -#include "protos.h" +#include "kafs_locl.h" RCSID("$Id$"); -#include -#include -#include -#include - -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_IOCTL_H -#include -#endif -#ifdef HAVE_SYS_FILIO_H -#include -#endif -#ifdef HAVE_SYS_SYSCALL_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#include - -#include "afssysdefs.h" - /* Magic to get AIX syscalls to work */ #ifdef _AIX @@ -77,8 +48,7 @@ static int (*Setpag)(void); #include "dlfcn.h" -static -int +static int isSuid() { int uid = getuid(); @@ -88,8 +58,7 @@ isSuid() return (uid != euid) || (gid != egid); } -static -int +static int aix_setup(void) { #ifdef STATIC_AFS_SYSCALLS @@ -124,6 +93,7 @@ aix_setup(void) #define UNKNOWN_ENTRY_POINT 6 static int afs_entry_point = UNKNOWN_ENTRY_POINT; + int k_pioctl(char *a_path, int o_opcode,