X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=src%2Fserver%2Fdispense.c;h=c631bed7686234a000621274680a7fcd18a3cade;hb=684849b68d48b3057d4bfae35142531c3bc86e68;hp=52d978cdfb32deb0ae529c0b3f9e4a7ac2e16345;hpb=df71d48cc0082a5333203384cfbce040cf54a155;p=tpg%2Fopendispense2.git diff --git a/src/server/dispense.c b/src/server/dispense.c index 52d978c..c631bed 100644 --- a/src/server/dispense.c +++ b/src/server/dispense.c @@ -3,6 +3,7 @@ #include "common.h" #include #include +#include int _GetMinBalance(int Account); int _CanTransfer(int Source, int Destination, int Ammount); @@ -179,6 +180,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;