diff options
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 30 |
1 files changed, 0 insertions, 30 deletions
@@ -120,36 +120,6 @@ int getconfint(char *confname, char *filename) { return strtol(result, NULL, 10); // Convert resulting string to an integer, base 10 } -// Check the password provided in the string 'str' against what is in -// the configuration file 'filename'. -// Return 0 for password mismatch, or 1 for password match. -int checkpassword(char *password, char *filename) { - char confpassword[MAXCHAR]; - - if (!getconfstr("password", filename, confpassword)) { - debugprint(DEBUG_CRIT, "checkpassword(): error getting configuration option 'password' from configuration file '%s'.\n", filename); - return 0; - } - - // Ensure passwords are the same length - if (strlen(password) != strlen(confpassword)) { - debugprint(DEBUG_SOME, "Password length mismatch!\n"); - return 0; - } - // Ensure passwords match - if (strncmp(password, confpassword, strlen(password)) == 0) { - debugprint(DEBUG_FULL, "confpassword matches password.\n"); - return 1; - } else { - debugprint(DEBUG_SOME, "confpassword does NOT match password!\n"); - return 0; - } - - printf("checkpassword(): unexpectedly got to end of function, quitting.\n"); - debugprint(DEBUG_CRIT, "checkpassword(): unexpectedly got to end of function, quitting.\n"); - exit(1); -} - // Create the default configuration file. // Return 1 on success, 0 on failure. int createconfigfile(char *filename) { |