[sr-dev] where is s proxy_challenge function?
Andrei Pelinescu-Onciul
andrei at iptel.org
Fri Jul 2 11:04:35 CEST 2010
On Jul 01, 2010 at 22:30, Juha Heinanen <jh at tutpro.com> wrote:
> Juha Heinanen writes:
>
> > i see that this thing in the code builds the challenge (p-a header):
> >
> > if (ret < 0) {
> > if (auth_api.build_challenge(msg, (cred ? cred->stale : 0), realm, NULL, NULL, hftype) < 0) {
> > ERR("Error while creating challenge\n");
> > ret = -2;
> > }
> >
> > is there a way to prevent p-a header from being added to reply in case
> > after proxy_authorize failure i want to reply with "403 Forbidden"
> > instead of "407 Proxy Authentication Required"?
>
> jan,
>
> i was able to figure this out. auth_api.build_challenge stores the
> header in a variable that defaults to $digest_challenge. however, when
> i write in config file as you suggested:
>
> if (defined $digest_challenge && $digest_challenge != "") {
> append_to_reply("%$digest_challenge");
> };
> send_reply("407", "Proxy Authentication Required");
>
> i get these errors to syslog:
>
> Jul 1 22:24:54 localhost /usr/sbin/sip-proxy[26750]: ERROR: <core> [mod_fix.c:246]: Cannot convert function parameter 1 to0
> Jul 1 22:24:54 localhost /usr/sbin/sip-proxy[26750]: ERROR: <core> [route.c:1088]: fixing failed (code=-1) at cfg:/etc/sip-proxy/sip-proxy.cfg:1019
> Jul 1 22:24:54 localhost /usr/sbin/sip-proxy[26750]: ERROR: <core> [route.c:1088]: fixing failed (code=-1) at cfg:/etc/sip-proxy/sip-proxy.cfg:1020
> Jul 1 22:24:54 localhost /usr/sbin/sip-proxy[26750]: ERROR: <core> [route.c:1088]: fixing failed (code=-1) at cfg:/etc/sip-proxy/sip-proxy.cfg:1023
> Jul 1 22:24:54 localhost /usr/sbin/sip-proxy[26750]: ERROR: <core> [route.c:1088]: fixing failed (code=-1) at cfg:/etc/sip-proxy/sip-proxy.cfg:1042
>
> what does % mean in "%$digest_challenge"?
That's used for passing format string to ser textops/append_to_reply. It
means what follows should be interpreted in a special way (avp, select,
xlog format). E.g.: append_to_reply("Foo: %$my_var \n\r");
If you use k textops skip the "%" (you should be able to use directly
$digest_challenge).
Andrei
More information about the sr-dev
mailing list