From 213f677dad7489cde681880ea481318441f9d44e Mon Sep 17 00:00:00 2001 From: John Kohl Date: Mon, 28 Sep 1987 12:30:51 +0000 Subject: clean up comments; add code for dealing with the class registry --- server/access.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'server/access.c') diff --git a/server/access.c b/server/access.c index 9b126a4..d30659e 100644 --- a/server/access.c +++ b/server/access.c @@ -27,11 +27,13 @@ static char rcsid_acl_s_c[] = "$Header$"; * ZNotice_t *notice; * ZAcl_t *acl; * ZAccess_t accesstype; + * + * void access_init(); */ /* - * Each restricted class has two ACL's associated with it, one - * governing subscriptions and one governing transmission. + * Each restricted class has four ACL's associated with it, + * governing subscriptions, transmission, and instance restrictions. * This module provides the 'glue' between the standard Athena ACL * routines and the support needed by the Zephyr server. */ @@ -69,7 +71,7 @@ ZAccess_t accesstype; syslog(LOG_ERR, "unknown access type %d", (int) accesstype); return(0); } - (void) sprintf(buf, "%s%s-%s", + (void) sprintf(buf, "%s%s-%s.acl", ZEPHYR_ACL_DIR, prefix, acl->acl_filename); @@ -78,3 +80,34 @@ ZAccess_t accesstype; return(1); return(acl_check(buf, notice->z_sender)); } + +int +access_init() +{ + char buf[MAXPATHLEN]; + char class[512]; /* assume class names <= 511 bytes */ + FILE *registry; + ZAcl_t *acl; + register int len; + + (void) sprintf(buf, "%s%s", ZEPHYR_ACL_DIR, ZEPHYR_CLASS_REGISTRY); + + if ((registry = fopen(buf, "r")) == (FILE *) NULL) { + syslog(LOG_ERR, "no registry available, all classes are free"); + return; + } + while (fgets(class, 512, registry) != NULL) { + if (len = strlen(class)) + class[len - 1] = '\0'; + acl = (ZAcl_t *) xmalloc(sizeof(ZAcl_t)); + if (!acl) { + syslog(LOG_ERR, "no mem acl alloc"); + abort(); + } + acl->acl_filename = strsave(class); + (void) class_setup_restricted(class, acl); + } + (void) fclose(registry); + + return; +} -- cgit v1.2.3