aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/otputil.c16
-rw-r--r--src/widget-otp.c11
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[] =
174 }, 174 },
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 [ code ]]]",
178 .short_opt = (TOTP_SHORT_OPT "c:m:O: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 = 3,
181 .aliases = NULL, 181 .aliases = NULL,
182 .func_exec = &otputil_widget_otp, 182 .func_exec = &otputil_widget_otp,
183 .func_usage = &otputil_widget_otp_usage, 183 .func_usage = &otputil_widget_otp_usage,
184 }, 184 },
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 [ code ]]]",
188 .short_opt = (TOTP_SHORT_OPT "c:O: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 = 3,
191 .aliases = NULL, 191 .aliases = NULL,
192 .func_exec = &otputil_widget_otp_md4, 192 .func_exec = &otputil_widget_otp_md4,
193 .func_usage = NULL, 193 .func_usage = NULL,
194 }, 194 },
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 [ code ]]]",
198 .short_opt = (TOTP_SHORT_OPT "c:O: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 = 3,
201 .aliases = NULL, 201 .aliases = NULL,
202 .func_exec = &otputil_widget_otp_md5, 202 .func_exec = &otputil_widget_otp_md5,
203 .func_usage = NULL, 203 .func_usage = NULL,
204 }, 204 },
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 [ code ]]]",
208 .short_opt = (TOTP_SHORT_OPT "c:O: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 = 3,
211 .aliases = NULL, 211 .aliases = NULL,
212 .func_exec = &otputil_widget_otp_sha1, 212 .func_exec = &otputil_widget_otp_sha1,
213 .func_usage = NULL, 213 .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(
132 fprintf(stderr, "%s: otputil_set_param(OTP_SEQ): %s\n", cnf->prog_name, otputil_err2string(rc)); 132 fprintf(stderr, "%s: otputil_set_param(OTP_SEQ): %s\n", cnf->prog_name, otputil_err2string(rc));
133 return(1); 133 return(1);
134 }; 134 };
135 optind++;
135 }; 136 };
136 if (cnf->argc > (optind+1)) 137 if (cnf->argc > optind)
137 { 138 {
138 if ((rc = otputil_set_param(NULL, OTPUTIL_OPT_OTP_SEED, cnf->argv[optind+1])) != OTPUTIL_SUCCESS) 139 if ((rc = otputil_set_param(NULL, OTPUTIL_OPT_OTP_SEED, cnf->argv[optind])) != OTPUTIL_SUCCESS)
139 { 140 {
140 fprintf(stderr, "%s: otputil_set_param(OTP_SEED): %s\n", cnf->prog_name, otputil_err2string(rc)); 141 fprintf(stderr, "%s: otputil_set_param(OTP_SEED): %s\n", cnf->prog_name, otputil_err2string(rc));
141 return(1); 142 return(1);
142 }; 143 };
144 optind++;
145 };
146 if (cnf->argc > optind)
147 {
148 cnf->otp_pass = cnf->argv[optind];
149 optind++;
143 }; 150 };
144 151
145 // verify password and seed were provided 152 // verify password and seed were provided