Skip to content

Commit

Permalink
Fix token-related command line options
Browse files Browse the repository at this point in the history
Aliasing --stoken to --token-secret is not effective because token_mode
does not get set.  Might as well just drop --stoken.

For --token-mode, change "stoken" to "rsa" to make the UI more intuitive:
liboath provides TOTP token support, and libstoken provides RSA token
support.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
cernekee authored and David Woodhouse committed Mar 25, 2013
1 parent 18f6a9d commit 1568814
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions main.c
Expand Up @@ -178,9 +178,7 @@ static struct option long_options[] = {
OPTION("non-inter", 0, OPT_NON_INTER),
OPTION("dtls-local-port", 1, OPT_DTLS_LOCAL_PORT),
OPTION("token-mode", 1, OPT_TOKEN_MODE),
/* Alias --stoken to --token-secret for backwards compatibility. */
OPTION("stoken", 2, OPT_TOKEN_SECRET),
OPTION("token-secret", 2, OPT_TOKEN_SECRET),
OPTION("token-secret", 1, OPT_TOKEN_SECRET),
OPTION("os", 1, OPT_OS),
OPTION(NULL, 0, 0)
};
Expand Down Expand Up @@ -290,9 +288,8 @@ static void usage(void)
printf(" --no-cert-check %s\n", _("Do not require server SSL cert to be valid"));
printf(" --non-inter %s\n", _("Do not expect user input; exit if it is required"));
printf(" --passwd-on-stdin %s\n", _("Read password from standard input"));
printf(" --token-mode=MODE %s\n", _("Software token type: stoken (default) or totp"));
printf(" --token-secret[=STRING] %s\n", _("Software token secret (can be empty for stoken mode"));
printf(" %s\n", _(" to read from ~/.stokenrc)"));
printf(" --token-mode=MODE %s\n", _("Software token type: rsa or totp"));
printf(" --token-secret=STRING %s\n", _("Software token secret"));
#ifndef HAVE_LIBSTOKEN
printf(" %s\n", _("(NOTE: libstoken (RSA SecurID) disabled in this build)"));
#endif
Expand Down Expand Up @@ -726,7 +723,7 @@ int main(int argc, char **argv)
vpninfo->dtls_local_port = atoi(config_arg);
break;
case OPT_TOKEN_MODE:
if (strcasecmp(config_arg, "stoken") == 0) {
if (strcasecmp(config_arg, "rsa") == 0) {
token_mode = OC_TOKEN_MODE_STOKEN;
} else if (strcasecmp(config_arg, "totp") == 0) {
token_mode = OC_TOKEN_MODE_TOTP;
Expand Down

0 comments on commit 1568814

Please sign in to comment.