unicode filename in NTCreateAndX

Alison Winters alisonw at sgi.com
Thu Nov 30 00:26:45 GMT 2006


Hi everyone,

I'd like to make clear i'm not using C++ out of choice :-)  The first
and last time i used STL was in university.  Unfortunately the original
tool was written in C++ (see SAMBA_3_0/examples/pcap2nbench) and i
figure it's better to augment existing code than rewrite from scratch.
Currently it also doesn't link to any Samba libraries, which i'm
guessing was a deliberate design decision.  This looks like the kind of
tool you can compile and just drop in at a customer site to anonymously
profile their traffic.

Volker Lendecke wrote:
> On Wed, Nov 29, 2006 at 02:26:39PM +1100, Alison Winters wrote:
>> 1. What clients send UCS-2-encoded filenames?
> This can be negotiated by the client (highest bit in the
> flags2 field of the smb header), all clients that are
> able to send ntcreate&x are able to negotiate unicode.
> Unicode here means UTF-16.
> 
Cool.  Since we're only looking at read/write/ntcreatex here we'll only
need the conversion in one place (createx filename).  I'll check out
James' iconv tip to see if it's easier than shifting it all round myself :-)

>> 3. Is it possible sometimes the first byte of the UCS-2 string is
>>    uninitialized?  Is this one of those weird freaky alignment things?
> Yes, this is alignment. This is done via some wild macro
> calls from nttrans.c:576 down in charcnv.c:1193.
> 
I'll take a look.

I'm thinking of dumping std::string and just using a char *.  The
filenames should be UTF-8 anyway, and since " is an illegal NTFS
character we shouldn't get any problems breaking up the string.

Alison


More information about the samba-technical mailing list