From 2aa193ed735871cfcd0dab0043688a1619e58bf6 Mon Sep 17 00:00:00 2001 From: Martti Mela Date: Thu, 27 Apr 2006 15:02:07 +0300 Subject: [PATCH] iptsec: ntlm support now compiles, not working. darcs-hash:20060427120207-1b897-505031710fcaadfb60939abcacd68aa09d2592e0.gz --- libsofia-sip-ua/iptsec/auth_digest.c | 1 - libsofia-sip-ua/iptsec/auth_module.c | 31 ++++++++++++++++++- .../iptsec/sofia-sip/auth_digest.h | 1 + 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/libsofia-sip-ua/iptsec/auth_digest.c b/libsofia-sip-ua/iptsec/auth_digest.c index f4d93990..65859ed8 100644 --- a/libsofia-sip-ua/iptsec/auth_digest.c +++ b/libsofia-sip-ua/iptsec/auth_digest.c @@ -129,7 +129,6 @@ int auth_get_params(su_home_t *home, return n; } -static int auth_struct_copy(void *dst, void const *src, int s_size) { int d_size = *(int *)dst; diff --git a/libsofia-sip-ua/iptsec/auth_module.c b/libsofia-sip-ua/iptsec/auth_module.c index 5f735e9b..cc3408a3 100644 --- a/libsofia-sip-ua/iptsec/auth_module.c +++ b/libsofia-sip-ua/iptsec/auth_module.c @@ -914,8 +914,14 @@ void auth_check_ntlm(auth_mod_t *am, return; } + /* XXX - replace */ +#if 0 if (as->as_nonce_issued == 0 /* Already validated nonce */ && auth_validate_ntlm_nonce(am, as, ar, now) < 0) { +#else + if (as->as_nonce_issued == 0 /* Already validated nonce */ && + auth_validate_digest_nonce(am, as, ar, now) < 0) { +#endif as->as_blacklist = am->am_blacklist; auth_challenge_ntlm(am, as, ach); return; @@ -928,6 +934,7 @@ void auth_check_ntlm(auth_mod_t *am, apw = auth_mod_getpass(am, ar->ar_username, ar->ar_realm); +#if 0 if (apw && apw->apw_hash) a1 = apw->apw_hash; else if (apw && apw->apw_pass) @@ -937,9 +944,26 @@ void auth_check_ntlm(auth_mod_t *am, if (ar->ar_md5sess) auth_ntlm_a1sess(ar, a1buf, a1), a1 = a1buf; - +#else + if (apw && apw->apw_hash) + a1 = apw->apw_hash; + else if (apw && apw->apw_pass) + auth_digest_a1(ar, a1buf, apw->apw_pass), a1 = a1buf; + else + auth_digest_a1(ar, a1buf, "xyzzy"), a1 = a1buf, apw = NULL; + + if (ar->ar_md5sess) + auth_digest_a1sess(ar, a1buf, a1), a1 = a1buf; +#endif + + /* XXX - replace with auth_ntlm_response */ +#if 0 auth_ntlm_response(ar, response, a1, + as->as_method, as->as_body, as->as_bodylen); +#else + auth_digest_response(ar, response, a1, as->as_method, as->as_body, as->as_bodylen); +#endif if (!apw || strcmp(response, ar->ar_response)) { if (am->am_forbidden) { @@ -1031,7 +1055,12 @@ void auth_info_ntlm(auth_mod_t *am, if (am->am_nextnonce) { char nonce[AUTH_NTLM_NONCE_LEN]; + /* XXX - replace */ +#if 0 auth_generate_ntlm_nonce(am, nonce, sizeof nonce, 1, msg_now()); +#else + auth_generate_digest_nonce(am, nonce, sizeof nonce, 1, msg_now()); +#endif as->as_info = msg_header_format(as->as_home, ach->ach_info, "nextnonce=\"%s\"", nonce); diff --git a/libsofia-sip-ua/iptsec/sofia-sip/auth_digest.h b/libsofia-sip-ua/iptsec/sofia-sip/auth_digest.h index bbecc3cc..9b8b5b28 100644 --- a/libsofia-sip-ua/iptsec/sofia-sip/auth_digest.h +++ b/libsofia-sip-ua/iptsec/sofia-sip/auth_digest.h @@ -153,6 +153,7 @@ int auth_digest_sessionkey(auth_response_t *, auth_hexmd5_t ha1, int auth_digest_response(auth_response_t *, auth_hexmd5_t response, auth_hexmd5_t const ha1, char const *method_name, void const *data, int dlen); +int auth_struct_copy(void *dst, void const *src, int s_size); SOFIA_END_DECLS -- GitLab