From 5bcd1277a2cbadb0c9000c11c0a804653bd0f51a Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Tue, 17 Jan 2023 09:23:16 -0900 Subject: otputil: updating arguments to otp widget --- src/otputil.c | 16 ++++++++-------- src/widget-otp.c | 11 +++++++++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/otputil.c b/src/otputil.c index c3065df..fac63f2 100644 --- a/src/otputil.c +++ b/src/otputil.c @@ -174,40 +174,40 @@ static otputil_widget_t otputil_widget_map[] = }, { .name = "otp", .desc = "otp tools (RFC 2289)", - .usage = " [ sequence ] seed ]", + .usage = " [ sequence [ seed [ code ]]]", .short_opt = (TOTP_SHORT_OPT "c:m:O:oP:ps:"), .arg_min = 0, - .arg_max = 2, + .arg_max = 3, .aliases = NULL, .func_exec = &otputil_widget_otp, .func_usage = &otputil_widget_otp_usage, }, { .name = "otp-md4", .desc = "otp alias for MD4", - .usage = " [ sequence ] seed ]", + .usage = " [ sequence [ seed [ code ]]]", .short_opt = (TOTP_SHORT_OPT "c:O:oP:ps:"), .arg_min = 0, - .arg_max = 2, + .arg_max = 3, .aliases = NULL, .func_exec = &otputil_widget_otp_md4, .func_usage = NULL, }, { .name = "otp-md5", .desc = "otp alias for MD5", - .usage = " [ sequence ] seed ]", + .usage = " [ sequence [ seed [ code ]]]", .short_opt = (TOTP_SHORT_OPT "c:O:oP:ps:"), .arg_min = 0, - .arg_max = 2, + .arg_max = 3, .aliases = NULL, .func_exec = &otputil_widget_otp_md5, .func_usage = NULL, }, { .name = "otp-sha1", .desc = "otp alias for SHA1", - .usage = " [ sequence ] seed ]", + .usage = " [ sequence [ seed [ code ]]]", .short_opt = (TOTP_SHORT_OPT "c:O:oP:ps:"), .arg_min = 0, - .arg_max = 2, + .arg_max = 3, .aliases = NULL, .func_exec = &otputil_widget_otp_sha1, .func_usage = NULL, diff --git a/src/widget-otp.c b/src/widget-otp.c index ae67a86..d4c06fc 100644 --- a/src/widget-otp.c +++ b/src/widget-otp.c @@ -132,14 +132,21 @@ otputil_widget_otp( fprintf(stderr, "%s: otputil_set_param(OTP_SEQ): %s\n", cnf->prog_name, otputil_err2string(rc)); return(1); }; + optind++; }; - if (cnf->argc > (optind+1)) + if (cnf->argc > optind) { - if ((rc = otputil_set_param(NULL, OTPUTIL_OPT_OTP_SEED, cnf->argv[optind+1])) != OTPUTIL_SUCCESS) + if ((rc = otputil_set_param(NULL, OTPUTIL_OPT_OTP_SEED, cnf->argv[optind])) != OTPUTIL_SUCCESS) { fprintf(stderr, "%s: otputil_set_param(OTP_SEED): %s\n", cnf->prog_name, otputil_err2string(rc)); return(1); }; + optind++; + }; + if (cnf->argc > optind) + { + cnf->otp_pass = cnf->argv[optind]; + optind++; }; // verify password and seed were provided -- cgit v1.2.3