diff options
author | Bardur Arantsson <bardur@scientician.net> | 2011-04-18 20:37:31 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-03-29 20:57:29 +0200 |
commit | b102a2e0aeb70e93a1122f42e00a7b672f718a07 (patch) | |
tree | 8b7cb08fe9c3251836e8f5a8b975eee452833366 /src/util.c | |
parent | 142e4467809aec4a8dfa5a1126d9cc1d5eea5ed3 (diff) |
Refactor: Remove some dead setuid code.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 22 |
1 files changed, 2 insertions, 20 deletions
@@ -171,14 +171,12 @@ void user_name(char *buf, int id) * Extract a "parsed" path from an initial filename * Normally, we simply copy the filename into the buffer * But leading tilde symbols must be handled in a special way -* Replace "~user/" by the home directory of the user named "user" * Replace "~/" by the home directory of the current user */ errr path_parse(char *buf, int max, cptr file) { cptr u, s; struct passwd *pw; - char user[128]; /* Assume no result */ @@ -200,9 +198,6 @@ errr path_parse(char *buf, int max, cptr file) /* Look for non-user portion of the file */ s = strstr(u, PATH_SEP); - /* Hack -- no long user names */ - if (s && (s >= u + sizeof(user))) return (1); - #ifdef GETLOGIN_BROKEN /* Ask the environment for the home directory */ u = getenv("HOME"); @@ -211,21 +206,8 @@ errr path_parse(char *buf, int max, cptr file) (void)strcpy(buf, u); #else - /* Extract a user name */ - if (s) - { - int i; - for (i = 0; u < s; ++i) user[i] = *u++; - user[i] = '\0'; - u = user; - } - - /* Look up the "current" user */ - if (u[0] == '\0') u = getlogin(); - - /* Look up a user (or "current" user) */ - if (u) pw = getpwnam(u); - else pw = getpwuid(getuid()); + /* Look up password data for user */ + pw = getpwuid(getuid()); /* Nothing found? */ if (!pw) return (1); |