From: John Hodge Date: Fri, 7 Jan 2011 07:43:00 +0000 (+0800) Subject: Removed references to LDAP when USE_LDAP is undefined X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Fopendispense2.git;a=commitdiff_plain;h=3d919eb78adae49b0871332458b6183a2c12af7a Removed references to LDAP when USE_LDAP is undefined --- diff --git a/src/cokebank_basic/Makefile b/src/cokebank_basic/Makefile index 6aa55df..7a0d815 100644 --- a/src/cokebank_basic/Makefile +++ b/src/cokebank_basic/Makefile @@ -6,6 +6,11 @@ CPPFLAGS := CFLAGS := -Wall -Werror -g -fPIC LDFLAGS := -shared -Wl,-soname,cokebank.so +ifneq ($(USE_LDAP),) + CFLAGS += -DUSE_LDAP + LDFLAGS += -lldap +endif + .PHONY: all clean all: $(BIN) diff --git a/src/cokebank_basic/main.c b/src/cokebank_basic/main.c index 87bfc9e..2e3deae 100644 --- a/src/cokebank_basic/main.c +++ b/src/cokebank_basic/main.c @@ -13,6 +13,9 @@ #include #include #include "common.h" +#if USE_LDAP +# include +#endif // === HACKS === #define HACK_TPG_NOAUTH 1 @@ -228,7 +231,6 @@ int GetUserAuth(const char *Salt, const char *Username, const char *PasswordStri ); // Then create the hash from the provided salt // Compare that with the provided hash - if( giDebugLevel ) { int i; diff --git a/src/server/Makefile b/src/server/Makefile index 04161e4..85678a8 100644 --- a/src/server/Makefile +++ b/src/server/Makefile @@ -6,7 +6,7 @@ OBJ += dispense.o itemdb.o OBJ += handler_coke.o handler_snack.o handler_door.o BIN := ../../dispsrv -LINKFLAGS := -g ../../cokebank.so -lldap +LINKFLAGS := -g ../../cokebank.so CPPFLAGS := CFLAGS := -Wall -g diff --git a/src/server/server.c b/src/server/server.c index d3bb49b..330ac66 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -17,7 +17,6 @@ #include #include #include -#include #define DEBUG_TRACE_CLIENT 0 @@ -322,7 +321,10 @@ void Server_ParseClientCommand(tClient *Client, char *CommandString) * Usage: USER */ void Server_Cmd_USER(tClient *Client, char *Args) -{ +{ + char *space = strchr(Args, ' '); + if(space) *space = '\0'; // Remove characters after the ' ' + // Debug! if( giDebugLevel ) printf("Client %i authenticating as '%s'\n", Client->ID, Args); @@ -357,9 +359,11 @@ void Server_Cmd_USER(tClient *Client, char *Args) * Usage: PASS */ void Server_Cmd_PASS(tClient *Client, char *Args) -{ - // TODO: Decrypt password passed +{ + char *space = strchr(Args, ' '); + if(space) *space = '\0'; // Remove characters after the ' ' + // Pass on to cokebank Client->UID = GetUserAuth(Client->Salt, Client->Username, Args); if( Client->UID != -1 ) { @@ -378,8 +382,8 @@ void Server_Cmd_PASS(tClient *Client, char *Args) */ void Server_Cmd_AUTOAUTH(tClient *Client, char *Args) { - char *spos = strchr(Args, ' '); - if(spos) *spos = '\0'; // Remove characters after the ' ' + char *space = strchr(Args, ' '); + if(space) *space = '\0'; // Remove characters after the ' ' // Check if trusted if( !Client->bIsTrusted ) {