fix for net.cpp
hi, i've noticed the command:
world adduser userx passx 1
no longer works. it seems the placment of the check for disablecommandline setting in the table variables has disabled the testing for the adduser command.
if (argc >= 2) {
char tmp[2];
if (strcasecmp(argv[1], "help") == 0 || strcasecmp(argv[1], "?") == 0 || strcasecmp(argv[1], "/?") == 0 || strcasecmp(argv[1], "-?") == 0 || strcasecmp(argv[1], "-h") == 0 || strcasecmp(argv[1], "- help") == 0) {
cout << "Worldserver command line commands:" << endl;
cout << "adduser username password flag - adds a user account" << endl;
cout << "flag username flag - sets GM flag on the account" << endl;
cout << "startzone zoneshortname - sets the starting zone" << endl;
cout << "-holdzones - reboots lost zones" << endl;
return 0;
}
else if (strcasecmp(argv[1], "-holdzones") == 0) {
cout << "Reboot Zones mode ON" << endl;
holdzones = true;
}
else if (database.GetVariable("disablecommandline", tmp, 2)) {
if (strlen(tmp) == 1) {
if (tmp[0] == '1') {
cout << "Command line disabled in database... exiting" << endl;
return 0;
}
}
}
else if (strcasecmp(argv[1], "adduser") == 0) {
if (argc == 5) {
if (Seperator::IsNumber(argv[4])) {
if the value is set to 1 the code returns 0. but if the value is set to 0 the code falls out of the if/else if statement and never processes the adduser test. it seems that the test of the disablecommandline variable should be a separate test before the main if/else if testing occurs. that way you wouldn't even get the help text if you had turned on the disablecommandline variable.
kabalah
|