summaryrefslogtreecommitdiff
path: root/test/oldacl.c
diff options
context:
space:
mode:
authorjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2008-10-14 19:19:41 +0000
committerjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2008-10-14 19:19:41 +0000
commit368fef44d8b9cc8cd1a527fab6aa9be20fd95e18 (patch)
tree9286382968d893baf5a8c3384f8e15744de1dbb1 /test/oldacl.c
parent580ad6f7786fba0740a00f98cf3d398bb5dfcd58 (diff)
downloadneon-368fef44d8b9cc8cd1a527fab6aa9be20fd95e18.tar.gz
Introduce new ACL interface under separate header, function name, and
restore API/ABI backwards-compat with old ACL interface: * src/ne_acl3744.c, src/ne_acl3744.h: Renamed from ne_acl.c, ne_acl.h. (ne_acl3744_set): Renamed from ne_acl_set. * src/ne_oldacl.c, src/ne_acl.h: Copied from old ne_acl.c, ne_acl.h on 0.28.x branch. * src/Makefile.in: Update deps. * test/acl3744.c: Renamed from acl.c. (test_acl): Call new function name. * test/oldacl.c: Copied from acl.c on 0.28.x branch. * test/Makefile.in: Update accordingly. * macros/neon.m4 (LIBNEON_SOURCE_CHECKS): Update for new source file names. * neon.mak: Update for new source file names. git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@1567 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'test/oldacl.c')
-rw-r--r--test/oldacl.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/test/oldacl.c b/test/oldacl.c
new file mode 100644
index 0000000..2e72caa
--- /dev/null
+++ b/test/oldacl.c
@@ -0,0 +1,101 @@
+/*
+ Dummy ACL tests
+ Copyright (C) 2001-2003, Joe Orton <joe@manyfish.co.uk>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "ne_acl.h"
+
+#include "tests.h"
+#include "child.h"
+#include "utils.h"
+
+/**** DUMMY TESTS: just makes sure the stuff doesn't dump core. */
+
+static int test_acl(const char *uri, ne_acl_entry *es, int nume)
+{
+ ne_session *sess;
+
+ CALL(make_session(&sess, single_serve_string,
+ "HTTP/1.1 200 OK\r\n"
+ "Connection: close\r\n\r\n"));
+
+ ON(ne_acl_set(sess, uri, es, nume));
+
+ CALL(await_server());
+ ne_session_destroy(sess);
+
+ return OK;
+}
+
+static int grant_all(void)
+{
+ ne_acl_entry e = {0};
+
+ e.apply = ne_acl_all;
+ e.type = ne_acl_grant;
+
+ CALL(test_acl("/foo", &e, 1));
+
+ return OK;
+}
+
+static int deny_all(void)
+{
+ ne_acl_entry e = {0};
+
+ e.apply = ne_acl_all;
+ e.type = ne_acl_deny;
+
+ CALL(test_acl("/foo", &e, 1));
+
+ return OK;
+}
+
+static int deny_one(void)
+{
+ ne_acl_entry e = {0};
+
+ e.apply = ne_acl_href;
+ e.type = ne_acl_deny;
+ e.principal = "http://webdav.org/users/joe";
+
+ CALL(test_acl("/foo", &e, 1));
+
+ return OK;
+}
+
+static int deny_byprop(void)
+{
+ ne_acl_entry e = {0};
+
+ e.apply = ne_acl_property;
+ e.type = ne_acl_deny;
+ e.principal = "owner";
+
+ CALL(test_acl("/foo", &e, 1));
+
+ return OK;
+}
+
+ne_test tests[] = {
+ T(grant_all),
+ T(deny_all),
+ T(deny_one),
+ T(deny_byprop),
+ T(NULL)
+};