Carlos Ramirez wrote:
> Here are some fixes I incorporated into my private copy of
> Authen::Smb and Apache::AuthenSmb modules. These changes
> are based on some discussion I found in the modperl
> mailing list posted on Thu, 16 Sep 1999 by Matt Arnold. I
> basically copied Matt's suggestions and added them in.
> I was getting the same error messages but after I
> incorporated theses changes, it to fixed the problem on
> SUN Sparc Solaris 2.5.1..2.8.
>
> =Begin Snippet from mailing list
>
> The resulting additions to Authen::Smb look like this:
>
> use Fcntl qw(:flock);
> ...
> open S, "> /full/path/to/AuthenSmb.lck" or die "Can't open
> AuthenSmb.lck: $!\n";
> flock S, LOCK_EX;
> my $res = Valid_User($username, $password, $server, $backup, $domain);
>
> close S;
>
> In short, I ended up adding
> the following two lines to Apache::AuthenSmb.
>
> use Memoize;
> memoize('Authen::Smb::authen');
>
> =End of Snippet
>
> I contacted the author of Apache::AuthenSmb (a long time
> ago) and asked him if he could add these changes into
> the module. He stated he no longer has access to machines
> where he can test his module and asked me to post
> it in the modperl mailing list (which I never did).
> I used this module extensively in our environment and
> have also added some other nice features. Anyhow, if
> the author can no longer maintain it, i'd be glad ty
> update it ;)
>
> Since, this fix also requires that Authen::Smb to be
> modified, maybe the author of the cool Authen::Smb module
> add some option to allow a lock file or force it to use a
> lock file (??).
>
> Something along the lines:
> sub authen {
> my @args = @_;
>
> # Truncate everything to length 80 to avoid poor coding practices in the
> # smbvalid.a (buffer overflows) PMK--fixme in smbvalid.a when possible.
> for my $i ( 0..$#args ) {
> $args[$i] = substr($args[$i], 0, 80);
> }
>
> my($username, $password, $server, $backup, $domain, $lockfile) = @args;
> my $res;
> if ($lockfile) {
> open L, "> $lockfile" or die "Can't open AuthenSmb.lck: $!\n";
> flock L, LOCK_EX;
> $res = Valid_User($username, $password, $server, $backup, $domain);
> close L;
> }
> else {
> $res = Valid_User($username, $password, $server, $backup, $domain);
> }
>
> return $res;
> }
>
>
> Anyhow, hope this helps.
>
> > > Please, let's continue discussing my problem. Remind you, that I
> > > installed mod_perl, Authen-Smb-0.91 and Apache-AuthenSmb-0.60 for
> > > authorization in apache against NT server. And I get this error in
> > > apache error.log file:
> > > "Undefined subroutine &Apache::AuthenSmb::handler called".
> > > In discussion we stopped at the point that I have wrong Smb.so file,
> > > because when I put "PerlModule Apache::AuthenSmb" in my httpd.conf file
> > > I get
> > > --
> > > Syntax error on line 346 of /usr/local/apache/conf/httpd.conf:
> > > Can't load
> > > '/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/Authen/Smb/Smb.so'
> > > for
> > > module Authen::Smb: ld.so.1: /usr/local/apache/bin/httpd: fatal:
> > > relocation error: file
> > > /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/Authen/Smb/Smb.so:
> > > symbol main: referenced symbol not found at
> > > /usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206.
> > > at /usr/local/lib/perl5/site_perl/5.6.1/Apache/AuthenSmb.pm line 5
> > > Compilation failed in require at
> > > /usr/local/lib/perl5/site_perl/5.6.1/Apache/AuthenSmb.pm line 5.
> > > BEGIN failed--compilation aborted at
> > > /usr/local/lib/perl5/site_perl/5.6.1/Apache/AuthenSmb.pm line 5.
> > > Compilation failed in require at (eval 3) line 3.
> > > --
> > > when making 'apachectl configtest'. I tried to reinstall AuthenSmb with
> > > its default options (default Makefile.PL), - no success.
> > > Maybe I must install it with some different from default options? Who
> > > knows what are such options? What is configurable there? Or what may be
> > > done with my Smb.so in oder Authen:Smb to understand it?
> > >
> >
> >
Hi!
I did suggested changes:
In Authen::Smb added lines 'use Fcntl qw(:flock);' and
--
open S, "> /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/Authen/AuthenSmb.lck"
or die "Can't open AuthenSmb.lck: $!\n";
flock S, LOCK_EX;
my $res = Valid_User($username, $password, $server, $backup, $domain);
close S;
--
Replaced subroutine 'authen' as shown above.
In Apache::AuthenSmb added
--
use Memoize;
memoize('Authen::Smb::authen');
--
And now I get this error when making 'apachectl configtest':
--
Syntax error on line 346 of /usr/local/apache/conf/httpd.conf:
Can't load '/usr/local/lib/perl5/5.6.1/sun4-solaris/auto/Fcntl/Fcntl.so' for
module Fcntl: ld.so.1: /usr/local/apache/bin/httpd: fatal: relocation error: file
/usr/local/lib/perl5/5.6.1/sun4-solaris/auto/Fcntl/Fcntl.so: symbol main:
referenced symbol not found at /usr/local/lib/perl5/5.6.1/sun4-solaris/XSLoader.pm
line 75.
at /usr/local/lib/perl5/5.6.1/sun4-solaris/Fcntl.pm line 220
Compilation failed in require at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/Authen/Smb.pm line 6.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/Authen/Smb.pm line 6.
Compilation failed in require at
/usr/local/lib/perl5/site_perl/5.6.1/Apache/AuthenSmb.pm line 5.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.6.1/Apache/AuthenSmb.pm line 5.
Compilation failed in require at (eval 3) line 3.
--
Line 346 of httpd.conf contains 'PerlModule Apache::AuthenSmb'.
So, what am I supposed to do now?
--
Andrew