MigOpsRepos / credcheck

PostgreSQL plain credential checker
MIT License
57 stars 5 forks source link

Special characters #34

Closed Gabi201265 closed 2 months ago

Gabi201265 commented 5 months ago

Hi,

I have a question. What special characters are allowed by the extension?

Best regards, Gabriel Leroux

darold commented 5 months ago

Everything that is not a digit and is not a lower of upper character is considered a special character.

static void check_str_counters(const char *str, int *lower, int *upper,
                               int *digit, int *special) {
  for (const char *i = str; *i; i++) {
    if (islower(*i)) {
      (*lower)++;
    } else if (isupper(*i)) {
      (*upper)++;
    } else if (isdigit(*i)) {
      (*digit)++;
    } else {
      (*special)++;
    }
  }
}