Use rpmtsRootDir() instead of ts->rootDir + url guess-games in psm
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 30 Oct 2007 12:31:42 +0000 (14:31 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 30 Oct 2007 12:31:42 +0000 (14:31 +0200)
lib/psm.c
lib/rpmts.c
lib/rpmts.h

index ffa1c86..c811de8 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -795,13 +795,8 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
            }
        }
 
-       rootDir = ts->rootDir;  /* HACK: rootDir = rpmtsRootDir(ts); instead */
-       if (rootDir  != NULL)   /* XXX can't happen */
-       switch(urlIsURL(rootDir)) {
-       case URL_IS_PATH:
-           rootDir += sizeof("file://") - 1;
-           rootDir = strchr(rootDir, '/');
-       case URL_IS_UNKNOWN:
+       rootDir = rpmtsRootDir(ts);
+       if (rootDir  != NULL) { /* XXX can't happen */
            if (!rpmtsChrootDone(ts) &&
                !(rootDir[0] == '/' && rootDir[1] == '\0'))
            {
@@ -818,21 +813,12 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
            /* Permit libselinux to do the scriptlet exec. */
            if (rpmtsSELinuxEnabled(ts) == 1) { 
                xx = rpm_execcon(0, argv[0], (char ** const) argv, environ);
-               if (xx != 0)
-                   break;
            }
 
-           xx = execv(argv[0], (char *const *)argv);
-           break;
-       case URL_IS_HTTPS:
-       case URL_IS_HTTP:
-       case URL_IS_FTP:
-       case URL_IS_DASH:
-       case URL_IS_HKP:
-       default:
-           break;
+           if (xx == 0) {
+               xx = execv(argv[0], (char *const *)argv);
+           }
        }
-
        _exit(-1);
     }
 
index c297b42..df6c471 100644 (file)
@@ -1051,6 +1051,7 @@ const char * rpmtsRootDir(rpmts ts)
        case URL_IS_UNKNOWN:
        case URL_IS_PATH:
            break;
+       /* XXX these shouldn't be allowed as rootdir! */
        case URL_IS_HTTPS:
        case URL_IS_HTTP:
        case URL_IS_HKP:
index 88f1601..ee6f660 100644 (file)
@@ -586,6 +586,7 @@ extern const char * rpmtsRootDir(rpmts ts);
 
 /** \ingroup rpmts
  * Set transaction rootDir, i.e. path to chroot(2).
+ * @todo               disallow funky http:// etc urls...
  * @param ts           transaction set
  * @param rootDir      new transaction rootDir (or NULL)
  */