teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.4.2-noselinux-verify.patch

Paul Nasrat 088b46
--- ./lib/query.c.nosever	2006-06-23 13:00:13.000000000 -0400
Paul Nasrat 088b46
+++ ./lib/query.c	2006-06-23 13:00:56.000000000 -0400
Paul Nasrat 088b46
@@ -787,22 +787,6 @@
Paul Nasrat 088b46
     if (qva->qva_flags & VERIFY_HDRCHK)
Paul Nasrat 088b46
 	vsflags |= RPMVSF_NOHDRCHK;
Paul Nasrat 088b46
 
Paul Nasrat 088b46
-#ifdef	NOTYET
Paul Nasrat 088b46
-    /* Initialize security context patterns (if not already done). */
Paul Nasrat 088b46
-    if (!(qva->qva_flags & VERIFY_CONTEXTS)) {
Paul Nasrat 088b46
-	rpmsx sx = rpmtsREContext(ts);
Paul Nasrat 088b46
-	if (sx == NULL) {
Paul Nasrat 088b46
-	    arg = rpmGetPath("%{?_verify_file_context_path}", NULL);
Paul Nasrat 088b46
-	    if (arg != NULL && *arg != '\0') {
Paul Nasrat 088b46
-		sx = rpmsxNew(arg);
Paul Nasrat 088b46
-		(void) rpmtsSetREContext(ts, sx);
Paul Nasrat 088b46
-	    }
Paul Nasrat 088b46
-	    arg = _free(arg);
Paul Nasrat 088b46
-	}
Paul Nasrat 088b46
-	sx = rpmsxFree(sx);
Paul Nasrat 088b46
-    }
Paul Nasrat 088b46
-#endif
Paul Nasrat 088b46
-
Paul Nasrat 088b46
     ovsflags = rpmtsSetVSFlags(ts, vsflags);
Paul Nasrat 088b46
     ec = rpmcliArgIter(ts, qva, argv);
Paul Nasrat 088b46
     vsflags = rpmtsSetVSFlags(ts, ovsflags);
Paul Nasrat 088b46
--- ./lib/verify.c.nosever	2004-10-24 15:36:30.000000000 -0400
Paul Nasrat 088b46
+++ ./lib/verify.c	2006-06-23 13:06:23.000000000 -0400
Paul Nasrat 088b46
@@ -78,8 +78,6 @@
Paul Nasrat 088b46
 	return 1;
Paul Nasrat 088b46
     }
Paul Nasrat 088b46
 
Paul Nasrat 088b46
-    flags |= RPMVERIFY_CONTEXTS;	/* no disable from package. */
Paul Nasrat 088b46
-
Paul Nasrat 088b46
     /*
Paul Nasrat 088b46
      * Not all attributes of non-regular files can be verified.
Paul Nasrat 088b46
      */
Paul Nasrat 088b46
@@ -117,33 +115,6 @@
Paul Nasrat 088b46
      */
Paul Nasrat 088b46
     flags &= ~(omitMask | RPMVERIFY_FAILURES);
Paul Nasrat 088b46
 
Paul Nasrat 088b46
-    /*
Paul Nasrat 088b46
-     * Verify file security context.
Paul Nasrat 088b46
-     */
Paul Nasrat 088b46
-/*@-branchstate@*/
Paul Nasrat 088b46
-    if (selinuxEnabled == 1 && (flags & RPMVERIFY_CONTEXTS)) {
Paul Nasrat 088b46
-	security_context_t con;
Paul Nasrat 088b46
-
Paul Nasrat 088b46
-	rc = lgetfilecon(fn, &con);
Paul Nasrat 088b46
-	if (rc == -1)
Paul Nasrat 088b46
-	    *res |= (RPMVERIFY_LGETFILECONFAIL|RPMVERIFY_CONTEXTS);
Paul Nasrat 088b46
-	else {
Paul Nasrat 088b46
-	    rpmsx sx = rpmtsREContext(ts);
Paul Nasrat 088b46
-	    const char * fcontext;
Paul Nasrat 088b46
-
Paul Nasrat 088b46
-	    if (sx != NULL) {
Paul Nasrat 088b46
-		/* Get file security context from patterns. */
Paul Nasrat 088b46
-		fcontext = rpmsxFContext(sx, fn, fmode);
Paul Nasrat 088b46
-		sx = rpmsxFree(sx);
Paul Nasrat 088b46
-	    } else {
Paul Nasrat 088b46
-		/* Get file security context from package. */
Paul Nasrat 088b46
-		fcontext = rpmfiFContext(fi);
Paul Nasrat 088b46
-	    }
Paul Nasrat 088b46
-	    if (fcontext == NULL || strcmp(fcontext, con))
Paul Nasrat 088b46
-		*res |= RPMVERIFY_CONTEXTS;
Paul Nasrat 088b46
-	    freecon(con);
Paul Nasrat 088b46
-	}
Paul Nasrat 088b46
-    }
Paul Nasrat 088b46
 /*@=branchstate@*/
Paul Nasrat 088b46
 
Paul Nasrat 088b46
     if (flags & RPMVERIFY_MD5) {
Paul Nasrat 088b46
@@ -331,10 +302,9 @@
Paul Nasrat 088b46
 	    }
