[jdev] problem with connecting to mysql server on module..

Luís Miguel Silva lms at ispgaya.pt
Mon Feb 23 09:51:59 CST 2004

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
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

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
Here is a snap of the code...


#include "mkntpwd.h"
#include <mysql.h>
MYSQL_SERVER         ""
#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;
== NULL) {
         fputs("could not connect to server...\n",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: lms at ispgaya.pt
| H: http://lms.ispgaya.pt/
Este email foi enviado através do site http://webmail.ispgaya.pt/
Instituto Superior Politécnico Gaya

More information about the JDev mailing list