Skip to content

Commit

Permalink
chore: fix typos in deepin_pw_check.c
Browse files Browse the repository at this point in the history
  • Loading branch information
felixonmars authored Sep 17, 2023
1 parent 2033b89 commit 6238f3a
Showing 1 changed file with 9 additions and 9 deletions.
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(lenth >= 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 (lenth >= 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

0 comments on commit 6238f3a

Please sign in to comment.