diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-06-16 21:16:29 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-06-16 21:16:29 +0100 |
commit | 67fd69854489a088bc8d90702ba37cecccd6f169 (patch) | |
tree | ac0efe967e433d725cab51b6fe93aa685c928950 /config.c | |
parent | a31e7b13b3cef0872be5922a568633d74dd408d2 (diff) |
Load all settings from configuration file at startup instead of reading it for certain settings (password/nick/nick2/nick3).
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) { |