diff options
Diffstat (limited to 'Utilities/cmcurl/lib/curl_ntlm_wb.c')
-rw-r--r-- | Utilities/cmcurl/lib/curl_ntlm_wb.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/Utilities/cmcurl/lib/curl_ntlm_wb.c b/Utilities/cmcurl/lib/curl_ntlm_wb.c index 9f5b87b..03f47a3 100644 --- a/Utilities/cmcurl/lib/curl_ntlm_wb.c +++ b/Utilities/cmcurl/lib/curl_ntlm_wb.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -48,6 +48,7 @@ #include "sendf.h" #include "select.h" #include "vauth/ntlm.h" +#include "curl_ntlm_core.h" #include "curl_ntlm_wb.h" #include "url.h" #include "strerror.h" @@ -123,7 +124,6 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp) struct passwd pw, *pw_res; char pwbuf[1024]; #endif - int error; /* Return if communication with ntlm_auth already set up */ if(conn->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD || @@ -178,26 +178,23 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp) ntlm_auth = NTLM_WB_FILE; if(access(ntlm_auth, X_OK) != 0) { - error = ERRNO; failf(conn->data, "Could not access ntlm_auth: %s errno %d: %s", - ntlm_auth, error, Curl_strerror(conn, error)); + ntlm_auth, errno, Curl_strerror(conn, errno)); goto done; } if(socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds)) { - error = ERRNO; failf(conn->data, "Could not open socket pair. errno %d: %s", - error, Curl_strerror(conn, error)); + errno, Curl_strerror(conn, errno)); goto done; } child_pid = fork(); if(child_pid == -1) { - error = ERRNO; sclose(sockfds[0]); sclose(sockfds[1]); failf(conn->data, "Could not fork. errno %d: %s", - error, Curl_strerror(conn, error)); + errno, Curl_strerror(conn, errno)); goto done; } else if(!child_pid) { @@ -208,16 +205,14 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp) /* Don't use sclose in the child since it fools the socket leak detector */ sclose_nolog(sockfds[0]); if(dup2(sockfds[1], STDIN_FILENO) == -1) { - error = ERRNO; failf(conn->data, "Could not redirect child stdin. errno %d: %s", - error, Curl_strerror(conn, error)); + errno, Curl_strerror(conn, errno)); exit(1); } if(dup2(sockfds[1], STDOUT_FILENO) == -1) { - error = ERRNO; failf(conn->data, "Could not redirect child stdout. errno %d: %s", - error, Curl_strerror(conn, error)); + errno, Curl_strerror(conn, errno)); exit(1); } @@ -235,10 +230,9 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp) "--username", username, NULL); - error = ERRNO; sclose_nolog(sockfds[1]); failf(conn->data, "Could not execl(). errno %d: %s", - error, Curl_strerror(conn, error)); + errno, Curl_strerror(conn, errno)); exit(1); } @@ -364,7 +358,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, /* not set means empty */ if(!userp) - userp=""; + userp = ""; switch(ntlm->state) { case NTLMSTATE_TYPE1: @@ -420,7 +414,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, /* connection is already authenticated, * don't send a header in future requests */ free(*allocuserpwd); - *allocuserpwd=NULL; + *allocuserpwd = NULL; authp->done = TRUE; break; } |