1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

curl_easy_setopt: Added the ability to set the login options separately

Rather than set the authentication options as part of the login details
specified in the URL, or via the older CURLOPT_USERPWD option, added a
new libcurl option to allow the login options to be set separately.
This commit is contained in:
Steve Holme 2013-11-12 19:01:04 +00:00
parent 6901861fc9
commit f2584627c8
8 changed files with 37 additions and 7 deletions

View File

@ -1164,14 +1164,23 @@ user name to use for the transfer.
authentication. You should not use this option together with the (older)
CURLOPT_USERPWD option.
In order to specify the password to be used in conjunction with the user name
use the \fICURLOPT_PASSWORD\fP option. (Added in 7.19.1)
To specify the password and login options, along with the user name, use the
\fICURLOPT_PASSWORD\fP and \fICURLOPT_OPTIONS\fP options or alternatively use
the older \CURLOPT_USERPWD\fP option instead. (Added in 7.19.1)
.IP CURLOPT_PASSWORD
Pass a char * as parameter, which should be pointing to the zero terminated
password to use for the transfer.
The CURLOPT_PASSWORD option should be used in conjunction with
the \fICURLOPT_USERNAME\fP option. (Added in 7.19.1)
The CURLOPT_PASSWORD option should be used in conjunction with the
\fICURLOPT_USERNAME\fP option. (Added in 7.19.1)
.IP CURLOPT_OPTIONS
Pass a char * as parameter, which should be pointing to the zero terminated
options string to use for the transfer.
\CURLOPT_OPTIONS\fP can be used to set protocol specific authentication options,
such as the preferred authentication mechanism via "AUTH=NTLM" or "AUTH=*", and
should be used in conjunction with the \fICURLOPT_USERNAME\fP option. (Added in
7.34.0)
.IP CURLOPT_PROXYUSERNAME
Pass a char * as parameter, which should be pointing to the zero terminated
user name to use for the transfer while connecting to Proxy.

View File

@ -417,6 +417,7 @@ CURLOPT_NOSIGNAL 7.10
CURLOPT_NOTHING 7.1.1 7.11.1 7.11.0
CURLOPT_OPENSOCKETDATA 7.17.1
CURLOPT_OPENSOCKETFUNCTION 7.17.1
CURLOPT_OPTIONS 7.34.0
CURLOPT_PASSWDDATA 7.4.2 7.11.1 7.15.5
CURLOPT_PASSWDFUNCTION 7.4.2 7.11.1 7.15.5
CURLOPT_PASSWORD 7.19.1

View File

@ -827,10 +827,10 @@ typedef enum {
/* Name of proxy to use. */
CINIT(PROXY, OBJECTPOINT, 4),
/* "name:password" to use when fetching. */
/* "user:password;options" to use when fetching. */
CINIT(USERPWD, OBJECTPOINT, 5),
/* "name:password" to use with proxy. */
/* "user:password" to use with proxy. */
CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
/* Range to get, specified as an ASCII string. */
@ -1569,6 +1569,9 @@ typedef enum {
* Only supported by the c-ares DNS backend */
CINIT(DNS_LOCAL_IP6, OBJECTPOINT, 223),
/* Set authentication options directly */
CINIT(OPTIONS, OBJECTPOINT, 224),
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;

View File

@ -269,6 +269,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
(option) == CURLOPT_DNS_INTERFACE || \
(option) == CURLOPT_DNS_LOCAL_IP4 || \
(option) == CURLOPT_DNS_LOCAL_IP6 || \
(option) == CURLOPT_OPTIONS || \
0)
/* evaluates to true if option takes a curl_write_callback argument */

View File

@ -1560,6 +1560,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
&data->set.str[STRING_PASSWORD],
&data->set.str[STRING_OPTIONS]);
break;
case CURLOPT_USERNAME:
/*
* authentication user name to use in the operation
@ -1567,6 +1568,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
result = setstropt(&data->set.str[STRING_USERNAME],
va_arg(param, char *));
break;
case CURLOPT_PASSWORD:
/*
* authentication password to use in the operation
@ -1574,6 +1576,15 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
result = setstropt(&data->set.str[STRING_PASSWORD],
va_arg(param, char *));
break;
case CURLOPT_OPTIONS:
/*
* authentication options to use in the operation
*/
result = setstropt(&data->set.str[STRING_OPTIONS],
va_arg(param, char *));
break;
case CURLOPT_XOAUTH2_BEARER:
/*
* XOAUTH2 bearer token to use in the operation
@ -1581,6 +1592,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
result = setstropt(&data->set.str[STRING_BEARER],
va_arg(param, char *));
break;
case CURLOPT_POSTQUOTE:
/*
* List of RAW FTP commands to use after a transfer
@ -4824,7 +4836,7 @@ static CURLcode override_login(struct SessionHandle *data,
}
/*
* Set password so it's available in the connection.
* Set the login details so they're available in the connection
*/
static CURLcode set_login(struct connectdata *conn,
const char *user, const char *passwd,

View File

@ -89,6 +89,7 @@ options:
CURLOPT_MAIL_AUTH
CURLOPT_NETRC_FILE
CURLOPT_NOPROXY
CURLOPT_OPTIONS
CURLOPT_PASSWORD
CURLOPT_PROXY
CURLOPT_PROXYPASSWORD

View File

@ -1145,6 +1145,7 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...)
case CURLOPT_MAIL_AUTH:
case CURLOPT_NETRC_FILE:
case CURLOPT_NOPROXY:
case CURLOPT_OPTIONS:
case CURLOPT_PASSWORD:
case CURLOPT_PROXY:
case CURLOPT_PROXYPASSWORD:

View File

@ -1180,6 +1180,8 @@
d c 10222
d CURLOPT_DNS_LOCAL_IP6...
d c 10223
d CURLOPT_OPTIONS...
d c 10224
*
/if not defined(CURL_NO_OLDIES)
d CURLOPT_SSLKEYPASSWD...