Skip to content

Commit df2f138

Browse files
authored
Merge pull request #5690 from vpodzime/master-cf_secret_help
Fix `cf-secret -h` output regarding localhost as default
2 parents 578257a + 562ab30 commit df2f138

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

cf-secret/cf-secret.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ static const char *const HINTS[] =
125125
"Enable verbose output",
126126
"Specify how detailed logs should be. Possible values: 'error', 'warning', 'notice', 'info', 'verbose', 'debug'",
127127
"Enable basic information output",
128-
"Comma-separated list of key files to use (one of -k/-H options is required for encryption)",
128+
"Comma-separated list of key files to use",
129129
"Comma-separated list of hosts to encrypt/decrypt for (defaults to 'localhost')",
130-
"Output file (required)",
130+
"Output file (required for encrypt/decrypt)",
131131
NULL
132132
};
133133

@@ -981,12 +981,10 @@ int main(int argc, char *argv[])
981981
DoCleanupAndExit(EXIT_SUCCESS);
982982
}
983983

984-
if (decrypt && (host_arg == NULL) && (key_path_arg == NULL))
984+
// Default to localhost
985+
if ((encrypt || decrypt) && (host_arg == NULL) && (key_path_arg == NULL))
985986
{
986-
/* Decryption requires a private key which is usually only available for
987-
* the local host. Let's just default to localhost if no other specific
988-
* host/key is given for decryption. */
989-
Log(LOG_LEVEL_VERBOSE, "Using the localhost private key for decryption");
987+
Log(LOG_LEVEL_VERBOSE, "Using the localhost private key as default");
990988
host_arg = "localhost";
991989
}
992990

@@ -1022,13 +1020,6 @@ int main(int argc, char *argv[])
10221020
key_paths = SeqNew(16, free);
10231021
}
10241022

1025-
// Default to localhost on encryption
1026-
char *localhost = "127.0.0.1";
1027-
if (encrypt && key_path_arg == NULL && host_arg == NULL)
1028-
{
1029-
host_arg = localhost;
1030-
}
1031-
10321023
if (host_arg != NULL)
10331024
{
10341025
Log(LOG_LEVEL_DEBUG, "-H/--host given: '%s'", host_arg);

0 commit comments

Comments
 (0)