From f92c9f5ade627fb239908c918a0e9e34b2b0498a Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Fri, 23 Mar 2012 10:36:02 +0000 Subject: [PATCH] Created wmud_player_auth() --- src/networking.c | 1 + src/players.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/networking.c b/src/networking.c index 5f5c7b1..81f0e9d 100644 --- a/src/networking.c +++ b/src/networking.c @@ -316,6 +316,7 @@ wmud_client_start_login(wmudClient *client) else { client->state = WMUD_CLIENT_STATE_PASSWAIT; + client->player = player; wmud_client_send(client, "Please provide us your password: %c%c%c", TELNET_IAC, TELNET_WONT, TELNET_ECHO); } } diff --git a/src/players.c b/src/players.c index 67f6d0b..dc5eaa2 100644 --- a/src/players.c +++ b/src/players.c @@ -35,6 +35,9 @@ wmud_player_auth(wmudClient *client) { g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Player entered %s as password", client->buffer->str); + if (g_strcmp0(crypt(client->buffer->str, client->player->cpassword), client->player->cpassword) == 0) + return TRUE; + return FALSE; }