From 7314126d9e1d84997d818166f27e2076d55ff04e Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Mon, 28 Jul 1997 18:59:57 +0000 Subject: client.c: Added amanda fixes. clitar.c: Added amanda fixes. nameannounce.c: Removed redundent code. nameelect.c: Removed redundent code. nameserv.h: Removed redundent code. nameservresp.c: Removed redundent code. namework.c: Removed redundent code. password.c: Prevented crash if getpwnam fails. Jeremy (jallison@whistle.com) (This used to be commit 760fe30353de66e8e6571f8ff4ec1064261b5428) --- source3/smbd/password.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'source3/smbd/password.c') diff --git a/source3/smbd/password.c b/source3/smbd/password.c index eb837c2584..23c29104e3 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -237,13 +237,15 @@ uint16 register_vuid(int uid,int gid, char *name,BOOL guest) vuser->real_name = Realloc(vuser->real_name, 15); strcpy(vuser->real_name, "\0"); if (lp_unix_realname()) { - pwfile=getpwnam(vuser->name); - DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->name,pwfile->pw_gecos)); - real_name_len = strcspn(pwfile->pw_gecos, ","); - DEBUG(3, ("Real name length: %d\n", real_name_len)); - vuser->real_name = (char *)Realloc(vuser->real_name, real_name_len+1); - strncpy(vuser->real_name, pwfile->pw_gecos, real_name_len); - vuser->real_name[real_name_len]='\0'; + if((pwfile=getpwnam(vuser->name))!= NULL) + { + DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->name,pwfile->pw_gecos)); + real_name_len = strcspn(pwfile->pw_gecos, ","); + DEBUG(3, ("Real name length: %d\n", real_name_len)); + vuser->real_name = (char *)Realloc(vuser->real_name, real_name_len+1); + strncpy(vuser->real_name, pwfile->pw_gecos, real_name_len); + vuser->real_name[real_name_len]='\0'; + } } return (uint16)((num_validated_users - 1) + VUID_OFFSET); -- cgit