summaryrefslogtreecommitdiff
path: root/kerberosIV/acl/acl_files.c
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1995-12-14 08:43:57 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1995-12-14 08:43:57 +0000
commitb9bde382b38aba7823a008759b0b88b6c7a68966 (patch)
tree2df6948320f675f2f3b178831a2c18f8062fc4d3 /kerberosIV/acl/acl_files.c
parent51285176beb2daf7fedfbdc3f22cb775c29ef5af (diff)
Do not use hardcoded realm or host names
Diffstat (limited to 'kerberosIV/acl/acl_files.c')
-rw-r--r--kerberosIV/acl/acl_files.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/kerberosIV/acl/acl_files.c b/kerberosIV/acl/acl_files.c
index 545db32ca4d..03dd041d60b 100644
--- a/kerberosIV/acl/acl_files.c
+++ b/kerberosIV/acl/acl_files.c
@@ -1,4 +1,4 @@
-/* $Id: acl_files.c,v 1.1 1995/12/14 06:52:36 tholo Exp $ */
+/* $Id: acl_files.c,v 1.2 1995/12/14 08:43:39 tholo Exp $ */
/*-
* Copyright (C) 1989 by the Massachusetts Institute of Technology
@@ -66,7 +66,7 @@
/* If realm is missing, it becomes the local realm */
/* Canonicalized form is put in canon, which must be big enough to hold
MAX_PRINCIPAL_SIZE characters */
-void
+int
acl_canonicalize_principal(principal, canon)
char *principal;
char *canon;
@@ -84,7 +84,7 @@ acl_canonicalize_principal(principal, canon)
/* Copy into canon */
strncpy(canon, principal, MAX_PRINCIPAL_SIZE);
canon[MAX_PRINCIPAL_SIZE-1] = '\0';
- return;
+ return(0);
} else {
/* Nope, it's part of the realm */
dot = NULL;
@@ -122,8 +122,9 @@ acl_canonicalize_principal(principal, canon)
canon += len;
*canon++ = '\0';
} else if(krb_get_lrealm(canon, 1) != KSUCCESS) {
- strcpy(canon, KRB_REALM);
+ return(-1);
}
+ return(0);
}
/* Get a lock to modify acl_file */
@@ -438,7 +439,8 @@ acl_load(name)
acl_cache[i].acl = make_hash(ACL_LEN);
while(fgets(buf, sizeof(buf), f) != NULL) {
nuke_whitespace(buf);
- acl_canonicalize_principal(buf, canon);
+ if (acl_canonicalize_principal(buf, canon) < 0)
+ return(-1);
add_hash(acl_cache[i].acl, canon);
}
fclose(f);
@@ -472,7 +474,8 @@ acl_check(acl, principal)
char canon[MAX_PRINCIPAL_SIZE];
char *realm;
- acl_canonicalize_principal(principal, canon);
+ if (acl_canonicalize_principal(principal, canon) < 0)
+ return(0);
/* Is it there? */
if(acl_exact_match(acl, canon)) return(1);
@@ -502,7 +505,8 @@ acl_add(acl, principal)
FILE *new;
char canon[MAX_PRINCIPAL_SIZE];
- acl_canonicalize_principal(principal, canon);
+ if (acl_canonicalize_principal(principal, canon) < 0)
+ return(-1);
if((new = acl_lock_file(acl)) == NULL) return(-1);
if((acl_exact_match(acl, canon))
@@ -537,7 +541,8 @@ acl_delete(acl, principal)
FILE *new;
char canon[MAX_PRINCIPAL_SIZE];
- acl_canonicalize_principal(principal, canon);
+ if (acl_canonicalize_principal(principal, canon) < 0)
+ return(-1);
if((new = acl_lock_file(acl)) == NULL) return(-1);
if((!acl_exact_match(acl, canon))