1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

One less getpwnam() call...

Andrew Bartlett
(This used to be commit 204da7ba96)
This commit is contained in:
Andrew Bartlett 2001-08-17 05:38:44 +00:00
parent 8cceea0f3f
commit 90d2460cf0
2 changed files with 6 additions and 11 deletions

View File

@ -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);

View File

@ -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));