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
This commit is contained in:
Assar Westerlund
1996-11-17 02:22:06 +00:00
parent 34a51d3abf
commit ef51fd2aab
2 changed files with 10 additions and 7 deletions

View File

@@ -83,7 +83,8 @@ renew (int argc, char **argv, int count, OtpAlgorithm *alg, int hexp)
ctx = &oldctx; ctx = &oldctx;
if(otp_challenge (ctx, user, prompt, sizeof(prompt))) if(otp_challenge (ctx, user, prompt, sizeof(prompt)))
return 1; 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); ret = otp_verify_user_1 (ctx, pw);
if (ret == 0) { if (ret == 0) {
newctx.alg = alg; newctx.alg = alg;
@@ -96,8 +97,8 @@ renew (int argc, char **argv, int count, OtpAlgorithm *alg, int hexp)
newctx.alg->name, newctx.alg->name,
newctx.n, newctx.n,
newctx.seed); newctx.seed);
des_read_pw_string (pw, sizeof(pw), prompt, 0); if (des_read_pw_string (pw, sizeof(pw), prompt, 0) == 0 &&
if (otp_parse (newctx.key, pw, alg) == 0) { otp_parse (newctx.key, pw, alg) == 0) {
ctx = &newctx; ctx = &newctx;
} }
} }
@@ -139,7 +140,8 @@ set (int argc, char **argv, int count, OtpAlgorithm *alg, int hexp)
ctx.seed[sizeof(ctx.seed) - 1] = '\0'; ctx.seed[sizeof(ctx.seed) - 1] = '\0';
strlwr(ctx.seed); strlwr(ctx.seed);
do { 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) if (strlen (pw) < OTP_MIN_PASSPHRASE)
printf ("Too short pass-phrase. Use at least %d characters\n", printf ("Too short pass-phrase. Use at least %d characters\n",
OTP_MIN_PASSPHRASE); OTP_MIN_PASSPHRASE);
@@ -168,7 +170,7 @@ main (int argc, char **argv)
int hexp = 0; int hexp = 0;
int renewp = 0; int renewp = 0;
int extendedp = 0; int extendedp = 0;
OtpAlgorithm *alg = otp_find_alg ("md4"); OtpAlgorithm *alg = otp_find_alg (OTP_ALG_DEFAULT);
prog = argv[0]; prog = argv[0];

View File

@@ -70,7 +70,8 @@ print (int argc,
usage (); usage ();
n = atoi(argv[0]); n = atoi(argv[0]);
seed = argv[1]; 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); alg->init (key, pw, seed);
if (extendedp) if (extendedp)
if (hexp) if (hexp)
@@ -101,7 +102,7 @@ main (int argc, char **argv)
int count = 10; int count = 10;
int hexp = 0; int hexp = 0;
int extendedp = 0; int extendedp = 0;
OtpAlgorithm *alg = otp_find_alg ("md4"); OtpAlgorithm *alg = otp_find_alg (OTP_ALG_DEFAULT);
prog = argv[0]; prog = argv[0];