aboutsummaryrefslogtreecommitdiff
path: root/src/auth.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2015-12-26 21:02:54 -0500
committerFranklin Wei <git@fwei.tk>2015-12-26 21:03:15 -0500
commit0a2f9197058cc5248ec8e4bed7c361397c8d1c79 (patch)
treeb4ac31dcaa64bdfded9cdb2450bf936904802d08 /src/auth.c
parentf7041112f179aa79b6e315e7d57afbf76d3cd8bb (diff)
downloadnetcosm-0a2f9197058cc5248ec8e4bed7c361397c8d1c79.zip
netcosm-0a2f9197058cc5248ec8e4bed7c361397c8d1c79.tar.gz
netcosm-0a2f9197058cc5248ec8e4bed7c361397c8d1c79.tar.bz2
netcosm-0a2f9197058cc5248ec8e4bed7c361397c8d1c79.tar.xz
stuff mostly works, need to fix error on client exit
Diffstat (limited to 'src/auth.c')
-rw-r--r--src/auth.c24
1 files changed, 23 insertions, 1 deletions
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 <http://www.gnu.org/licenses/>.
+ */
+
#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));