Hi list.

I have some issues with PAM and I was hoping someone with more 
experience can help me with it - either with PAM or specifically with 
the MySQL problem:

I recently upgraded my server from MySQL 4.0 to 4.1. on that server I 
use pam-mysql for authentication with the passwords stored in a 
specific table in MySQL using MySQL password hashes (pam-mysql offers 
either plain-text, crypt, mysql hash or MD5 - due to integration 
problems with the MD5 implementation I prefered to use the MySQL 
password hashes figuring it was better then crypt). 

The problem is that the password hash mechanism has been changed in 
MySQL 4.1 to create longer hashes and as a result the C API to generate 
password hashes has apparently also changed.
As I didn't want to lose all currently stored passwords of users, I 
setup the new 4.1 server to use the "old-password" mehcnism which 
forces both client and server to use an generate the old style short 
hashes.   

Regardless of that I wanted to make some changes to the pam-mysql module 
(for first, turning off DEBUG with which it was originally compiled and 
now drives me nuts and fills my logs), but when I rebuild it against 
the new 4.1 API, the make_scrambled_password() call it uses to compute 
the hashes generates the new long hashes and the authentication fails. 

To solve this I "fixed" the code to use another call to compute the 
hash, which I copied from here 
http://www.freshports.org/www/mod_auth_mysql_another/[EMAIL PROTECTED]
And now it looks like this:

unsigned long hash_res[2];
<...>
/* change to 4.1 api */
hash_password(hash_res, passwd, strlen(passwd));
sprintf(encryptedPass, 17U, "%08lx%08lx", hash_res[0], hash_res[1]);

The result was that the pam module crashes every time. 

This is where I'm currently stuck - I don't know what's wrong with my 
code and I don't know how to debug pam modules. I also can't find 
documentation for the authentication functions from mysql_com.h - the C 
API documentation in the MySQL manual deals only with the actual SQL 
related calls. the only thing I haven't tried yet is opening the source 
and reading it - which I'm going to do next right after I finish this 
rant ;-)

I hope someone has some pointers to throw my way.

TIA

-- 
Oded

::..
"A horrible little boy came up to me and said, `You know in your book 
The Martian Chronicles?'  I said, `Yes?'  He said, `You know where you 
talk about Deimos rising in the East?'  I said, `Yes?'  He said `No.' 
-- So I hit him."
        -- attributed to Ray Bradbury

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to