Re: authenticators and squid codeing question

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 01 Oct 1999 14:41:04 +0200

Bart Bunting wrote:

> 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 a more appropriate forum.

>
> 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.

No, it cuts the reply on the first space char, and if there was nothing
prior to the first space char then the reply becomes null.

> if ((t = strchr(reply, ' ')))
> *t = '\0';
> if (*reply == '\0')
> reply = NULL;
> }

> what do the next two lines do?

This verifies that the function asking for authentication still wants to
have an answer.

> valid = cbdataValid(r->data);
> cbdataUnlock(r->data);
> if (valid)

> and this one :)

This sends the answer back to the function who asked for it.

> r->handler(r->data, reply);
> authenticateStateFree(r);
> }
>
> how would i go about replacing the username that was supplied to the
> authenticator with the one returned by the authenticator.

You would change what is being returned to the handler, and change the
handler to take appropriate actions.

In this case the handler being called is aclLookupProxyAuthDone (sent
as handler argument to authenticateStart in aclLookupProxyAuthStart)

--
Henrik Nordstrom
Spare time Squid hacker
Received on Fri Oct 01 1999 - 11:31:42 MDT

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