diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-01-19 23:14:55 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-01-19 23:14:55 +0100 |
commit | b77a3b9a35ec9a13f832899b6af5db80bdb2341e (patch) | |
tree | 49064129d682b59266d5172f007be29039fad317 | |
parent | c0a2ee65a4d266c5e223723b677c6a532dc7182b (diff) |
main: make the tlsauth options always present
... to not make the connection between the tool and the libcurl used
tighter than necessary, the tlsauth options are now always present but
if the used libcurl doesn't have TLSAUTH support it will return failure.
Also, replaced strncmp() with strequal to get case insensitive matching.
-rw-r--r-- | src/main.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/main.c b/src/main.c index d8a105ea7..cfff1f982 100644 --- a/src/main.c +++ b/src/main.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2011, 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 @@ -906,11 +906,9 @@ static void help(void) " --url <URL> Set URL to work with", " -B/--use-ascii Use ASCII/text transfer", " -u/--user <user[:password]> Set server user and password", -#ifdef USE_TLS_SRP " --tlsuser <user> Set TLS username", " --tlspassword <string> Set TLS password", " --tlsauthtype <string> Set TLS authentication type (default SRP)", -#endif " -A/--user-agent <string> User-Agent to send to server (H)", " -v/--verbose Make the operation more talkative", " -V/--version Show version number and quit", @@ -1924,11 +1922,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ {"Eh","pubkey", TRUE}, {"Ei", "hostpubmd5", TRUE}, {"Ej","crlfile", TRUE}, -#ifdef USE_TLS_SRP {"Ek","tlsuser", TRUE}, {"El","tlspassword", TRUE}, {"Em","tlsauthtype", TRUE}, -#endif {"f", "fail", FALSE}, {"F", "form", TRUE}, {"Fs","form-string", TRUE}, @@ -2757,28 +2753,27 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ /* CRL file */ GetStr(&config->crlfile, nextarg); break; -#ifdef USE_TLS_SRP case 'k': /* TLS username */ - if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) { - GetStr(&config->tls_username, nextarg); - } else + if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) + GetStr(&config->tls_username, nextarg); + else return PARAM_LIBCURL_DOESNT_SUPPORT; break; case 'l': /* TLS password */ - if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) { - GetStr(&config->tls_password, nextarg); - } else + if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) + GetStr(&config->tls_password, nextarg); + else return PARAM_LIBCURL_DOESNT_SUPPORT; break; case 'm': /* TLS authentication type */ if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) { GetStr(&config->tls_authtype, nextarg); - if (strncmp(config->tls_authtype, "SRP", strlen("SRP")) != 0) + if (!strequal(config->tls_authtype, "SRP")) return PARAM_LIBCURL_DOESNT_SUPPORT; /* only support TLS-SRP */ - } else + } + else return PARAM_LIBCURL_DOESNT_SUPPORT; break; -#endif default: /* certificate file */ { char *ptr = strchr(nextarg, ':'); |