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
This commit is contained in:
Yang Tse 2011-08-27 06:31:18 +02:00
parent b4f6319cf7
commit b976d108f1
9 changed files with 67 additions and 68 deletions

View File

@ -2816,9 +2816,9 @@ AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
) )
CURL_CHECK_OPTION_WINBIND_NTLM_AUTH CURL_CHECK_OPTION_NTLM_WB
CURL_CHECK_WINBIND_NTLM_AUTH CURL_CHECK_NTLM_WB
dnl ************************************************************ dnl ************************************************************
dnl disable TLS-SRP authentication dnl disable TLS-SRP authentication
@ -2995,7 +2995,7 @@ if test "x$CURL_DISABLE_HTTP" != "x1"; then
if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \ if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
-o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1"; then -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1"; then
SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM" SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
if test "x$WINBIND_NTLM_AUTH_ENABLED" = "x1"; then if test "x$NTLM_WB_ENABLED" = "x1"; then
SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB" SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
fi fi
fi fi

View File

@ -545,7 +545,7 @@ output_auth_headers(struct connectdata *conn,
} }
else else
#endif #endif
#ifdef WINBIND_NTLM_AUTH_ENABLED #ifdef NTLM_WB_ENABLED
if(authstatus->picked == CURLAUTH_NTLM_WB) { if(authstatus->picked == CURLAUTH_NTLM_WB) {
auth="NTLM_WB"; auth="NTLM_WB";
result = Curl_output_ntlm_wb(conn, proxy); 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); Curl_input_ntlm(conn, (bool)(httpcode == 407), start);
if(CURLE_OK == ntlm) { if(CURLE_OK == ntlm) {
data->state.authproblem = FALSE; data->state.authproblem = FALSE;
#ifdef WINBIND_NTLM_AUTH_ENABLED #ifdef NTLM_WB_ENABLED
if(authp->picked == CURLAUTH_NTLM_WB) { if(authp->picked == CURLAUTH_NTLM_WB) {
*availp &= ~CURLAUTH_NTLM; *availp &= ~CURLAUTH_NTLM;
authp->avail &= ~CURLAUTH_NTLM; authp->avail &= ~CURLAUTH_NTLM;

View File

@ -124,8 +124,8 @@ CURLcode Curl_input_ntlm(struct connectdata *conn,
return result; return result;
} }
#ifdef WINBIND_NTLM_AUTH_ENABLED #ifdef NTLM_WB_ENABLED
static void wb_ntlm_close(struct connectdata *conn) static void ntlm_wb_cleanup(struct connectdata *conn)
{ {
if(conn->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD) { if(conn->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD) {
sclose(conn->ntlm_auth_hlpr_socket); sclose(conn->ntlm_auth_hlpr_socket);
@ -163,8 +163,7 @@ static void wb_ntlm_close(struct connectdata *conn)
conn->response_header = NULL; conn->response_header = NULL;
} }
static CURLcode wb_ntlm_initiate(struct connectdata *conn, static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp)
const char *userp)
{ {
curl_socket_t sockfds[2]; curl_socket_t sockfds[2];
pid_t child_pid; 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 /* 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 NTLM challenge/response which only accepts commands and output
strings pre-written in test case definitions */ strings pre-written in test case definitions */
#ifdef DEBUGBUILD #ifdef DEBUGBUILD
ntlm_auth_alloc = curl_getenv("CURL_NTLM_AUTH"); ntlm_auth_alloc = curl_getenv("CURL_NTLM_WB_FILE");
if(ntlm_auth_alloc) if(ntlm_auth_alloc)
ntlm_auth = ntlm_auth_alloc; ntlm_auth = ntlm_auth_alloc;
else else
#endif #endif
ntlm_auth = WINBIND_NTLM_AUTH_FILE; ntlm_auth = NTLM_WB_FILE;
if(access(ntlm_auth, X_OK) != 0) { if(access(ntlm_auth, X_OK) != 0) {
error = ERRNO; error = ERRNO;
@ -279,7 +278,7 @@ done:
return CURLE_REMOTE_ACCESS_DENIED; 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) const char *input, curlntlm state)
{ {
ssize_t size; ssize_t size;
@ -347,7 +346,7 @@ done:
CURLcode Curl_output_ntlm_wb(struct connectdata *conn, CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
bool proxy) 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 */ server, which is for a plain host or for a HTTP proxy */
char **allocuserpwd; char **allocuserpwd;
/* point to the name and password for this */ /* point to the name and password for this */
@ -383,23 +382,23 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
switch(ntlm->state) { switch(ntlm->state) {
case NTLMSTATE_TYPE1: case NTLMSTATE_TYPE1:
default: 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 * by delegating the NTLM challenge/response protocal to a helper
* in ntlm_auth. * in ntlm_auth.
* http://devel.squid-cache.org/ntlm/squid_helper_protocol.html * 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/winbindd.8.html
* http://www.samba.org/samba/docs/man/manpages-3/ntlm_auth.1.html * http://www.samba.org/samba/docs/man/manpages-3/ntlm_auth.1.html
* Preprocessor symbol 'WINBIND_NTLM_AUTH_ENABLED' is defined when * Preprocessor symbol 'NTLM_WB_ENABLED' is defined when this
* this feature is enabled and 'WINBIND_NTLM_AUTH_FILE' symbol holds * feature is enabled and 'NTLM_WB_FILE' symbol holds absolute
* absolute filename of ntlm_auth helper. * filename of ntlm_auth helper.
* If NTLM single-sign-on fails, go back to original request * If NTLM authentication using winbind fails, go back to original
* handling process. * request handling process.
*/ */
/* Create communication with ntlm_auth */ /* Create communication with ntlm_auth */
res = wb_ntlm_initiate(conn, userp); res = ntlm_wb_init(conn, userp);
if(res) if(res)
return res; return res;
res = wb_ntlm_response(conn, "YR\n", ntlm->state); res = ntlm_wb_response(conn, "YR\n", ntlm->state);
if(res) if(res)
return res; return res;
@ -415,7 +414,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
input = aprintf("TT %s", conn->challenge_header); input = aprintf("TT %s", conn->challenge_header);
if(!input) if(!input)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
res = wb_ntlm_response(conn, input, ntlm->state); res = ntlm_wb_response(conn, input, ntlm->state);
free(input); free(input);
input = NULL; input = NULL;
if(res) if(res)
@ -428,7 +427,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd)); DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd));
ntlm->state = NTLMSTATE_TYPE3; /* we sent a type-3 */ ntlm->state = NTLMSTATE_TYPE3; /* we sent a type-3 */
authp->done = TRUE; authp->done = TRUE;
wb_ntlm_close(conn); ntlm_wb_cleanup(conn);
break; break;
case NTLMSTATE_TYPE3: case NTLMSTATE_TYPE3:
/* connection is already authenticated, /* connection is already authenticated,
@ -443,7 +442,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
return CURLE_OK; return CURLE_OK;
} }
#endif /* WINBIND_NTLM_AUTH_ENABLED */ #endif /* NTLM_WB_ENABLED */
/* /*
* This is for creating ntlm header output * This is for creating ntlm header output
@ -563,8 +562,8 @@ void Curl_http_ntlm_cleanup(struct connectdata *conn)
#ifdef USE_WINDOWS_SSPI #ifdef USE_WINDOWS_SSPI
Curl_ntlm_sspi_cleanup(&conn->ntlm); Curl_ntlm_sspi_cleanup(&conn->ntlm);
Curl_ntlm_sspi_cleanup(&conn->proxyntlm); Curl_ntlm_sspi_cleanup(&conn->proxyntlm);
#elif defined(WINBIND_NTLM_AUTH_ENABLED) #elif defined(NTLM_WB_ENABLED)
wb_ntlm_close(conn); ntlm_wb_cleanup(conn);
#else #else
(void)conn; (void)conn;
#endif #endif

View File

@ -29,7 +29,7 @@ CURLcode Curl_input_ntlm(struct connectdata *conn, bool proxy,
/* this is for creating ntlm header output */ /* this is for creating ntlm header output */
CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy); 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 /* this is for creating ntlm header output by delegating challenge/response
to Samba's winbind daemon helper ntlm_auth */ to Samba's winbind daemon helper ntlm_auth */
CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy); CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy);

View File

@ -1388,7 +1388,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
#ifndef USE_NTLM #ifndef USE_NTLM
auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */ auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
#endif #endif
#ifndef WINBIND_NTLM_AUTH_ENABLED #ifndef NTLM_WB_ENABLED
auth &= ~CURLAUTH_NTLM_WB; auth &= ~CURLAUTH_NTLM_WB;
#endif #endif
#ifndef USE_HTTP_NEGOTIATE #ifndef USE_HTTP_NEGOTIATE
@ -1452,7 +1452,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
#ifndef USE_NTLM #ifndef USE_NTLM
auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */ auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
#endif #endif
#ifndef WINBIND_NTLM_AUTH_ENABLED #ifndef NTLM_WB_ENABLED
auth &= ~CURLAUTH_NTLM_WB; auth &= ~CURLAUTH_NTLM_WB;
#endif #endif
#ifndef USE_HTTP_NEGOTIATE #ifndef USE_HTTP_NEGOTIATE
@ -3526,7 +3526,7 @@ static struct connectdata *allocate_conn(struct SessionHandle *data)
conn->ip_version = data->set.ipver; 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_socket = CURL_SOCKET_BAD;
conn->ntlm_auth_hlpr_pid = 0; conn->ntlm_auth_hlpr_pid = 0;
conn->challenge_header = NULL; conn->challenge_header = NULL;

View File

@ -905,7 +905,7 @@ struct connectdata {
single requests! */ single requests! */
struct ntlmdata proxyntlm; /* NTLM data for proxy */ 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 */ /* used for communication with Samba's winbind daemon helper ntlm_auth */
curl_socket_t ntlm_auth_hlpr_socket; curl_socket_t ntlm_auth_hlpr_socket;
pid_t ntlm_auth_hlpr_pid; pid_t ntlm_auth_hlpr_pid;

View File

@ -240,7 +240,7 @@ static curl_version_info_data version_info = {
#ifdef USE_NTLM #ifdef USE_NTLM
| CURL_VERSION_NTLM | CURL_VERSION_NTLM
#endif #endif
#ifdef WINBIND_NTLM_AUTH_ENABLED #ifdef NTLM_WB_ENABLED
| CURL_VERSION_NTLM_WB | CURL_VERSION_NTLM_WB
#endif #endif
#ifdef USE_WINDOWS_SSPI #ifdef USE_WINDOWS_SSPI

View File

@ -21,7 +21,7 @@
#*************************************************************************** #***************************************************************************
# File version for 'aclocal' use. Keep it a single number. # File version for 'aclocal' use. Keep it a single number.
# serial 15 # serial 16
dnl CURL_CHECK_OPTION_THREADED_RESOLVER dnl CURL_CHECK_OPTION_THREADED_RESOLVER
dnl ------------------------------------------------- dnl -------------------------------------------------
@ -497,63 +497,63 @@ AC_DEFUN([CURL_CHECK_LIB_ARES], [
]) ])
dnl CURL_CHECK_OPTION_WINBIND_NTLM_AUTH dnl CURL_CHECK_OPTION_NTLM_WB
dnl ------------------------------------------------- dnl -------------------------------------------------
dnl Verify if configure has been invoked with option dnl Verify if configure has been invoked with option
dnl --enable-ntlm-auth or --disable-ntlm-auth, and dnl --enable-ntlm-wb or --disable-ntlm-wb, and set
dnl set shell variable want_wb_ntlm_auth and dnl shell variable want_ntlm_wb and want_ntlm_wb_file
dnl want_wb_ntlm_auth_file as appropriate. dnl as appropriate.
AC_DEFUN([CURL_CHECK_OPTION_WINBIND_NTLM_AUTH], [ AC_DEFUN([CURL_CHECK_OPTION_NTLM_WB], [
AC_BEFORE([$0],[CURL_CHECK_WINBIND_NTLM_AUTH])dnl AC_BEFORE([$0],[CURL_CHECK_NTLM_WB])dnl
OPT_WINBIND_NTLM_AUTH="default" OPT_NTLM_WB="default"
AC_ARG_ENABLE(wb-ntlm-auth, AC_ARG_ENABLE(ntlm-wb,
AC_HELP_STRING([--enable-wb-ntlm-auth@<:@=FILE@:>@],[Enable NTLM delegation to winbind's ntlm_auth helper, where FILE is ntlm_auth's absolute filename (default: /usr/bin/ntlm_auth)]) AC_HELP_STRING([--enable-ntlm-wb@<:@=FILE@:>@],[Enable NTLM delegation to winbind's ntlm_auth helper, where FILE is ntlm_auth's absolute filename (default: /usr/bin/ntlm_auth)])
AC_HELP_STRING([--disable-wb-ntlm-auth],[Disable NTLM delegation to winbind's ntlm_auth helper]), AC_HELP_STRING([--disable-ntlm-wb],[Disable NTLM delegation to winbind's ntlm_auth helper]),
OPT_WINBIND_NTLM_AUTH=$enableval) OPT_NTLM_WB=$enableval)
want_wb_ntlm_auth_file="/usr/bin/ntlm_auth" want_ntlm_wb_file="/usr/bin/ntlm_auth"
case "$OPT_WINBIND_NTLM_AUTH" in case "$OPT_NTLM_WB" in
no) no)
dnl --disable-wb-ntlm-auth option used dnl --disable-ntlm-wb option used
want_wb_ntlm_auth="no" want_ntlm_wb="no"
;; ;;
default) default)
dnl configure option not specified dnl configure option not specified
want_wb_ntlm_auth="yes" want_ntlm_wb="yes"
;; ;;
*) *)
dnl --enable-wb-ntlm-auth option used dnl --enable-ntlm-wb option used
want_wb_ntlm_auth="yes" want_ntlm_wb="yes"
if test -n "$enableval" && test "$enableval" != "yes"; then if test -n "$enableval" && test "$enableval" != "yes"; then
want_wb_ntlm_auth_file="$enableval" want_ntlm_wb_file="$enableval"
fi fi
;; ;;
esac esac
]) ])
dnl CURL_CHECK_WINBIND_NTLM_AUTH dnl CURL_CHECK_NTLM_WB
dnl ------------------------------------------------- dnl -------------------------------------------------
dnl Check if winbind's ntlm_auth helper support will dnl Check if support for NTLM delegation to winbind's
dnl finally be enabled depending on configure option dnl ntlm_auth helper will finally be enabled depending
dnl given and target platform. dnl on given configure options and target platform.
AC_DEFUN([CURL_CHECK_WINBIND_NTLM_AUTH], [ AC_DEFUN([CURL_CHECK_NTLM_WB], [
AC_REQUIRE([CURL_CHECK_OPTION_WINBIND_NTLM_AUTH])dnl AC_REQUIRE([CURL_CHECK_OPTION_NTLM_WB])dnl
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
AC_MSG_CHECKING([whether to enable NTLM delegation to winbind's helper]) AC_MSG_CHECKING([whether to enable NTLM delegation to winbind's helper])
if test "$ac_cv_native_windows" = "yes" || if test "$ac_cv_native_windows" = "yes" ||
test "x$SSL_ENABLED" = "x"; then test "x$SSL_ENABLED" = "x"; then
want_wb_ntlm_auth_file="" want_ntlm_wb_file=""
want_wb_ntlm_auth="no" want_ntlm_wb="no"
fi fi
AC_MSG_RESULT([$want_wb_ntlm_auth]) AC_MSG_RESULT([$want_ntlm_wb])
if test "$want_wb_ntlm_auth" = "yes"; then if test "$want_ntlm_wb" = "yes"; then
AC_DEFINE(WINBIND_NTLM_AUTH_ENABLED, 1, AC_DEFINE(NTLM_WB_ENABLED, 1,
[Define to enable NTLM delegation to winbind's ntlm_auth helper.]) [Define to enable NTLM delegation to winbind's ntlm_auth helper.])
AC_DEFINE_UNQUOTED(WINBIND_NTLM_AUTH_FILE, "$want_wb_ntlm_auth_file", AC_DEFINE_UNQUOTED(NTLM_WB_FILE, "$want_ntlm_wb_file",
[Define absolute filename for winbind's ntlm_auth helper.]) [Define absolute filename for winbind's ntlm_auth helper.])
WINBIND_NTLM_AUTH_ENABLED=1 NTLM_WB_ENABLED=1
fi fi
]) ])

View File

@ -62,7 +62,7 @@ debug
http http
</server> </server>
<name> <name>
HTTP with NTLM single-sign-on authorization HTTP with NTLM delegation to winbind helper
</name> </name>
<setenv> <setenv>
# we force our own host name, in order to make the test machine independent # we force our own host name, in order to make the test machine independent
@ -70,7 +70,7 @@ CURL_GETHOSTNAME=curlhost
# we try to use the LD_PRELOAD hack, if not a debug build # we try to use the LD_PRELOAD hack, if not a debug build
LD_PRELOAD=%PWD/libtest/.libs/libhostname.so LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
# set path to fake_auth instead of real ntlm_auth to generate NTLM type1 and type 3 messages # set path to fake_auth instead of real ntlm_auth to generate NTLM type1 and type 3 messages
CURL_NTLM_AUTH=%PWD/server/fake_ntlm CURL_NTLM_WB_FILE=%PWD/server/fake_ntlm
# set source directory so fake_ntlm can find the test files # set source directory so fake_ntlm can find the test files
CURL_NTLM_AUTH_SRCDIR=%SRCDIR CURL_NTLM_AUTH_SRCDIR=%SRCDIR
# set the test number # set the test number