summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-08-17 05:38:44 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-08-17 05:38:44 +0000
commit90d2460cf0e644e82650763c502332e5adad27e7 (patch)
tree03cebde5b43b6267a3b50549dc0fbbafd1a13f4f
parent8cceea0f3f75aa3b12612e23ac6f80bae1e7e37f (diff)
downloadsamba-90d2460cf0e644e82650763c502332e5adad27e7.tar.gz
samba-90d2460cf0e644e82650763c502332e5adad27e7.tar.bz2
samba-90d2460cf0e644e82650763c502332e5adad27e7.zip
One less getpwnam() call...
Andrew Bartlett (This used to be commit 204da7ba96b0c562bab5e5536728a0378077bdc7)
-rw-r--r--source3/smbd/password.c13
-rw-r--r--source3/smbd/reply.c4
2 files changed, 6 insertions, 11 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 4aa5a0211e..b4d22a3850 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -203,10 +203,9 @@ tell random client vuid's (normally zero) from valid vuids.
****************************************************************************/
int register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
- char *domain,BOOL guest)
+ char *domain,BOOL guest, char* full_name)
{
user_struct *vuser = NULL;
- struct passwd *pwfile; /* for getting real name from passwd file */
/* Ensure no vuid gets registered in share level security. */
if(lp_security() == SEC_SHARE)
@@ -243,6 +242,8 @@ int register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
fstrcpy(vuser->user.unix_name,unix_name);
fstrcpy(vuser->user.smb_name,requested_name);
fstrcpy(vuser->user.domain,domain);
+ fstrcpy(vuser->user.full_name, full_name);
+ DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->user.unix_name,vuser->user.full_name));
vuser->n_groups = 0;
vuser->groups = NULL;
@@ -260,14 +261,6 @@ int register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
DLIST_ADD(validated_users, vuser);
- DEBUG(3,("uid %d registered to name %s\n",(int)uid,unix_name));
-
- DEBUG(3, ("Clearing default real name\n"));
- if ((pwfile=sys_getpwnam(vuser->user.unix_name))!= NULL) {
- DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->user.unix_name,pwfile->pw_gecos));
- fstrcpy(vuser->user.full_name, pwfile->pw_gecos);
- }
-
if (!session_claim(vuser->vuid)) {
DEBUG(1,("Failed to claim session for vuid=%d\n", vuser->vuid));
invalidate_vuid(vuser->vuid);
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 3ba1d4eea9..47a363ae8d 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -567,6 +567,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
int sess_vuid;
gid_t gid;
uid_t uid;
+ char* full_name;
int smb_bufsize;
int smb_apasslen = 0;
pstring smb_apasswd;
@@ -879,6 +880,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
}
gid = pw->pw_gid;
uid = pw->pw_uid;
+ full_name = pw->pw_gecos;
}
if (guest)
@@ -887,7 +889,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
/* register the name and uid as being validated, so further connections
to a uid can get through without a password, on the same VC */
- sess_vuid = register_vuid(uid,gid,user,current_user_info.smb_name,domain,guest);
+ sess_vuid = register_vuid(uid,gid,user,current_user_info.smb_name,domain,guest, full_name);
if (sess_vuid == -1) {
return(ERROR(ERRDOS,ERRnoaccess));