I tried installing the Samba server mod for IPCop today, but didn't have much luck.
I got it from here.
After I installed the mod server, and then manually installed the smb mod, I found that I had broken the web interface to IPCop.
I had a look in index.cgi, to see what the install of the mod had done, and I noticed a reference to debugging in the top, so I uncommented the following line:
use CGI::Carp 'fatalsToBrowser';
After refreshing the page, I got the following error:
Global symbol "%tr" requires explicit package name at /var/ipcop/header.pl line 97.
I had a look at the header.pl file, and changed line 97 from:
[ $tr{'samba'} , '/cgi-bin/samba.cgi', "IPCop $tr{'Samba'}" ],
to:
[ $Lang::tr{'samba'} , '/cgi-bin/samba.cgi', "IPCop $Lang::tr{'Samba'}" ],
Now I had a new option in the Services menu, "Samba File Service".
I clicked on that, and I got a cgi error, so I went back an did the same as before, to enable the debugging.
The line wasn't in samba.cgi by default, so I had to add:
use CGI::Carp 'fatalsToBrowser';
Now I'm getting somewhere, I get the error:
Undefined subroutine &main::readhash called at /home/httpd/cgi-bin/samba.cgi line 21.
Hmm, what's this "readhash"? there are 2 references to it in the file, and it looks like it reads config files.
I did a quick google, and I turned up this page, with the source of the readhash function, so I copied it, and pasted in to end of samba.cgi.
I had another go at viewing the page, and I got the error:
Undefined subroutine &main::GetFileLock called at /home/httpd/cgi-bin/samba.cgi line 122.
I figured I could do without file locking, so I just commented out line 122, then I got:
Undefined subroutine &main::ReleaseFileLock called at /home/httpd/cgi-bin/samba.cgi line 139.
Since I didn't lock it, I figured I didn't need to unlock it, so I just commented out line 139.
Now I got:
Error in subroutine readhash: Can't open /ethernet/settings: No such file or directory at /home/httpd/cgi-bin/samba.cgi line 140.
Hmm, it seems that something is not right here, why is it looking in /ethernet? I doubt there is a subdirectory off root of /ethernet. I had a look in a couple of other files, and I saw other files using the readhash call etc, so it must work, and there must be something dumb breaking the samba file.
I removed the readhash subroutine again. That got me back to the original error:
Undefined subroutine &main::readhash called at /home/httpd/cgi-bin/samba.cgi line 21.
I compared the samba.cgi file with the vpn config cgi file, and started to suss out what was wrong.
I decided to change:
&readhash("${swroot}/ethernet/settings", \%netsettings);
to:
&readhash("${General::swroot}/ethernet/settings", \%netsettings);
but I was still getting:
Undefined subroutine &main::readhash called at /home/httpd/cgi-bin/samba.cgi line 21.
I noticed a couple of other lines different in the source files, and tried replacing:
require '/var/ipcop/header.pl';
with the version from the vpn file:
require "${General::swroot}/header.pl";
But now it was looking for /header.pl. Hmm, it seems that the "swroot" variable is not being evaluted properly. I might be on to something here, since this would explain the /ethernet call from before.
I added in:
require '/var/ipcop/general-functions.pl';
Above the other line, and then I changed line 21, from:
&readhash("${General::swroot}/ethernet/settings", \%netsettings);
to:
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
That seemed to work, but now I got:
Undefined subroutine &main::showhttpheaders called at /home/httpd/cgi-bin/samba.cgi line 25.
I had another look, and compared with the vpn file, and decided to change:
&showhttpheaders();
to:
&Header::showhttpheaders();
I got a bit further:
Undefined subroutine &main::getcgihash called at /home/httpd/cgi-bin/samba.cgi line 29.
so I changed:
&getcgihash(\%sambasettings, {'wantfile' => 1, 'filevar' => 'FH'});
to:
&Header::getcgihash(\%sambasettings, {'wantfile' => 1, 'filevar' => 'FH'});
Which resulted in:
Undefined subroutine &main::writehash called at /home/httpd/cgi-bin/samba.cgi line 33.
so I changed:
&writehash("${swroot}/samba/settings", \%sambasettings);
to:
&General::writehash("${swroot}/samba/settings", \%sambasettings);
And now I got a new error:
Unable to write file /samba/settings at /var/ipcop/general-functions.pl line 75.
oops, I see what the problem is, let's try again, and change the line to:
&General::writehash("${General::swroot}/samba/settings", \%sambasettings);
Now I got:
Can't open file: No such file or directory at /home/httpd/cgi-bin/samba.cgi line 37.
It looked like I needed to change:
open(OUTFILE, ">${swroot}/samba/smb.conf") or die "Can't open file: $!";
to:
open(OUTFILE, ">${General::swroot}/samba/smb.conf") or die "Can't open file: $!";
This got me a bit further, and it took a second, so I thought it was going to work, but then:
Can't open '/samba/smb.conf': No such file or directory at /home/httpd/cgi-bin/samba.cgi line 52.
Damn. Let me guess, another "General::" missing, from line 52..
Nope.. it's actually missing from line 51..
my $file = shift || "${swroot}/samba/smb.conf";
which I changed to:
my $file = shift || "${General::swroot}/samba/smb.conf";
Now I got:
Can't open '/samba/smb.conf': No such file or directory at /home/httpd/cgi-bin/samba.cgi line 58.
Another problem, this time line 58? nope, it's the same as 52, where the problem was before it. This time I found the line with the problem was line 55, which was exactly the same as 51, so I just replaced 55 with the fixed line 51.
I don't know why it's declared twice, that doesn't make sense to me, but then I'm not a perl programmer, so who knows.
Now I got:
Undefined subroutine &main::readhash called at /home/httpd/cgi-bin/samba.cgi line 63.
so I replaced the line:
&readhash("${swroot}/samba/settings", \%sambasettings);
with:
&General::readhash("${General::swroot}/samba/settings", \%sambasettings);
Now I got a bit further..
Undefined subroutine &main::openpage called at /home/httpd/cgi-bin/samba.cgi line 69.
and I found another line requiring fixing..
&openpage($tr{'samba'}, 1, '');
changed to:
&Header::openpage($Lang::tr{'samba'}, 1, '');
now the page starts to render properly, and I get the bars across the top, but still get:
Undefined subroutine &main::openbigbox called at /home/httpd/cgi-bin/samba.cgi line 71.
I found that I had to change the line:
&openbigbox('100%', 'left');
to:
&Header::openbigbox('100%', 'left');
This now got marginally further, but:
Undefined subroutine &main::openbox called at /home/httpd/cgi-bin/samba.cgi line 80.
Gees, this is getting tedious.
I replaced:
&openbox('100%', 'left', $tr{'samba'});
with:
&Header::openbox('100%', 'left', $Lang::tr{'samba'});
Now it looks like I'm getting close, I get a big text box rendered, but still get errors:
Undefined subroutine &main::closebox called at /home/httpd/cgi-bin/samba.cgi line 110.
I changed:
&closebox();
to:
&Header::closebox();
and before seeing more errors, I decided to change the next couple of lines, from:
&closebigbox();
&closepage();
to:
&Header::closebigbox();
&Header::closepage();
Now I was getting no errors, but the text box was still empty, and the check box and button at the top had no text labels.
At this point, I decided to replace all reference to $tr with $Lang::tr, and all ${swroot} with ${General::swroot}, openbox/closebox Header etc, which still achieved nothing.
I then found that the smb.conf was empty for some reason. I backed up my modified cgi file, and reinstalled the package again, (because I was too lazy to just extract the tarball, and copy the smb.conf file.
I tried again, and was back to the old error in header.pl, oops, forgot that would get overwritten. I fixed that again, but the text box was still blank, and smb.conf was trashed again.
I decided to untar the samba install, and copy the config file across manually. This got me:
Can't open file: Permission denied at /home/httpd/cgi-bin/samba.cgi line 37.
oops, it belongs to root now, so I chown'd the file.. and tried again.. and it immediately got trashed.
I gaveup, after all that.
I while later, I decided to have another look. I noticed an "addons" tab in the IPCop web interface, so I tried to use it to install samba, but got:
This is not an authorized addon, or your addon list is out of date.
The addons list is 1 second old, so I doubt that's the problem.
I gave up again.
A couple of hours later, I decided to see if I could just get samba running, without bothering with the web interface.
I edited the config file manually, and then when I tried to use the restartsamba binary, it wouldn't do anything.
If I started smbd/nmbd manually, restartsamba would kill them, and not respawn them.
I had a look at the web interface source, and saw that when starting samba, it would touch /var/ipcop/samba/enable, so I did that manually, and use restartsamba, which this time started.
I'd configured it to run as a WINS server (the main reason I installed it, because netbios broadcast noise doesn't traverse subnets, and MS networking doesn't work properly.
I couldn't connect to any shares running off it though, which was weird.
No matter what fiddling I did in the config file, related to what interfaces it was listening on, and what IP ranges were allowed to connect, I still couldn't connect.
I wondered if I needed a user account to authenticate with, so I tried adding an account, but found that smbpassword needed it to exist as a system account first, do I added it to ipcop, and set an smbpassword, restarted samba, but still coudln't connect.
Argh.
Eventually I found that I could connect from the IPCop box, to itself, whether through the loopback interface, or the proper interfaces, but not from any remote host.
I dunno what's going on there. I have connectivity to the box remotely, I can connect to port 139 with nmbd running on it, but it just won't talk, and I get:
read_socket_with_timeout: timeout read. read error = Connection reset by peer.
protocol negotiation failed
I decided to try to install a newer samba version manually, since this package is version 2.2, and I have 3 on my laptop.
I copied across smbd and nmbd, and then found that I needed a bunch of libraries, which I scp'd across, one at a time, copied them into /usr/lib and tried again, until I ended up with:
./nmbd: /lib/libc.so.6: version `GLIBC_2.3.4' not found (required by /usr/lib/libkrb5.so.3)
So now I well and truly give up. No samba on an IPCop machine, at least not without me going insane.
1 Comments:
gee, thats all?
you give up already?
shame shame :P
Post a Comment
<< Home