libxbps: execute pkg scripts with /bin/sh directly.
The pkg INSTALL/REMOVE scripts do not need to have the executable bit set anymore, thus /tmp can be mounted with 'noexec' from now on. GH #149
This commit is contained in:
parent
b81b9ab379
commit
430a25f422
5
NEWS
5
NEWS
@ -1,5 +1,10 @@
|
|||||||
xbps-0.52 (???):
|
xbps-0.52 (???):
|
||||||
|
|
||||||
|
* libxbps: package INSTALL/REMOVE scripts do not need to be executables
|
||||||
|
anymore because they are executed with "/bin/sh" directly. That means
|
||||||
|
"/tmp" can be mounted as "noexec". Fixed #149 correctly.
|
||||||
|
See https://github.com/voidlinux/xbps/issues/149
|
||||||
|
|
||||||
* xbps-query(1): fix a bug where the output of -o became mixed up
|
* xbps-query(1): fix a bug where the output of -o became mixed up
|
||||||
when running on multiple cores.
|
when running on multiple cores.
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
|
|||||||
const char *tmpdir, *version;
|
const char *tmpdir, *version;
|
||||||
char *pkgname, *fpath;
|
char *pkgname, *fpath;
|
||||||
int fd, rv;
|
int fd, rv;
|
||||||
mode_t mask;
|
|
||||||
|
|
||||||
assert(blob);
|
assert(blob);
|
||||||
assert(pkgver);
|
assert(pkgver);
|
||||||
@ -72,15 +71,12 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create temp file to run script */
|
/* Create temp file to run script */
|
||||||
mask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
|
|
||||||
if ((fd = mkstemp(fpath)) == -1) {
|
if ((fd = mkstemp(fpath)) == -1) {
|
||||||
umask(mask);
|
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "%s: mkstemp %s\n",
|
xbps_dbg_printf(xhp, "%s: mkstemp %s\n",
|
||||||
__func__, strerror(errno));
|
__func__, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
umask(mask);
|
|
||||||
/* write blob to our temp fd */
|
/* write blob to our temp fd */
|
||||||
ret = write(fd, blob, blobsiz);
|
ret = write(fd, blob, blobsiz);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
@ -100,7 +96,7 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
|
|||||||
version = xbps_pkg_version(pkgver);
|
version = xbps_pkg_version(pkgver);
|
||||||
assert(version);
|
assert(version);
|
||||||
|
|
||||||
rv = xbps_file_exec(xhp, fpath, action, pkgname, version,
|
rv = xbps_file_exec(xhp, "/bin/sh", fpath, action, pkgname, version,
|
||||||
update ? "yes" : "no",
|
update ? "yes" : "no",
|
||||||
"no", xhp->native_arch, NULL);
|
"no", xhp->native_arch, NULL);
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user