Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix typos in deepin_pw_check.c #33

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/deepin_pw_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ struct Options {
bool first_letter_uppercase;
int monotone_character_num; // 单调字符个数
int consecutive_same_character_num; // 连续相似字符个数
int password_lenth_standard_high;
int password_lenth_standard_middle;
int password_length_standard_high;
int password_length_standard_middle;
int password_character_type_num_high;
int password_character_type_num_middle;
};
Expand Down Expand Up @@ -139,8 +139,8 @@ static int load_pwd_conf(struct Options *options, const char *conf_file) {
iniparser_getint(dic, "Password:CONSECUTIVE_SAME_CHARACTER_NUM", 0);
options->first_letter_uppercase =
iniparser_getboolean(dic, "Password:FIRST_LETTER_UPPERCASE", 0);
options->password_lenth_standard_high = iniparser_getint(dic, "Password:PASSWORD_LENTH_STANDARD_HIGH", 8);
options->password_lenth_standard_middle = iniparser_getint(dic, "Password:PASSWORD_LENTH_STANDARD_MIDDLE", 6);
options->password_length_standard_high = iniparser_getint(dic, "Password:PASSWORD_LENGTH_STANDARD_HIGH", 8);
options->password_length_standard_middle = iniparser_getint(dic, "Password:PASSWORD_LENGTH_STANDARD_MIDDLE", 6);
options->password_character_type_num_high = iniparser_getint(dic, "Password:PASSWORD_CHARACTER_TYPE_NUM_HIGH", 3);
options->password_character_type_num_middle = iniparser_getint(dic, "Password:PASSWORD_CHARACTER_TYPE_NUM_MIDDLE", 2);
iniparser_freedict(dic);
Expand Down Expand Up @@ -462,7 +462,7 @@ static PASSWORD_LEVEL_TYPE get_new_passwd_strength_level_by_conf(const char *new
int lower_count = 0;
int number_count = 0;
int character_count = 0;
int lenth;
int length;
int type;
char character;
PASSWORD_LEVEL_TYPE level;
Expand All @@ -471,8 +471,8 @@ static PASSWORD_LEVEL_TYPE get_new_passwd_strength_level_by_conf(const char *new
free(options);
return PASSWORD_STRENGTH_LEVEL_ERROR;
}
lenth=strlen(newPasswd);
for(int i = 0; i < lenth; i++) {
length=strlen(newPasswd);
for(int i = 0; i < length; i++) {
character=newPasswd[i];
if(character >= 'a' && character <= 'z') {
lower_count++;
Expand All @@ -485,9 +485,9 @@ static PASSWORD_LEVEL_TYPE get_new_passwd_strength_level_by_conf(const char *new
}
}
type = (upper_count > 0 ? 1:0) + (lower_count > 0 ? 1:0) + ( number_count > 0 ? 1:0) + (character_count > 0 ? 1:0);
if(lenth >= options->password_lenth_standard_high && type >= options->password_character_type_num_high) {
if(length >= options->password_length_standard_high && type >= options->password_character_type_num_high) {
level = PASSWORD_STRENGTH_LEVEL_HIGH;
} else if (lenth >= options->password_lenth_standard_middle && type >= options->password_character_type_num_middle) {
} else if (length >= options->password_length_standard_middle && type >= options->password_character_type_num_middle) {
level = PASSWORD_STRENGTH_LEVEL_MIDDLE;
} else {
level = PASSWORD_STRENGTH_LEVEL_LOW;
Expand Down
Loading