diff options
author | SUZUKI, Shinsuke <suz@kame.net> | 2007-02-27 14:47:11 +0000 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2010-08-06 15:37:36 +0200 |
commit | fc15adcff189d5fb96a9802307f8b82866e12ac7 (patch) | |
tree | 9795f2174138334f799ac987c2545791f98589c2 /dhcp6c_script.c | |
parent | fe2c74572f875332b461ba2a17a594a7ee4eb2d3 (diff) |
supported script execution for dhcp6relay (contributed by Bruno STEVANT)
Diffstat (limited to 'dhcp6c_script.c')
-rw-r--r-- | dhcp6c_script.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/dhcp6c_script.c b/dhcp6c_script.c index b052f18..05ccf8c 100644 --- a/dhcp6c_script.c +++ b/dhcp6c_script.c @@ -72,8 +72,6 @@ static char nispname_str[] = "new_nisp_name"; static char bcmcsserver_str[] = "new_bcmcs_servers"; static char bcmcsname_str[] = "new_bcmcs_name"; -static int safefile __P((const char *)); - int client6_script(scriptpath, state, optinfo) char *scriptpath; @@ -437,42 +435,3 @@ client6_script(scriptpath, state, optinfo) return ret; } - -static int -safefile(path) - const char *path; -{ - struct stat s; - uid_t myuid; - - /* no setuid */ - if (getuid() != geteuid()) { - dprintf(LOG_NOTICE, FNAME, - "setuid'ed execution not allowed"); - return (-1); - } - - if (lstat(path, &s) != 0) { - dprintf(LOG_NOTICE, FNAME, "lstat failed: %s", - strerror(errno)); - return (-1); - } - - /* the file must be owned by the running uid */ - myuid = getuid(); - if (s.st_uid != myuid) { - dprintf(LOG_NOTICE, FNAME, "%s has invalid owner uid", path); - return (-1); - } - - switch (s.st_mode & S_IFMT) { - case S_IFREG: - break; - default: - dprintf(LOG_NOTICE, FNAME, "%s is an invalid file type 0x%o", - path, (s.st_mode & S_IFMT)); - return (-1); - } - - return (0); -} |