diff options
| author | Colin Percival <cperciva@FreeBSD.org> | 2006-03-22 16:00:42 +0000 |
|---|---|---|
| committer | Colin Percival <cperciva@FreeBSD.org> | 2006-03-22 16:00:42 +0000 |
| commit | d16f6f50276f22d892749e99b9ad5f6b7e1d41c8 (patch) | |
| tree | 505281ed70ef5587153603a305cee43608da2925 /contrib/opie | |
| parent | e72f58bbd90d3a0798327b7517babb8628fc0147 (diff) | |
Notes
Diffstat (limited to 'contrib/opie')
| -rw-r--r-- | contrib/opie/opiepasswd.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/opie/opiepasswd.c b/contrib/opie/opiepasswd.c index 2e2358ada07a..cd4ff018c3a0 100644 --- a/contrib/opie/opiepasswd.c +++ b/contrib/opie/opiepasswd.c @@ -118,11 +118,18 @@ int main FUNCTION((argc, argv), int argc AND char *argv[]) struct opie opie; int rval, n = 499, i, mode = MODE_DEFAULT, force = 0; char seed[OPIE_SEED_MAX+1]; + char *username; + uid_t ruid; struct passwd *pp; memset(seed, 0, sizeof(seed)); - if (!(pp = getpwnam(getlogin()))) { + ruid = getuid(); + username = getlogin(); + pp = getpwnam(username); + if (username == NULL || pp == NULL || pp->pw_uid != ruid) + pp = getpwuid(ruid); + if (pp == NULL) { fprintf(stderr, "Who are you?"); return 1; } |
