3
* Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved.
5
* $Id: acls.l 8774 1996-07-22 20:49:46Z marc $
9
* Revision 1.3 1996/07/22 20:28:49 marc
10
* this commit includes all the changes on the OV_9510_INTEGRATION and
11
* OV_MERGE branches. This includes, but is not limited to, the new openvision
12
* admin system, and major changes to gssapi to add functionality, and bring
13
* the implementation in line with rfc1964. before committing, the
14
* code was built and tested for netbsd and solaris.
16
* Revision 1.2.4.1 1996/07/18 03:03:31 marc
17
* merged in changes from OV_9510_BP to OV_9510_FINAL1
19
* Revision 1.2.2.1 1996/06/20 21:56:31 marc
20
* File added to the repository on a branch
22
* Revision 1.2 1993/11/05 07:47:46 bjaspan
23
* add and use cmp_gss_names, fix regexp bug
25
* Revision 1.1 1993/11/05 07:08:48 bjaspan
30
#if !defined(lint) && !defined(__CODECENTER__)
31
static char *rcsid = "$Header$";
65
"modify" return (MODIFY);
66
"delete" return (DELETE);
67
^[^ \t\n]+ { tokval.s = yytext; return (ID); }
73
#include <gssapi/gssapi.h>
74
#include <gssapi/gssapi_krb5.h>
75
#include <ovsec_admin/admin.h>
77
typedef struct _entry {
84
static acl_entry *acl_head = NULL;
86
static void error(char *msg);
88
int parse_aclfile(FILE *acl_file)
90
OM_uint32 gssstat, minor_stat;
91
gss_buffer_desc in_buf;
98
while ((tok = yylex()) != 0) {
100
error("expected identifier");
104
entry = (acl_entry *) malloc(sizeof(acl_entry));
106
error("out of memory");
109
entry->name = strdup(tokval.s);
112
switch (tok = yylex()) {
114
entry->privs |= OVSEC_KADM_PRIV_GET;
117
entry->privs |= OVSEC_KADM_PRIV_ADD;
120
entry->privs |= OVSEC_KADM_PRIV_MODIFY;
123
entry->privs |= OVSEC_KADM_PRIV_DELETE;
126
error("expected privilege");
132
else if (tok == SEMI)
135
error("expected comma or semicolon");
140
in_buf.value = entry->name;
141
in_buf.length = strlen(entry->name) + 1;
142
gssstat = gss_import_name(&minor_stat, &in_buf,
143
gss_nt_krb5_name, &entry->gss_name);
144
if (gssstat != GSS_S_COMPLETE) {
145
error("invalid name");
149
if (acl_head == NULL) {
153
entry->next = acl_head;
163
int acl_check(gss_name_t caller, int priv)
169
if (cmp_gss_names(entry->gss_name, caller) && entry->privs & priv)
176
int cmp_gss_names(gss_name_t name1, gss_name_t name2)
178
OM_uint32 minor_stat;
180
(void) gss_compare_name(&minor_stat, name1, name2, &eq);
184
static void error(char *msg)
186
syslog(LOG_ERR, "Error while parsing acl file, line %d: %s\n",
190
yywrap() { return(1); }