diff options
author | wollman <wollman@FreeBSD.org> | 1996-05-17 15:35:13 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1996-05-17 15:35:13 +0000 |
commit | 1af3a60b40a4b0390af1ef33dce05a4aa1ba00f7 (patch) | |
tree | 9b1feb74938f028bc710450783568ce570f28bb5 /lib/libc/gen/getvfsent.c | |
parent | 94c3aa770fb1ae4eeddb0d797de1266f3dfcd6c1 (diff) | |
download | FreeBSD-src-1af3a60b40a4b0390af1ef33dce05a4aa1ba00f7.zip FreeBSD-src-1af3a60b40a4b0390af1ef33dce05a4aa1ba00f7.tar.gz |
Fix for vfsload(3):
- Don't allow non-root users to specify LKMDIR.
- Don't allow any users to specify TMPDIR.
- Call /sbin/modload using execl() rather than execlp().
Diffstat (limited to 'lib/libc/gen/getvfsent.c')
-rw-r--r-- | lib/libc/gen/getvfsent.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/gen/getvfsent.c b/lib/libc/gen/getvfsent.c index 05b50f8..d27bfee 100644 --- a/lib/libc/gen/getvfsent.c +++ b/lib/libc/gen/getvfsent.c @@ -17,6 +17,8 @@ #include <errno.h> #include <paths.h> +#define _PATH_MODLOAD "/sbin/modload" /* XXX should be in header file */ + static struct vfsconf *_vfslist = 0; static struct vfsconf _vfsconf; static size_t _vfslistlen = 0; @@ -171,7 +173,7 @@ vfspath(const char *name) char *userdir = getenv("LKMDIR"); int i; - if(userdir) { + if(userdir && getuid() == geteuid() && getuid() == 0) { vfs_lkmdirs[NLKMDIRS - 2] = userdir; } @@ -226,9 +228,7 @@ vfsload(const char *name) } status = -1; - if(getenv("TMPDIR")) { - status = chdir(getenv("TMPDIR")); - } + unsetenv("TMPDIR"); if(status) { status = chdir(_PATH_VARTMP); } @@ -236,12 +236,12 @@ vfsload(const char *name) status = chdir(_PATH_TMP); } if(status) { - exit(status ? errno : 0); + exit(errno); } snprintf(name_mod, sizeof name_mod, "%s%s", name, "_mod"); - status = execlp("modload", "modload", "-e", name_mod, "-o", name_mod, - "-u", "-q", path, (const char *)0); + status = execl(_PATH_MODLOAD, "modload", "-e", name_mod, "-o", + name_mod, "-u", "-q", path, (const char *)0); exit(status ? errno : 0); } |