uint16 acb_mask)
{
void *vp = NULL;
- struct smb_passwd *pwd = NULL;
+ struct sam_passwd *pwd = NULL;
(*num_entries) = 0;
(*total_entries) = 0;
return False;
}
- while (((pwd = getsmbpwent(vp)) != NULL) && (*num_entries) < max_num_entries)
+ while (((pwd = getsam21pwent(vp)) != NULL) && (*num_entries) < max_num_entries)
{
int user_name_len = strlen(pwd->smb_name);
make_unistr2(&(pw_buf[(*num_entries)].uni_user_name), pwd->smb_name, user_name_len-1);
make_uni_hdr(&(pw_buf[(*num_entries)].hdr_user_name), user_name_len-1,
user_name_len-1, 1);
- pw_buf[(*num_entries)].user_rid = pwd->smb_userid;
+ pw_buf[(*num_entries)].user_rid = pwd->user_rid;
bzero( pw_buf[(*num_entries)].nt_pwd , 16);
/* Now check if the NT compatible password is available. */
pw_buf[(*num_entries)].acb_info = (uint16)pwd->acct_ctrl;
- DEBUG(5, ("get_smbpwd_entries: idx: %d user %s, uid %d, acb %x",
- (*num_entries), pwd->smb_name, pwd->smb_userid, pwd->acct_ctrl));
+ DEBUG(5, ("entry idx: %d user %s, rid 0x%x, acb %x",
+ (*num_entries), pwd->smb_name, pwd->user_rid, pwd->acct_ctrl));
if (acb_mask == 0 || IS_BITS_SET_SOME(pwd->acct_ctrl, acb_mask))
{
SAMR_R_CLOSE_HND r_u;
/* set up the SAMR unknown_1 response */
- bzero(&(r_u.pol.data), POL_HND_SIZE);
+ bzero(r_u.pol.data, POL_HND_SIZE);
/* close the policy handle */
if (close_lsa_policy_hnd(&(q_u->pol)))
DOM_SID other_sid;
user_sid = global_machine_sid;
+
+ SMB_ASSERT_ARRAY(user_sid.sub_auths, user_sid.num_auths+1);
+
/*
* Add the user RID.
*/
got_aliases = True;
num_entries = 1;
make_unistr2(&(pass[0].uni_user_name), dummy_alias, strlen(dummy_alias));
- pass[0].user_rid = DOMAIN_ALIAS_RID_ADMINS;
+ pass[0].user_rid = BUILTIN_ALIAS_RID_ADMINS;
if (r_e.status == 0 && got_aliases)
{
#if 0
int i;
+ SMB_ASSERT_ARRAY(q_u->uni_user_name, num_rids);
+
for (i = 0; i < num_rids && status == 0; i++)
{
- struct smb_passwd *smb_pass;
+ struct sam_passwd *sam_pass;
fstring user_name;
+
fstrcpy(user_name, unistrn2(q_u->uni_user_name[i].buffer,
- q_u->uni_user_name[i].uni_str_len));
+ q_u->uni_user_name[i].uni_str_len));
/* find the user account */
become_root(True);
- smb_pass = get_sampwd_entry(user_name, 0);
+ sam_pass = get_smb21pwd_entry(user_name, 0);
unbecome_root(True);
- if (smb_pass == NULL)
+ if (sam_pass == NULL)
{
status = 0xC0000000 | NT_STATUS_NO_SUCH_USER;
rid[i] = 0;
}
else
{
- /* lkclXXXX SHOULD use name_to_rid() here! */
- rid[i] = smb_pass->smb_userid;
+ rid[i] = sam_pass->user_rid;
}
}
#endif
num_rids = 1;
- rid[0] = DOMAIN_ALIAS_RID_USERS;
+ rid[0] = BUILTIN_ALIAS_RID_USERS;
make_samr_r_lookup_ids(&r_u, num_rids, rid, status);
DEBUG(5,("samr_lookup_names: truncating entries to %d\n", num_rids));
}
+ SMB_ASSERT_ARRAY(q_u->uni_user_name, num_rids);
+
for (i = 0; i < num_rids && status == 0; i++)
{
fstring name;
int status)
{
SAMR_R_OPEN_USER r_u;
- struct smb_passwd *smb_pass;
+ struct sam_passwd *sam_pass;
int pol_idx;
BOOL pol_open = False;
/* set up the SAMR open_user response */
- bzero(&(r_u.user_pol.data), POL_HND_SIZE);
+ bzero(r_u.user_pol.data, POL_HND_SIZE);
r_u.status = 0x0;
}
become_root(True);
- smb_pass = getsmbpwuid(q_u->user_rid);
+ sam_pass = getsam21pwrid(q_u->user_rid);
unbecome_root(True);
/* check that the RID exists in our domain. */
- if (r_u.status == 0x0 && smb_pass == NULL)
+ if (r_u.status == 0x0 && sam_pass == NULL)
{
r_u.status = 0xC0000000 | NT_STATUS_NO_SUCH_USER;
}
/*******************************************************************
api_samr_open_user
********************************************************************/
-static void api_samr_open_user( int uid, prs_struct *data, prs_struct *rdata)
+static void api_samr_open_user( int rid, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_OPEN_USER q_u;
/*************************************************************************
get_user_info_21
*************************************************************************/
-static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 rid)
+static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 user_rid)
{
NTTIME dummy_time;
struct sam_passwd *sam_pass;
LOGON_HRS hrs;
int i;
- /*
- * Convert from rid to either a uid or gid as soon as
- * possible. JRA.
- */
-
- if(pdb_rid_is_user(rid))
- {
- uint32 uid = pdb_user_rid_to_uid(rid);
- become_root(True);
- sam_pass = getsam21pwuid(uid);
- unbecome_root(True);
- }
- else
- {
- struct group *grent;
- uint32 gid;
- gid = pdb_group_rid_to_gid(rid);
- if((grent = getgrgid(gid)) == NULL)
- {
- DEBUG(0,("get_user_info_21: Unable to get group info.\n"));
- return False;
- }
- /* TODO - at this point we need to convert from
- a UNIX struct group into a user info 21 structure.
- Punt for now. JRA.
- */
- return False;
- }
+#ifdef DONT_CHECK_THIS_FOR_NOW
+ if (!pdb_rid_is_user(user_rid))
+ {
+ DEBUG(4,("RID 0x%x is not a user RID\n", user_rid));
+ return False;
+ }
+#endif
+
+ become_root(True);
+ sam_pass = getsam21pwrid(user_rid);
+ unbecome_root(True);
if (sam_pass == NULL)
{
+ DEBUG(4,("User 0x%x not found\n", user_rid));
return False;
}
/* create a LOGON_HRS structure */
hrs.len = sam_pass->hours_len;
+ SMB_ASSERT_ARRAY(hrs.hours, hrs.len);
for (i = 0; i < hrs.len; i++)
{
hrs.hours[i] = sam_pass->hours[i];
void *info = NULL;
uint32 status = 0x0;
- uint32 rid;
+ uint32 rid = 0x0;
int obj_idx;
DEBUG(5,("samr_reply_query_userinfo: %d\n", __LINE__));
status = NT_STATUS_OBJECT_TYPE_MISMATCH;
}
+ DEBUG(5,("samr_reply_query_userinfo: rid:0x%x\n", rid));
+
/* ok! user info levels (there are lots: see MSDEV help), off we go... */
if (status == 0x0)
{
SAMR_R_QUERY_USERGROUPS r_u;
uint32 status = 0x0;
- struct smb_passwd *smb_pass;
+ struct sam_passwd *sam_pass;
DOM_GID *gids = NULL;
int num_groups = 0;
int pol_idx;
if (status == 0x0)
{
become_root(True);
- smb_pass = getsmbpwuid(rid);
+ sam_pass = getsam21pwrid(rid);
unbecome_root(True);
- if (smb_pass == NULL)
+ if (sam_pass == NULL)
{
status = 0xC0000000 | NT_STATUS_NO_SUCH_USER;
}
if (status == 0x0)
{
pstring groups;
- get_domain_user_groups(groups, smb_pass->smb_name);
+ get_domain_user_groups(groups, sam_pass->smb_name);
gids = NULL;
num_groups = make_dom_gids(groups, &gids);
}
/* store the response in the SMB stream */
samr_io_r_query_usergroups("", &r_u, rdata, 0);
- if(gids)
- free((char *)gids);
+ if (gids)
+ {
+ free((char *)gids);
+ }
+
DEBUG(5,("samr_query_usergroups: %d\n", __LINE__));
}
SAMR_R_UNKNOWN_32 r_u;
/* set up the SAMR unknown_32 response */
- bzero(&(r_u.pol.data), POL_HND_SIZE);
+ bzero(r_u.pol.data, POL_HND_SIZE);
if (status == 0)
{
for (i = 4; i < POL_HND_SIZE; i++)
static void api_samr_unknown_32( int uid, prs_struct *data, prs_struct *rdata)
{
uint32 status = 0;
- struct smb_passwd *smb_pass;
+ struct sam_passwd *sam_pass;
fstring mach_acct;
SAMR_Q_UNKNOWN_32 q_u;
q_u.uni_mach_acct.uni_str_len));
become_root(True);
- smb_pass = getsmbpwnam(mach_acct);
+ sam_pass = getsam21pwnam(mach_acct);
unbecome_root(True);
- if (smb_pass != NULL)
+ if (sam_pass != NULL)
{
/* machine account exists: say so */
status = 0xC0000000 | NT_STATUS_USER_EXISTS;
else
{
/* this could cause trouble... */
+ DEBUG(0,("trouble!\n"));
status = 0;
}