From ef51fd2aaba19484109e5836e68e9e42948bacee Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sun, 17 Nov 1996 02:22:06 +0000 Subject: [PATCH] Use OTP_ALG_DEFAULT. Consistent language Check return value from des_read_pw_string. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@999 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/otp/otp.c | 12 +++++++----- appl/otp/otpprint.c | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/appl/otp/otp.c b/appl/otp/otp.c index daec00efb..fac8f31d7 100644 --- a/appl/otp/otp.c +++ b/appl/otp/otp.c @@ -83,7 +83,8 @@ renew (int argc, char **argv, int count, OtpAlgorithm *alg, int hexp) ctx = &oldctx; if(otp_challenge (ctx, user, prompt, sizeof(prompt))) return 1; - des_read_pw_string (pw, sizeof(pw), prompt, 0); + kf(des_read_pw_string (pw, sizeof(pw), prompt, 0)) + return 1; ret = otp_verify_user_1 (ctx, pw); if (ret == 0) { newctx.alg = alg; @@ -96,8 +97,8 @@ renew (int argc, char **argv, int count, OtpAlgorithm *alg, int hexp) newctx.alg->name, newctx.n, newctx.seed); - des_read_pw_string (pw, sizeof(pw), prompt, 0); - if (otp_parse (newctx.key, pw, alg) == 0) { + if (des_read_pw_string (pw, sizeof(pw), prompt, 0) == 0 && + otp_parse (newctx.key, pw, alg) == 0) { ctx = &newctx; } } @@ -139,7 +140,8 @@ set (int argc, char **argv, int count, OtpAlgorithm *alg, int hexp) ctx.seed[sizeof(ctx.seed) - 1] = '\0'; strlwr(ctx.seed); do { - des_read_pw_string (pw, sizeof(pw), "Pass-phrase", 1); + if (des_read_pw_string (pw, sizeof(pw), "Pass-phrase: ", VERIFY)) + return 1; if (strlen (pw) < OTP_MIN_PASSPHRASE) printf ("Too short pass-phrase. Use at least %d characters\n", OTP_MIN_PASSPHRASE); @@ -168,7 +170,7 @@ main (int argc, char **argv) int hexp = 0; int renewp = 0; int extendedp = 0; - OtpAlgorithm *alg = otp_find_alg ("md4"); + OtpAlgorithm *alg = otp_find_alg (OTP_ALG_DEFAULT); prog = argv[0]; diff --git a/appl/otp/otpprint.c b/appl/otp/otpprint.c index f8a95e403..6861cd771 100644 --- a/appl/otp/otpprint.c +++ b/appl/otp/otpprint.c @@ -70,7 +70,8 @@ print (int argc, usage (); n = atoi(argv[0]); seed = argv[1]; - des_read_pw_string (pw, sizeof(pw), "Password: ", 0); + if (des_read_pw_string (pw, sizeof(pw), "Pass-phrase: ", 0)) + return 1; alg->init (key, pw, seed); if (extendedp) if (hexp) @@ -101,7 +102,7 @@ main (int argc, char **argv) int count = 10; int hexp = 0; int extendedp = 0; - OtpAlgorithm *alg = otp_find_alg ("md4"); + OtpAlgorithm *alg = otp_find_alg (OTP_ALG_DEFAULT); prog = argv[0];