summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-09-24 20:02:56 +0000
committerLuke Leighton <lkcl@samba.org>1998-09-24 20:02:56 +0000
commitf650b65800c6d6c09cc2d59d7afe728fcb819a5f (patch)
tree11db7b86fe69a29e00f2aa22ec6aa9fd84bf4ddd /source3
parent50beafdf22e54399af4b3dd841c53bfd6dd6de33 (diff)
downloadsamba-f650b65800c6d6c09cc2d59d7afe728fcb819a5f.tar.gz
samba-f650b65800c6d6c09cc2d59d7afe728fcb819a5f.tar.bz2
samba-f650b65800c6d6c09cc2d59d7afe728fcb819a5f.zip
this fixes the last of the issues where USRMGR.EXE and SRVMGR.EXE were
failing. running these two programs on a samba pdc now work. parse_samr.c: - removed __LINE__ from debug macros. - removed call to SMB_ASSERT_ARRAY() in samr_r_query_usergroups. the DOM_GID array is a malloc'd array (by make_dom_gids) not a static array. srv_samr.c: - replaced all "struct smb_passwd"s with sam_passwds instead. there were uid to rid confusion issues (assumptions that uids were equal to rids). - #if 0'd the pdb_rid_is_user() call which, given the above corrections, would probably work now. srv_util.c: - replaced "struct smb_passwd" with sam_passwd in lookup_user_rid, as assumptions were being made that uids were equal to rids. (This used to be commit 3f98697cd5203fba07518d7c777ba19644e35b45)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_parse/parse_samr.c10
-rw-r--r--source3/rpc_server/srv_samr.c57
-rw-r--r--source3/rpc_server/srv_util.c9
3 files changed, 41 insertions, 35 deletions
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 71eb8a37dd..e35bdd19d1 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -355,7 +355,7 @@ static void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx,
{
if (sam == NULL) return;
- DEBUG(5,("make_sam_entry1: %d\n", __LINE__));
+ DEBUG(5,("make_sam_entry1\n"));
sam->user_idx = user_idx;
sam->rid_user = rid_user;
@@ -415,7 +415,7 @@ static void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx,
{
if (sam == NULL) return;
- DEBUG(5,("make_sam_entry2: %d\n", __LINE__));
+ DEBUG(5,("make_sam_entry2\n"));
sam->user_idx = user_idx;
sam->rid_user = rid_user;
@@ -472,7 +472,7 @@ static void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx,
{
if (sam == NULL) return;
- DEBUG(5,("make_sam_entry3: %d\n", __LINE__));
+ DEBUG(5,("make_sam_entry3\n"));
sam->grp_idx = grp_idx;
sam->rid_grp = rid_grp;
@@ -510,7 +510,7 @@ static void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid)
{
if (sam == NULL) return;
- DEBUG(5,("make_sam_entry: %d\n", __LINE__));
+ DEBUG(5,("make_sam_entry\n"));
sam->rid = rid;
make_uni_hdr(&(sam->hdr_name), len_sam_name, len_sam_name, len_sam_name != 0);
@@ -1744,8 +1744,6 @@ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s
{
prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
- SMB_ASSERT_ARRAY(r_u->gid, r_u->num_entries2);
-
for (i = 0; i < r_u->num_entries2; i++)
{
smb_io_gid("", &(r_u->gid[i]), ps, depth);
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index 95b0a413c7..2c6e34801a 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -46,7 +46,7 @@ static BOOL get_sampwd_entries(SAM_USER_INFO_21 *pw_buf,
uint16 acb_mask)
{
void *vp = NULL;
- struct smb_passwd *pwd = NULL;
+ struct sam_passwd *pwd = NULL;
(*num_entries) = 0;
(*total_entries) = 0;
@@ -60,13 +60,13 @@ static BOOL get_sampwd_entries(SAM_USER_INFO_21 *pw_buf,
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. */
@@ -77,8 +77,8 @@ static BOOL get_sampwd_entries(SAM_USER_INFO_21 *pw_buf,
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))
{
@@ -617,27 +617,26 @@ static void samr_reply_lookup_ids(SAMR_Q_LOOKUP_IDS *q_u,
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
@@ -798,7 +797,7 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u,
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;
@@ -820,11 +819,11 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u,
}
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;
}
@@ -853,7 +852,7 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u,
/*******************************************************************
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;
@@ -875,10 +874,13 @@ static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 user_rid)
LOGON_HRS hrs;
int i;
+#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);
@@ -886,6 +888,7 @@ static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 user_rid)
if (sam_pass == NULL)
{
+ DEBUG(4,("User 0x%x not found\n", user_rid));
return False;
}
@@ -968,6 +971,8 @@ static void samr_reply_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u,
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)
{
@@ -1037,7 +1042,7 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
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;
@@ -1060,10 +1065,10 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
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;
}
@@ -1072,7 +1077,7 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
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);
}
@@ -1083,8 +1088,11 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
/* 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__));
}
@@ -1141,7 +1149,7 @@ static void samr_reply_unknown_32(SAMR_Q_UNKNOWN_32 *q_u,
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;
@@ -1159,10 +1167,10 @@ static void api_samr_unknown_32( int uid, prs_struct *data, prs_struct *rdata)
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;
@@ -1170,6 +1178,7 @@ static void api_samr_unknown_32( int uid, prs_struct *data, prs_struct *rdata)
else
{
/* this could cause trouble... */
+ DEBUG(0,("trouble!\n"));
status = 0;
}
diff --git a/source3/rpc_server/srv_util.c b/source3/rpc_server/srv_util.c
index 68a4f79f0b..3c0fc9271e 100644
--- a/source3/rpc_server/srv_util.c
+++ b/source3/rpc_server/srv_util.c
@@ -478,18 +478,17 @@ uint32 lookup_alias_rid(char *alias_name, uint32 *rid)
********************************************************************/
uint32 lookup_user_rid(char *user_name, uint32 *rid)
{
- struct smb_passwd *smb_pass;
+ struct sam_passwd *sam_pass;
(*rid) = 0;
/* find the user account */
become_root(True);
- smb_pass = getsmbpwnam(user_name);
+ sam_pass = getsam21pwnam(user_name);
unbecome_root(True);
- if (smb_pass != NULL)
+ if (sam_pass != NULL)
{
- /* lkclXXXX SHOULD use name_to_rid() here! */
- (*rid) = smb_pass->smb_userid;
+ (*rid) = sam_pass->user_rid;
return 0x0;
}