From 67fd69854489a088bc8d90702ba37cecccd6f169 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sun, 16 Jun 2019 21:16:29 +0100 Subject: Load all settings from configuration file at startup instead of reading it for certain settings (password/nick/nick2/nick3). --- config.c | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index faa153a..9a144cd 100644 --- a/config.c +++ b/config.c @@ -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) { -- cgit v1.2.3