Skip Menu |

This queue is for tickets about the Filesys-SmbClient CPAN distribution.

Report information
The Basics
Id: 4085
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Filesys-SmbClient

People
Owner: alian [...] alianwebserver.com
Requestors: dpavlin [...] rot13.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.4
Fixed in: (no value)



Subject: Problems with Filesys::SmbClient and patch
It seems that samba 3.0.0 in smbc_readdir reports filename length which include null terminating char. So, checks like ($f eq '.' || $f eq '..') will fail miserably and probably drag rest of perl with it (as it happend to me). Included is patch (against version 1.4) which change length of created strings (from using value supplied by samba to strlen). I'm using Debian GNU/Linux unstable, and perl, v5.8.1 built for i386-linux-thread-multi.
--- Filesys-SmbClient-1.4/SmbClient.xs 2002-10-17 15:12:53.000000000 +0200 +++ Filesys-SmbClient-1.4+opendir_fix/SmbClient.xs 2003-10-12 16:16:55.000000000 +0200 @@ -159,8 +159,14 @@ if (dirp) { XPUSHs(sv_2mortal(newSVnv(dirp->smbc_type))); +/* + * original code here produces strings which include NULL as last char + * XPUSHs(sv_2mortal((SV*)newSVpv(dirp->name, dirp->namelen))); XPUSHs(sv_2mortal((SV*)newSVpv(dirp->comment, dirp->commentlen))); +*/ + XPUSHs(sv_2mortal((SV*)newSVpv(dirp->name, strlen(dirp->name)))); + XPUSHs(sv_2mortal((SV*)newSVpv(dirp->comment, strlen(dirp->comment)))); }