summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-10-30 14:31:42 +0200
committerPanu Matilainen <pmatilai@redhat.com>2007-10-30 14:31:42 +0200
commit51c91957ae7378547604f1e008fabab28145d7b8 (patch)
tree6f6dda50be0295dc1e6c45441d3b966d62dd9520
parentc36d94ded4e65b45e4d448acd2f32866da8be445 (diff)
downloadlibrpm-tizen-51c91957ae7378547604f1e008fabab28145d7b8.tar.gz
librpm-tizen-51c91957ae7378547604f1e008fabab28145d7b8.tar.bz2
librpm-tizen-51c91957ae7378547604f1e008fabab28145d7b8.zip
Use rpmtsRootDir() instead of ts->rootDir + url guess-games in psm
-rw-r--r--lib/psm.c24
-rw-r--r--lib/rpmts.c1
-rw-r--r--lib/rpmts.h1
3 files changed, 7 insertions, 19 deletions
diff --git a/lib/psm.c b/lib/psm.c
index ffa1c868b..c811de8ef 100644
--- 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);
}
diff --git a/lib/rpmts.c b/lib/rpmts.c
index c297b42d3..df6c47175 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -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:
diff --git a/lib/rpmts.h b/lib/rpmts.h
index 88f160135..ee6f660a9 100644
--- a/lib/rpmts.h
+++ b/lib/rpmts.h
@@ -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)
*/