From 48912a224469496bbfa92ba90ab608896166c474 Mon Sep 17 00:00:00 2001 From: miker Date: Sun, 14 Dec 2008 21:30:44 +0000 Subject: [PATCH] return true if no permissions are specified git-svn-id: svn://svn.open-ils.org/ILS/trunk@11545 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/c-apps/oils_cstore.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/c-apps/oils_cstore.c b/Open-ILS/src/c-apps/oils_cstore.c index c4c6f8af03..3ef278f889 100644 --- a/Open-ILS/src/c-apps/oils_cstore.c +++ b/Open-ILS/src/c-apps/oils_cstore.c @@ -826,7 +826,6 @@ static int verifyObjectPCRUD ( osrfMethodContext* ctx, const jsonObject* obj ) osrfStringArray* context_org_array = osrfNewStringArray(1); char* pkey_value = NULL; - int OK = 0; int err = 0; if (global_required && strcmp( "true", global_required )) { // check for perm at top of org tree @@ -838,7 +837,7 @@ static int verifyObjectPCRUD ( osrfMethodContext* ctx, const jsonObject* obj ) if (!_tree_top) { jsonObjectFree(_tmp_params); jsonObjectFree(_list); - return -1; + return 0; } osrfStringArrayAdd( context_org_array, oilsFMGetString( _tree_top, "id" ) ); @@ -876,7 +875,7 @@ static int verifyObjectPCRUD ( osrfMethodContext* ctx, const jsonObject* obj ) if (!param) { jsonObjectFree(_tmp_params); jsonObjectFree(_list); - return -1; + return 0; } jsonObjectFree(_tmp_params); @@ -919,7 +918,7 @@ static int verifyObjectPCRUD ( osrfMethodContext* ctx, const jsonObject* obj ) if (!_fparam) { jsonObjectFree(_tmp_params); jsonObjectFree(_list); - return -1; + return 0; } jsonObjectFree(_tmp_params); @@ -939,8 +938,11 @@ static int verifyObjectPCRUD ( osrfMethodContext* ctx, const jsonObject* obj ) jsonObjectFree(param); } - char* context_org; - char* perm; + char* context_org = NULL; + char* perm = NULL; + int OK = 0; + + if (permission->size == 0) OK = 1; int i = 0; while ( (perm = osrfStringArrayGetString(permission, i++)) ) { @@ -995,8 +997,7 @@ static int verifyObjectPCRUD ( osrfMethodContext* ctx, const jsonObject* obj ) if (pkey_value) free(pkey_value); osrfStringArrayFree(context_org_array); - if (!OK) return 0; - return 1; + return OK; } #endif -- 2.11.0