X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fserver%2Fserver.c;h=3970476c9c762befb78b169dc1144ca88540f8df;hb=470cc8029bc931275ce82dd33709ba90c4f4c62f;hp=483806ab41f7d8d032fd50cdfad2282f28a98429;hpb=8a516dd60ab15cf514481c74dd087a294915565d;p=tpg%2Fopendispense2.git diff --git a/src/server/server.c b/src/server/server.c index 483806a..3970476 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -164,9 +164,15 @@ void Server_Start(void) } // In child // - Sort out stdin/stdout + #if 0 dup2( open("/dev/null", O_RDONLY, 0644), STDIN_FILENO ); dup2( open(gsServer_LogFile, O_CREAT|O_APPEND, 0644), STDOUT_FILENO ); dup2( open(gsServer_ErrorLog, O_CREAT|O_APPEND, 0644), STDERR_FILENO ); + #else + freopen("/dev/null", "r", stdin); + freopen(gsServer_LogFile, "a", stdout); + freopen(gsServer_ErrorLog, "a", stderr); + #endif } // Start the helper thread @@ -235,13 +241,13 @@ void Server_Start(void) case 0x7F000001: // 127.0.0.1 localhost // case 0x825F0D00: // 130.95.13.0 case 0x825F0D04: // 130.95.13.4 merlo - case 0x825F0D05: // 130.95.13.5 heathred (MR) + // case 0x825F0D05: // 130.95.13.5 heathred (MR) case 0x825F0D07: // 130.95.13.7 motsugo case 0x825F0D11: // 130.95.13.17 mermaid case 0x825F0D12: // 130.95.13.18 mussel case 0x825F0D17: // 130.95.13.23 martello case 0x825F0D2A: // 130.95.13.42 meersau - case 0x825F0D42: // 130.95.13.66 heathred (Clubroom) + // case 0x825F0D42: // 130.95.13.66 heathred (Clubroom) bTrusted = 1; break; default: @@ -509,6 +515,11 @@ void Server_Cmd_AUTOAUTH(tClient *Client, char *Args) return ; } + // Save username + if(Client->Username) + free(Client->Username); + Client->Username = strdup(username); + Client->bIsAuthed = 1; if(giDebugLevel) @@ -912,6 +923,16 @@ void Server_Cmd_ADD(tClient *Client, char *Args) return ; } + #if !ROOT_CAN_ADD + if( strcmp( Client->Username, "root" ) == 0 ) { + // Allow adding for new users + if( strcmp(reason, "treasurer: new user") != 0 ) { + sendf(Client->Socket, "403 Root may not add\n"); + return ; + } + } + #endif + #if HACK_NO_REFUNDS if( strstr(reason, "refund") != NULL || strstr(reason, "misdispense") != NULL ) {