summaryrefslogtreecommitdiff
path: root/server/access.h
blob: 43e0d7744eff684a21b24e4fde6903709d71833e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * This file is part of the Project Athena Zephyr Notification System.
 *
 * It contains declarations for use in the server, relating to access
 * control.
 *
 * Created by Ken Raeburn.
 *
 * $Source$
 * $Author$
 * $Id$
 *
 * Copyright (c) 1990 by the Massachusetts Institute of Technology.
 * For copying and distribution information, see the file
 * "mit-copyright.h".
 */

#include <zephyr/mit-copyright.h>

#include <zephyr/acl.h>
#include "ZString.h"
#include "unix.h"

typedef	enum _ZAccess_t {
	TRANSMIT,			/* use transmission acl */
	SUBSCRIBE,			/* use subscription acl */
	INSTWILD,			/* use instance wildcard acl */
	INSTUID				/* use instance UID identity acl */
} ZAccess_t;

class ZAcl_t {
	char *acl_filename;
	int	acl_types;	/* Flag field indcating which acls
				 are present.  Used ONLY in access.c */
    public:
	int ok (ZString, ZAccess_t);
	ZAcl_t (const char *path) {
	    extern char * strsave (const char *);
	    acl_filename = strsave (path);
	    acl_types = 0;
	    check ();
	}
	~ZAcl_t () {
	    xfree (acl_filename);
	}
    private:
	void check (void);
	void check_acl_type (ZAccess_t, int);
};

inline int access_check(ZString sender, ZAcl_t *acl, ZAccess_t accesstype) {
    return acl->ok (sender, accesstype);
}

/* found in access.c */
extern void access_init (void), access_reinit (void);

/* found in acl_files.c */
extern "C" int acl_load (char *);

/* external data relevant */
extern int zdebug;