From: John Hodge Date: Sat, 19 Feb 2011 06:27:42 +0000 (+0800) Subject: Hacked to stop root dispenses X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=bc1c8c976b0ec2836f942bddd36645b44c39f18f;p=tpg%2Fopendispense2.git Hacked to stop root dispenses --- diff --git a/src/server/dispense.c b/src/server/dispense.c index 52d978c..7e80703 100644 --- a/src/server/dispense.c +++ b/src/server/dispense.c @@ -179,6 +179,19 @@ int _GetMinBalance(int Account) { int flags = Bank_GetFlags(Account); + // Evil little piece of HACK: + // root's balance cannot be changed by any of the above functions + // - Stops dispenses as root by returning insufficent balance. + { + char *username = Bank_GetAcctName(Account); + if( strcmp(username, "root") == 0 ) + { + free(username); + return INT_MAX; + } + free(username); + } + // - Internal accounts have no lower bound if( flags & USER_FLAG_INTERNAL ) return INT_MIN;