From 0011847d5fa0e2dc5b53b50238d928547b57c248 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 24 Apr 2008 00:08:34 +0000 Subject: 2008-04-24 Samuel Thibault * mux.c (lookup_user): Check null condition for struct passwd returnd by getpwnam_r. Reported by Marc-Olivier Mercier . --- usermux/ChangeLog | 6 ++++++ 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 + + * mux.c (lookup_user): Check null condition for struct passwd returnd + by getpwnam_r. + Reported by Marc-Olivier Mercier . + 2007-11-13 Thomas Schwinge * 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 -- cgit v1.2.3