diff options
| author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2003-02-05 11:11:32 +0000 |
|---|---|---|
| committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2003-02-05 11:11:32 +0000 |
| commit | 31f77a4b49662c9b9393baada9143db31e7a41a8 (patch) | |
| tree | 4b29e35aa35941f09786f00cc1ba9616d4b55f2e /libexec/ftpd | |
| parent | 1d825c58fbbabdf9f22c7c39be528487f8cc05e2 (diff) | |
Notes
Diffstat (limited to 'libexec/ftpd')
| -rw-r--r-- | libexec/ftpd/ftpcmd.y | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index c9d52638c0b2..49fc1ffee444 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -1671,8 +1671,10 @@ exptilde(char *s) user = p + 1; /* skip tilde */ if ((path = strchr(p, '/')) != NULL) *(path++) = '\0'; /* separate ~user from the rest of path */ - ppw = *user ? getpwnam(user) : pw; - if (ppw) { + if (*user == '\0') /* no user specified, use the current user */ + user = pw->pw_name; + /* read passwd even for the current user since we may be chrooted */ + if ((ppw = getpwnam(user)) != NULL) { /* user found, substitute login directory for ~user */ if (path) asprintf(&q, "%s/%s", ppw->pw_dir, path); |
