diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2008-04-24 00:08:34 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2008-04-24 00:08:34 +0000 |
commit | 0011847d5fa0e2dc5b53b50238d928547b57c248 (patch) | |
tree | 52b82534b297b9700539f5b2e7828e474b731a8b | |
parent | 889825b6db150b3f0fc684fdb2ec8d95844f7437 (diff) |
2008-04-24 Samuel Thibault <samuel.thibault@ens-lyon.org>
* mux.c (lookup_user): Check null condition for struct passwd returnd
by getpwnam_r.
Reported by Marc-Olivier Mercier <mercier.m@sympatico.ca>.
-rw-r--r-- | usermux/ChangeLog | 6 | ||||
-rw-r--r-- | usermux/mux.c | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/usermux/ChangeLog b/usermux/ChangeLog index 6c107c24..e6572e0e 100644 --- a/usermux/ChangeLog +++ b/usermux/ChangeLog @@ -1,3 +1,9 @@ +2008-04-24 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * mux.c (lookup_user): Check null condition for struct passwd returnd + by getpwnam_r. + Reported by Marc-Olivier Mercier <mercier.m@sympatico.ca>. + 2007-11-13 Thomas Schwinge <tschwinge@gnu.org> * node.c (netfs_attempt_utimes): Adapt to ``struct stat'' changes. diff --git a/usermux/mux.c b/usermux/mux.c index 722ba2ec..d2dd366b 100644 --- a/usermux/mux.c +++ b/usermux/mux.c @@ -384,10 +384,14 @@ lookup_user (struct usermux *mux, const char *user, struct node **node) if (was_cached) return 0; - else if (getpwnam_r (user, &_pw, pwent_data, sizeof pwent_data, &pw) == 0) - return lookup_pwent (mux, user, pw, node); - else - return ENOENT; + else + { + if (getpwnam_r (user, &_pw, pwent_data, sizeof pwent_data, &pw)) + return ENOENT; + if (pw == NULL) + return ENOENT; + return lookup_pwent (mux, user, pw, node); + } } /* This should sync the entire remote filesystem. If WAIT is set, return |