opensips/opensips.patch.uac

changeset 382
b972dc20871f
parent 377
67e813202d53
child 397
c98ae03f4266
     1.1 --- a/opensips/opensips.patch.uac	Wed Sep 21 14:31:41 2011 +0200
     1.2 +++ b/opensips/opensips.patch.uac	Wed Sep 21 16:06:14 2011 +0200
     1.3 @@ -2,7 +2,7 @@
     1.4  diff -Nau modules/uac/auth.c.orig modules/uac/auth.c
     1.5  --- modules/uac/auth.c.orig	2008-08-03 15:53:40.000000000 +0200
     1.6  +++ modules/uac/auth.c	2009-03-24 21:48:53.478867420 +0100
     1.7 -@@ -143,14 +143,172 @@
     1.8 +@@ -375,14 +375,172 @@
     1.9   	HASHHEX response;
    1.10   	str *new_hdr;
    1.11   
    1.12 @@ -70,7 +70,7 @@
    1.13  +			crd->passwd = pv_val.rs;
    1.14  +
    1.15  +		if (nret) { /* if not found, look into predefined credentials */
    1.16 -+			tst = uac_auth_api._lookup_realm(&crd->realm);
    1.17 ++			tst = lookup_realm(&crd->realm);
    1.18  +
    1.19  +			if (tst==0) { /* found? */
    1.20  +				LM_DBG("no credential for realm \"%.*s\"\n", \
    1.21 @@ -121,25 +121,25 @@
    1.22  +
    1.23  +		/* set the nonce from existing UAC message */
    1.24  +		tmp_hdr = msg->proxy_auth;
    1.25 -+		auth->nonce.len = 0;
    1.26 -+		auth->nonce.s = 0;
    1.27 ++		auth.nonce.len = 0;
    1.28 ++		auth.nonce.s = 0;
    1.29  +		while (tmp_hdr) {
    1.30  +			if(pv_get_spec_value(msg, &auth_realm_spec, &pv_val)==0 \
    1.31  +				&& pv_val.rs.len>0) /* ensure realm is the desired one */
    1.32  +				if (strncmp(crd->realm.s, pv_val.rs.s, crd->realm.len)==0) {
    1.33 -+					auth->nonce.s = strchr(strstr(tmp_hdr->body.s, "nonce="), '"') + 1;
    1.34 -+					auth->nonce.len = strchr(auth->nonce.s, '"') - auth->nonce.s;
    1.35 ++					auth.nonce.s = strchr(strstr(tmp_hdr->body.s, "nonce="), '"') + 1;
    1.36 ++					auth.nonce.len = strchr(auth.nonce.s, '"') - auth.nonce.s;
    1.37  +				}
    1.38  +			tmp_hdr = tmp_hdr->sibling;
    1.39  +		}
    1.40 -+		if (auth->nonce.s == 0) {
    1.41 ++		if (auth.nonce.s == 0) {
    1.42  +			LM_DBG("failed to retrieve nonce from UAC message\n");
    1.43  +			pkg_free(crd);
    1.44  +			goto error;
    1.45  +		}
    1.46  +
    1.47  +		/* do authentication */
    1.48 -+		uac_auth_api._do_uac_auth(msg, newuri, crd, auth, &auth_nc_cnonce, response);
    1.49 ++		do_uac_auth(msg, newuri, crd, &auth, response);
    1.50  +		if (response==0) {
    1.51  +			LM_ERR("failed to calculate challenge response\n");
    1.52  +			pkg_free(crd);
    1.53 @@ -147,7 +147,7 @@
    1.54  +		}
    1.55  +
    1.56  +		/* build the authorization header */
    1.57 -+		new_hdr = uac_auth_api._build_authorization_hdr(407, newuri, crd, auth, &auth_nc_cnonce, response);
    1.58 ++		new_hdr = build_authorization_hdr(407, newuri, crd, &auth, response);
    1.59  +		if (new_hdr==0) {
    1.60  +			LM_ERR("failed to build authorization hdr\n");
    1.61  +			pkg_free(crd);
    1.62 @@ -184,7 +184,7 @@
    1.63  diff -Nau modules/uac/uac.c.orig modules/uac/uac.c
    1.64  --- modules/uac/uac.c.orig	2008-08-03 15:53:40.000000000 +0200
    1.65  +++ modules/uac/uac.c	2009-03-24 21:49:48.922890737 +0100
    1.66 -@@ -117,7 +117,7 @@
    1.67 +@@ -106,7 +106,7 @@
    1.68   			REQUEST_ROUTE|BRANCH_ROUTE|FAILURE_ROUTE },
    1.69   	{"uac_auth",          (cmd_function)w_uac_auth,       0,
    1.70   			0, 0,

mercurial