3 messages in net.sourceforge.lists.courier-usersRe: [courier-users] authlib
FromSent OnAttachments
jona...@callisia.comJun 1, 2000 8:44 am 
Sam VarshavchikJun 1, 2000 2:52 pm 
jona...@callisia.comJun 7, 2000 7:05 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [courier-users] authlibActions...
From:jona...@callisia.com (jona@callisia.com)
Date:Jun 7, 2000 7:05:48 pm
List:net.sourceforge.lists.courier-users

Thanks for the info, just forgot one close() and now my module works great.

Does libuserdb provide anyway to open multiple db's simulataneously ? Perhaps with some db handles ?

-Jonan

* Sam Varshavchik (mrs@stop.mail-abuse.org) [000601 19:25]:

jona@callisia.com writes:

Hello,

I am writing a authmodule using authlib and am having one problem. The module forks then opens up a pipe between parent/child and the child changes uid to read in a user controlled gdbm file. The parent waits for success or failure. Everything is ok if the auth succeeds, but if it fails the module crashes or exits in

authlib/chain.c line 32

if (!prog || open("/dev/null", O_RDONLY) != 3) authexit(1);

Im sure its my fault , but I don't understand what we are checking here for ? Why open /dev/null and why on fd 3 ?

File descriptor 3 is a "special" file descriptor. It is a pipe used for passing the authentication data from one authentication module to the next one, without touching stdin and stdout.

The pipe on file descriptor 3 is created just before an authentication module is executed, and the the new authentication module immediately reads the authentication data from file descriptor 3, then closes it before running the actual authentication code.

So, when you're rolling your own stuff, you need to clean up after yourself, and close all your open files. The code in question is a sanity check to make sure that file descriptor 3 is available, that the only open file descriptors at this point on are 0, 1, and 2.