- Proxy Authorization: enclose strings with quotes
and fixed an error that did not let REGISTER requests pass through to a 3rd party registrar.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
0.5.4
|
||||
=====
|
||||
21-Feb-2004: - Proxy Authorization: enclose strings with quotes
|
||||
and fixed an error that did not let REGISTER
|
||||
requests pass through to a 3rd party registrar.
|
||||
17-Feb-2004: - Documentation spell corrections (patch from Luke Mewburn)
|
||||
16-Feb-2004: - Hack for Grandstream SIP phones and SUBSCRIBE response
|
||||
|
||||
|
||||
+7
-6
@@ -57,7 +57,7 @@ static char *auth_getpwd(char *username);
|
||||
* STS_NEEDAUTH: authentication needed
|
||||
*/
|
||||
int authenticate_proxy(osip_message_t *request) {
|
||||
osip_proxy_authorization_t *proxy_auth;
|
||||
osip_proxy_authorization_t *proxy_auth=NULL;
|
||||
|
||||
/* required by config? */
|
||||
if (configuration.proxy_auth_realm == NULL) {
|
||||
@@ -119,8 +119,9 @@ static char *auth_generate_nonce() {
|
||||
|
||||
gettimeofday (&tv, NULL);
|
||||
|
||||
/* yeah, I know... should be a better algorithm */
|
||||
sprintf(nonce, "%8.8lx%8.8lx%8.8x%8.8x",
|
||||
/* yeah, I know... should be a better algorithm */
|
||||
/* enclose it in double quotes, as libosip does *not* do it (2.0.6) */
|
||||
sprintf(nonce, "\"%8.8lx%8.8lx%8.8x%8.8x\"",
|
||||
(long)tv.tv_sec, (long)tv.tv_usec, rand(), rand() );
|
||||
|
||||
DEBUGC(DBCLASS_AUTH,"created nonce=\"%s\"",nonce);
|
||||
@@ -176,7 +177,7 @@ static int auth_check(osip_proxy_authorization_t *proxy_auth) {
|
||||
|
||||
if (proxy_auth->response)
|
||||
Response=osip_strdup_without_quote(proxy_auth->response);
|
||||
|
||||
|
||||
/* get password */
|
||||
if (configuration.proxy_auth_pwfile) {
|
||||
/* check in passwd file */
|
||||
@@ -185,14 +186,14 @@ static int auth_check(osip_proxy_authorization_t *proxy_auth) {
|
||||
/* get password from configuration */
|
||||
password=configuration.proxy_auth_passwd;
|
||||
}
|
||||
|
||||
|
||||
if (password == NULL) password="";
|
||||
|
||||
DEBUGC(DBCLASS_BABBLE," username=\"%s\"",Username );
|
||||
DEBUGC(DBCLASS_BABBLE," realm =\"%s\"",Realm );
|
||||
DEBUGC(DBCLASS_BABBLE," nonce =\"%s\"",Nonce );
|
||||
DEBUGC(DBCLASS_BABBLE," cnonce =\"%s\"",CNonce );
|
||||
DEBUGC(DBCLASS_BABBLE," nonce_cn=\"%s\"",NonceCount);
|
||||
DEBUGC(DBCLASS_BABBLE," nonce_nc=\"%s\"",NonceCount);
|
||||
DEBUGC(DBCLASS_BABBLE," qpop =\"%s\"",Qpop );
|
||||
DEBUGC(DBCLASS_BABBLE," uri =\"%s\"",Uri );
|
||||
DEBUGC(DBCLASS_BABBLE," response=\"%s\"",Response );
|
||||
|
||||
+20
-14
@@ -176,21 +176,27 @@ int register_client(osip_message_t *my_msg, int force_lcl_masq) {
|
||||
osip_uri_param_t *expires_param=NULL;
|
||||
|
||||
/*
|
||||
* RFC 3261, Section 16.3 step 6
|
||||
* Proxy Behavior - Request Validation - Proxy-Authorization
|
||||
* Authorization - do only if I'm not just acting as outbound proxy
|
||||
* but am ment to be the registrar
|
||||
*/
|
||||
sts = authenticate_proxy(my_msg);
|
||||
if (sts == STS_FAILURE) {
|
||||
/* failed */
|
||||
WARN("proxy authentication failed for %s@%s",
|
||||
(my_msg->to->url->username)? my_msg->to->url->username : "*NULL*",
|
||||
my_msg->to->url->host);
|
||||
return STS_FAILURE;
|
||||
} else if (sts == STS_NEED_AUTH) {
|
||||
/* needed */
|
||||
DEBUGC(DBCLASS_REG,"proxy authentication needed for %s@%s",
|
||||
my_msg->to->url->username,my_msg->to->url->host);
|
||||
return STS_NEED_AUTH;
|
||||
if (force_lcl_masq == 0) {
|
||||
/*
|
||||
* RFC 3261, Section 16.3 step 6
|
||||
* Proxy Behavior - Request Validation - Proxy-Authorization
|
||||
*/
|
||||
sts = authenticate_proxy(my_msg);
|
||||
if (sts == STS_FAILURE) {
|
||||
/* failed */
|
||||
WARN("proxy authentication failed for %s@%s",
|
||||
(my_msg->to->url->username)? my_msg->to->url->username : "*NULL*",
|
||||
my_msg->to->url->host);
|
||||
return STS_FAILURE;
|
||||
} else if (sts == STS_NEED_AUTH) {
|
||||
/* needed */
|
||||
DEBUGC(DBCLASS_REG,"proxy authentication needed for %s@%s",
|
||||
my_msg->to->url->username,my_msg->to->url->host);
|
||||
return STS_NEED_AUTH;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user