From 0a2f9197058cc5248ec8e4bed7c361397c8d1c79 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sat, 26 Dec 2015 21:02:54 -0500 Subject: stuff mostly works, need to fix error on client exit --- src/auth.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/auth.c') diff --git a/src/auth.c b/src/auth.c index c771747..5041ef4 100644 --- a/src/auth.c +++ b/src/auth.c @@ -1,8 +1,27 @@ +/* + * NetCosm - a MUD server + * Copyright (C) 2015 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "netcosm.h" #define SALT_LEN 12 #define ALGO GCRY_MD_SHA512 -#define HASH_ITERS 500000 +//#define HASH_ITERS 500000 +#define HASH_ITERS 1 static bool valid_login_name(const char *name); @@ -307,9 +326,11 @@ struct authinfo_t auth_check(const char *name2, const char *pass2) } good: printf("Successful authentication.\n"); + fclose(f); return ret; bad: sleep(2); + fclose(f); printf("Failed authentication.\n"); return ret; } @@ -328,6 +349,7 @@ void auth_user_list(void) if(getline(&line, &len, f) < 0) { free(line); + fclose(f); return; } char *user = strdup(strtok_r(line, ":\r\n", &save)); -- cgit v1.1