Winreg EnumValue returns junk values

Chetan S cshring at gmail.com
Mon Nov 20 09:14:58 GMT 2006


Hi Volker,

On 11/17/06, Volker Lendecke <Volker.Lendecke at sernet.de> wrote:
> Hi, Chetan!
>
> On Fri, Oct 13, 2006 at 06:50:30PM +0530, Chetan S wrote:
> > The winreg_enumvalue digs out values perfectly fine from the tdb and
> > this is observed in the server side log.smbd. However on the rpc
> > client side no value is listed. More importantly it receives junk.
>
> Did you find out more about this? If not, then this bug
> report is not really sufficient. We'd need more detailed
> steps to reproduce and log files.
>

I did find more about it.  The problem is with the UTF-8 / UTF-16
strings that get passed around.  Here's the error reported by ndr_pull
:

[2006/11/20 14:23:17, 10] rpc_client/cli_pipe.c:rpc_api_pipe(894)
  rpc_api_pipe: Remote machine 127.0.0.1 pipe \winreg fnum 0x75ab
returned 216 bytes.
[2006/11/20 14:23:17, 3] librpc/ndr/ndr.c:ndr_pull_error(343)
  ndr_pull_error(0): Bad array size 7 should exceed array length 12


The client code trips on the fact that the array size is less that the
actual length of the string.   The tcp dump+smbd log shows that the
values data is passed from the server side.

Steps to reproduce :

1. There are default values that smbd loads into the registry tdb in
registry/reg_db.c.  one of them is "DisplayName" which should have the
value "Event Log".   Enumerating the Event log key should result in
displaying the values within the subkey


./net rpc registry enumerate
"HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
-Uusername%password -d 10 2>smbclient_err.log

Expected output :
List of subkeys and values for the Eventlog key.

Actual output :
Nothing.

Client Error log (at -d 10) : smbclient_err.log  line 3014 states the
ndr_pull check error.

Samba Server log ( at -d 10 ) : log.smbd    line 4357 states that the
value was retrieved.


> Another thing: Did you already succeed in getting
> registry-defined shares in smbd running? I'm asking because
> I really want that feature, I'm close to doing it very soon
> :-)

Not really. Am entagled in trying to understand the problem.  My
immediate fear was whether the data I write goes in right or not. Its
really tricky to understand if a write to the registry has worked if
you cannot enumerate the values.  Although the crude way I employed
was to tdbdump and grep :)

The UTF-16 requirements of windows clients creeps into the code. And
interchangeably dealing with UTF-8/16 is a problem.

Another problem with the UTF-16 code is the conversion routine
convert_string_allocate ... I haven't had much success converting a
CH_UNIX / CH_UTF8 string to UTF-16. The function returns a truncated
value.

> Volker


Please let me know if you need any more information.

regards,
Chetan Shringarpure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smbclient_err.log.tar.bz2
Type: application/x-bzip2
Size: 9657 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20061120/9a4df354/smbclient_err.log.tar.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smbd.log.tar.bz2
Type: application/x-bzip2
Size: 17639 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20061120/9a4df354/smbd.log.tar.bin


More information about the samba-technical mailing list