From 2c7dce030f8c538ce70d361ec5c2ff83a05c14d2 Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Mon, 16 Jan 2023 11:43:40 -0900 Subject: otputil: renaming member 'pass' to 'otp_pass' in 'struct _otputil_cli_config' --- src/otputil.c | 2 +- src/otputil.h | 2 +- src/widget-hotp.c | 12 ++++++------ src/widget-totp.c | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/otputil.c b/src/otputil.c index b3225eb..8528010 100644 --- a/src/otputil.c +++ b/src/otputil.c @@ -377,7 +377,7 @@ otputil_arguments( break; case 'p': - cnf->pass = otputil_getpass("Enter code: ", NULL, 0); + cnf->otp_pass = otputil_getpass("Enter OTP password or code: ", NULL, 0); break; case 'q': diff --git a/src/otputil.h b/src/otputil.h index 0bb3c84..5471cd8 100644 --- a/src/otputil.h +++ b/src/otputil.h @@ -90,7 +90,7 @@ struct _otputil_cli_config int argc; char ** argv; const char * prog_name; - const char * pass; + const char * otp_pass; const otputil_widget_t * widget; }; diff --git a/src/widget-hotp.c b/src/widget-hotp.c index 123878f..af1e51e 100644 --- a/src/widget-hotp.c +++ b/src/widget-hotp.c @@ -114,15 +114,15 @@ otputil_widget_hotp( // initial processing of cli arguments if ((rc = otputil_arguments(cnf, cnf->argc, cnf->argv)) != 0) return((rc == -1) ? 0 : 1); - if ( ((cnf->pass)) && (cnf->argc > optind) ) + if ( ((cnf->otp_pass)) && (cnf->argc > optind) ) { fprintf(stderr, "%s: cannot specify code and use `-p'\n", cnf->prog_name); fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); return(1); }; - cnf->pass = (cnf->argc > optind) ? cnf->argv[optind] : cnf->pass; + cnf->otp_pass = (cnf->argc > optind) ? cnf->argv[optind] : cnf->otp_pass; - if ((cnf->pass)) + if ((cnf->otp_pass)) return(otputil_widget_hotp_verify(cnf)); return(otputil_widget_hotp_code(cnf)); @@ -180,8 +180,8 @@ otputil_widget_hotp_verbose( printf(" HMAC Hash: hmac-%s\n", otputil_md2str(hotp_hmac)); printf(" Shared Key: %s\n", otp_kstr ); printf(" Counter: %" PRIu64 "\n", hotp_c ); - if ((cnf->pass)) - printf(" Expected Code: %s\n", cnf->pass ); + if ((cnf->otp_pass)) + printf(" Expected Code: %s\n", cnf->otp_pass ); printf(" Code: %s\n", code ); if ((status)) printf(" Status: %s\n", status ); @@ -207,7 +207,7 @@ otputil_widget_hotp_verify( return(1); }; - rc = ((strcasecmp(cnf->pass, code))) ? 2 : 0; + rc = ((strcasecmp(cnf->otp_pass, code))) ? 2 : 0; status = ((rc)) ? "invalid code" : "valid code"; if ((cnf->verbose)) diff --git a/src/widget-totp.c b/src/widget-totp.c index fbd2293..0c5a41d 100644 --- a/src/widget-totp.c +++ b/src/widget-totp.c @@ -115,15 +115,15 @@ otputil_widget_totp( // initial processing of cli arguments if ((rc = otputil_arguments(cnf, cnf->argc, cnf->argv)) != 0) return((rc == -1) ? 0 : 1); - if ( ((cnf->pass)) && (cnf->argc > optind) ) + if ( ((cnf->otp_pass)) && (cnf->argc > optind) ) { fprintf(stderr, "%s: cannot specify code and use `-p'\n", cnf->prog_name); fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); return(1); }; - cnf->pass = (cnf->argc > optind) ? cnf->argv[optind] : cnf->pass; + cnf->otp_pass = (cnf->argc > optind) ? cnf->argv[optind] : cnf->otp_pass; - if ((cnf->pass)) + if ((cnf->otp_pass)) return(otputil_widget_totp_verify(cnf)); return(otputil_widget_totp_code(cnf)); @@ -201,8 +201,8 @@ otputil_widget_totp_verbose( printf(" UNIX Start Time: %" PRIu64 "\n", totp_t0 ); printf(" UNIX Current Time: %" PRIu64 "\n", totp_time ); printf(" Valid for: %" PRIu64 "s\n", otputil_timer(NULL)); - if ((cnf->pass)) - printf(" Expected Code: %s\n", cnf->pass ); + if ((cnf->otp_pass)) + printf(" Expected Code: %s\n", cnf->otp_pass ); printf(" Code: %s\n", code ); if ((status)) printf(" Status: %s\n", status ); @@ -228,7 +228,7 @@ otputil_widget_totp_verify( return(1); }; - rc = ((strcasecmp(cnf->pass, code))) ? 2 : 0; + rc = ((strcasecmp(cnf->otp_pass, code))) ? 2 : 0; status = ((rc)) ? "invalid code" : "valid code"; if ((cnf->verbose)) -- cgit v1.2.3