EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   #<command> Security and Addon.ini (https://www.eqemulator.org/forums/showthread.php?t=9285)

Scorpious2k 08-30-2003 05:02 AM

#<command> Security and Addon.ini
 
I don't know if anyone else has had a problem with this, but there is an idiosyncrasy in the code for the #&lt;command> which doesn't allow you to raise but not lower the security for the command.

For example, the #grid, #wp and #gassign are all defined as serverop commands and if you wanted to allow LeadGMs access to them, your only choice is to set their status to 200.

If you want to change this and make it entirely driven by the addon.ini file, here are the changes.

In Zone/Client.cpp Client::ChannelMessageReceived find
Code:

                                if (admin >= 250 || admin==cmdlevel)
                                        if (VHServerOP(&amp;sep))
                                                break;
                                if (admin >= 200 || admin==cmdlevel)
                                        if (ServerOP(&amp;sep))
                                                break;
                                if (admin >= 150 || admin==cmdlevel)
                                        if (LeadGM(&amp;sep))
                                                break;
                                if (admin >= 100 || admin==cmdlevel)
                                        if (NormalGM(&amp;sep))
                                                break;
                                if (admin >= 80 || admin==cmdlevel)
                                        if (QuestTroupe(&amp;sep))
                                                break;
                                if (admin >= 20 || admin==cmdlevel)
                                        if (VeryPrivUser(&amp;sep))
                                                break;
                                if (admin >= 10 || admin==cmdlevel)
                                        if (PrivUser(&amp;sep))
                                                break;
                                NormalUser(&amp;sep);

and chamge it to
Code:

                                if (NormalUser(&amp;sep)) break;
                                if (PrivUser(&amp;sep)) break;
                                if (VeryPrivUser(&amp;sep)) break;
                                if (QuestTroupe(&amp;sep)) break;
                                if (NormalGM(&amp;sep)) break;
                                if (LeadGM(&amp;sep)) break;
                                if (ServerOP(&amp;sep)) break;
                                if (VHServerOP(&amp;sep)) break;
                                else
                                {
                                        Message(0, "Command does not exist");
                                        break;
                                }

At the bottom of Client::NormalUser find
Code:

        else {
                Message(0, "Command does not exist");
        }
        return found;

and change it to
Code:

//        else {
//                Message(0, "Command does not exist");
//        }
        return found;

This will make #command security be driven by whatever you have set in your addon.ini files. However, any command not in addon.ini will be assumed to be set to 0 (any user can do it)

If you want to set a default security for any command that was omitted go to common/database.cpp Database::CommandRequirement and find
Code:

        for(int i=0; i&lt;maxcommandlevel; i++)
        {
                if((strcasecmp(commandname, commands[i]) == 0)) {
                        return commandslevels[i];
                }
        }
        return 255;

change the return 255 to return whatever you want the default to be. So if you wanted the commands that you didn't list in addon.ini to be for serverops only...
Code:

        for(int i=0; i&lt;maxcommandlevel; i++)
        {
                if((strcasecmp(commandname, commands[i]) == 0)) {
                        return commandslevels[i];
                }
        }
        return 200;

I hope this helps anyone else who has come up against this and found it a problem.

Scorpious2k 09-29-2003 12:54 AM

On thinking about it, this can also be fixed and the original intent maintained (which drives it by default status levels if it isn't in addon.ini) by doing the following:

In Zone/Client.cpp Client::ChannelMessageReceived find

Code:

        if (admin >= 250 || admin==cmdlevel)
          if (VHServerOP(&sep))
            break;
        if (admin >= 200 || admin==cmdlevel)
          if (ServerOP(&sep))
            break;
        if (admin >= 150 || admin==cmdlevel)
          if (LeadGM(&sep))
            break;
        if (admin >= 100 || admin==cmdlevel)
          if (NormalGM(&sep))
            break;
        if (admin >= 80 || admin==cmdlevel)
          if (QuestTroupe(&sep))
            break;
        if (admin >= 20 || admin==cmdlevel)
          if (VeryPrivUser(&sep))
            break;
        if (admin >= 10 || admin==cmdlevel)
          if (PrivUser(&sep))
            break;
        NormalUser(&sep);

and change it to read

Code:

        if (admin >= 250 || admin>=cmdlevel)
          if (VHServerOP(&sep))
            break;
        if (admin >= 200 || admin>=cmdlevel)
          if (ServerOP(&sep))
            break;
        if (admin >= 150 || admin>=cmdlevel)
          if (LeadGM(&sep))
            break;
        if (admin >= 100 || admin>=cmdlevel)
          if (NormalGM(&sep))
            break;
        if (admin >= 80 || admin>=cmdlevel)
          if (QuestTroupe(&sep))
            break;
        if (admin >= 20 || admin>=cmdlevel)
          if (VeryPrivUser(&sep))
            break;
        if (admin >= 10 || admin>=cmdlevel)
          if (PrivUser(&sep))
            break;
        NormalUser(&sep);



All times are GMT -4. The time now is 12:28 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.