Hi all,
I need to authenticate Active Directory users in Solaris. I wrote a program
to do it using smbclient.a lib, but the method Valid_User is returning aways
the code 1 (Network Error). The program is in attachment.
When I use the following code, the user is sucessfully authenticated:
smbclient '\\192.168.0.20\downloads' -W adteste -U dmadmin%Senha123
But, this command log in the machine. I need a program that returns TRUE for
valid username/password and FALSE, otherwise. Can somebody help me?
Thanks in advance,
Jociel
-------------- next part --------------
#include "valid.h"
#include <stdarg.h>
#include <shadow.h>
#include <crypt.h>
#include <stdlib.h>
#include <sys/utsname.h>
#include <utmpx.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
void catch_sigpipe(int sig_num)
{
/* We were not able to read off of the domain authentication pipe. */
fputs("Signal error while authenticating domain.\n", stdout);
exit(0);
}
int main(int argc, char **argv) {
printf("userName:userPassword\n");
printf("%s:%s\n", argv[1], argv[2]);
void (*old_signal_handler)(int);
old_signal_handler = signal(SIGPIPE, catch_sigpipe);
//result = Valid_User(userName, userPassword, pdc, bdc, domain);
int result = Valid_User(argv[1], argv[2],
"192.168.0.20",
"192.168.0.20",
"ADTESTE");
signal(SIGPIPE, old_signal_handler);
printf("Resut: %d.\n", result);
switch (result)
{
case 0:
fputs("SMB Authentication Succeeded.\n", stdout);
break;
case 1:
fputs("SMB Network Error.\n", stdout);
break;
case 2:
fputs("SMB Protocol Error.\n", stdout);
break;
case 3:
fputs("Logon Error.\n", stdout);
break;
default:
fputs("Unknown Error.\n", stdout);
break;
}
return 0;
}
take a look here: http://www.hacom.nl/~richard/software/smb_auth_pt_br.html it's a squid module for authentication. see the source code. maybe can help you. 2007/3/13, Jociel Andrade <jcainfo@gmail.com>:> Hi all, > > I need to authenticate Active Directory users in Solaris. I wrote a program > to do it using smbclient.a lib, but the method Valid_User is returning aways > the code 1 (Network Error). The program is in attachment. > > When I use the following code, the user is sucessfully authenticated: > smbclient '\\192.168.0.20\downloads' -W adteste -U dmadmin%Senha123 > > But, this command log in the machine. I need a program that returns TRUE for > valid username/password and FALSE, otherwise. Can somebody help me? > > Thanks in advance, > Jociel > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/listinfo/samba > >-- Att. Lutieri G. B.
franz.pfoertsch@brose.net
2007-Mar-13 16:04 UTC
[Samba] Re: Authenticating with Active Directory
Jociel Andrade wrote:> Hi all, > > I need to authenticate Active Directory users in Solaris. I wrote a > program to do it using smbclient.a lib, but the method Valid_User is > returning aways the code 1 (Network Error). The program is in attachment. > > When I use the following code, the user is sucessfully authenticated: > smbclient '\\192.168.0.20\downloads' -W adteste -U dmadmin%Senha123 > > But, this command log in the machine. I need a program that returns TRUE > for valid username/password and FALSE, otherwise. Can somebody help me? > > Thanks in advance, > JocielWe do something like this using aix for years what happend when you do the following: smbclient -L 192.168.0.20 -U dmadmin%Senha123 echo $? at my installation I got the share and a "0" back. In our productiv environment we create a public share to authenticate web users. the detailed commandline depends on your smb.conf regards Franz