From d549e0c4c5623eb64f7047ad5b0a146bfddbc11a Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Tue, 23 Jul 2019 10:17:35 +0200 Subject: [PATCH 1/4] Fixed missing permission --- server/src/client/ConnectedClientCommandHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/client/ConnectedClientCommandHandler.cpp b/server/src/client/ConnectedClientCommandHandler.cpp index ff237c8..2bf778b 100644 --- a/server/src/client/ConnectedClientCommandHandler.cpp +++ b/server/src/client/ConnectedClientCommandHandler.cpp @@ -1668,7 +1668,7 @@ inline ssize_t count_characters(const std::string& in) { * 3. Apply changed, test for advanced requirements like channel name etc * 4. notify everyone */ -CommandResult ConnectedClient::handleCommandChannelEdit(Command &cmd) { +CommandResult ConnectedClient:handleCommandChannelEdit(Command &cmd) { CMD_RESET_IDLE; CMD_CHK_AND_INC_FLOOD_POINTS(25); @@ -1692,6 +1692,8 @@ CommandResult ConnectedClient::handleCommandChannelEdit(Command &cmd) { bool target_channel_type_changed = false; ChannelType::ChannelType target_channel_type = channel->channelType(); CHANNEL_PERM_TEST_INIT; + CHANNEL_PERMISSION_TEST(permission::i_channel_modify_power, permission::i_channel_needed_modify_power, channel, true); + for (const auto &key : cmd[0].keys()) { if(key == "cid") continue; From 1211f517d5992562e90d6241d6f3fc220ba4068d Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Tue, 23 Jul 2019 10:21:58 +0200 Subject: [PATCH 2/4] Improved channeledit command --- server/src/client/ConnectedClientCommandHandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/client/ConnectedClientCommandHandler.cpp b/server/src/client/ConnectedClientCommandHandler.cpp index 2bf778b..8e1676e 100644 --- a/server/src/client/ConnectedClientCommandHandler.cpp +++ b/server/src/client/ConnectedClientCommandHandler.cpp @@ -1697,6 +1697,8 @@ CommandResult ConnectedClient:handleCommandChannelEdit(Command &cmd) { for (const auto &key : cmd[0].keys()) { if(key == "cid") continue; + if(key == "return_code") + continue; const auto &property = property::info(key); if(*property == property::CHANNEL_UNDEFINED) { @@ -1714,6 +1716,9 @@ CommandResult ConnectedClient:handleCommandChannelEdit(Command &cmd) { continue; } + if(channel->properties()[*property].as() == cmd[key].as()) + continue; /* we dont need to update stuff which is the same */ + if(key == "channel_icon_id") { CHANNEL_PERMISSION_TEST(permission::i_channel_permission_modify_power, permission::i_channel_needed_permission_modify_power, channel, true); } else if (key == "channel_order") { From 34b363f4cf64ef0540a4d1b27e44c52c8cb0a942 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Tue, 23 Jul 2019 10:23:12 +0200 Subject: [PATCH 3/4] fixed typo --- server/src/client/ConnectedClientCommandHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/client/ConnectedClientCommandHandler.cpp b/server/src/client/ConnectedClientCommandHandler.cpp index 8e1676e..9eba1fd 100644 --- a/server/src/client/ConnectedClientCommandHandler.cpp +++ b/server/src/client/ConnectedClientCommandHandler.cpp @@ -1668,7 +1668,7 @@ inline ssize_t count_characters(const std::string& in) { * 3. Apply changed, test for advanced requirements like channel name etc * 4. notify everyone */ -CommandResult ConnectedClient:handleCommandChannelEdit(Command &cmd) { +CommandResult ConnectedClient::handleCommandChannelEdit(Command &cmd) { CMD_RESET_IDLE; CMD_CHK_AND_INC_FLOOD_POINTS(25); From 76dad7e100047a339860ceba8290d2c3862c83a6 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Tue, 23 Jul 2019 15:53:20 +0200 Subject: [PATCH 4/4] fixed grant notify --- server/src/client/ConnectedClientNotifyHandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/client/ConnectedClientNotifyHandler.cpp b/server/src/client/ConnectedClientNotifyHandler.cpp index 6bc7708..76a22e1 100644 --- a/server/src/client/ConnectedClientNotifyHandler.cpp +++ b/server/src/client/ConnectedClientNotifyHandler.cpp @@ -61,6 +61,7 @@ bool ConnectedClient::notifyServerGroupList() { return true; } + bool ConnectedClient::notifyGroupPermList(const std::shared_ptr& group, bool as_sid) { Command cmd(this->getExternalType() == CLIENT_TEAMSPEAK ? group->target() == GROUPTARGET_SERVER ? "notifyservergrouppermlist" : "notifychannelgrouppermlist" : ""); if (group->target() == GROUPTARGET_SERVER) @@ -94,9 +95,9 @@ bool ConnectedClient::notifyGroupPermList(const std::shared_ptr& group, b auto type = permission::resolvePermissionData(get<0>(permission_data)); if(as_sid) { - cmd[index]["permsid"] = type->name; + cmd[index]["permsid"] = type->grant_name; } else { - cmd[index]["permid"] = (uint16_t) type->type; + cmd[index]["permid"] = (uint16_t) (type->type | PERM_ID_GRANT); } cmd[index]["permvalue"] = permission.values.value; cmd[index]["permnegated"] = permission.flags.negate;