aboutsummaryrefslogtreecommitdiff
path: root/src/auth.c
diff options
context:
space:
mode:
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));