here (attached) is a checkpassword proggy for NT authentication of
non-local pop users.  I got it working very well to host mail for a 
few windows users.  and maybe soon to transfer mail hosting completely
accross to a linux machine :-).

if there is a better way than this, please tell me. maybe an executable
that does nt auth + etcpasswd auth + non-standard pop passwd file ?

you'll need this perl module if you intereseted.

http://www.perl.com/CPAN/authors/id/P/PM/PMKANE/Authen-Smb-0.91.tar.gz

then change the four variables at the top of the script to point to your
PDC, BDC, DOMAIN, and popbox dir.
#!/usr/bin/perl

use Authen::Smb;

$PDC = "server1";
$BDC = "hewitt";
$DOMAIN = "rmnetnt";
$HOME = "/var/qmail/popboxes/methody-org";

# thanks [EMAIL PROTECTED]
sub read_uinfo() {
   my($user,$passwd,$apop_ts);
   open FD,"<&=3" or exit 1;
   $_ = <FD>;
   # ugly; should use sysread instead
   ($user, $passwd, $apop_ts) = /^(.*)\0(.*)\0(.*)\0/;
   while (<FD>) {};
   close FD;
   return ($user,$passwd,$apop_ts);
}

sub Validate_User($$) {
   my $user = $_[0], $passwd = $_[1];

   return 0 if (! $passwd || ! $user);
   
   my $authResult = Authen::Smb::authen($user, $passwd, $PDC, $BDC, $DOMAIN);

   return ($authResult == Authen::Smb::NO_ERROR);
}


# Main
{
   my $home;
   my ($user, $passwd, $apop_ts) = read_uinfo();
   
   if (Validate_User($user, $passwd)) {
      $home = "$HOME/$user";   
      @ENV{"SHELL","USER","HOME"} = ("/bin/sh", $user, $home);
      chdir $home or exit 1;
      exec @ARGV;
      die "can't exec $user_program: $!\n";
   }
}

Reply via email to