summaryrefslogtreecommitdiff
path: root/server/access.c
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1987-09-28 12:30:51 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1987-09-28 12:30:51 +0000
commit213f677dad7489cde681880ea481318441f9d44e (patch)
tree2307005c98967f142e353ae74dd12a0afa43672b /server/access.c
parent43958ba0117930de2869f6d44542e788656bb5c2 (diff)
clean up comments; add code for dealing with the class registry
Diffstat (limited to 'server/access.c')
-rw-r--r--server/access.c39
1 files changed, 36 insertions, 3 deletions
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;
+}