diff options
author | Rich Megginson <rmeggins@redhat.com> | 2010-07-06 16:47:45 -0600 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2010-07-06 17:41:20 -0600 |
commit | 85eb9216d5d4163139a90432084452cf81c8444e (patch) | |
tree | a1f1306ce6cb9f2d346eaddefcf75a29d29f91f0 /lib | |
parent | 7a9c069a7d64c1370353278c34bf9065aeb604ea (diff) | |
download | ds-85eb9216d5d4163139a90432084452cf81c8444e.tar.gz ds-85eb9216d5d4163139a90432084452cf81c8444e.tar.xz ds-85eb9216d5d4163139a90432084452cf81c8444e.zip |
Bug 611850 - fix coverity Defect Type: Error handling issues
https://bugzilla.redhat.com/show_bug.cgi?id=611850
Resolves: bug 611850
Bug Description: fix coverity Defect Type: Error handling issues
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: Check the error return from the functions. In some cases,
I was able to figure out that the calling function should perform additional
error handling (return early, goto error label), but in general the code
just logs an appropriate error message and continues. I was able to get
rid of some more libacl code. I removed an unused variable from modify.c
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libaccess/aclcache.cpp | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/lib/libaccess/aclcache.cpp b/lib/libaccess/aclcache.cpp index e474601a..10588879 100644 --- a/lib/libaccess/aclcache.cpp +++ b/lib/libaccess/aclcache.cpp @@ -432,110 +432,6 @@ ACL_CacheEnterGet(char *uri, ACLListHandle_t **acllistp) return; } -/* ACL_AddAclName - * Adds the ACLs for just the terminal object specified in a pathname. - * INPUT - * path The filesystem pathname of the terminal object. - * acllistp The address of the list of ACLs found thus far. - * Could be NULL. If so, a new acllist will be allocated (if any - * acls are found). Otherwise the existing list will be added to. - * masterlist Usually acl_root_30. - */ -void -ACL_AddAclName(char *path, ACLListHandle_t **acllistp, ACLListHandle_t -*masterlist) -{ - ACLHandle_t *acl; - NSErr_t *errp = 0; - -#ifdef XP_WIN32 - acl = ACL_ListFind(errp, masterlist, path, ACL_CASE_INSENSITIVE); -#else - acl = ACL_ListFind(errp, masterlist, path, ACL_CASE_SENSITIVE); -#endif - if (!acl) - return; - - PR_ASSERT(ACL_AssertAcl(acl)); - - if (!*acllistp) - *acllistp = ACL_ListNew(errp); - ACL_ListAppend(NULL, *acllistp, acl, 0); - - PR_ASSERT(ACL_AssertAcllist(*acllistp)); - return; -} - - -/* ACL_GetPathAcls - * Adds the ACLs for all directories plus the terminal object along a given - * filesystem pathname. For each pathname component, look for the name, the - * name + "/", and the name + "/*". The last one is because the resource - * picker likes to postpend "/*" for directories. - * INPUT - * path The filesystem pathname of the terminal object. - * acllistp The address of the list of ACLs found thus far. - * Could be NULL. If so, a new acllist will be allocated (if any - * acls are found). Otherwise the existing list will be added to. - * prefix A string to be prepended to the path component when looking - * for a matching ACL tag. - */ -void -ACL_GetPathAcls(char *path, ACLListHandle_t **acllistp, char *prefix, -ACLListHandle_t *masterlist) -{ - char *slashp=path; - int slashidx; - char ppath[ACL_PATH_MAX]; - int prefixlen; - char *dst; - - PR_ASSERT(path); - PR_ASSERT(prefix); - - dst = strncpy(ppath, prefix, ACL_PATH_MAX); - if (dst >= (ppath+ACL_PATH_MAX-1)) { - ereport(LOG_SECURITY, "Abort - the path is too long for ACL_GetPathAcls to handle\n"); - abort(); - } - prefixlen = strlen(ppath); - - /* Handle the first "/". i.e. the root directory */ - if (*path == '/') { - ppath[prefixlen]='/'; - ppath[prefixlen+1]='\0'; - ACL_AddAclName(ppath, acllistp, masterlist); - strcat(ppath, "*"); - ACL_AddAclName(ppath, acllistp, masterlist); - slashp = path; - } - - do { - slashp = strchr(++slashp, '/'); - if (slashp) { - slashidx = slashp - path; - strncpy(&ppath[prefixlen], path, slashidx); - ppath[slashidx+prefixlen] = '\0'; - ACL_AddAclName(ppath, acllistp, masterlist); - /* Must also handle "/a/b/" in addition to "/a/b" */ - strcat(ppath, "/"); - ACL_AddAclName(ppath, acllistp, masterlist); - strcat(ppath, "*"); - ACL_AddAclName(ppath, acllistp, masterlist); - continue; - } - strcpy(&ppath[prefixlen], path); - ACL_AddAclName(ppath, acllistp, masterlist); - strcat(ppath, "/"); - ACL_AddAclName(ppath, acllistp, masterlist); - strcat(ppath, "*"); - ACL_AddAclName(ppath, acllistp, masterlist); - break; - } while (slashp); - -} - - static int get_is_owner_default (NSErr_t *errp, PList_t subject, PList_t resource, PList_t auth_info, PList_t global_auth, void *unused) |