From 42fc3c98a71b805e05cb142ae314447413e3d7c1 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Tue, 31 Mar 2020 01:41:51 +0000 Subject: [PATCH] Use the new MIN_PASS_LEN macro rather than harding '4' in the code and in the text.dat. This may be a sysop-configurable value in the future. text.dat NewPasword is now NewPassswordPromptFmt and includes both the minimum and maximum password length as % specifiers. --- src/sbbs3/logon.cpp | 2 +- src/sbbs3/newuser.cpp | 2 +- src/sbbs3/str.cpp | 2 +- src/sbbs3/text.h | 2 +- src/sbbs3/text_defaults.c | 10 +++++----- src/sbbs3/useredit.cpp | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/sbbs3/logon.cpp b/src/sbbs3/logon.cpp index e1720a94b1..cb55c1f57e 100644 --- a/src/sbbs3/logon.cpp +++ b/src/sbbs3/logon.cpp @@ -242,7 +242,7 @@ bool sbbs_t::logon() if(cfg.sys_misc&SM_PWEDIT && yesno(text[NewPasswordQ])) while(online) { - bputs(text[NewPassword]); + bprintf(text[NewPasswordPromptFmt], MIN_PASS_LEN, LEN_PASS); getstr(str,LEN_PASS,K_UPPER|K_LINE); truncsp(str); if(chkpass(str,&useron,true)) diff --git a/src/sbbs3/newuser.cpp b/src/sbbs3/newuser.cpp index a868be49c1..0dd1f74056 100644 --- a/src/sbbs3/newuser.cpp +++ b/src/sbbs3/newuser.cpp @@ -378,7 +378,7 @@ BOOL sbbs_t::newuser() if(cfg.sys_misc&SM_PWEDIT && text[NewPasswordQ][0] && yesno(text[NewPasswordQ])) while(online) { - bputs(text[NewPassword]); + bprintf(text[NewPasswordPromptFmt], MIN_PASS_LEN, LEN_PASS); getstr(str,LEN_PASS,K_UPPER|K_LINE); truncsp(str); if(chkpass(str,&useron,true)) { diff --git a/src/sbbs3/str.cpp b/src/sbbs3/str.cpp index 76a16b62da..37a2031510 100644 --- a/src/sbbs3/str.cpp +++ b/src/sbbs3/str.cpp @@ -702,7 +702,7 @@ bool sbbs_t::chkpass(char *passwd, user_t* user, bool unique) SAFECOPY(pass,passwd); strupr(pass); - if(strlen(pass)<4) { + if(strlen(pass) < MIN_PASS_LEN) { bputs(text[PasswordTooShort]); return(false); } diff --git a/src/sbbs3/text.h b/src/sbbs3/text.h index 965b51382d..b3a77b06a0 100644 --- a/src/sbbs3/text.h +++ b/src/sbbs3/text.h @@ -342,7 +342,7 @@ enum { ,HappyBirthday ,TimeToChangePw ,NewPasswordQ - ,NewPassword + ,NewPasswordPromptFmt ,VerifyPassword ,Wrong ,PasswordChanged diff --git a/src/sbbs3/text_defaults.c b/src/sbbs3/text_defaults.c index 04a81b1de2..c24e033e32 100644 --- a/src/sbbs3/text_defaults.c +++ b/src/sbbs3/text_defaults.c @@ -534,8 +534,8 @@ const char * const text_defaults[TOTAL_TEXT]={ ,"\x01\x77\x01\x68\x59\x6f\x75\x20\x68\x61\x76\x65\x6e\x27\x74\x20\x63\x68\x61\x6e\x67\x65\x64\x20\x79\x6f\x75\x72\x20\x70\x61\x73" "\x73\x77\x6f\x72\x64\x20\x69\x6e\x20\x6d\x6f\x72\x65\x20\x74\x68\x61\x6e\x20\x25\x64\x20\x64\x61\x79\x73\x2e\x0d\x0a\x0d\x0a" // 330 TimeToChangePw ,"\x0d\x0a\x45\x6e\x74\x65\x72\x20\x61\x20\x64\x69\x66\x66\x65\x72\x65\x6e\x74\x20\x70\x61\x73\x73\x77\x6f\x72\x64" // 331 NewPasswordQ - ,"\x01\x5f\x01\x3f\x01\x79\x01\x68\x4e\x65\x77\x20\x70\x61\x73\x73\x77\x6f\x72\x64\x20\x28\x34\x2d\x38\x20\x63\x68\x61\x72\x73\x29" - "\x3a\x20" // 332 NewPassword + ,"\x01\x5f\x01\x3f\x01\x79\x01\x68\x4e\x65\x77\x20\x70\x61\x73\x73\x77\x6f\x72\x64\x20\x28\x25\x75\x2d\x25\x75\x20\x63\x68\x61\x72" + "\x73\x29\x3a\x20" // 332 NewPasswordPromptFmt ,"\x01\x5f\x01\x79\x01\x68\x56\x65\x72\x69\x66\x79\x20\x28\x65\x6e\x74\x65\x72\x20\x61\x67\x61\x69\x6e\x29\x3a\x20\x01\x6e" // 333 VerifyPassword ,"\x07\x01\x72\x01\x68\x57\x72\x6f\x6e\x67\x21" // 334 Wrong ,"\x01\x77\x01\x68\x50\x61\x73\x73\x77\x6f\x72\x64\x20\x63\x68\x61\x6e\x67\x65\x64\x2e\x0d\x0a" // 335 PasswordChanged @@ -628,10 +628,10 @@ const char * const text_defaults[TOTAL_TEXT]={ ,"\x01\x6c\x01\x6e\x01\x63\x01\x68\x25\x73\x20\x01\x6e\x01\x63\x45\x78\x74\x65\x72\x6e\x61\x6c\x20\x50\x72\x6f\x67\x72\x61\x6d\x73" "\x3a\x0d\x0a\x0d\x0a" // 380 XtrnProgLstHdr ,"\x01\x6e\x01\x63\x4e\x75\x6d\x20\x01\x68\xb3\x01\x6e\x01\x63\x20\x4e\x61\x6d\x65\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" - "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" // 381 XtrnProgLstTitles + "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" // 381 XtrnProgLstTitles ,"\x01\x68\xc4\xc4\xc4\xc4\xc5\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4" - "\xc4\x20\x20\x20\x20\x20\x20" // 382 XtrnProgLstUnderline - ,"\x01\x68\x01\x63\x25\x33\x75\x20\xb3\x20\x01\x6e\x01\x63\x25\x2d\x32\x35\x2e\x32\x35\x73\x01\x68\x20\x20\x20\x20\x20\x20" // 383 XtrnProgLstFmt + "\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\x20" // 382 XtrnProgLstUnderline + ,"\x01\x68\x01\x63\x25\x33\x75\x20\xb3\x20\x01\x6e\x01\x63\x25\x2d\x33\x32\x2e\x33\x32\x73\x01\x68\x20" // 383 XtrnProgLstFmt ,"\x0d\x0a\x01\x2d\x01\x63\x57\x68\x69\x63\x68\x20\x6f\x72\x20\x01\x68\x7e\x51\x01\x6e\x01\x63\x75\x69\x74\x3a\x20\x01\x68" // 384 WhichXtrnProg ,"\x0d\x0a\x25\x73\x20\x69\x73\x20\x63\x75\x72\x72\x65\x6e\x74\x6c\x79\x20\x72\x75\x6e\x6e\x69\x6e\x67\x20\x25\x73\x20\x6f\x6e\x20" "\x6e\x6f\x64\x65\x20\x25\x64\x2e\x0d\x0a\x0d\x0a\x54\x72\x79\x20\x61\x67\x61\x69\x6e\x20\x6c\x61\x74\x65\x72\x2e\x0d\x0a\x0d\x0a" diff --git a/src/sbbs3/useredit.cpp b/src/sbbs3/useredit.cpp index 7cc76bd348..ad06389ad9 100644 --- a/src/sbbs3/useredit.cpp +++ b/src/sbbs3/useredit.cpp @@ -1081,7 +1081,7 @@ void sbbs_t::maindflts(user_t* user) pause(); break; } - bputs(text[NewPassword]); + bprintf(text[NewPasswordPromptFmt], MIN_PASS_LEN, LEN_PASS); if(!getstr(str,LEN_PASS,K_UPPER|K_LINE)) break; truncsp(str); -- GitLab