[Samba] Re: Win32 services management?

Gerald (Jerry) Carter jerry at samba.org
Wed Apr 11 17:01:53 GMT 2007

Hash: SHA1

[Moving to Samba-technical for dev discussion]


> I am facing some difficulties in implementing the parser 
> function. Somehow - I keep getting a 'nca_s_fault_ndr' responses.
> I guess this is due invalid parsing of parameters. I am 
> counting on the IDL specified here:
> http://websvn.samba.org/cgi-bin/viewcvs.cgi/branches/SAMBA_4_0/source/librpc/idl/svcctl.idl?rev=18639&view=markup
> And having couple of problems:

First, are you using bzr for source control?  This would be
helpful in reviewing your patches.

If you need more details on using bzr with Samba svn trees,
See http://wiki.samba.org/index.php/Using_Bazaar_for_Samba_Development

>   1.
>      svcctl_CreateServiceW defines [in,size_is(dependencies_size)] 
> uint8 *dependencies and [in] uint32 dependencies_size.
> Which are uint8 type - I think I can use a RPC_DATA_BLOB
> for that. This type appear in several places - including
> the username/pass combination for the service user.
> Looking at a Windows packet created with the CreateService() 
> API, I can see the password is encrypted. I don't know
> how to resolve this issue.

What is the password length ?  I'd assume it is some derivative
of the the NTLM hash (it not the hash itself).

>   2. I am trying to create a simple service, ignoring 
>      all the complicated issues, that is: passing 'null'
>      at all places I don't have to implement. But yet - all
>      I am getting is a 'nca_s_fault_ndr'.

Something is off with the parsing functions.  Specifically the PDU you
are sending.

>   3. Questions:
>      1. How much should I count on the Samba4 IDL? How is it
>         generated? I found no official documentation on that.

It's generally very accurate although I remember having to flesh
out a few places where the svcctl calls were wrong.

>      2. Looking at the SMB package data I see that the
>         'Policy_handle' part is larger (in size) than the Windows
>         counterpart, my function does the same as the others
>         regarding this handle, so I am just ignoring this issue. Is
>         it wise?

The handle is always 20 bytes.  Can you send me a packet trace
to point out what you mean here ?

>      3. I don't quite understand if it matters to declare a pointer
>         in the code (UNISTR2 *str) and then use the prs_pointer()
>         function rather than declaring a variable (UNISTR2 str) and
>         using the smb_io_unistr2() function. I saw the latter do
>         some padding (prs_align()), but I keep getting gaps in my
>         packets which I can't explain - no matter which function I use.

Some rpc PDUs always have the string.  Others use a 32bit pointer
to indicate whether the string value is present or not.  These two
instances (a UNISTR2 and a UNIST2R2*) are parsed differently.

cheers, jerry
Samba                                    ------- http://www.samba.org
Centeris                         -----------  http://www.centeris.com
"What man is a man who does not make the world better?"      --Balian
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the samba-technical mailing list