aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2007-03-23 17:59:40 +0000
committerDan Fandrich <dan@coneharvesters.com>2007-03-23 17:59:40 +0000
commit0043e870145d167003931cda2fd90b5e13b0b7f8 (patch)
treea8d633e4505144346433fe8beec7bb792b3e286d /src
parent0f634a0c899b2c21a4f7f4af480d94937bd81bf4 (diff)
Added --pubkey option to curl and made --key also work for SCP/SFTP,
plus made --pass work on an SSH private key as well.
Diffstat (limited to 'src')
-rw-r--r--src/main.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 32bc8a03c..56bc1c7bf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -389,6 +389,7 @@ struct Configurable {
char *key;
char *key_type;
char *key_passwd;
+ char *pubkey;
char *engine;
bool list_engines;
bool crlf;
@@ -607,9 +608,10 @@ static void help(void)
" -e/--referer Referer URL (H)",
" -E/--cert <cert[:passwd]> Client certificate file and password (SSL)",
" --cert-type <type> Certificate file type (DER/PEM/ENG) (SSL)",
- " --key <key> Private key file name (SSL)",
+ " --key <key> Private key file name (SSL/SSH)",
" --key-type <type> Private key file type (DER/PEM/ENG) (SSL)",
- " --pass <pass> Pass phrase for the private key (SSL)",
+ " --pass <pass> Pass phrase for the private key (SSL/SSH)",
+ " --pubkey <key> Public key file name (SSH)",
" --engine <eng> Crypto engine to use (SSL). \"--engine list\" for list",
" --cacert <file> CA certificate to verify peer against (SSL)",
" --capath <directory> CA directory (made using c_rehash) to verify",
@@ -1505,6 +1507,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
{"Ee","pass", TRUE},
{"Ef","engine", TRUE},
{"Eg","capath ", TRUE},
+ {"Eh","pubkey", TRUE},
{"f", "fail", FALSE},
{"F", "form", TRUE},
{"Fs","form-string", TRUE},
@@ -2111,6 +2114,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
/* CA cert directory */
GetStr(&config->capath, nextarg);
break;
+ case 'h': /* --pubkey public key file */
+ GetStr(&config->pubkey, nextarg);
+ break;
default: /* certificate file */
{
char *ptr = strchr(nextarg, ':');
@@ -3255,6 +3261,8 @@ static void free_config_fields(struct Configurable *config)
free(config->key);
if (config->key_type)
free(config->key_type);
+ if (config->pubkey)
+ free(config->pubkey);
if (config->referer)
free(config->referer);
@@ -4112,6 +4120,10 @@ operate(struct Configurable *config, int argc, char *argv[])
my_setopt(curl, CURLOPT_SSLKEYTYPE, config->key_type);
my_setopt(curl, CURLOPT_SSLKEYPASSWD, config->key_passwd);
+ /* SSH private key uses the same command-line option as SSL private key */
+ my_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, config->key);
+ my_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, config->pubkey);
+
/* default to strict verifyhost */
my_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2);
if(config->cacert || config->capath) {