Mike wrote:
Joe Lewis wrote:
Mike wrote:
Hi,
The Subject here may be completely wrong, so I will describe what I
am doing. Some years ago I hacked together an authentication module
which uses the c-client imap lib. I decided to take a look at
porting it to 2.0 only to realize that the code is complete
crap,thus I am looking to fix (Disclaimer, I am not a C Programmer).
C-client is implemented such that it obtains data via callback
functions which must be defined by the caller. One of these
functions is to obtain the username and password to auth with. Since
this was a callback function I did not have any apache context handy
to store things in so I stuffed the user and password in globals.
This is obviously bad so I am looking to do it the correct way. My
current thought was to create some named shared memory segment in
the process pool to store this in and then maybe store the process
pool in a global. Reading/writing the user/pass pair to the pool
would be controlled by a mutex.
On second thought though this isn't really that much different than
if I controlled access to the current globals with a mutex, there
must be a better way? Any advice/pointers appreciated.
Authentication in Apache 2.0 is actually very nicely engineered. If
you want to store the username and the password, you can. However,
you don't have to.
Thanks for the reply.
The problem is that I need access to this info in the callback
function, and the callback does not have access to the request_rec.
For example..
auth_basic_user(){
do_some_stuff(); //Gets the user name and password(password as you
suggested) and stores them so that they can be used by later callback.
mm_login
call_cclient_to_auth();
return;
}
call_cclient_to_auth() takes no parms and eventually uses callback
functions to do things, one of these being to get the user/password to
auth with. This is by design of the c-client lib and not something I
can change.
PAM is very similar - it uses a callback. However, it also uses a void
pointer that gets passed in a setup function earlier. Anything like
that available? (e.g. to call it with an r-> or a custom structure with
the info?)
Joe