martin,
what was the conclusion regarding your stale nonce param patch?
i would do it so that if www or proxy_authorize function returns -4
(stale nonce) then i would call www or proxy_challenge with stale flag
on. it would then cause stale=true to be added to the header.
i don't understand why your patch calls pre_auth, since the request was
already authenticated and it failed due to stale nonce.
-- juha
Module: sip-router
Branch: master
Commit: b63f14b1fd5042b3b605794d6bb18a4030e573ed
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b63f14b…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Sat May 28 11:43:41 2011 +0300
modules/auth: new flag 16 to add stale=true to challenge response
---
modules/auth/README | 2 ++
modules/auth/auth_mod.c | 10 ++++++++--
modules/auth/doc/functions.xml | 9 +++++++++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/modules/auth/README b/modules/auth/README
index 0c34aa8..04d7594 100644
--- a/modules/auth/README
+++ b/modules/auth/README
@@ -539,6 +539,7 @@ if (www_authenticate("realm", "subscriber)) {
+ 4 - do not send '500 Internal Server Error' reply
automatically in failure cases (error code is returned to
config)
+ + 16 - build challenge header with stale=true
This function can be used from REQUEST_ROUTE.
@@ -607,6 +608,7 @@ if (!proxy_authenticate("$fd", "subscriber)) {
+ 2 - build challenge header with no qop and add it to avp
+ 4 - build challenge header with qop=auth and add it to avp
+ 8 - build challenge header with qop=auth-int and add it to avp
+ + 16 - build challenge header with stale=true
When challenge header is built and stored in avp, append_to_reply() and
sl reply functions can be used to send appropriate SIP reply to
diff --git a/modules/auth/auth_mod.c b/modules/auth/auth_mod.c
index c44fb96..a28c2ba 100644
--- a/modules/auth/auth_mod.c
+++ b/modules/auth/auth_mod.c
@@ -635,7 +635,7 @@ static int auth_send_reply(struct sip_msg *msg, int code, char *reason,
*/
int auth_challenge(struct sip_msg *msg, str *realm, int flags, int hftype)
{
- int ret;
+ int ret, stale;
str hf = {0, 0};
struct qp *qop = NULL;
@@ -646,7 +646,13 @@ int auth_challenge(struct sip_msg *msg, str *realm, int flags, int hftype)
} else if(flags&1) {
qop = &auth_qauth;
}
- if (get_challenge_hf(msg, 0, realm, NULL, NULL, qop, hftype, &hf) < 0) {
+ if (flags & 16) {
+ stale = 1;
+ } else {
+ stale = 0;
+ }
+ if (get_challenge_hf(msg, stale, realm, NULL, NULL, qop, hftype, &hf)
+ < 0) {
ERR("Error while creating challenge\n");
ret = -2;
goto error;
diff --git a/modules/auth/doc/functions.xml b/modules/auth/doc/functions.xml
index f452529..d328def 100644
--- a/modules/auth/doc/functions.xml
+++ b/modules/auth/doc/functions.xml
@@ -81,6 +81,10 @@ if (www_authenticate("realm", "subscriber)) {
Server Error' reply automatically in failure cases
(error code is returned to config)</para>
</listitem>
+ <listitem>
+ <para><emphasis>16</emphasis> - build challenge header with
+ stale=true</para>
+ </listitem>
</itemizedlist>
</listitem>
</itemizedlist>
@@ -214,6 +218,11 @@ if (!proxy_authenticate("$fd", "subscriber)) {
<para><emphasis>8</emphasis> - build challenge header with
qop=auth-int and add it to avp</para>
</listitem>
+ <listitem>
+ <para><emphasis>16</emphasis> - build challenge header with
+ stale=true</para>
+ </listitem>
+
</itemizedlist>
</listitem>
</itemizedlist>
Module: sip-router
Branch: master
Commit: 05b5d0183653d936261a91e6f172ddb1e5d30037
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=05b5d01…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sat May 28 08:55:02 2011 +0200
parser: new internal msg flag FL_SDP_BODY
- mark the request if there is an sdp body (useful for multi-part bodies
or to quickly check in tm routes as the msg body is not cloned in shm
and will require parsing again)
---
parser/msg_parser.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/parser/msg_parser.h b/parser/msg_parser.h
index 8ef60ca..30069a9 100644
--- a/parser/msg_parser.h
+++ b/parser/msg_parser.h
@@ -118,6 +118,7 @@ enum request_method {
#define FL_MTU_TLS_FB (1 << 9)
#define FL_MTU_SCTP_FB (1 << 10)
#define FL_ADD_LOCAL_RPORT (1 << 11) /*!< add 'rport' to local via hdr */
+#define FL_SDP_BODY (1 << 12) /*!< msg has SDP in body */
/* WARNING: Value (1 << 29) is temporarily reserved for use in kamailio acc
* module (flag FL_REQ_UPSTREAM)! */