mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
added a NET_USER_INFO_3 struct to user_struct.
register_vuid fills it with constructed info.
(This used to be commit b1889e4334
)
This commit is contained in:
parent
1bdbb4e601
commit
84d40095e1
File diff suppressed because it is too large
Load Diff
@ -612,24 +612,6 @@ typedef struct {
|
||||
fstring domain; /* domain that the client specified */
|
||||
} userdom_struct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uid_t uid; /* uid of a validated user */
|
||||
gid_t gid; /* gid of a validated user */
|
||||
|
||||
userdom_struct user;
|
||||
BOOL guest;
|
||||
|
||||
/* following groups stuff added by ih */
|
||||
/* This groups info is needed for when we become_user() for this uid */
|
||||
int n_groups;
|
||||
gid_t *groups;
|
||||
|
||||
/* per-user authentication information on NT RPCs */
|
||||
/* lkclXXXX - THIS SHOULD NOT BE HERE! */
|
||||
struct dcinfo dc;
|
||||
} user_struct;
|
||||
|
||||
enum {LPQ_QUEUED,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING};
|
||||
|
||||
typedef struct _print_queue_struct
|
||||
@ -1701,6 +1683,26 @@ struct ntdom_info
|
||||
#include "client.h"
|
||||
#include "rpcclient.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uid_t uid; /* uid of a validated user */
|
||||
gid_t gid; /* gid of a validated user */
|
||||
|
||||
userdom_struct user;
|
||||
BOOL guest;
|
||||
|
||||
/* following groups stuff added by ih */
|
||||
/* This groups info is needed for when we become_user() for this uid */
|
||||
int n_groups;
|
||||
gid_t *groups;
|
||||
|
||||
NET_USER_INFO_3 usr;
|
||||
|
||||
/* per-user authentication information on NT RPCs */
|
||||
/* lkclXXXX - THIS SHOULD NOT BE HERE! */
|
||||
struct dcinfo dc;
|
||||
} user_struct;
|
||||
|
||||
/*
|
||||
* Size of new password account encoding string. DO NOT CHANGE.
|
||||
*/
|
||||
|
@ -100,11 +100,11 @@ END {
|
||||
|
||||
{
|
||||
gotstart = 0;
|
||||
if( $0 ~ /^connection_struct|^pipes_struct|^file_fd_struct|^files_struct|^connection_struct|^uid_t|^gid_t|^unsigned|^mode_t|^DIR|^user|^int|^pid_t|^ino_t|^off_t/ ) {
|
||||
if( $0 ~ /^const|^connection_struct|^pipes_struct|^file_fd_struct|^files_struct|^connection_struct|^uid_t|^gid_t|^unsigned|^mode_t|^DIR|^user|^int|^pid_t|^ino_t|^off_t/ ) {
|
||||
gotstart = 1;
|
||||
}
|
||||
|
||||
if( $0 ~ /^LOCAL_GRP|^DOMAIN_GRP|^SMB_STRUCT_DIRENT|^SEC_ACL|^SEC_DESC|^SEC_DESC_BUF|^DOM_SID/ ) {
|
||||
if( $0 ~ /^vuser_key|^UNISTR2|^LOCAL_GRP|^DOMAIN_GRP|^SMB_STRUCT_DIRENT|^SEC_ACL|^SEC_DESC|^SEC_DESC_BUF|^DOM_SID/ ) {
|
||||
gotstart = 1;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,8 @@ has been given. vuid is biased by an offset. This allows us to
|
||||
tell random client vuid's (normally zero) from valid vuids.
|
||||
****************************************************************************/
|
||||
uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
|
||||
char *domain,BOOL guest)
|
||||
char *domain,BOOL guest,
|
||||
NET_USER_INFO_3 *usr)
|
||||
{
|
||||
user_struct *vuser;
|
||||
struct passwd *pwfile; /* for getting real name from passwd file */
|
||||
@ -274,6 +275,38 @@ uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
|
||||
&vuser->n_groups,
|
||||
&vuser->groups);
|
||||
|
||||
if (usr == NULL)
|
||||
{
|
||||
int i;
|
||||
extern DOM_SID global_sam_sid;
|
||||
|
||||
DEBUG(0,("vuser struct usr being filled in with trash, today\n"));
|
||||
DEBUG(0,("this needs to be replaced with a proper surs impl.\n"));
|
||||
DEBUG(0,("e.g. the one used in winbindd. in fact, all\n"));
|
||||
DEBUG(0,("occurrences of pdb_xxx_to_xxx should be replaced\n"));
|
||||
DEBUG(0,("as soon as possible.\n"));
|
||||
vuser->usr.user_id = pdb_uid_to_user_rid(uid);
|
||||
vuser->usr.group_id = pdb_gid_to_group_rid(gid);
|
||||
vuser->usr.num_groups = vuser->n_groups;
|
||||
for (i = 0; i < vuser->usr.num_groups; i++)
|
||||
{
|
||||
DOM_GID *ntgid = &vuser->usr.gids[i];
|
||||
ntgid->attr = 0x7;
|
||||
ntgid->g_rid = pdb_gid_to_group_rid(vuser->groups[i]);
|
||||
}
|
||||
|
||||
/* this is possibly the worst thing to do, ever. it assumes */
|
||||
/* that all users of this system are in the local SAM database */
|
||||
/* however, because there is no code to do anything otherwise, */
|
||||
/* we have no choice */
|
||||
|
||||
init_dom_sid2(&vuser->usr.dom_sid, &global_sam_sid);
|
||||
}
|
||||
else
|
||||
{
|
||||
vuser->usr = *usr;
|
||||
}
|
||||
|
||||
DEBUG(3,("uid %d registered to name %s\n",(int)uid,unix_name));
|
||||
|
||||
DEBUG(3, ("Clearing default real name\n"));
|
||||
|
@ -1000,7 +1000,10 @@ 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,sesssetup_user,domain,guest);
|
||||
|
||||
DEBUG(0,("must call domain_client_validate() which returns a "));
|
||||
DEBUG(0,("NET_USER_INFO_3 structure to pass to register_vuid()"));
|
||||
sess_vuid = register_vuid(uid,gid,user,sesssetup_user,domain,guest, NULL);
|
||||
|
||||
SSVAL(outbuf,smb_uid,sess_vuid);
|
||||
SSVAL(inbuf,smb_uid,sess_vuid);
|
||||
|
Loading…
Reference in New Issue
Block a user