curl_easy_setopt: Added the ability to set the login options separately
authorSteve Holme <steve_holme@hotmail.com>
Tue, 12 Nov 2013 19:01:04 +0000 (19:01 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Tue, 12 Nov 2013 19:08:55 +0000 (19:08 +0000)
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.

docs/libcurl/curl_easy_setopt.3
docs/libcurl/symbols-in-versions
include/curl/curl.h
include/curl/typecheck-gcc.h
lib/url.c
packages/OS400/README.OS400
packages/OS400/ccsidcurl.c
packages/OS400/curl.inc.in

index fb22306..0b507d8 100644 (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.
index ac679d9..9f2fe9f 100644 (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
index e3c6bf2..14ff7c7 100644 (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;
 
index e8f1dff..7feccf3 100644 (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 */
index 36bd464..7536877 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -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,
index 4a39738..62918c9 100644 (file)
@@ -89,6 +89,7 @@ options:
         CURLOPT_MAIL_AUTH
         CURLOPT_NETRC_FILE
         CURLOPT_NOPROXY
+        CURLOPT_OPTIONS
         CURLOPT_PASSWORD
         CURLOPT_PROXY
         CURLOPT_PROXYPASSWORD
index e312c71..923bb1b 100644 (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:
index edd5167..dfc172c 100644 (file)
      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...