blob: 4da14cee2338b0b0c417f92b52c7324eed352481 (
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
|
/** BEGIN COPYRIGHT BLOCK
* Copyright 2001 Sun Microsystems, Inc.
* Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
* All rights reserved.
* END COPYRIGHT BLOCK **/
/*
* ACL parser unit test program
*/
#include <stdio.h>
#include <netsite.h>
#include <libaccess/acl.h>
#include <libaccess/nserror.h>
#include "../aclpriv.h"
#include <libaccess/aclproto.h>
main(int argc, char **argv)
{
ACLListHandle_t *acllist;
int ii;
char filename[255];
ACLWrapper_t *wrap;
ACLExprHandle_t *expr;
if ( argc < 2 ) {
fprintf(stderr, "usage: aclparse <filenames>\n");
exit(1);
}
for (ii = 1; ii < argc; ii++ ) {
acllist = ACL_ParseFile(NULL, argv[ii]);
if ( acllist == NULL ) {
printf("Failed to parse ACL.\n");
} else {
for (wrap = acllist->acl_list_head; wrap;
wrap = wrap->wrap_next) {
for (expr=wrap->acl->expr_list_head;
expr;
expr = expr->expr_next ) {
ACL_ExprDisplay(expr);
}
}
}
sprintf(filename, "%s.v30", argv[ii]);
ACL_WriteFile(NULL, filename, acllist);
ACL_ListDestroy( acllist );
}
}
|