smb2www - libsmbclient.so

Richard Sharpe sharpe at ns.aus.com
Thu Jan 3 18:09:02 GMT 2002


Hmmm,

I guess I should look at this :-)

Andrew Bartlett wrote:

>Alain BARBET wrote:
>
>>Hi,
>>
>>I just upload on CPAN version 0.7 of Perl module Filesys-SmbClient.
>>(It use libsmbclient.so to provide perl method to access smb filesystem).
>>It comes with a cgi script smb2www-2.cgi
>>Features for now are:
>>- browse share, dir
>>- read file
>>- upload file
>>- create dir
>>- unlink file
>>Waiting CPAN put file on mirrors, you can found it here:
>>http://www.alianwebserver.com/tmp/Filesys-SmbClient-0.7.tar.gz
>>
>
>Neat!  I've been hoping sombody would do that.
>
>>But there is 2 problems with that, pb that I already know:
>>1/ trivial
>>Here the code in SmbClient.pm ....
>>
>># Here is a temporary hack:
>># Actually libsmbclient will segfault if it can't find file
>># $ENV{HOME}/.smb/smb.conf so I will test if it exist,
>># and create it if no file is found. A empty file is enough ...
>># In cgi environnement, $ENV{HOME} can be unset because
>># nobody is not a real user. So I will set $ENV{HOME} to dir /tmp
>>if (!$ENV{HOME}) {$ENV{HOME}="/tmp";}
>>if (!-e "$ENV{HOME}/.smb/smb.conf")
>>   {
>>    print STDERR "you don't have a $ENV{HOME}/.smb/smb.conf, ",
>>       "I will create it (empty file)\n";
>>     mkdir "$ENV{HOME}/.smb" unless (-e "$ENV{HOME}/.smb");
>>     open(F,">$ENV{HOME}/.smb/smb.conf") ||
>>     die "Can't create $ENV{HOME}/.smb/smb.conf : $!\n";
>>     close(F);
>>   }
>># End of temporary hack
>>
>>Not really beautiful no ? and add a test in libsmbclient.so is not too
>>hard no ? I know that there is a lot of job around smb.conf, but if only
>>a empty file is mandatory, it's not a good reason.
>>
>
>If nobody else chases this up I'll do it.  It shouldn't be too hard to
>make it cope without it (if only by allowing .smb/.smb.conf or /dev/null
>as default config files).
> 
>
>>2/ need to add method in libsmbclient ...
>>Problem with:
>>CGI persistant (FAST-cgi, mod-perl) / User connection / security
>>As I can understand, there is a poll of connection in libsmbclient.so
>>I a user is already connected, password is not checked and open
>>connection is given. So in one shot CGI, no problem.
>>No with persistant:
>>First a user will successful logged. He do his job and go on. Now a
>>second user come. CGI script will not go down on web server and smb
>>connection is always open. If second user provide a correct name, he can
>>use connection of first user without know the password :-((
>>A workaround is to provide method that check that a user/password is
>>correct on a given server.
>>
>>I know that I have already asked for this feature on this list, but I
>>hope that for a open source project I will receive more result ;-)
>>
>
>This shouldn't be too hard, but I've not looked inside the
>libsmbclient.so code yet.  But as I intend to use (and extend)
>libsmbclient and your perl lib I might be able to do somthing.
>
>Andrew Bartlett
>

-- 
Richard Sharpe, rsharpe at ns.aus.com, LPIC-1
www.samba.org, www.ethereal.com, SAMS Teach Yourself Samba 
in 24 Hours, Special Edition, Using Samba







More information about the samba-technical mailing list