Hello all,

Yesterday i began coding a auth module for my university.
I need a special module which auths in 2 ways:
a) against the mysql DB which supports the auth for our samba 3.0 domain
server.
b) against an hash (on a mysql db) which is created when users auth
themselves on a site.

Thanks to the help of Matthias Wimmer i was able to start the code of my new
module.

I based myself on authreg_anon.c.

Iam now able to get the users password and then generate the NT/LM hash so i
can NEXT make a mysql query and see if they inserted the correct password.

My problem is that my c2s server crashes when i get make a mysql
connection...
Here is a snap of the code...

#ifdef WANT_AUTHREG_ISPGAYA

#include "mkntpwd.h"
#include <mysql.h>
                                                                      #define
MYSQL_SERVER         "192.168.4.36"
#define MYSQL_USER           "jabberd2"
#define MYSQL_PASSWORD       "thepassword"
#define MYSQL_DATABASE       "samba"
#define MYSQL_USERS_TABLE    "user"
#define MYSQL_SERVER_PORT    3306
...
static int _ar_ispgaya_check_password(authreg_t ar, char *username, char
*realm, char password[257])
{
        ...        
        FILE *fx;
        MYSQL *conn;
        MYSQL_RES *res;
        MYSQL_ROW row;

        ...nt/lm hash generation code here...

        conn = mysql_init(NULL);
        if(conn == NULL) return 1;
        if(mysql_real_connect(conn,
MYSQL_SERVER,MYSQL_USER,MYSQL_PASSWORD,MYSQL_DATABASE,MYSQL_SERVER_PORT,NULL,0)
== NULL) {
         fx=fopen("/tmp/test.txt","a");
         fputs("could not connect to server...\n",fx);
         fclose(fx);
        }
        ...
}

It all goes smoothly till i get to the mysql_real_connect() function!
The call to that function crashes my server!

Do i have to declare it anywhere in the code?
I never worked with modules in C..so im pretty blind folded :o/

PS: the Makefile includes the -lmysqlclient flag!
PS2: the authreg_mysql module works perfectly on my system...

Thank you,
+-----------------------------------------
| Luís Miguel Silva
| Network Administrator@ ISPGaya.pt
| Rua António Rodrigues da Rocha, 291/341 
| Sto. Ovídio • 4400-025 V. N. de Gaia
| Portugal
| T: +351 22 3745730/3/5  F: +351 22 3745738
| G: +351 93 6371253      E: [EMAIL PROTECTED]
| H: http://lms.ispgaya.pt/
+-----------------------------------------
________________________________________________________________
Este email foi enviado através do site http://webmail.ispgaya.pt/
Instituto Superior Politécnico Gaya



_______________________________________________
jdev mailing list
[EMAIL PROTECTED]
https://jabberstudio.org/mailman/listinfo/jdev

Reply via email to