PHP Module to do SMB authentication

This is a hacked up PHP module which allows you to do SMB authentication from PHP.  This is very handy for building intranet sites as you can use existing NT or Samba servers to do the authentication for you.  This does not do HTTP authentication, you have to code it your self from your PHP application.

Downloads

For people using php-4.1.2-7.2.4

For people using php-4.0.6-15

The authentication is done using libsmbauth.a which was build from the pam_smb code http://www.csn.ul.ie/~airlied/pam_smb/

The code is not pretty and the build does not use the PHP scripts.  When I first built the module they did but I have now hacked it to build against the RedHat php-devel package

Usage

Usage is simple, just call 

smbauth($username, $password, $primary_svr, $secondary_svr, $domain);

$username and $password should be supplied by the user.  You might want to check that they are not 'root' or 'Administrator'.

$primary_svr and $secondary_svr should be the dns names or hostnames of the servers.  Depending on what server you are using, you might have to make sure that the name used matches the netbios name of the server.  Samba does not care, NT4 seems to.  If you only have one server then use the same name for both the primary and the secondary.

$domain does not have to be a domain but could just be the server name.  This does not do a domain logon and you do not have to be part of a domain to authenticate against it.

The result will be a string of either "Success" or "Denied".

 

There is an alternative implementation available from this site http://tekrat.com/smbauth/


Last modified 20050120
Maintained by John Newbigin