The tag is invalid (patch)
Jeremy Allison
jeremy at valinux.com
Wed Aug 8 19:05:09 GMT 2001
Adriaan de Jong wrote:
>
> I am currently having the same problems. Would it indeed be possible to
> post the patch?
>
> Thank you in advance,
>
> Adriaan de Jong
>
> jeremy at valinux.com (Jeremy Allison) wrote in message
> news:<9k4q0t$bmn$1 at FreeBSD.csie.NCTU.edu.tw>...
> > Arnold Andrews X-324-4292 wrote:
> > >
> > > > The NT Server tools are supported in "Read Only" mode.
> > > >
> > > > I've gotten this "invalid tag" error before when using User Manager
> for
> > > > Domains on a workstation that was not a member of a domain or a
> member
> > > > of a domain that wasn't functioning.
> > >
> > > When I try it from my Windows 2k pro workstation (which is a member of
> the Samba
> > > PDC) I get, "the stub received bad data".
> > >
> > > I'm running 2.2.1a on Solaris 8.
> >
> > Known bug I fixed in the 2.2 CVS tree. I'm sorry.
> > Let me know if you need the patch posted...
Ok - I've attached the diff against 2.2.1a to this
message.
Jeremy.
--
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------
-------------- next part --------------
--- /cthulhu/u1/jeremy/tmp/samba-2.2.1/source/rpc_server/srv_samr_nt.c Mon Jul 9 17:13:22 2001
+++ rpc_server/srv_samr_nt.c Mon Jul 23 15:02:47 2001
@@ -625,9 +625,9 @@
if (num_sam_entries == 0)
return;
- sam = (SAM_ENTRY *)talloc(ctx, sizeof(SAM_ENTRY)*num_sam_entries);
+ sam = (SAM_ENTRY *)talloc_zero(ctx, sizeof(SAM_ENTRY)*num_sam_entries);
- uni_name = (UNISTR2 *)talloc(ctx, sizeof(UNISTR2)*num_sam_entries);
+ uni_name = (UNISTR2 *)talloc_zero(ctx, sizeof(UNISTR2)*num_sam_entries);
if (sam == NULL || uni_name == NULL) {
DEBUG(0, ("NULL pointers in SAMR_R_QUERY_DISPINFO\n"));
@@ -740,9 +740,9 @@
if (num_sam_entries == 0)
return;
- sam = (SAM_ENTRY *)talloc(ctx, sizeof(SAM_ENTRY)*num_sam_entries);
+ sam = (SAM_ENTRY *)talloc_zero(ctx, sizeof(SAM_ENTRY)*num_sam_entries);
- uni_name = (UNISTR2 *)talloc(ctx, sizeof(UNISTR2)*num_sam_entries);
+ uni_name = (UNISTR2 *)talloc_zero(ctx, sizeof(UNISTR2)*num_sam_entries);
if (sam == NULL || uni_name == NULL) {
DEBUG(0, ("NULL pointers in SAMR_R_QUERY_DISPINFO\n"));
@@ -1044,43 +1044,55 @@
data_size = q_u->max_size;
- ctr = (SAM_DISPINFO_CTR *)talloc(p->mem_ctx,sizeof(SAM_DISPINFO_CTR));
+ ctr = (SAM_DISPINFO_CTR *)talloc_zero(p->mem_ctx,sizeof(SAM_DISPINFO_CTR));
if (!ctr)
return NT_STATUS_NO_MEMORY;
+ ZERO_STRUCTP(ctr);
+
/* Now create reply structure */
switch (q_u->switch_level) {
case 0x1:
- if (!(ctr->sam.info1 = (SAM_DISPINFO_1 *)talloc(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_1))))
- return NT_STATUS_NO_MEMORY;
+ if (num_entries) {
+ if (!(ctr->sam.info1 = (SAM_DISPINFO_1 *)talloc_zero(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_1))))
+ return NT_STATUS_NO_MEMORY;
+ }
disp_ret = init_sam_dispinfo_1(p->mem_ctx,ctr->sam.info1, &num_entries, &data_size, q_u->start_idx, pass);
if (disp_ret != NT_STATUS_NO_PROBLEMO)
return disp_ret;
break;
case 0x2:
- if (!(ctr->sam.info2 = (SAM_DISPINFO_2 *)talloc(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_2))))
- return NT_STATUS_NO_MEMORY;
+ if (num_entries) {
+ if (!(ctr->sam.info2 = (SAM_DISPINFO_2 *)talloc_zero(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_2))))
+ return NT_STATUS_NO_MEMORY;
+ }
disp_ret = init_sam_dispinfo_2(p->mem_ctx,ctr->sam.info2, &num_entries, &data_size, q_u->start_idx, pass);
if (disp_ret != NT_STATUS_NO_PROBLEMO)
return disp_ret;
break;
case 0x3:
- if (!(ctr->sam.info3 = (SAM_DISPINFO_3 *)talloc(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_3))))
- return NT_STATUS_NO_MEMORY;
+ if (num_entries) {
+ if (!(ctr->sam.info3 = (SAM_DISPINFO_3 *)talloc_zero(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_3))))
+ return NT_STATUS_NO_MEMORY;
+ }
disp_ret = init_sam_dispinfo_3(p->mem_ctx,ctr->sam.info3, &num_entries, &data_size, q_u->start_idx, grps);
if (disp_ret != NT_STATUS_NO_PROBLEMO)
return disp_ret;
break;
case 0x4:
- if (!(ctr->sam.info4 = (SAM_DISPINFO_4 *)talloc(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_4))))
- return NT_STATUS_NO_MEMORY;
+ if (num_entries) {
+ if (!(ctr->sam.info4 = (SAM_DISPINFO_4 *)talloc_zero(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_4))))
+ return NT_STATUS_NO_MEMORY;
+ }
disp_ret = init_sam_dispinfo_4(p->mem_ctx,ctr->sam.info4, &num_entries, &data_size, q_u->start_idx, pass);
if (disp_ret != NT_STATUS_NO_PROBLEMO)
return disp_ret;
break;
case 0x5:
- if (!(ctr->sam.info5 = (SAM_DISPINFO_5 *)talloc(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_5))))
- return NT_STATUS_NO_MEMORY;
+ if (num_entries) {
+ if (!(ctr->sam.info5 = (SAM_DISPINFO_5 *)talloc_zero(p->mem_ctx,num_entries*sizeof(SAM_DISPINFO_5))))
+ return NT_STATUS_NO_MEMORY;
+ }
disp_ret = init_sam_dispinfo_5(p->mem_ctx,ctr->sam.info5, &num_entries, &data_size, q_u->start_idx, grps);
if (disp_ret != NT_STATUS_NO_PROBLEMO)
return disp_ret;
@@ -1313,11 +1325,11 @@
*pp_hdr_name = NULL;
if (num_names != 0) {
- hdr_name = (UNIHDR *)talloc(ctx, sizeof(UNIHDR)*num_names);
+ hdr_name = (UNIHDR *)talloc_zero(ctx, sizeof(UNIHDR)*num_names);
if (hdr_name == NULL)
return False;
- uni_name = (UNISTR2 *)talloc(ctx,sizeof(UNISTR2)*num_names);
+ uni_name = (UNISTR2 *)talloc_zero(ctx,sizeof(UNISTR2)*num_names);
if (uni_name == NULL)
return False;
}
@@ -1363,7 +1375,7 @@
}
if (num_rids) {
- if ((group_attrs = (uint32 *)talloc(p->mem_ctx, num_rids * sizeof(uint32))) == NULL)
+ if ((group_attrs = (uint32 *)talloc_zero(p->mem_ctx, num_rids * sizeof(uint32))) == NULL)
return NT_STATUS_NO_MEMORY;
}
@@ -1476,6 +1488,7 @@
DEBUG(3,("User:[%s]\n", smb_pass->smb_name));
+ ZERO_STRUCTP(id10);
init_sam_user_info10(id10, smb_pass->acct_ctrl);
return True;
@@ -1513,6 +1526,7 @@
if (smb_pass->acct_ctrl & ACB_DISABLED)
return NT_STATUS_ACCOUNT_DISABLED;
+ ZERO_STRUCTP(id12);
init_sam_user_info12(id12, smb_pass->smb_passwd, smb_pass->smb_nt_passwd);
return NT_STATUS_NOPROBLEMO;
@@ -1613,7 +1627,7 @@
DEBUG(5,("_samr_query_userinfo: rid:0x%x\n", rid));
- ctr = (SAM_USERINFO_CTR *)talloc(p->mem_ctx, sizeof(SAM_USERINFO_CTR));
+ ctr = (SAM_USERINFO_CTR *)talloc_zero(p->mem_ctx, sizeof(SAM_USERINFO_CTR));
if (!ctr)
return NT_STATUS_NO_MEMORY;
@@ -1624,7 +1638,7 @@
switch (q_u->switch_value) {
case 0x10:
- ctr->info.id10 = (SAM_USER_INFO_10 *)talloc(p->mem_ctx, sizeof(SAM_USER_INFO_10));
+ ctr->info.id10 = (SAM_USER_INFO_10 *)talloc_zero(p->mem_ctx, sizeof(SAM_USER_INFO_10));
if (ctr->info.id10 == NULL)
return NT_STATUS_NO_MEMORY;
@@ -1642,7 +1656,7 @@
expire.low = 0xffffffff;
expire.high = 0x7fffffff;
- ctr->info.id = (SAM_USER_INFO_11 *)talloc(p->mem_ctx,
+ ctr->info.id = (SAM_USER_INFO_11 *)talloc_zero(p->mem_ctx,
sizeof
(*ctr->
info.
@@ -1658,7 +1672,7 @@
#endif
case 0x12:
- ctr->info.id12 = (SAM_USER_INFO_12 *)talloc(p->mem_ctx, sizeof(SAM_USER_INFO_12));
+ ctr->info.id12 = (SAM_USER_INFO_12 *)talloc_zero(p->mem_ctx, sizeof(SAM_USER_INFO_12));
if (ctr->info.id12 == NULL)
return NT_STATUS_NO_MEMORY;
@@ -1667,7 +1681,7 @@
break;
case 21:
- ctr->info.id21 = (SAM_USER_INFO_21 *)talloc(p->mem_ctx,sizeof(SAM_USER_INFO_21));
+ ctr->info.id21 = (SAM_USER_INFO_21 *)talloc_zero(p->mem_ctx,sizeof(SAM_USER_INFO_21));
if (ctr->info.id21 == NULL)
return NT_STATUS_NO_MEMORY;
if (!get_user_info_21(ctr->info.id21, rid))
@@ -1739,7 +1753,7 @@
{
SAM_UNK_CTR *ctr;
- if ((ctr = (SAM_UNK_CTR *)talloc(p->mem_ctx, sizeof(SAM_UNK_CTR))) == NULL)
+ if ((ctr = (SAM_UNK_CTR *)talloc_zero(p->mem_ctx, sizeof(SAM_UNK_CTR))) == NULL)
return NT_STATUS_NO_MEMORY;
ZERO_STRUCTP(ctr);
@@ -1983,8 +1997,8 @@
if (num_sam_entries == 0)
return True;
- sam = (SAM_ENTRY *)talloc(ctx, sizeof(SAM_ENTRY)*num_sam_entries);
- uni_name = (UNISTR2 *)talloc(ctx, sizeof(UNISTR2)*num_sam_entries);
+ sam = (SAM_ENTRY *)talloc_zero(ctx, sizeof(SAM_ENTRY)*num_sam_entries);
+ uni_name = (UNISTR2 *)talloc_zero(ctx, sizeof(UNISTR2)*num_sam_entries);
if (sam == NULL || uni_name == NULL)
return False;
More information about the samba-technical
mailing list