libsmbclient MacOS X escape \r

Aleksandr Dolgarev adolgarev at
Tue Oct 23 16:13:03 MDT 2012


after mounting MacOS X 10.6 share via cifs:

mount -t cifs '//AAA/BBB' -o 'username=CCC,password=DDD' mpoint

I can stat file
stat mpoint/Post-Installation/Icon^M
File: `mpoint/Post-Installation/Icon\r' Size: 0 Blocks: 424 IO Block: 16384 
regular empty file Device: 13h/19d Inode: 34 Links: 1 Access: (0755/-rwxr-xr-x) 
Uid: ( 501/ UNKNOWN) Gid: ( 20/ dialout) Access: 2010-01-06 23:05:32.000000000 
-0800 Modify: 2010-01-06 23:05:32.000000000 -0800 Change: 2010-01-06 
23:05:32.000000000 -0800

But if I use libsmbclient I cannot stat this file. The reason lies in SMB 
protocol implementation. Stat operation (or smbc_stat() in libsmbclient) 
results in QUERY_PATH_INFO command that in the case of cifs.ko has following 
file name as parameter:
But in case of libsmbclient backslashes are used:
As you can see \r is not properly escaped in second case.

The question is how to properly escape the url for smbc_stat() (urlencode 
doesn't help) or how to make libsmbclient use forward slashes instead of 
backslashes as file name separator?

(I'm using samba-3.6-stable.)

best regards,

More information about the samba-technical mailing list