]> git.sesse.net Git - itkacl/blob - itkacl-2.2/itkacl-test.c
Release a new version of the Apache module, with the context support.
[itkacl] / itkacl-2.2 / itkacl-test.c
1 #include <stdio.h>
2 #include "itkacl.h"
3
4 int main()
5 {
6         char errmsg[1024];
7         int ret;
8         struct itkacl_ctx *ctx;
9
10         ctx = itkacl_create_ctx(errmsg, sizeof(errmsg));
11         if (ctx == NULL) {
12                 printf("Error while creating context: %s\n", errmsg);
13                 return 1;
14         }
15
16         ret = itkacl_check_with_ctx(ctx, "/login/unix-servers/cirkus", "sesse", errmsg, sizeof(errmsg));
17
18         itkacl_free_ctx(ctx);
19
20         if (ret == 0) {
21                 printf("OK\n");
22         } else if (ret == -1) {
23                 printf("Error: %s\n", errmsg);
24         } else {
25                 printf("Not OK\n");
26         }
27         return 0;
28 }