Server - Root behavior
authorJohn Hodge <[email protected]>
Fri, 20 May 2011 05:29:17 +0000 (13:29 +0800)
committerJohn Hodge <[email protected]>
Fri, 20 May 2011 05:29:17 +0000 (13:29 +0800)
- Disallowed heathred
- Disallowed root to use `dispense acct`
 > Exception for new accounts (matches "treasurer: new user")
- Fixed username not being set for AUTOAUTH

src/server/server.c

index 9ee4ec7..3970476 100644 (file)
@@ -241,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:
@@ -515,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)
@@ -918,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 )
        {

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