|
Jan
26
|
if you want to modify qmailadmin to check if new password is strong you can do like this:
edit qmailadmin.c and:
add: #include <ctype.h>
I wrote a function to check if new password contains at least 1 alphachar and 1 digit.
add it before int main(argc,argv)
int check_strong(char *pass_string)
{
int digit=0;
int alpha=0;
int length=strlen(pass_string);
int i;
for(i=0;i<length;i++){
if( digit == 1 && alpha == 1 ) return 1;
else{
if(isdigit(pass_string[i])) digit=1;
if(isalpha(pass_string[i])) alpha=1;
}
}
return 0;
}
It’s not the best coding but it works
. You can add more checks in this function.
after :
} else if (*Password1 == ‘\0′) {
snprintf (StatusMessage, sizeof(StatusMessage), “%s”, html_text[234]);
add:
} else if (strlen(Password1) < 6) { //checks if length is at least 6 chars
snprintf (StatusMessage, sizeof(StatusMessage), “%s”, html_text[318]); //318 is the text from qmailadmin/lang/en file if you use english
} else if (check_strong(Password1) == 0) { //use our function
snprintf (StatusMessage, sizeof(StatusMessage), “%s”, html_text[319]); //319 is the text from qmailadmin/lang/en file if you use english
recompile qmailadmin and install.
in qmailadmin/lang/en add:
318 Password to short (at least 6 chars)
319 Password to weak
Recent Comments