smb2www -

Alain BARBET alian at
Thu Jan 3 03:27:01 GMT 2002


I just upload on CPAN version 0.7 of Perl module Filesys-SmbClient.
(It use 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:

But there is 2 problems with that, pb that I already know:
1/ trivial
Here the code in ....

# 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";
# End of temporary hack

Not really beautiful no ? and add a test in 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.

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
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 ;-)

Thanks for R.Sharpe and others for job they do on Samba.
Sorry for bad english.

More information about the samba-technical mailing list