aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2023-01-16 11:43:40 -0900
committerDavid M. Syzdek <david@syzdek.net>2023-01-16 11:43:40 -0900
commit2c7dce030f8c538ce70d361ec5c2ff83a05c14d2 (patch)
treef73fdad2eddf1a7182008b53b159835a1aac40c8
parentaaab49ba46c961adb78b368331a871a5e42c83d6 (diff)
downloadotputils-2c7dce030f8c538ce70d361ec5c2ff83a05c14d2.tar.gz
otputils-2c7dce030f8c538ce70d361ec5c2ff83a05c14d2.tar.bz2
otputils-2c7dce030f8c538ce70d361ec5c2ff83a05c14d2.tar.xz
otputils-2c7dce030f8c538ce70d361ec5c2ff83a05c14d2.zip
otputil: renaming member 'pass' to 'otp_pass' in 'struct _otputil_cli_config'
-rw-r--r--src/otputil.c2
-rw-r--r--src/otputil.h2
-rw-r--r--src/widget-hotp.c12
-rw-r--r--src/widget-totp.c12
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(
377 break; 377 break;
378 378
379 case 'p': 379 case 'p':
380 cnf->pass = otputil_getpass("Enter code: ", NULL, 0); 380 cnf->otp_pass = otputil_getpass("Enter OTP password or code: ", NULL, 0);
381 break; 381 break;
382 382
383 case 'q': 383 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
90 int argc; 90 int argc;
91 char ** argv; 91 char ** argv;
92 const char * prog_name; 92 const char * prog_name;
93 const char * pass; 93 const char * otp_pass;
94 const otputil_widget_t * widget; 94 const otputil_widget_t * widget;
95}; 95};
96 96
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(
114 // initial processing of cli arguments 114 // initial processing of cli arguments
115 if ((rc = otputil_arguments(cnf, cnf->argc, cnf->argv)) != 0) 115 if ((rc = otputil_arguments(cnf, cnf->argc, cnf->argv)) != 0)
116 return((rc == -1) ? 0 : 1); 116 return((rc == -1) ? 0 : 1);
117 if ( ((cnf->pass)) && (cnf->argc > optind) ) 117 if ( ((cnf->otp_pass)) && (cnf->argc > optind) )
118 { 118 {
119 fprintf(stderr, "%s: cannot specify code and use `-p'\n", cnf->prog_name); 119 fprintf(stderr, "%s: cannot specify code and use `-p'\n", cnf->prog_name);
120 fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); 120 fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name);
121 return(1); 121 return(1);
122 }; 122 };
123 cnf->pass = (cnf->argc > optind) ? cnf->argv[optind] : cnf->pass; 123 cnf->otp_pass = (cnf->argc > optind) ? cnf->argv[optind] : cnf->otp_pass;
124 124
125 if ((cnf->pass)) 125 if ((cnf->otp_pass))
126 return(otputil_widget_hotp_verify(cnf)); 126 return(otputil_widget_hotp_verify(cnf));
127 127
128 return(otputil_widget_hotp_code(cnf)); 128 return(otputil_widget_hotp_code(cnf));
@@ -180,8 +180,8 @@ otputil_widget_hotp_verbose(
180 printf(" HMAC Hash: hmac-%s\n", otputil_md2str(hotp_hmac)); 180 printf(" HMAC Hash: hmac-%s\n", otputil_md2str(hotp_hmac));
181 printf(" Shared Key: %s\n", otp_kstr ); 181 printf(" Shared Key: %s\n", otp_kstr );
182 printf(" Counter: %" PRIu64 "\n", hotp_c ); 182 printf(" Counter: %" PRIu64 "\n", hotp_c );
183 if ((cnf->pass)) 183 if ((cnf->otp_pass))
184 printf(" Expected Code: %s\n", cnf->pass ); 184 printf(" Expected Code: %s\n", cnf->otp_pass );
185 printf(" Code: %s\n", code ); 185 printf(" Code: %s\n", code );
186 if ((status)) 186 if ((status))
187 printf(" Status: %s\n", status ); 187 printf(" Status: %s\n", status );
@@ -207,7 +207,7 @@ otputil_widget_hotp_verify(
207 return(1); 207 return(1);
208 }; 208 };
209 209
210 rc = ((strcasecmp(cnf->pass, code))) ? 2 : 0; 210 rc = ((strcasecmp(cnf->otp_pass, code))) ? 2 : 0;
211 status = ((rc)) ? "invalid code" : "valid code"; 211 status = ((rc)) ? "invalid code" : "valid code";
212 212
213 if ((cnf->verbose)) 213 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(
115 // initial processing of cli arguments 115 // initial processing of cli arguments
116 if ((rc = otputil_arguments(cnf, cnf->argc, cnf->argv)) != 0) 116 if ((rc = otputil_arguments(cnf, cnf->argc, cnf->argv)) != 0)
117 return((rc == -1) ? 0 : 1); 117 return((rc == -1) ? 0 : 1);
118 if ( ((cnf->pass)) && (cnf->argc > optind) ) 118 if ( ((cnf->otp_pass)) && (cnf->argc > optind) )
119 { 119 {
120 fprintf(stderr, "%s: cannot specify code and use `-p'\n", cnf->prog_name); 120 fprintf(stderr, "%s: cannot specify code and use `-p'\n", cnf->prog_name);
121 fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); 121 fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name);
122 return(1); 122 return(1);
123 }; 123 };
124 cnf->pass = (cnf->argc > optind) ? cnf->argv[optind] : cnf->pass; 124 cnf->otp_pass = (cnf->argc > optind) ? cnf->argv[optind] : cnf->otp_pass;
125 125
126 if ((cnf->pass)) 126 if ((cnf->otp_pass))
127 return(otputil_widget_totp_verify(cnf)); 127 return(otputil_widget_totp_verify(cnf));
128 128
129 return(otputil_widget_totp_code(cnf)); 129 return(otputil_widget_totp_code(cnf));
@@ -201,8 +201,8 @@ otputil_widget_totp_verbose(
201 printf(" UNIX Start Time: %" PRIu64 "\n", totp_t0 ); 201 printf(" UNIX Start Time: %" PRIu64 "\n", totp_t0 );
202 printf(" UNIX Current Time: %" PRIu64 "\n", totp_time ); 202 printf(" UNIX Current Time: %" PRIu64 "\n", totp_time );
203 printf(" Valid for: %" PRIu64 "s\n", otputil_timer(NULL)); 203 printf(" Valid for: %" PRIu64 "s\n", otputil_timer(NULL));
204 if ((cnf->pass)) 204 if ((cnf->otp_pass))
205 printf(" Expected Code: %s\n", cnf->pass ); 205 printf(" Expected Code: %s\n", cnf->otp_pass );
206 printf(" Code: %s\n", code ); 206 printf(" Code: %s\n", code );
207 if ((status)) 207 if ((status))
208 printf(" Status: %s\n", status ); 208 printf(" Status: %s\n", status );
@@ -228,7 +228,7 @@ otputil_widget_totp_verify(
228 return(1); 228 return(1);
229 }; 229 };
230 230
231 rc = ((strcasecmp(cnf->pass, code))) ? 2 : 0; 231 rc = ((strcasecmp(cnf->otp_pass, code))) ? 2 : 0;
232 status = ((rc)) ? "invalid code" : "valid code"; 232 status = ((rc)) ? "invalid code" : "valid code";
233 233
234 if ((cnf->verbose)) 234 if ((cnf->verbose))