Re: authenticators and squid codeing question

From: Duane Wessels <wessels@dont-contact.us>
Date: Thu, 19 Aug 1999 14:21:28 -0600

On Thu, 19 Aug 1999, Bart Bunting wrote:

> hi again,
> sory for the previous half finished post. -- hit the send key by mistake :-( emacs c-c c-c = send and c-x c-x = switch point and mark argggg@@!# :)
> anyway,
> I've been working on modifying squid to receive a group name along
> with the ok returned from the authenticator.
>
> i have a couple of questions about the function below.
>
> if there is a better place to ask these questions please point me there.

squid-dev@ircache.net is probably more appropriate

 
>
> static void
> authenticateHandleReply(void *data, char *reply)
> {
> authenticateStateData *r = data;
> int valid;
> char *t = NULL;
> debug(29, 5) ("authenticateHandleReply: {%s}\n", reply ? reply : "<NULL>");
> if (reply) {
> this bit has me confused.
> it appears to say if the string returned contains a space make reply = null.
> if ((t = strchr(reply, ' ')))
> *t = '\0';

That says to chop the reply string at the first space character, if any.

> if (*reply == '\0')
> reply = NULL;

This makes an empty line the same as "no response" so the callback
function doesn't have to check both conditions.

> }
> what do the next two lines do?
> valid = cbdataValid(r->data);
> cbdataUnlock(r->data);

Those decide if the module that initiated the authentication process
still wants to know the answer. Maybe it has been aborted, in
which case we don't want to call the callback function.

> if (valid)
> and this one :)
> r->handler(r->data, reply);

r->handler is the callaback function. It parses the reply for
"OK" or "ERR" and takes appropriate action

Duane W.
Received on Tue Jul 29 2003 - 13:15:59 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:16 MST