aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/otputil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/otputil.c')
-rw-r--r--src/otputil.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/otputil.c b/src/otputil.c
index 9524b63..c3065df 100644
--- a/src/otputil.c
+++ b/src/otputil.c
@@ -165,7 +165,7 @@ static otputil_widget_t otputil_widget_map[] =
165 { .name = "hotp", 165 { .name = "hotp",
166 .desc = "hotp tools (RFC 4226)", 166 .desc = "hotp tools (RFC 4226)",
167 .usage = " [ code ]", 167 .usage = " [ code ]",
168 .short_opt = (TOTP_SHORT_OPT "c:d:k:m:o"), 168 .short_opt = (TOTP_SHORT_OPT "c:d:k:m:O:o"),
169 .arg_min = 0, 169 .arg_min = 0,
170 .arg_max = 1, 170 .arg_max = 1,
171 .aliases = NULL, 171 .aliases = NULL,
@@ -175,7 +175,7 @@ static otputil_widget_t otputil_widget_map[] =
175 { .name = "otp", 175 { .name = "otp",
176 .desc = "otp tools (RFC 2289)", 176 .desc = "otp tools (RFC 2289)",
177 .usage = " [ sequence ] seed ]", 177 .usage = " [ sequence ] seed ]",
178 .short_opt = (TOTP_SHORT_OPT "c:m:oP:ps:"), 178 .short_opt = (TOTP_SHORT_OPT "c:m:O:oP:ps:"),
179 .arg_min = 0, 179 .arg_min = 0,
180 .arg_max = 2, 180 .arg_max = 2,
181 .aliases = NULL, 181 .aliases = NULL,
@@ -185,7 +185,7 @@ static otputil_widget_t otputil_widget_map[] =
185 { .name = "otp-md4", 185 { .name = "otp-md4",
186 .desc = "otp alias for MD4", 186 .desc = "otp alias for MD4",
187 .usage = " [ sequence ] seed ]", 187 .usage = " [ sequence ] seed ]",
188 .short_opt = (TOTP_SHORT_OPT "c:oP:ps:"), 188 .short_opt = (TOTP_SHORT_OPT "c:O:oP:ps:"),
189 .arg_min = 0, 189 .arg_min = 0,
190 .arg_max = 2, 190 .arg_max = 2,
191 .aliases = NULL, 191 .aliases = NULL,
@@ -195,7 +195,7 @@ static otputil_widget_t otputil_widget_map[] =
195 { .name = "otp-md5", 195 { .name = "otp-md5",
196 .desc = "otp alias for MD5", 196 .desc = "otp alias for MD5",
197 .usage = " [ sequence ] seed ]", 197 .usage = " [ sequence ] seed ]",
198 .short_opt = (TOTP_SHORT_OPT "c:oP:ps:"), 198 .short_opt = (TOTP_SHORT_OPT "c:O:oP:ps:"),
199 .arg_min = 0, 199 .arg_min = 0,
200 .arg_max = 2, 200 .arg_max = 2,
201 .aliases = NULL, 201 .aliases = NULL,
@@ -205,7 +205,7 @@ static otputil_widget_t otputil_widget_map[] =
205 { .name = "otp-sha1", 205 { .name = "otp-sha1",
206 .desc = "otp alias for SHA1", 206 .desc = "otp alias for SHA1",
207 .usage = " [ sequence ] seed ]", 207 .usage = " [ sequence ] seed ]",
208 .short_opt = (TOTP_SHORT_OPT "c:oP:ps:"), 208 .short_opt = (TOTP_SHORT_OPT "c:O:oP:ps:"),
209 .arg_min = 0, 209 .arg_min = 0,
210 .arg_max = 2, 210 .arg_max = 2,
211 .aliases = NULL, 211 .aliases = NULL,
@@ -215,7 +215,7 @@ static otputil_widget_t otputil_widget_map[] =
215 { .name = "skey", 215 { .name = "skey",
216 .desc = "s/key tools (RFC 1760)", 216 .desc = "s/key tools (RFC 1760)",
217 .usage = " [ sequence ]", 217 .usage = " [ sequence ]",
218 .short_opt = (TOTP_SHORT_OPT "c:m:oP:p"), 218 .short_opt = (TOTP_SHORT_OPT "c:m:O:oP:p"),
219 .arg_min = 0, 219 .arg_min = 0,
220 .arg_max = 1, 220 .arg_max = 1,
221 .aliases = NULL, 221 .aliases = NULL,
@@ -225,7 +225,7 @@ static otputil_widget_t otputil_widget_map[] =
225 { .name = "totp", 225 { .name = "totp",
226 .desc = "totp tools (RFC 6238)", 226 .desc = "totp tools (RFC 6238)",
227 .usage = " [ code ]", 227 .usage = " [ code ]",
228 .short_opt = (TOTP_SHORT_OPT "d:k:m:oT:t:x:"), 228 .short_opt = (TOTP_SHORT_OPT "d:k:m:O:oT:t:x:"),
229 .arg_min = 0, 229 .arg_min = 0,
230 .arg_max = 1, 230 .arg_max = 1,
231 .aliases = NULL, 231 .aliases = NULL,
@@ -434,6 +434,10 @@ otputil_arguments(
434 otputil_set_param(NULL, OTPUTIL_OPT_TOTP_HMAC, &i); 434 otputil_set_param(NULL, OTPUTIL_OPT_TOTP_HMAC, &i);
435 break; 435 break;
436 436
437 case 'O':
438 cnf->otp_pass = optarg;
439 break;
440
437 case 'o': 441 case 'o':
438 cnf->prompt_otp_pass = 1; 442 cnf->prompt_otp_pass = 1;
439 break; 443 break;
@@ -575,7 +579,7 @@ otputil_arguments(
575 579
576 // process OTP password 580 // process OTP password
577 if ((cnf->prompt_otp_pass)) 581 if ((cnf->prompt_otp_pass))
578 cnf->otp_pass = otputil_getpass("Enter OTP password or code: ", NULL, 0); 582 cnf->otp_pass = otputil_getpass("Enter OTP password or code: ", cnf->otp_pass_buff, sizeof(cnf->otp_pass_buff));
579 583
580 return(0); 584 return(0);
581} 585}
@@ -704,6 +708,7 @@ otputil_widget_usage(
704 if ((strchr(short_opt, 'k'))) printf(" -k string shared user key\n"); 708 if ((strchr(short_opt, 'k'))) printf(" -k string shared user key\n");
705 if ((strchr(short_opt, 'h'))) printf(" -h, --help print this help and exit\n"); 709 if ((strchr(short_opt, 'h'))) printf(" -h, --help print this help and exit\n");
706 if ((strchr(short_opt, 'm'))) printf(" -m hash use message digest hash\n"); 710 if ((strchr(short_opt, 'm'))) printf(" -m hash use message digest hash\n");
711 if ((strchr(short_opt, 'O'))) printf(" -O str OTP password/code to verify\n");
707 if ((strchr(short_opt, 'o'))) printf(" -o prompt for OTP password/code to verify\n"); 712 if ((strchr(short_opt, 'o'))) printf(" -o prompt for OTP password/code to verify\n");
708 if ((strchr(short_opt, 'P'))) printf(" -P str user password\n"); 713 if ((strchr(short_opt, 'P'))) printf(" -P str user password\n");
709 if ((strchr(short_opt, 'p'))) printf(" -p prompt for user password\n"); 714 if ((strchr(short_opt, 'p'))) printf(" -p prompt for user password\n");