summaryrefslogtreecommitdiffstats
path: root/lib/libaccess
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2005-03-07 15:35:39 +0000
committerRob Crittenden <rcritten@redhat.com>2005-03-07 15:35:39 +0000
commitae8bac2a32815e92b6691266b722d539f0752c15 (patch)
tree1b83a3847b9ad3ab686db4c05e7342f44959e855 /lib/libaccess
parentab37199479f849ecae189e1a2314da49cc906187 (diff)
downloadds-ae8bac2a32815e92b6691266b722d539f0752c15.tar.gz
ds-ae8bac2a32815e92b6691266b722d539f0752c15.tar.xz
ds-ae8bac2a32815e92b6691266b722d539f0752c15.zip
149510
Fix ACL unit test compile errors and warnings. All tests pass 100% now.
Diffstat (limited to 'lib/libaccess')
-rw-r--r--lib/libaccess/utest/Makefile5
-rw-r--r--lib/libaccess/utest/acltest.cpp43
-rw-r--r--lib/libaccess/utest/onetest.cpp9
-rw-r--r--lib/libaccess/utest/test.ref17
-rw-r--r--lib/libaccess/utest/twotest.cpp9
-rw-r--r--lib/libaccess/utest/ustubs.cpp44
6 files changed, 38 insertions, 89 deletions
diff --git a/lib/libaccess/utest/Makefile b/lib/libaccess/utest/Makefile
index bfcabb2e..fda7ee78 100644
--- a/lib/libaccess/utest/Makefile
+++ b/lib/libaccess/utest/Makefile
@@ -39,12 +39,12 @@ XSRC = \
../aclspace.cpp \
../lasgroup.cpp \
../lasuser.cpp \
- ../lasprogram.cpp \
../nseframe.cpp \
../aclcache.cpp \
../register.cpp \
../symbols.cpp \
../method.cpp \
+ ../access_plhash.cpp \
../authdb.cpp
COBJ = $(CSRC:%.cpp=%.o)
@@ -68,7 +68,6 @@ XLIBS+= $(OBJDIR)/lib/base/plist.o \
$(OBJDIR)/lib/base/ereport.o \
$(OBJDIR)/lib/base/system.o \
$(OBJDIR)/lib/base/shexp.o \
- $(OBJDIR)/lib/base/pblock.o \
$(OBJDIR)/lib/base/file.o \
$(OBJDIR)/lib/base/systhr.o \
$(OBJDIR)/lib/base/nscperror.o \
@@ -79,7 +78,7 @@ all: $(COBJ) $(TSRC) acltest
./acltest > test.out
diff test.ref test.out
@echo
- @echo "The unit test is passed if there is no diff output, and the"
+ @echo "The unit test has passed if there is no diff output and the"
@echo "Purify window shows no errors and 0 bytes leaked."
@echo
@echo "Run - gmake coverage - manually to get code coverage analysis."
diff --git a/lib/libaccess/utest/acltest.cpp b/lib/libaccess/utest/acltest.cpp
index a4a7b186..ba7790ba 100644
--- a/lib/libaccess/utest/acltest.cpp
+++ b/lib/libaccess/utest/acltest.cpp
@@ -5,8 +5,6 @@
* END COPYRIGHT BLOCK **/
#include <stdio.h>
#include <netsite.h>
-#include <base/session.h>
-#include <base/daemon.h>
#include <base/systhr.h>
#include <libaccess/nserror.h>
#include <libaccess/acl.h>
@@ -42,7 +40,7 @@ static int parse_dburl (NSErr_t *errp, ACLDbType_t dbtype,
}
-main()
+int main(int argc, char **argv)
{
ACLListHandle_t *acl_list;
int result;
@@ -232,6 +230,7 @@ main()
eval.subject = NULL;
eval.resource = NULL;
+ eval.default_result = ACL_RES_DENY;
for (i=0; i<10; i++) {
sprintf(filename, "aclfile%d", i);
@@ -437,44 +436,6 @@ skip_test:
printf("%s = %d\n\n", filename, result);
}
- /*
- * Program LAS Unit Tests
- */
- char *groups[32] = {
- "http-foo",
- "http-bar",
- "http-grog",
- NULL
- };
- char *programs[32] = {
- "foo, fubar, frobozz",
- "bar, shoo, fly",
- "grog, beer",
- NULL
- };
- struct program_groups program_groups;
- program_groups.groups = groups;
- program_groups.programs = programs;
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo, http-bar,http-grog", &cachable, &las_cookie, (PList_t)"foo", (PList_t)&program_groups, NULL, NULL);
- printf("program = foo %d\n\n", result);
-
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo, http-bar,http-grog", &cachable, &las_cookie, (PList_t)"nomatch", (PList_t)&program_groups, NULL, NULL);
- printf("program = nomatch %d\n\n", result);
-
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo, http-bar,http-grog", &cachable, &las_cookie, (PList_t)"beer", (PList_t)&program_groups, NULL, NULL);
- printf("program = beer %d\n\n", result);
-
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo, http-bar, http-grog", &cachable, &las_cookie, (PList_t)"http-grog", (PList_t)&program_groups, NULL, NULL);
- printf("program = http-grog %d\n\n", result);
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo", &cachable, &las_cookie, (PList_t)"ubar", (PList_t)&program_groups, NULL, NULL);
- printf("program = ubar %d\n\n", result);
-
-
/*
* DNS LAS Unit Tests
*/
diff --git a/lib/libaccess/utest/onetest.cpp b/lib/libaccess/utest/onetest.cpp
index 8068828e..478605a6 100644
--- a/lib/libaccess/utest/onetest.cpp
+++ b/lib/libaccess/utest/onetest.cpp
@@ -6,7 +6,6 @@
#include <stdio.h>
#include <netsite.h>
#include <libaccess/nserror.h>
-#include <base/session.h>
#include <libaccess/acl.h>
#include "../aclpriv.h"
#include <libaccess/aclproto.h>
@@ -15,18 +14,13 @@
#include <base/ereport.h>
extern ACLListHandle_t *ACL_ParseFile(NSErr_t *errp, char *filename);
-extern ACLEvalDestroyContext(NSErr_t *errp, ACLEvalHandle_t *acleval);
-main(int arc, char **argv)
+int main(int arc, char **argv)
{
int result;
- int cachable;
- void *las_cookie=NULL;
ACLEvalHandle_t eval;
char *rights[2];
- char filename[20];
- int i;
char *bong;
char *bong_type;
char *acl_tag;
@@ -40,7 +34,6 @@ main(int arc, char **argv)
eval.acllist = ACL_ParseFile((NSErr_t *)NULL, argv[1]);
result = ACL_EvalTestRights(NULL, &eval, &rights[0], NULL, &bong, &bong_type, &acl_tag, &expr_num);
- ACLEvalDestroyContext(NULL, &eval);
ACL_ListDestroy(NULL, eval.acllist);
printf("%s = %d\n\n", argv[1], result);
diff --git a/lib/libaccess/utest/test.ref b/lib/libaccess/utest/test.ref
index 329c3272..1a2d060f 100644
--- a/lib/libaccess/utest/test.ref
+++ b/lib/libaccess/utest/test.ref
@@ -1,10 +1,3 @@
-#
-# BEGIN COPYRIGHT BLOCK
-# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
-# Copyright (C) 2005 Red Hat, Inc.
-# All rights reserved.
-# END COPYRIGHT BLOCK
-#
Failed ACL_FileMergeFile() test.
Method one is #1, rv=0
Method two is #2, rv=0
@@ -68,16 +61,6 @@ aclfile18 = 0
aclfile19 = 1
-program = foo -1
-
-program = nomatch -2
-
-program = beer -1
-
-program = http-grog -2
-
-program = ubar -2
-
dnsalias = *? -1
dnsalias = aruba.mcom.com brain251.mcom.com? -1
diff --git a/lib/libaccess/utest/twotest.cpp b/lib/libaccess/utest/twotest.cpp
index f26bbc18..8972ade7 100644
--- a/lib/libaccess/utest/twotest.cpp
+++ b/lib/libaccess/utest/twotest.cpp
@@ -5,7 +5,6 @@
* END COPYRIGHT BLOCK **/
#include <stdio.h>
#include <netsite.h>
-#include <base/session.h>
#include <base/plist.h>
#include <base/ereport.h>
#include <libaccess/nserror.h>
@@ -16,18 +15,13 @@
extern ACLListHandle_t *ACL_ParseFile(NSErr_t *errp, char *filename);
-extern ACLEvalDestroyContext(NSErr_t *errp, ACLEvalHandle_t *acleval);
-main(int arc, char **argv)
+int main(int arc, char **argv)
{
int result;
- int cachable;
- void *las_cookie=NULL;
ACLEvalHandle_t eval;
char *rights[2];
char *map_generic[7];
- char filename[20];
- int i;
char *bong;
char *bong_type;
char *acl_tag;
@@ -50,7 +44,6 @@ main(int arc, char **argv)
eval.acllist = ACL_ParseFile((NSErr_t *)NULL, argv[1]);
result = ACL_EvalTestRights(NULL, &eval, &rights[0], map_generic, &bong, &bong_type, &acl_tag, &expr_num);
- ACLEvalDestroyContext(NULL, &eval);
ACL_ListDestroy(NULL, eval.acllist);
printf("%s = %d\n\n", argv[1], result);
diff --git a/lib/libaccess/utest/ustubs.cpp b/lib/libaccess/utest/ustubs.cpp
index 88b6ac35..877ca31f 100644
--- a/lib/libaccess/utest/ustubs.cpp
+++ b/lib/libaccess/utest/ustubs.cpp
@@ -35,7 +35,11 @@ extern int XP_GetError();
extern int acl_usr_cache_init();
extern int acl_usr_cache_set_group();
extern int acl_usr_cache_group_check();
-extern int sema_destroy();
+extern int acl_usr_cache_group_len_check();
+extern int acl_usr_cache_enabled();
+extern int get_userdn_ldap (NSErr_t *errp, PList_t subject,
+ PList_t resource, PList_t auth_info,
+ PList_t global_auth, void *unused);
extern char *ldapu_err2string(int err);
extern int ACL_CacheFlush(void);
NSPR_END_EXTERN_C
@@ -54,11 +58,6 @@ void init_ldb_rwlock ()
{
}
-sema_destroy()
-{
- return 0;
-}
-
#ifdef notdef
char *system_errmsg()
{
@@ -75,27 +74,44 @@ ACL_CacheFlushRegister(AclCacheFlushFunc_t flush_func)
return 0;
}
-acl_usr_cache_init()
+int acl_usr_cache_init()
{
return 0;
}
-acl_usr_cache_group_check()
+int acl_usr_cache_group_check()
{
return 0;
}
-acl_usr_cache_set_group()
+int acl_usr_cache_set_group()
{
return 0;
}
-XP_SetError()
+int acl_usr_cache_group_len_check()
{
return 0;
}
-XP_GetError()
+int acl_usr_cache_enabled()
+{
+ return 0;
+}
+
+int get_userdn_ldap (NSErr_t *errp, PList_t subject,
+ PList_t resource, PList_t auth_info,
+ PList_t global_auth, void *unused)
+{
+ return LAS_EVAL_TRUE;
+}
+
+int XP_SetError()
+{
+ return 0;
+}
+
+int XP_GetError()
{
return 0;
}
@@ -129,7 +145,7 @@ int crit_owner_is_me(CRITICAL id)
return 1;
}
-symTableFindSym()
+int symTableFindSym()
{
return 0;
}
@@ -171,11 +187,13 @@ LASUserGetUser()
return "hmiller";
}
+int
LASIpGetIp()
{
return(0x11223344);
}
+int
LASDnsGetDns(char **dnsv)
{
*dnsv = "aruba.mcom.com";
@@ -188,11 +206,13 @@ ACL_DestroyList()
return(0);
}
+int
aclCheckHosts()
{
return(0);
}
+int
aclCheckUsers()
{
return(0);