From b976d108f1beecff743f912f190ffc89f1ef9098 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 27 Aug 2011 06:31:18 +0200 Subject: NTLM_WB: final congruency naming adjustments Configure script option --enable-wb-ntlm-auth renamed to --enable-ntlm-wb Configure script option --disable-wb-ntlm-auth renamed to --disable-ntlm-wb Preprocessor symbol WINBIND_NTLM_AUTH_ENABLED renamed to NTLM_WB_ENABLED Preprocessor symbol WINBIND_NTLM_AUTH_FILE renamed to NTLM_WB_FILE Test harness env var CURL_NTLM_AUTH renamed to CURL_NTLM_WB_FILE Static function wb_ntlm_close renamed to ntlm_wb_cleanup Static function wb_ntlm_initiate renamed to ntlm_wb_init Static function wb_ntlm_response renamed to ntlm_wb_response --- lib/http.c | 4 ++-- lib/http_ntlm.c | 43 +++++++++++++++++++++---------------------- lib/http_ntlm.h | 2 +- lib/url.c | 6 +++--- lib/urldata.h | 2 +- lib/version.c | 2 +- 6 files changed, 29 insertions(+), 30 deletions(-) (limited to 'lib') diff --git a/lib/http.c b/lib/http.c index 54bb53527..c1a94712e 100644 --- a/lib/http.c +++ b/lib/http.c @@ -545,7 +545,7 @@ output_auth_headers(struct connectdata *conn, } else #endif -#ifdef WINBIND_NTLM_AUTH_ENABLED +#ifdef NTLM_WB_ENABLED if(authstatus->picked == CURLAUTH_NTLM_WB) { auth="NTLM_WB"; result = Curl_output_ntlm_wb(conn, proxy); @@ -773,7 +773,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn, Curl_input_ntlm(conn, (bool)(httpcode == 407), start); if(CURLE_OK == ntlm) { data->state.authproblem = FALSE; -#ifdef WINBIND_NTLM_AUTH_ENABLED +#ifdef NTLM_WB_ENABLED if(authp->picked == CURLAUTH_NTLM_WB) { *availp &= ~CURLAUTH_NTLM; authp->avail &= ~CURLAUTH_NTLM; diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c index ccecc02b3..8d9a8a1b5 100644 --- a/lib/http_ntlm.c +++ b/lib/http_ntlm.c @@ -124,8 +124,8 @@ CURLcode Curl_input_ntlm(struct connectdata *conn, return result; } -#ifdef WINBIND_NTLM_AUTH_ENABLED -static void wb_ntlm_close(struct connectdata *conn) +#ifdef NTLM_WB_ENABLED +static void ntlm_wb_cleanup(struct connectdata *conn) { if(conn->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD) { sclose(conn->ntlm_auth_hlpr_socket); @@ -163,8 +163,7 @@ static void wb_ntlm_close(struct connectdata *conn) conn->response_header = NULL; } -static CURLcode wb_ntlm_initiate(struct connectdata *conn, - const char *userp) +static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp) { curl_socket_t sockfds[2]; pid_t child_pid; @@ -190,16 +189,16 @@ static CURLcode wb_ntlm_initiate(struct connectdata *conn, } /* For testing purposes, when DEBUGBUILD is defined and environment - variable CURL_NTLM_AUTH is set a fake_ntlm is used to perform + variable CURL_NTLM_WB_FILE is set a fake_ntlm is used to perform NTLM challenge/response which only accepts commands and output strings pre-written in test case definitions */ #ifdef DEBUGBUILD - ntlm_auth_alloc = curl_getenv("CURL_NTLM_AUTH"); + ntlm_auth_alloc = curl_getenv("CURL_NTLM_WB_FILE"); if(ntlm_auth_alloc) ntlm_auth = ntlm_auth_alloc; else #endif - ntlm_auth = WINBIND_NTLM_AUTH_FILE; + ntlm_auth = NTLM_WB_FILE; if(access(ntlm_auth, X_OK) != 0) { error = ERRNO; @@ -279,7 +278,7 @@ done: return CURLE_REMOTE_ACCESS_DENIED; } -static CURLcode wb_ntlm_response(struct connectdata *conn, +static CURLcode ntlm_wb_response(struct connectdata *conn, const char *input, curlntlm state) { ssize_t size; @@ -347,7 +346,7 @@ done: CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy) { - /* point to the address of the pointer that holds the string to sent to the + /* point to the address of the pointer that holds the string to send to the server, which is for a plain host or for a HTTP proxy */ char **allocuserpwd; /* point to the name and password for this */ @@ -383,23 +382,23 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, switch(ntlm->state) { case NTLMSTATE_TYPE1: default: - /* Use Samba's 'winbind' daemon to support NTLM single-sign-on, + /* Use Samba's 'winbind' daemon to support NTLM authentication, * by delegating the NTLM challenge/response protocal to a helper * in ntlm_auth. * http://devel.squid-cache.org/ntlm/squid_helper_protocol.html * http://www.samba.org/samba/docs/man/manpages-3/winbindd.8.html * http://www.samba.org/samba/docs/man/manpages-3/ntlm_auth.1.html - * Preprocessor symbol 'WINBIND_NTLM_AUTH_ENABLED' is defined when - * this feature is enabled and 'WINBIND_NTLM_AUTH_FILE' symbol holds - * absolute filename of ntlm_auth helper. - * If NTLM single-sign-on fails, go back to original request - * handling process. + * Preprocessor symbol 'NTLM_WB_ENABLED' is defined when this + * feature is enabled and 'NTLM_WB_FILE' symbol holds absolute + * filename of ntlm_auth helper. + * If NTLM authentication using winbind fails, go back to original + * request handling process. */ /* Create communication with ntlm_auth */ - res = wb_ntlm_initiate(conn, userp); + res = ntlm_wb_init(conn, userp); if(res) return res; - res = wb_ntlm_response(conn, "YR\n", ntlm->state); + res = ntlm_wb_response(conn, "YR\n", ntlm->state); if(res) return res; @@ -415,7 +414,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, input = aprintf("TT %s", conn->challenge_header); if(!input) return CURLE_OUT_OF_MEMORY; - res = wb_ntlm_response(conn, input, ntlm->state); + res = ntlm_wb_response(conn, input, ntlm->state); free(input); input = NULL; if(res) @@ -428,7 +427,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd)); ntlm->state = NTLMSTATE_TYPE3; /* we sent a type-3 */ authp->done = TRUE; - wb_ntlm_close(conn); + ntlm_wb_cleanup(conn); break; case NTLMSTATE_TYPE3: /* connection is already authenticated, @@ -443,7 +442,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, return CURLE_OK; } -#endif /* WINBIND_NTLM_AUTH_ENABLED */ +#endif /* NTLM_WB_ENABLED */ /* * This is for creating ntlm header output @@ -563,8 +562,8 @@ void Curl_http_ntlm_cleanup(struct connectdata *conn) #ifdef USE_WINDOWS_SSPI Curl_ntlm_sspi_cleanup(&conn->ntlm); Curl_ntlm_sspi_cleanup(&conn->proxyntlm); -#elif defined(WINBIND_NTLM_AUTH_ENABLED) - wb_ntlm_close(conn); +#elif defined(NTLM_WB_ENABLED) + ntlm_wb_cleanup(conn); #else (void)conn; #endif diff --git a/lib/http_ntlm.h b/lib/http_ntlm.h index d13998f4e..635d6313b 100644 --- a/lib/http_ntlm.h +++ b/lib/http_ntlm.h @@ -29,7 +29,7 @@ CURLcode Curl_input_ntlm(struct connectdata *conn, bool proxy, /* this is for creating ntlm header output */ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy); -#ifdef WINBIND_NTLM_AUTH_ENABLED +#ifdef NTLM_WB_ENABLED /* this is for creating ntlm header output by delegating challenge/response to Samba's winbind daemon helper ntlm_auth */ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy); diff --git a/lib/url.c b/lib/url.c index 73f633f0d..9834e04f8 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1388,7 +1388,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, #ifndef USE_NTLM auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */ #endif -#ifndef WINBIND_NTLM_AUTH_ENABLED +#ifndef NTLM_WB_ENABLED auth &= ~CURLAUTH_NTLM_WB; #endif #ifndef USE_HTTP_NEGOTIATE @@ -1452,7 +1452,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, #ifndef USE_NTLM auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */ #endif -#ifndef WINBIND_NTLM_AUTH_ENABLED +#ifndef NTLM_WB_ENABLED auth &= ~CURLAUTH_NTLM_WB; #endif #ifndef USE_HTTP_NEGOTIATE @@ -3526,7 +3526,7 @@ static struct connectdata *allocate_conn(struct SessionHandle *data) conn->ip_version = data->set.ipver; -#ifdef WINBIND_NTLM_AUTH_ENABLED +#ifdef NTLM_WB_ENABLED conn->ntlm_auth_hlpr_socket = CURL_SOCKET_BAD; conn->ntlm_auth_hlpr_pid = 0; conn->challenge_header = NULL; diff --git a/lib/urldata.h b/lib/urldata.h index b9439e458..8965c0bb2 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -905,7 +905,7 @@ struct connectdata { single requests! */ struct ntlmdata proxyntlm; /* NTLM data for proxy */ -#ifdef WINBIND_NTLM_AUTH_ENABLED +#ifdef NTLM_WB_ENABLED /* used for communication with Samba's winbind daemon helper ntlm_auth */ curl_socket_t ntlm_auth_hlpr_socket; pid_t ntlm_auth_hlpr_pid; diff --git a/lib/version.c b/lib/version.c index 409d5d4c4..fdf758f9a 100644 --- a/lib/version.c +++ b/lib/version.c @@ -240,7 +240,7 @@ static curl_version_info_data version_info = { #ifdef USE_NTLM | CURL_VERSION_NTLM #endif -#ifdef WINBIND_NTLM_AUTH_ENABLED +#ifdef NTLM_WB_ENABLED | CURL_VERSION_NTLM_WB #endif #ifdef USE_WINDOWS_SSPI -- cgit v1.2.3