perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Ramirez <vzn05...@verizon.net>
Subject Re: RE: [Samba authorization]
Date Tue, 19 Feb 2002 22:39:35 GMT
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. 


-Carlos

> 
> From: "Stathy G. Touloumis" <stathy.touloumis@edventions.com>
> Date: 2002/02/19 Tue PM 02:00:35 CST
> To: "Andrew Afliatunov" <andy@taom.ru>, 
> 	"Mod_perl" <modperl@apache.org>
> Subject: RE: [Samba authorization]
> 
> You should probably contact the maintainers of Apache::AuthSmb and
> kindly ask them to look into the problem : )  If I had some Sparcs lying
> around
> I would be willing to look into it but I don't ; )
> 
> > 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?
> >
> 
> 


Mime
View raw message