Merge branch 'master' of git://mutabah.net/opendispense2
[tpg/opendispense2.git] / src / server / dispense.c
index 52d978c..c631bed 100644 (file)
@@ -3,6 +3,7 @@
 #include "common.h"
 #include <stdlib.h>
 #include <limits.h>
+#include <string.h>
 
  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;
        

UCC git Repository :: git.ucc.asn.au