- establish rpm_script_t before scriptlet exec.
- python: add patch to rpm-4_3 to initialize RE contexts.
- fix: only first "mkdir -p" directory had context set.
+ - stable sort for policy specifications, patterns before paths.
4.2.1 -> 4.2.2:
- unify signal handling in librpmio, use condvar to deliver signal.
int _rpmsx_debug = 0;
/**
- */
-static int rpmsxpCompare(const void* A, const void* B)
- /*@*/
-{
- rpmsxp sxpA = (rpmsxp) A;
- rpmsxp sxpB = (rpmsxp) B;
- return (sxpB->hasMetaChars - sxpA->hasMetaChars);
-}
-
-/**
- * Sort the specifications with most general first.
+ * Stable sort for policy specifications, patterns before paths.
* @param sx security context patterns
*/
static void rpmsxSort(rpmsx sx)
/*@modifies sx @*/
{
- qsort(sx->sxp, sx->Count, sizeof(*sx->sxp), rpmsxpCompare);
+ rpmsxp sxp;
+ int i, j;
+
+ /* Stable sort for policy regex's and paths. */
+ sxp = xmalloc(sizeof(*sxp) * sx->Count);
+
+ /* Regex patterns first ... */
+ j = 0;
+ for (i = 0; i < sx->Count; i++) {
+ if (!sx->sxp[i].hasMetaChars)
+ continue;
+ memcpy(sxp + j, sx->sxp + i, sizeof(*sxp));
+ j++;
+ }
+
+ /* ... then file paths. */
+ for (i = 0; i < sx->Count; i++) {
+ if (sx->sxp[i].hasMetaChars)
+ continue;
+ memcpy(sxp + j, sx->sxp + i, sizeof(*sxp));
+ j++;
+ }
+
+ sx->sxp = _free(sx->sxp);
+ sx->sxp = sxp;
}
/* Determine if the regular expression specification has any meta characters. */
int pass;
int regerr;
int nerr = 0;
+
#define inc_err() nerr++
/*@-branchstate@*/
/*@=branchstate@*/
(void) fclose(fp);
- /* Sort the specifications with most general first */
+ /* Stable sort for policy specifications, patterns before paths. */
rpmsxSort(sx);
/* Verify no exact duplicates */
%changelog
* Sun Feb 22 2004 Jeff Johnson <jbj@jbj.org> 4.3-0.14
- add ia32e arch.
+- stable sort for policy specifications, patterns before paths.
* Fri Feb 20 2004 Jeff Johnson <jbj@jbj.org> 4.3-0.13
- fix: only first "mkdir -p" directory had context set.