summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usermux/ChangeLog6
-rw-r--r--usermux/mux.c12
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