[Samba] Re: Win32 services management?

Danny Tylman danny.tylman at insightix.com
Wed Apr 11 16:35:48 GMT 2007


Hi,


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:

   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.

   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'.
   3. Questions:
         1. How much should I count on the Samba4 IDL? How is it
            generated? I found no official documentation on that.
         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?
         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.

Regards, Danny.

Gerald (Jerry) Carter wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> dtylman at gmail.com wrote:
>
>   
>> I am interested in implementing the 'createservice()' functionality
>> using the RPC protocol. I need this functionality badly, and I
>> understand it is not implemented.
>>     
>
>   
>> I understand vaguely how this should be working and found 
>> some documentation,
>> here: http://www.hsc.fr/ressources/articles/win_net_srv/
>> here:http://www.hsc.fr/ressources/articles/win_net_srv/
>> well_known_named_pipes.html
>> and here: http://www.hsc.fr/ressources/articles/win_net_srv/msrpc_srvsvc.html.
>>     
>
> Also look at the svcctl.ild definition in SAMBA_4_0.
>
> http://websvn.samba.org/cgi-bin/viewcvs.cgi/branches/SAMBA_4_0/source/librpc/idl/svcctl.idl?rev=18639&view=markup
>
>   
>> I guess the issue here is to use the same method used 
>> in the 'net' command ('net.c' - util) and try to call
>> the rpc-client with just different parameter as
>> the above mentioned links state.
>>
>> I don't have much experience in samba programming and I 
>> need to know:
>> (a) how complicate is that? should it be an easy task?
>> (b) I need some starting point.
>>
>> (of course - if this is already implemented somewhere, i would 
>> be glad to know!)
>>     
>
> It's not too hard.  Look at
> svn://svnanon.samba.org/samba/SAMBA_3_0/source/utils/net_rpc_service.c
>
> You'll need to do a few things.
>
> * Add request/reply  structures to include/rpc_svcctl.h
> * Add the parsing functions to rpc_parse/parse_svcctl
> * Add the client function to rpc_client/cli_svcctl.c
> * Add in the new command to net_rpc_service.c
>
> Start by looking at how the existing service management
> calls are implemented and then start adapting that to the
> new call.  All make sure you have a current release of
> wireshark to anaylze the traffic and make sure that
> parsing functions are doing the right thing.  Might even be
> good idea to get comfortable with the trafiic between
> two windows servers while playing with the Service Control
> MMC plugin.
>
> Hope this helps get you started.
>
>
>
>
> 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
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGFW2FIR7qMdg1EfYRAo5zAJ0YPqvjTdWsCPiUvCCoYmbFaC0BjgCgg2+n
> pdRXnahzWjL6NzMUcr/sjyU=
> =ShmY
> -----END PGP SIGNATURE-----
>   



More information about the samba mailing list