diff options
author | Elena Reshetova <elena.reshetova@intel.com> | 2013-08-19 08:42:27 +0300 |
---|---|---|
committer | Elena Reshetova <elena.reshetova@intel.com> | 2013-08-19 09:25:16 +0300 |
commit | 6ec9c114ae34733b4faf4a8f7c4d110f923362e0 (patch) | |
tree | 7fc164764ceb318d4a2be00448856f636d3fd171 | |
parent | a08249263295ddd1f2cd07ed41abebc248f9f75c (diff) | |
download | rpm-6ec9c114ae34733b4faf4a8f7c4d110f923362e0.tar.gz rpm-6ec9c114ae34733b4faf4a8f7c4d110f923362e0.tar.bz2 rpm-6ec9c114ae34733b4faf4a8f7c4d110f923362e0.zip |
Security plugin: small fixessubmit/tizen/20130820.223822
- Removing unused code
- Changing the init hook to take care of new libsmack return code
-rw-r--r-- | plugins/msm-plugin.c | 41 | ||||
-rw-r--r-- | plugins/msm.h | 12 |
2 files changed, 1 insertions, 52 deletions
diff --git a/plugins/msm-plugin.c b/plugins/msm-plugin.c index b73993f20..bc95cf447 100644 --- a/plugins/msm-plugin.c +++ b/plugins/msm-plugin.c @@ -196,7 +196,7 @@ rpmRC PLUGINHOOK_INIT_FUNC(rpmts _ts, const char *name, const char *opts) if (stat(fullPath, &buf) == 0) { int res = smack_new_label_from_self(&ownSmackLabel); SmackEnabled = 1; - if (res != 0) { + if (res < 0) { rpmlog(RPMLOG_ERR, "Failed to obtain rpm security context\n"); goto plugin_error; } @@ -901,45 +901,6 @@ rpmRC PLUGINHOOK_CLEANUP_FUNC(void) return RPMRC_OK; } -const char *msmQueryPackageFile(const char *rfor, - const char **dname, const char **pname) -{ - int match = 0; - const char *path = NULL; - - if (ts) { - char *sep = strchr(rfor, ':'); - if (sep && sep[1] == ':' && sep[2] == '/') - path = &sep[2]; - if (!path) return NULL; - - rpmdbMatchIterator mi = rpmtsInitIterator(ts, RPMTAG_BASENAMES, path, 0); - if (!mi) - mi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, path, 0); - if (mi) { - Header h; - const char *name, *sw_source; - while ((h = rpmdbNextIterator(mi))) { - rpmdbCheckSignals(); - name = headerGetString(h, RPMTAG_NAME); - sw_source = headerGetString(h, RPMTAG_SECSWSOURCE); - if (name && sw_source) { - match = !strncmp(rfor, name, path - rfor - 2); - rpmlog(RPMLOG_DEBUG, "file %s belongs to package %s in sw source %s %s\n", - path, name, sw_source, (match ? "(matched request)" : "")); - if (match) { - *pname = xstrdup(name); - *dname = xstrdup(sw_source); - break; - } - } - } - mi = rpmdbFreeIterator(mi); - } - } - return match ? path : NULL; -} - void msmFreePointer(void** ptr) { if (*ptr) diff --git a/plugins/msm.h b/plugins/msm.h index bbe09275d..1a4853a2a 100644 --- a/plugins/msm.h +++ b/plugins/msm.h @@ -457,16 +457,4 @@ sw_source_x *msmSWSourceTreeTraversal(sw_source_x *sw_sources, int (func)(sw_sou * Free internal hashes. */ void msmFreeInternalHashes(void); - -/** \ingroup msm - * Query that requested package really owns the file. - * @param rfor request for 'package::/file/path' - * @param sw_sname sw source name, caller must free - * @param pname package name, caller must free - * @return pointer to the path part in rfor, or NULL if file - * is not owned by the specified package - */ -const char *msmQueryPackageFile(const char *rfor, - const char **sw_sname, const char **pname); - #endif |