NetUserModalsGet call to samba 2.2.2 fails
Tyler, Ross E
retyler at raytheon.com
Mon Nov 19 08:41:27 GMT 2001
i have patched samba 2.2.2 so that it responds successfully to a windows
(2000) client requesting domain identification information (name and SID):
USER_MODALS_INFO_2 * domainIdInfo = 0;
NetUserModalsGet(L"theNameOfMySambaServerGoesHere", 2, (BYTE **)
&domainIdInfo);
using SAM_UNK_INFO_2 as a model, i implemented SAM_UNK_INFO_5 with the
following fields:
UNIHDR hdr_server; /* server name unicode header */
UNISTR2 uni_server; /* server name unicode string */
i changed the following files:
source/include/rpc_samr.h
source/rpc_parse/parse_samr.c
source/rpc_server/srv_samr_nt.c
the diff(-c)erences from (.)orig(inal) samba 2.2.2 files is attached -
suitable for patch(-bp)ing
i would appreciate your inspection/blessing of this code and
the inclusion of it (or equivalent) in future samba releases.
thanks for your support!
"Gerald (Jerry) Carter" wrote:
> On Thu, 15 Nov 2001, Tyler, Ross E wrote:
>
> > yes, i guess i understood that.
>
> I figured :)
>
> > my implied questions were "why not", "when" and "how can i help".
>
> We just haven't needed it yet is the most likely answer.
>
> > this type of call is something that i commonly do in my windows
> > networking code for various reasons. some of which are:
> >
> > programmatically joining an NT domain
> >
> > programmatically purging locally cached profiles from NT domain
> > accounts that have been removed.
> >
> > thanks for you quick response and your support!
>
> It should be pretty easy to implement. Run you win32 client
> against smbd (set "log level = 10" and "debug timestamp = no")
> Then figure out the structure. Probably best grab a Netmon
> capture of this as well.
>
> Implemented support will probably be cut-n-paste stuff for
> the most part.
>
> If you need help, let me know.
>
> ---------------------------------------------------------------------
> www.samba.org SAMBA Team jerry_at_samba.org
> www.plainjoe.org jerry_at_plainjoe.org
> http://www.hp.com Hewlett-Packard
> --"I never saved anything for the swim back." Ethan Hawk in Gattaca--
-------------- next part --------------
*** ./source/include/rpc_samr.h.orig Mon Nov 19 07:49:49 2001
--- ./source/include/rpc_samr.h Mon Nov 19 07:50:14 2001
***************
*** 476,481 ****
--- 476,488 ----
} SAM_UNK_INFO_3;
+ typedef struct sam_unknown_info_5_info
+ {
+ UNIHDR hdr_server; /* server name unicode header */
+ UNISTR2 uni_server; /* server name unicode string */
+
+ } SAM_UNK_INFO_5;
+
typedef struct sam_unknown_info_6_info
{
uint32 unknown_0; /* 0x0000 0000 */
***************
*** 549,554 ****
--- 556,562 ----
SAM_UNK_INFO_1 inf1;
SAM_UNK_INFO_2 inf2;
SAM_UNK_INFO_3 inf3;
+ SAM_UNK_INFO_5 inf5;
SAM_UNK_INFO_6 inf6;
SAM_UNK_INFO_7 inf7;
SAM_UNK_INFO_12 inf12;
*** ./source/rpc_parse/parse_samr.c.orig Sat Oct 13 14:09:34 2001
--- ./source/rpc_parse/parse_samr.c Mon Nov 19 07:25:02 2001
***************
*** 494,499 ****
--- 494,532 ----
inits a structure.
********************************************************************/
+ void init_unk_info5(SAM_UNK_INFO_5 * u_5,
+ char *server)
+ {
+ int len_server = strlen(server);
+ init_uni_hdr(&u_5->hdr_server, len_server);
+ init_unistr2(&u_5->uni_server, server, len_server);
+ }
+
+ /*******************************************************************
+ reads or writes a structure.
+ ********************************************************************/
+
+ static BOOL sam_io_unk_info5(char *desc, SAM_UNK_INFO_5 * u_5,
+ prs_struct *ps, int depth)
+ {
+ if (u_5 == NULL)
+ return False;
+
+ prs_debug(ps, depth, desc, "sam_io_unk_info5");
+ depth++;
+
+ if(!smb_io_unihdr("hdr_server", &u_5->hdr_server, ps, depth))
+ return False;
+ if(!smb_io_unistr2("uni_server", &u_5->uni_server, u_5->hdr_server.buffer, ps, depth))
+ return False;
+
+ return True;
+ }
+
+ /*******************************************************************
+ inits a structure.
+ ********************************************************************/
+
void init_unk_info6(SAM_UNK_INFO_6 * u_6)
{
u_6->unknown_0 = 0x00000000;
***************
*** 781,786 ****
--- 814,823 ----
if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
return False;
break;
+ case 0x05:
+ if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
+ return False;
+ break;
case 0x03:
if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
return False;
*** ./source/rpc_server/srv_samr_nt.c.orig Sat Oct 13 14:09:36 2001
--- ./source/rpc_server/srv_samr_nt.c Mon Nov 19 07:09:31 2001
***************
*** 1831,1836 ****
--- 1831,1839 ----
case 0x03:
init_unk_info3(&ctr->info.inf3);
break;
+ case 0x05:
+ init_unk_info5(&ctr->info.inf5, global_myname);
+ break;
case 0x06:
init_unk_info6(&ctr->info.inf6);
break;
More information about the samba-technical
mailing list