I have downloaded and built the latest Courier IMAP package, 1.1.20001015.
The problems that had been causing segmentation faults have been cleared up,
and I appreciate Sam's effort on getting to that quickly.
I am still seeing strange behavior when using my version of authcustom,
though. Here's a recap of what is happening:
In my do_auth_custom function, the code sets authinfo->sysusername and
authinfo->address equal to userid, and then fills in information for
authinfo->sysuserid, authinfo->sysgroupid, authinfo->homedir, and
authinfo->clearpasswd. The remaining authinfo fields are not touched.
As far as I can tell, the fields are being filled in correctly. I inserted
some debugging code that prints the contents of the six modified authinfo
fields just before the function returns, and all the information is correct.
I am using static character arrays for the password and home directory, and
static uid_t and gid_t variables for the uid and gid. I have double-checked
to make sure that authinfo->userid receives a pointer to the uid value,
instead of the value itself.
When I configure and compile the code, running authtest with a user name and
good password yields this:
# ./authtest -m authcustom user1 goodpass
Authenticated: module authcustom
Home directory: /usr/local/src/courier-imap-1.1.20001007/authlib
UID/GID: 0/0
AUTHADDR=<none>
AUTHFULLNAME=<none>
This is not the correct info; the maildir should be "/maildir/user1", and
the UID/GID combination should be 500/500. Interestingly, the directory and
UID/GID combination displayed reflect who is running authtest (root), and
where from.
Running authtest with a user name and bad password does what it should:
# ./authtest -m authcustom user1 badpass
Authentication FAILED!
Again, I am fairly certain that I am filling in the authinfo structure
correctly, and that the information is being preserved after the function
exits. Any ideas on what could be causing this, perhaps something else I
have overlooked?