[ale] [OT] PHP Samba Authentication Module
Jonathan Glass (IBB)
jonathan.glass at ibb.gatech.edu
Thu May 29 21:14:29 EDT 2003
I wrote this little function a while ago for a client, and just found
another use for it at GT. THought it might be useful to someone in the
ALE community, too, if they haven't already done this. I wrote this
module to allow an NT4 shop to use a single set of accounts and
passwords for all their online applications. I have a slightly
different version of password protected directories in IIS, using ASP.
HTH
Jonathan Glass
<?
function nt_logon($usr,$pass) {
/* Check username and password against an NT 4 PDC, in PHP
If using Samba on Linux, uncomment the second if statement.
Of course, add your PDC's name/IP in place of <pdc> and your NT
domain in place of <domain name>.
To verify what gets returned to this function, copy the exec()
parameter and run it by hand. You may have to tweak the "if"
statement depending on your version of *nix and Samba.
Jonathan Glass - 5/29/2003 - jonathan.glass at ibb.gatech.edu
*/
$tmp = exec("smbclient //<pdc>/netlogon -U $usr%$pass -c 'exit'");
if ($tmp == "Domain=[<domain name>] OS=[Windows NT 4.0] Server=[NT LAN
Manager 4.0]") {
// if ($tmp == "Domain=[<domain name>] OS=[Unix] Server=[Samba 2.2.7]")
{
return 1;
}
else
{
return 0;
}
}
?>
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list