Paul Nasrat 088b46
 	} else if (verifyResult || rpmIsVerbose()) {
Paul Nasrat 088b46
 	    const char * size, * MD5, * link, * mtime, * mode;
Paul Nasrat 088b46
-	    const char * group, * user, * rdev, *ctxt;
Paul Nasrat 088b46
+	    const char * group, * user, * rdev;
Paul Nasrat 088b46
 	    /*@observer@*/ static const char *const aok = ".";
Paul Nasrat 088b46
 	    /*@observer@*/ static const char *const unknown = "?";
Paul Nasrat 088b46
-	    /*@observer@*/ static const char *const ctxt_ignore = " ";
Paul Nasrat 088b46
 
Paul Nasrat 088b46
 	    ec = 1;
Paul Nasrat 088b46
 
Paul Nasrat 088b46
@@ -346,10 +316,6 @@
Paul Nasrat 088b46
 #define	_verifyfile(_RPMVERIFY_F, _C)	\
Paul Nasrat 088b46
 	((verifyResult & RPMVERIFY_READFAIL) ? unknown : \
Paul Nasrat 088b46
 	 (verifyResult & _RPMVERIFY_F) ? _C : aok)
Paul Nasrat 088b46
-#define	_verifyctxt(_RPMVERIFY_F, _C)	\
Paul Nasrat 088b46
-	((selinuxEnabled != 1 ? ctxt_ignore : \
Paul Nasrat 088b46
-	 (verifyResult & RPMVERIFY_LGETFILECONFAIL) ? unknown : \
Paul Nasrat 088b46
-	 (verifyResult & _RPMVERIFY_F) ? _C : aok))
Paul Nasrat 088b46
 	
Paul Nasrat 088b46
 	    MD5 = _verifyfile(RPMVERIFY_MD5, "5");
Paul Nasrat 088b46
 	    size = _verify(RPMVERIFY_FILESIZE, "S");
Paul Nasrat 088b46
@@ -359,15 +325,13 @@
Paul Nasrat 088b46
 	    user = _verify(RPMVERIFY_USER, "U");
Paul Nasrat 088b46
 	    group = _verify(RPMVERIFY_GROUP, "G");
Paul Nasrat 088b46
 	    mode = _verify(RPMVERIFY_MODE, "M");
Paul Nasrat 088b46
-	    ctxt = _verifyctxt(RPMVERIFY_CONTEXTS, "C");
Paul Nasrat 088b46
 
Paul Nasrat 088b46
-#undef _verifyctxt
Paul Nasrat 088b46
 #undef _verifyfile
Paul Nasrat 088b46
 #undef _verifylink
Paul Nasrat 088b46
 #undef _verify
Paul Nasrat 088b46
 
Paul Nasrat 088b46
-	    sprintf(te, "%s%s%s%s%s%s%s%s%s %c %s",
Paul Nasrat 088b46
-			size, mode, MD5, rdev, link, user, group, mtime, ctxt,
Paul Nasrat 088b46
+	    sprintf(te, "%s%s%s%s%s%s%s%s %c %s",
Paul Nasrat 088b46
+			size, mode, MD5, rdev, link, user, group, mtime,
Paul Nasrat 088b46
 			((fileAttrs & RPMFILE_CONFIG)	? 'c' :
Paul Nasrat 088b46
 			 (fileAttrs & RPMFILE_DOC)	? 'd' :
Paul Nasrat 088b46
 			 (fileAttrs & RPMFILE_GHOST)	? 'g' :
Paul Nasrat 088b46
@@ -522,20 +486,6 @@
Paul Nasrat 088b46
 	vsflags |= RPMVSF_NOHDRCHK;
Paul Nasrat 088b46
     vsflags &= ~RPMVSF_NEEDPAYLOAD;
Paul Nasrat 088b46
 
Paul Nasrat 088b46
-    /* Initialize security context patterns (if not already done). */
Paul Nasrat 088b46
-    if (qva->qva_flags & VERIFY_CONTEXTS) {
Paul Nasrat 088b46
-	rpmsx sx = rpmtsREContext(ts);
Paul Nasrat 088b46
-	if (sx == NULL) {
Paul Nasrat 088b46
-	    arg = rpmGetPath("%{?_verify_file_context_path}", NULL);
Paul Nasrat 088b46
-	    if (arg != NULL && *arg != '\0') {
Paul Nasrat 088b46
-		sx = rpmsxNew(arg);
Paul Nasrat 088b46
-		(void) rpmtsSetREContext(ts, sx);
Paul Nasrat 088b46
-	    }
Paul Nasrat 088b46
-	    arg = _free(arg);
Paul Nasrat 088b46
-	}
Paul Nasrat 088b46
-	sx = rpmsxFree(sx);
Paul Nasrat 088b46
-    }
Paul Nasrat 088b46
-
Paul Nasrat 088b46
     ovsflags = rpmtsSetVSFlags(ts, vsflags);
Paul Nasrat 088b46
     ec = rpmcliArgIter(ts, qva, argv);
Paul Nasrat 088b46
     vsflags = rpmtsSetVSFlags(ts, ovsflags);