From 2e4de7bb1dcdf34bce1769c34c7cd42fb64637e2 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 26 Jul 2013 20:39:19 +0300 Subject: [PATCH 01/16] Debug. --- stglibs/srvconf.lib/servconf.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/stglibs/srvconf.lib/servconf.cpp b/stglibs/srvconf.lib/servconf.cpp index 0ca3028c..078466d7 100644 --- a/stglibs/srvconf.lib/servconf.cpp +++ b/stglibs/srvconf.lib/servconf.cpp @@ -379,6 +379,7 @@ return st_ok; //----------------------------------------------------------------------------- int SERVCONF::Start(const char *el, const char **attr) { +printfd(__FILE__, "<%s>\n", el); currParser->ParseStart(el, attr); return 0; } -- 2.44.2 From aab10975560853c3482eb0e0deca11acbc323a1c Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 26 Jul 2013 20:54:38 +0300 Subject: [PATCH 02/16] Small fix. --- stglibs/srvconf.lib/parser.cpp | 4 ++-- stglibs/srvconf.lib/servconf.cpp | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/stglibs/srvconf.lib/parser.cpp b/stglibs/srvconf.lib/parser.cpp index 62537359..284e1127 100644 --- a/stglibs/srvconf.lib/parser.cpp +++ b/stglibs/srvconf.lib/parser.cpp @@ -848,8 +848,8 @@ else { if (strcasecmp(el, "Auth") == 0) { - if (attr && attr[0]) - list.push_back(attr[0]); + if (attr && attr[0] && attr[1]) + list.push_back(attr[1]); return 0; } } diff --git a/stglibs/srvconf.lib/servconf.cpp b/stglibs/srvconf.lib/servconf.cpp index 078466d7..0ca3028c 100644 --- a/stglibs/srvconf.lib/servconf.cpp +++ b/stglibs/srvconf.lib/servconf.cpp @@ -379,7 +379,6 @@ return st_ok; //----------------------------------------------------------------------------- int SERVCONF::Start(const char *el, const char **attr) { -printfd(__FILE__, "<%s>\n", el); currParser->ParseStart(el, attr); return 0; } -- 2.44.2 From a94639179750883b1120be2f5d01bbb38eaa0928 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 26 Jul 2013 21:22:09 +0300 Subject: [PATCH 03/16] Added XML RPC method for getting user's authorizers. --- .../configuration/rpcconfig/rpcconfig.cpp | 6 ++++ .../configuration/rpcconfig/users_methods.cpp | 33 +++++++++++++++++++ .../configuration/rpcconfig/users_methods.h | 20 +++++++++++ 3 files changed, 59 insertions(+) diff --git a/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.cpp b/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.cpp index e84e9a0e..dca87fbe 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.cpp @@ -473,5 +473,11 @@ xmlrpc_c::methodPtr const methodGetOnlinIPsPtr(new METHOD_GET_ONLINE_IPS( users )); rpcRegistry.addMethod("stargazer.get_online_ips", methodGetOnlinIPsPtr); + +xmlrpc_c::methodPtr const methodGetUserAuthByPtr(new METHOD_GET_USER_AUTH_BY( + this, + users + )); +rpcRegistry.addMethod("stargazer.get_user_auth_by", methodGetUserAuthByPtr); } diff --git a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp index 9eabced6..5adbf441 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp @@ -509,3 +509,36 @@ ipm.mask = htonl(0xffFFffFF << (32 - ipm.mask)); return false; } + +void METHOD_GET_USER_AUTH_BY::execute(xmlrpc_c::paramList const & paramList, + xmlrpc_c::value * const retvalPtr) +{ +std::string cookie = paramList.getString(0); +std::string login = paramList.getString(1); +paramList.verifyEnd(2); + +std::map structVal; +ADMIN_INFO adminInfo; + +if (config->GetAdminInfo(cookie, &adminInfo)) + { + structVal["result"] = xmlrpc_c::value_boolean(false); + *retvalPtr = xmlrpc_c::value_struct(structVal); + return; + } + +USER_PTR u; + +if (users->FindByName(login, &u)) + { + structVal["result"] = xmlrpc_c::value_boolean(false); + *retvalPtr = xmlrpc_c::value_struct(structVal); + return; + } + +std::vector list(u->GetAuthorizers()); +std::vector authList; +for (std::vector::const_iterator it = list.begin(); it != list.end(); ++it) + authList.push_back(xmlrpc_c::value_string(*it)); +*retvalPtr = xmlrpc_c::value_array(authList); +} diff --git a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.h b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.h index 413e9aaf..d1ec33a4 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.h +++ b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.h @@ -229,4 +229,24 @@ private: bool ParseNet(const std::string & net, IP_MASK & ipm) const; }; +class METHOD_GET_USER_AUTH_BY : public xmlrpc_c::method { +public: + METHOD_GET_USER_AUTH_BY(RPC_CONFIG * c, + USERS * u) + : config(c), + users(u) + { + } + + void execute(xmlrpc_c::paramList const & paramList, + xmlrpc_c::value * const retvalP); + +private: + METHOD_GET_USER_AUTH_BY(const METHOD_GET_ONLINE_IPS & rvalue); + METHOD_GET_USER_AUTH_BY & operator=(const METHOD_GET_ONLINE_IPS & rvalue); + + RPC_CONFIG * config; + USERS * users; +}; + #endif -- 2.44.2 From 365bbdc9d0c0576d4b6032a27ba9344fa5046f30 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 26 Jul 2013 21:29:41 +0300 Subject: [PATCH 04/16] Adjusted XML RPC documentation. --- doc/xmlrpc/API-user.xml | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/doc/xmlrpc/API-user.xml b/doc/xmlrpc/API-user.xml index fac4f2be..82f8e7ee 100644 --- a/doc/xmlrpc/API-user.xml +++ b/doc/xmlrpc/API-user.xml @@ -243,6 +243,7 @@ stargazer.set_user_cash, stargazer.chg_user_tariff stargazer.get_online_ips + stargazer.get_user_auth_by @@ -481,6 +482,7 @@ stargazer.set_user_cash, stargazer.chg_user_tariff stargazer.get_online_ips + stargazer.get_user_auth_by @@ -534,6 +536,7 @@ stargazer.set_user_cash, stargazer.chg_user_tariff stargazer.get_online_ips + stargazer.get_user_auth_by @@ -732,6 +735,7 @@ stargazer.set_user_cash, stargazer.chg_user_tariff stargazer.get_online_ips + stargazer.get_user_auth_by @@ -785,6 +789,7 @@ stargazer.set_user_cash, stargazer.chg_user_tariff stargazer.get_online_ips + stargazer.get_user_auth_by @@ -852,6 +857,7 @@ stargazer.set_user_cash, stargazer.chg_user_tariff stargazer.get_online_ips + stargazer.get_user_auth_by @@ -919,6 +925,7 @@ stargazer.add_user_cash, stargazer.chg_user_tariff stargazer.get_online_ips + stargazer.get_user_auth_by @@ -993,6 +1000,7 @@ stargazer.add_user_cash, stargazer.set_user_cash stargazer.get_online_ips + stargazer.get_user_auth_by @@ -1060,6 +1068,75 @@ stargazer.add_user_cash, stargazer.set_user_cash stargazer.chg_user_tariff + stargazer.get_user_auth_by + + + + + + stargazer.get_user_auth_by + + + stargazer.get_user_auth_by + Получение списка авторизаторов которыми авторизован пользователь + + + + + stargazer.get_user_auth_by + string cookie + string login + + + + + Description + Метод stargazer.get_user_auth_by позволяет получить список авторизаторов которыми в данный момент авторизован пользователь. + + + string cookie + + Авторизационный cookie. Для авторизации в системе используется метод stargazer.login + + + + string login + + Логин пользователя + + + + + Return Value + Возвращает структуру: + + + bool result + + Результат операции. true - успешно, false - неудача (неправильный или устаревший cookie). + + + + array of strings auths + + Список авторизаторов которыми авторизован пользователь. + + + + + + + See also + + stargazer.get_users, + stargazer.get_user, + stargazer.add_user, + stargazer.chg_user, + stargazer.del_user, + stargazer.add_user_cash, + stargazer.set_user_cash + stargazer.chg_user_tariff + stargazer.get_online_ips -- 2.44.2 From bd3f1dd24a1af10b7c0e403397019610f727325c Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 26 Jul 2013 21:30:28 +0300 Subject: [PATCH 05/16] Minor fix. --- projects/sgconf/common_sg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sgconf/common_sg.cpp b/projects/sgconf/common_sg.cpp index bb4f5967..bf2ac622 100644 --- a/projects/sgconf/common_sg.cpp +++ b/projects/sgconf/common_sg.cpp @@ -129,7 +129,7 @@ printf("To get userdata<0...9> use:\n"); printf("sgconf get -s -p -a -w -u --ud0 [--ud1 ...]\n\n"); printf("To get user's authorizers list use:\n"); -printf("sgconf get -s -p -a -w -u --authorized-by\n"); +printf("sgconf get -s -p -a -w -u --authorized-by\n\n"); printf("To send message use:\n"); printf("sgconf set -s -p -a -w -u -m \n\n"); -- 2.44.2 From e19baa83c7f24b07e8925473a0d322d6fec440f9 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sat, 27 Jul 2013 20:04:03 +0300 Subject: [PATCH 06/16] Added missing files. --- .../configuration/sgconfig/parser_auth_by.cpp | 46 +++++++++++++++++++ .../configuration/sgconfig/parser_auth_by.h | 18 ++++++++ 2 files changed, 64 insertions(+) create mode 100644 projects/stargazer/plugins/configuration/sgconfig/parser_auth_by.cpp create mode 100644 projects/stargazer/plugins/configuration/sgconfig/parser_auth_by.h diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser_auth_by.cpp b/projects/stargazer/plugins/configuration/sgconfig/parser_auth_by.cpp new file mode 100644 index 00000000..e1da75b6 --- /dev/null +++ b/projects/stargazer/plugins/configuration/sgconfig/parser_auth_by.cpp @@ -0,0 +1,46 @@ +#include "parser_auth_by.h" + +int PARSER_AUTH_BY::ParseStart(void * /*data*/, const char *el, const char **attr) +{ +if (strcasecmp(el, "GetUserAuthBy") == 0) + { + if (attr[0] && attr[1]) + login = attr[1]; + else + { + login.erase(login.begin(), login.end()); + return -1; + } + return 0; + } +return -1; +} + +int PARSER_AUTH_BY::ParseEnd(void * /*data*/, const char *el) +{ +if (strcasecmp(el, "GetUserAuthBy") == 0) + { + CreateAnswer(); + return 0; + } +return -1; +} + +void PARSER_AUTH_BY::CreateAnswer() +{ +answerList->erase(answerList->begin(), answerList->end()); + +USER_PTR u; +if (users->FindByName(login, &u)) + { + answerList->push_back(""); + return; + } + +std::string s = ""; +std::vector list(u->GetAuthorizers()); +for (std::vector::const_iterator it = list.begin(); it != list.end(); ++it) + s += ""; +s += ""; +answerList->push_back(s); +} diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser_auth_by.h b/projects/stargazer/plugins/configuration/sgconfig/parser_auth_by.h new file mode 100644 index 00000000..c34586c9 --- /dev/null +++ b/projects/stargazer/plugins/configuration/sgconfig/parser_auth_by.h @@ -0,0 +1,18 @@ +#ifndef __STG_PARSER_AUTH_BY_H__ +#define __STG_PARSER_AUTH_BY_H__ + +#include + +#include "parser.h" + +class PARSER_AUTH_BY : public BASE_PARSER { +public: + int ParseStart(void *data, const char *el, const char **attr); + int ParseEnd(void *data, const char *el); + void CreateAnswer(); + +private: + std::string login; +}; + +#endif -- 2.44.2 From a903ce1ab463173c9a0af322c4c2f23076d21310 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sun, 28 Jul 2013 15:32:47 +0300 Subject: [PATCH 07/16] Allow to assign 0.0.0.0 to multiple users. --- include/stg/user_ips.h | 7 +++++++ projects/stargazer/users_impl.cpp | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/stg/user_ips.h b/include/stg/user_ips.h index 264b5896..e55f99fa 100644 --- a/include/stg/user_ips.h +++ b/include/stg/user_ips.h @@ -70,6 +70,7 @@ public: std::string GetIpStr() const; bool IsIPInIPS(uint32_t ip) const; bool OnlyOneIP() const; + bool IsAnyIP() const; size_t Count() const; void Add(const IP_MASK &im); void Erase(); @@ -172,6 +173,12 @@ return false; } //----------------------------------------------------------------------------- inline +bool USER_IPS::IsAnyIP() const +{ + return !ips.empty() && ips.front().ip == 0; +} +//----------------------------------------------------------------------------- +inline void USER_IPS::Add(const IP_MASK &im) { ips.push_back(im); diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp index dfdc8634..c4f63c64 100644 --- a/projects/stargazer/users_impl.cpp +++ b/projects/stargazer/users_impl.cpp @@ -702,7 +702,9 @@ std::list::const_iterator iter; iter = users.begin(); while (iter != users.end()) { - if (iter->GetLogin() != login && iter->GetProperty().ips.Get().IsIPInIPS(ip)) + if (iter->GetLogin() != login && + !iter->GetProperty().ips.Get().IsAnyIP() && + iter->GetProperty().ips.Get().IsIPInIPS(ip)) { if (user != NULL) *user = &(*iter); -- 2.44.2 From 9f2fcf1cf2b6e0665bb6375b69346117f26b6bf0 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 1 Aug 2013 13:24:21 +0300 Subject: [PATCH 08/16] Allow to build sgconf on Darwin. --- projects/sgconf/Makefile | 6 +++++- projects/sgconf/build | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/projects/sgconf/Makefile b/projects/sgconf/Makefile index 297d3e20..09699122 100644 --- a/projects/sgconf/Makefile +++ b/projects/sgconf/Makefile @@ -41,7 +41,11 @@ OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS)))) CXXFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS) CFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS) -LDFLAGS += -Wl,-E $(STGLIBS_LIBS) +LDFLAGS += $(STGLIBS_LIBS) + +ifneq ($(OS),darwin) +LDFLAGS += -Wl,-E +endif .PHONY: all clean distclean libs install uninstall install-bin install-data uninstall-bin uninstall-data all: libs $(PROG) ../../Makefile.conf diff --git a/projects/sgconf/build b/projects/sgconf/build index 47706a94..d7b72363 100755 --- a/projects/sgconf/build +++ b/projects/sgconf/build @@ -51,6 +51,13 @@ then MAKE="gmake" fi +if [ "$sys" = "Darwin" ] +then + OS=darwin + ETC_DIR="./inst/freebsd/etc/stargazer" + MAKE="gmake" +fi + if [ "$OS" = "unknown" ] then printf "#############################################################################\n" @@ -77,12 +84,18 @@ else then DEFS="$DEFS -DFREE_BSD" else - DEFS="$DEFS -DFREE_BSD5" if [ "$OS" = "bsd7" ] then + DEFS="$DEFS -DFREE_BSD5" LIB_THREAD=-lpthread else - LIB_THREAD=-lc_r + if [ "$OS" == "darwin" ] + then + DEFS="$DEFS -DDARWIN" + LIB_THREAD=-lpthread + else + LIB_THREAD=-lc_r + fi fi fi fi -- 2.44.2 From c1e94491c9480b4574deeb9bab802ad362c6bc9b Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 1 Aug 2013 13:24:39 +0300 Subject: [PATCH 09/16] Fixed stupid bugs in BPF capturer. --- .../stargazer/plugins/capture/ether_freebsd/ether_cap.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp index 12d35aa6..72e7f73b 100644 --- a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp +++ b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp @@ -289,7 +289,7 @@ strncpy(ifr.ifr_name, bd->iface.c_str(), sizeof(ifr.ifr_name)); if (ioctl(bd->fd, BIOCSBLEN, (caddr_t)&l) < 0) { errorStr = bd->iface + " BIOCSBLEN " + std::string(strerror(errno)); - logger("ioctl (BIOCSBLEN) error for interface '%s': %s", bd->iface, strerror(errno)); + logger("ioctl (BIOCSBLEN) error for interface '%s': %s", bd->iface.c_str(), strerror(errno)); printfd(__FILE__, "ioctl failed: '%s'\n", errorStr.c_str()); return -1; } @@ -297,7 +297,7 @@ if (ioctl(bd->fd, BIOCSBLEN, (caddr_t)&l) < 0) if (ioctl(bd->fd, BIOCSETIF, (caddr_t)&ifr) < 0) { errorStr = bd->iface + " BIOCSETIF " + std::string(strerror(errno)); - logger("ioctl (BIOCSETIF) error for interface '%s': %s", bd->iface, strerror(errno)); + logger("ioctl (BIOCSETIF) error for interface '%s': %s", bd->iface.c_str(), strerror(errno)); printfd(__FILE__, "ioctl failed: '%s'\n", errorStr.c_str()); return -1; } @@ -305,7 +305,7 @@ if (ioctl(bd->fd, BIOCSETIF, (caddr_t)&ifr) < 0) if (ioctl(bd->fd, BIOCIMMEDIATE, &im) < 0) { errorStr = bd->iface + " BIOCIMMEDIATE " + std::string(strerror(errno)); - logger("ioctl (BIOCIMMEDIATE) error for interface '%s': %s", bd->iface, strerror(errno)); + logger("ioctl (BIOCIMMEDIATE) error for interface '%s': %s", bd->iface.c_str(), strerror(errno)); printfd(__FILE__, "ioctl failed: '%s'\n", errorStr.c_str()); return -1; } -- 2.44.2 From 27ac6cd34ada410ecfb322007fa0a9f16a777a89 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 2 Aug 2013 22:09:39 +0300 Subject: [PATCH 10/16] Log all SIGHUP-related activity. --- projects/stargazer/plugins/other/rscript/rscript.cpp | 2 ++ projects/stargazer/plugins/other/smux/smux.cpp | 1 + projects/stargazer/traffcounter_impl.cpp | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/stargazer/plugins/other/rscript/rscript.cpp b/projects/stargazer/plugins/other/rscript/rscript.cpp index d5fab222..936f0c9e 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.cpp +++ b/projects/stargazer/plugins/other/rscript/rscript.cpp @@ -324,6 +324,8 @@ std::for_each(authorizedUsers.begin(), authorizedUsers.end(), UpdateRouter(*this)); +logger("%s reloaded successfully.", rsSettings.GetMapFileName().c_str()); + return 0; } //----------------------------------------------------------------------------- diff --git a/projects/stargazer/plugins/other/smux/smux.cpp b/projects/stargazer/plugins/other/smux/smux.cpp index 31b91bb3..c5d5132b 100644 --- a/projects/stargazer/plugins/other/smux/smux.cpp +++ b/projects/stargazer/plugins/other/smux/smux.cpp @@ -278,6 +278,7 @@ if (Stop()) return -1; if (Start()) return -1; +logger("Reconnected successfully."); return 0; } diff --git a/projects/stargazer/traffcounter_impl.cpp b/projects/stargazer/traffcounter_impl.cpp index 17a786ff..fce47595 100644 --- a/projects/stargazer/traffcounter_impl.cpp +++ b/projects/stargazer/traffcounter_impl.cpp @@ -738,8 +738,8 @@ if (ReadRules(true)) FreeRules(); ReadRules(); -printfd(__FILE__, "TRAFFCOUNTER_IMPL::Reload() - Reload rules successfull.\n"); -WriteServLog("TRAFFCOUNTER: Reload rules successfull."); +printfd(__FILE__, "TRAFFCOUNTER_IMPL::Reload() - Reloaded rules successfully.\n"); +WriteServLog("TRAFFCOUNTER: Reloaded rules successfully."); return 0; } //----------------------------------------------------------------------------- -- 2.44.2 From 7cf29091f8349ba810368707a9c40bf1930ff751 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 2 Aug 2013 22:23:11 +0300 Subject: [PATCH 11/16] Additional logging and small fixes. --- projects/stargazer/plugins/other/rscript/rscript.cpp | 1 + projects/stargazer/plugins/other/smux/smux.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/other/rscript/rscript.cpp b/projects/stargazer/plugins/other/rscript/rscript.cpp index 936f0c9e..fb8cb57c 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.cpp +++ b/projects/stargazer/plugins/other/rscript/rscript.cpp @@ -325,6 +325,7 @@ std::for_each(authorizedUsers.begin(), UpdateRouter(*this)); logger("%s reloaded successfully.", rsSettings.GetMapFileName().c_str()); +printfd(__FILE__, "REMOTE_SCRIPT::Reload() %s reloaded successfully.\n"); return 0; } diff --git a/projects/stargazer/plugins/other/smux/smux.cpp b/projects/stargazer/plugins/other/smux/smux.cpp index c5d5132b..09cb4636 100644 --- a/projects/stargazer/plugins/other/smux/smux.cpp +++ b/projects/stargazer/plugins/other/smux/smux.cpp @@ -278,7 +278,11 @@ if (Stop()) return -1; if (Start()) return -1; -logger("Reconnected successfully."); +if (!needReconnect) + { + printfd(__FILE__, "SMUX reconnected succesfully.\n"); + logger("Reconnected successfully."); + } return 0; } -- 2.44.2 From 52c2acfc00fe7ddad7180b9300a3e89fa8299e24 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sat, 9 Nov 2013 14:23:55 +0200 Subject: [PATCH 12/16] Fixed disconnecting users in rscriptd. --- .../stargazer/plugins/other/rscript/rscript.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/projects/stargazer/plugins/other/rscript/rscript.cpp b/projects/stargazer/plugins/other/rscript/rscript.cpp index fb8cb57c..3bc90792 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.cpp +++ b/projects/stargazer/plugins/other/rscript/rscript.cpp @@ -629,14 +629,25 @@ authorizedUsers.insert(std::make_pair(user->GetCurrIP(), rsu)); void REMOTE_SCRIPT::DelRSU(USER_PTR user) { STG_LOCKER lock(&mutex, __FILE__, __LINE__); -const std::map::iterator it( +std::map::iterator it(authorizedUsers.begin()); +while (it != authorizedUsers.end()) + { + if (it->second.user == user) + { + Send(it->second, true); + authorizedUsers.erase(it); + return; + } + ++it; + } +/*const std::map::iterator it( authorizedUsers.find(user->GetCurrIP()) ); if (it != authorizedUsers.end()) { Send(it->second, true); authorizedUsers.erase(it); - } + }*/ } //----------------------------------------------------------------------------- void RS::IP_NOTIFIER::Notify(const uint32_t & /*oldValue*/, const uint32_t & newValue) -- 2.44.2 From 18990b532c136adc812b80e20cb0b1b226d648d3 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 14 Nov 2013 21:51:58 +0200 Subject: [PATCH 13/16] Fixed typo. --- projects/stargazer/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/main.cpp b/projects/stargazer/main.cpp index 11fad552..200fd2a6 100644 --- a/projects/stargazer/main.cpp +++ b/projects/stargazer/main.cpp @@ -464,7 +464,7 @@ while (true) } break; default: - WriteServLog("Ignore signel %d", sig); + WriteServLog("Ignore signal %d", sig); break; } if (stop) -- 2.44.2 From 60995b1933ff94757d2d29629f324d16070de1ea Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 14 Nov 2013 21:52:16 +0200 Subject: [PATCH 14/16] Implemented IA protocol errors logging. --- include/stg/users.h | 4 +- include/stg/utime.h | 5 ++ .../authorization/inetaccess/inetaccess.cpp | 77 ++++++++++++++++--- .../authorization/inetaccess/inetaccess.h | 4 +- projects/stargazer/user_impl.cpp | 10 ++- projects/stargazer/user_impl.h | 4 +- projects/stargazer/users_impl.cpp | 6 +- projects/stargazer/users_impl.h | 4 +- 8 files changed, 97 insertions(+), 17 deletions(-) diff --git a/include/stg/users.h b/include/stg/users.h index b97a9be5..765fc14d 100644 --- a/include/stg/users.h +++ b/include/stg/users.h @@ -46,7 +46,9 @@ public: virtual bool Authorize(const std::string & login, uint32_t ip, uint32_t enabledDirs, const AUTH * auth) = 0; - virtual bool Unauthorize(const std::string & login, const AUTH * auth) = 0; + virtual bool Unauthorize(const std::string & login, + const AUTH * auth, + const std::string & reason = std::string()) = 0; virtual int ReadUsers() = 0; virtual size_t Count() const = 0; diff --git a/include/stg/utime.h b/include/stg/utime.h index 20da4e43..fe6b3f69 100644 --- a/include/stg/utime.h +++ b/include/stg/utime.h @@ -164,6 +164,11 @@ struct UTIME: public timeval { return tv_usec; } + + double AsDouble() const + { + return tv_sec + tv_usec * 1e-6; + } }; diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp index dd0102b2..5a15a10a 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp @@ -134,6 +134,17 @@ if (ParseIntInRange(pvi->value[0], 15, 1200, &userTimeout)) printfd(__FILE__, "Cannot parse parameter 'UserTimeout'\n"); return -1; } +/////////////////////////// +pv.param = "LogProtocolErrors"; +pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv); +if (pvi == s.moduleParams.end()) + logProtocolErrors = false; +else if (ParseYesNo(pvi->value[0], &logProtocolErrors)) + { + errorStr = "Cannot parse parameter \'LogProtocolErrors\': " + errorStr; + printfd(__FILE__, "Cannot parse parameter 'LogProtocolErrors'\n"); + return -1; + } ///////////////////////////////////////////////////////////// std::string freeMbType; int n = 0; @@ -590,8 +601,11 @@ if (dataLen <= 0) // Error if (dataLen > 256) return -1; +uint32_t sip = outerAddr.sin_addr.s_addr; +uint16_t sport = htons(outerAddr.sin_port); + int protoVer; -if (CheckHeader(buffer, &protoVer)) +if (CheckHeader(buffer, sip, &protoVer)) return -1; char login[PASSWD_LEN]; //TODO why PASSWD_LEN ? @@ -599,9 +613,6 @@ memset(login, 0, PASSWD_LEN); Decrypt(&ctxS, login, buffer + 8, PASSWD_LEN / 8); -uint32_t sip = outerAddr.sin_addr.s_addr; -uint16_t sport = htons(outerAddr.sin_port); - USER_PTR user; if (users->FindByName(login, &user)) { @@ -642,12 +653,14 @@ if (!user->GetProperty().ips.Get().IsIPInIPS(sip)) return PacketProcessor(buffer, dataLen, sip, sport, protoVer, user); } //----------------------------------------------------------------------------- -int AUTH_IA::CheckHeader(const char * buffer, int * protoVer) +int AUTH_IA::CheckHeader(const char * buffer, uint32_t sip, int * protoVer) { if (strncmp(IA_ID, buffer, strlen(IA_ID)) != 0) { //SendError(userIP, updateMsg); printfd(__FILE__, "update needed - IA_ID\n"); + if (iaSettings.LogProtocolErrors()) + logger("IP: %s. Header: invalid packed signature.", inet_ntostring(sip).c_str()); //SendError(userIP, "Incorrect header!"); return -1; } @@ -655,6 +668,8 @@ if (strncmp(IA_ID, buffer, strlen(IA_ID)) != 0) if (buffer[6] != 0) //proto[0] shoud be 0 { printfd(__FILE__, "update needed - PROTO major: %d\n", buffer[6]); + if (iaSettings.LogProtocolErrors()) + logger("IP: %s. Header: invalid protocol major version: %d.", inet_ntostring(sip).c_str(), buffer[6]); //SendError(userIP, updateMsg); return -1; } @@ -664,6 +679,8 @@ if (buffer[7] < 6) // need update //SendError(userIP, updateMsg); printfd(__FILE__, "update needed - PROTO minor: %d\n", buffer[7]); + if (iaSettings.LogProtocolErrors()) + logger("IP: %s. Header: invalid protocol minor version: %d.", inet_ntostring(sip).c_str(), buffer[7]); return -1; } else @@ -691,6 +708,8 @@ while (it != ip2user.end()) if ((it->second.phase.GetPhase() == 2) && (currTime - it->second.phase.GetTime()) > iaSettings.GetUserDelay()) { + if (iaSettings.LogProtocolErrors()) + logger("User '%s'. Protocol version: %d. Phase 2: connect request timeout (%f > %d).", it->second.login.c_str(), it->second.protoVer, (currTime - it->second.phase.GetTime()).AsDouble(), iaSettings.GetUserDelay()); it->second.phase.SetPhase1(); printfd(__FILE__, "Phase changed from 2 to 1. Reason: timeout\n"); ip2user.erase(it++); @@ -733,6 +752,8 @@ while (it != ip2user.end()) if ((currTime - it->second.phase.GetTime()) > iaSettings.GetUserTimeout()) { + if (iaSettings.LogProtocolErrors()) + logger("User '%s'. Protocol version: %d. Phase 3: alive timeout (%f > %d).", it->second.login.c_str(), it->second.protoVer, (currTime - it->second.phase.GetTime()).AsDouble(), iaSettings.GetUserTimeout()); users->Unauthorize(it->second.user->GetLogin(), this); ip2user.erase(it++); continue; @@ -742,6 +763,8 @@ while (it != ip2user.end()) if ((it->second.phase.GetPhase() == 4) && ((currTime - it->second.phase.GetTime()) > iaSettings.GetUserDelay())) { + if (iaSettings.LogProtocolErrors()) + logger("User '%s'. Protocol version: %d. Phase 4: disconnect request timeout (%f > %d).", it->second.login.c_str(), it->second.protoVer, (currTime - it->second.phase.GetTime()).AsDouble(), iaSettings.GetUserDelay()); it->second.phase.SetPhase3(); printfd(__FILE__, "Phase changed from 4 to 3. Reason: timeout\n"); } @@ -1174,6 +1197,8 @@ if ((iaUser->phase.GetPhase() == 2) && (connAck->rnd == iaUser->rnd + 1)) else { errorStr = iaUser->user->GetStrError(); + if (iaSettings.LogProtocolErrors()) + logger("IP: %s. User '%s'. Protocol version: %d. CONN_ACK: phase 2, authorization error ('%s').", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, errorStr.c_str()); iaUser->phase.SetPhase1(); ip2user.erase(sip); printfd(__FILE__, "Phase changed from 2 to 1. Reason: failed to authorize user\n"); @@ -1181,6 +1206,13 @@ if ((iaUser->phase.GetPhase() == 2) && (connAck->rnd == iaUser->rnd + 1)) } } printfd(__FILE__, "Invalid phase or control number. Phase: %d. Control number: %d\n", iaUser->phase.GetPhase(), connAck->rnd); +if (iaSettings.LogProtocolErrors()) + { + if (iaUser->phase.GetPhase() != 2) + logger("IP: %s. User '%s'. Protocol version: %d. CONN_ACK: invalid phase, expected 2, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, iaUser->phase.GetPhase()); + if (connAck->rnd != iaUser->rnd + 1) + logger("IP: %s. User '%s'. Protocol version: %d. CONN_ACK: invalid control number, expected %d, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, (iaUser->rnd + 1), connAck->rnd); + } return -1; } //----------------------------------------------------------------------------- @@ -1210,6 +1242,8 @@ if ((iaUser->phase.GetPhase() == 2) && (connAck->rnd == iaUser->rnd + 1)) else { errorStr = iaUser->user->GetStrError(); + if (iaSettings.LogProtocolErrors()) + logger("IP: %s. User '%s'. Protocol version: %d. CONN_ACK: phase 2, authorization error ('%s').", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, errorStr.c_str()); iaUser->phase.SetPhase1(); ip2user.erase(sip); printfd(__FILE__, "Phase changed from 2 to 1. Reason: failed to authorize user\n"); @@ -1217,6 +1251,13 @@ if ((iaUser->phase.GetPhase() == 2) && (connAck->rnd == iaUser->rnd + 1)) } } printfd(__FILE__, "Invalid phase or control number. Phase: %d. Control number: %d\n", iaUser->phase.GetPhase(), connAck->rnd); +if (iaSettings.LogProtocolErrors()) + { + if (iaUser->phase.GetPhase() != 2) + logger("IP: %s. User '%s'. Protocol version: %d. CONN_ACK: invalid phase, expected 2, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, iaUser->phase.GetPhase()); + if (connAck->rnd != iaUser->rnd + 1) + logger("IP: %s. User '%s'. Protocol version: %d. CONN_ACK: invalid control number, expected %d, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, (iaUser->rnd + 1), connAck->rnd); + } return -1; } //----------------------------------------------------------------------------- @@ -1259,11 +1300,13 @@ if ((iaUser->phase.GetPhase() == 3) && (aliveAck->rnd == iaUser->rnd + 1)) return 0; } //----------------------------------------------------------------------------- -int AUTH_IA::Process_DISCONN_SYN_6(DISCONN_SYN_6 *, IA_USER * iaUser, uint32_t) +int AUTH_IA::Process_DISCONN_SYN_6(DISCONN_SYN_6 *, IA_USER * iaUser, uint32_t sip) { printfd(__FILE__, "DISCONN_SYN_6\n"); if (iaUser->phase.GetPhase() != 3) { + if (iaSettings.LogProtocolErrors()) + logger("IP: %s. User '%s'. Protocol version: %d. DISCONN_SYN: invalid phase, expected 3, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, iaUser->phase.GetPhase()); printfd(__FILE__, "Invalid phase. Expected 3, actual %d\n", iaUser->phase.GetPhase()); errorStr = "Incorrect request DISCONN_SYN"; return -1; @@ -1280,10 +1323,12 @@ int AUTH_IA::Process_DISCONN_SYN_7(DISCONN_SYN_7 * disconnSyn, IA_USER * iaUser, return Process_DISCONN_SYN_6(disconnSyn, iaUser, sip); } //----------------------------------------------------------------------------- -int AUTH_IA::Process_DISCONN_SYN_8(DISCONN_SYN_8 *, IA_USER * iaUser, uint32_t) +int AUTH_IA::Process_DISCONN_SYN_8(DISCONN_SYN_8 *, IA_USER * iaUser, uint32_t sip) { if (iaUser->phase.GetPhase() != 3) { + if (iaSettings.LogProtocolErrors()) + logger("IP: %s. User '%s'. Protocol version: %d. DISCONN_SYN: invalid phase, expected 3, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, iaUser->phase.GetPhase()); errorStr = "Incorrect request DISCONN_SYN"; printfd(__FILE__, "Invalid phase. Expected 3, actual %d\n", iaUser->phase.GetPhase()); return -1; @@ -1297,7 +1342,7 @@ return 0; //----------------------------------------------------------------------------- int AUTH_IA::Process_DISCONN_ACK_6(DISCONN_ACK_6 * disconnAck, IA_USER * iaUser, - uint32_t, + uint32_t sip, std::map::iterator) { #ifdef ARCH_BE @@ -1307,6 +1352,13 @@ SwapBytes(disconnAck->rnd); printfd(__FILE__, "DISCONN_ACK_6\n"); if (!((iaUser->phase.GetPhase() == 4) && (disconnAck->rnd == iaUser->rnd + 1))) { + if (iaSettings.LogProtocolErrors()) + { + if (iaUser->phase.GetPhase() != 4) + logger("IP: %s. User '%s'. Protocol version: %d. DISCONN_ACK: invalid phase, expected 4, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, iaUser->phase.GetPhase()); + if (disconnAck->rnd != iaUser->rnd + 1) + logger("IP: %s. User '%s'. Protocol version: %d. DISCONN_ACK: invalid control number, expected %d, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, (iaUser->rnd + 1), disconnAck->rnd); + } printfd(__FILE__, "Invalid phase or control number. Phase: %d. Control number: %d\n", iaUser->phase.GetPhase(), disconnAck->rnd); return -1; } @@ -1319,7 +1371,7 @@ int AUTH_IA::Process_DISCONN_ACK_7(DISCONN_ACK_7 * disconnAck, IA_USER * iaUser, return Process_DISCONN_ACK_6(disconnAck, iaUser, sip, it); } //----------------------------------------------------------------------------- -int AUTH_IA::Process_DISCONN_ACK_8(DISCONN_ACK_8 * disconnAck, IA_USER * iaUser, uint32_t, std::map::iterator) +int AUTH_IA::Process_DISCONN_ACK_8(DISCONN_ACK_8 * disconnAck, IA_USER * iaUser, uint32_t sip, std::map::iterator) { #ifdef ARCH_BE SwapBytes(disconnAck->len); @@ -1328,6 +1380,13 @@ SwapBytes(disconnAck->rnd); printfd(__FILE__, "DISCONN_ACK_8\n"); if (!((iaUser->phase.GetPhase() == 4) && (disconnAck->rnd == iaUser->rnd + 1))) { + if (iaSettings.LogProtocolErrors()) + { + if (iaUser->phase.GetPhase() != 4) + logger("IP: %s. User '%s'. Protocol version: %d. DISCONN_ACK: invalid phase, expected 4, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, iaUser->phase.GetPhase()); + if (disconnAck->rnd != iaUser->rnd + 1) + logger("IP: %s. User '%s'. Protocol version: %d. DISCONN_ACK: invalid control number, expected %d, got %d.", inet_ntostring(sip).c_str(), iaUser->login.c_str(), iaUser->protoVer, (iaUser->rnd + 1), disconnAck->rnd); + } printfd(__FILE__, "Invalid phase or control number. Phase: %d. Control number: %d\n", iaUser->phase.GetPhase(), disconnAck->rnd); return -1; } diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h index a13a11db..87350556 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h @@ -209,6 +209,7 @@ public: int GetUserTimeout() const { return userTimeout; } uint16_t GetUserPort() const { return port; } FREEMB GetFreeMbShowType() const { return freeMbShowType; } + bool LogProtocolErrors() const { return logProtocolErrors; } private: int userDelay; @@ -216,6 +217,7 @@ private: uint16_t port; std::string errorStr; FREEMB freeMbShowType; + bool logProtocolErrors; }; //----------------------------------------------------------------------------- class AUTH_IA; @@ -266,7 +268,7 @@ private: int FinalizeNet(); void DelUser(USER_PTR u); int RecvData(char * buffer, int bufferSize); - int CheckHeader(const char * buffer, int * protoVer); + int CheckHeader(const char * buffer, uint32_t sip, int * protoVer); int PacketProcessor(void * buff, size_t dataLen, uint32_t sip, uint16_t sport, int protoVer, USER_PTR user); int Process_CONN_SYN_6(CONN_SYN_6 * connSyn, IA_USER * iaUser, uint32_t sip); diff --git a/projects/stargazer/user_impl.cpp b/projects/stargazer/user_impl.cpp index 5bb0069f..37178dd6 100644 --- a/projects/stargazer/user_impl.cpp +++ b/projects/stargazer/user_impl.cpp @@ -544,7 +544,7 @@ ScanMessage(); return 0; } //----------------------------------------------------------------------------- -void USER_IMPL::Unauthorize(const AUTH * auth) +void USER_IMPL::Unauthorize(const AUTH * auth, const std::string & reason) { STG_LOCKER lock(&mutex, __FILE__, __LINE__); /* @@ -555,6 +555,7 @@ if (!authorizedBy.erase(auth)) if (authorizedBy.empty()) { + lastDisconnectReason = reason; lastIPForDisconnect = currIP; currIP = 0; // DelUser in traffcounter return; @@ -673,7 +674,12 @@ if (!fakeDisconnect) connected = false; } -if (store->WriteUserDisconnect(login, up, down, sessionUpload, sessionDownload, cash, freeMb, reason)) +std::string reasonMessage(reason); +if (!lastDisconnectReason.empty()) + reasonMessage += ": " + lastDisconnectReason; + +if (store->WriteUserDisconnect(login, up, down, sessionUpload, sessionDownload, + cash, freeMb, reasonMessage)) { WriteServLog("Cannot write disconnect for user %s.", login.c_str()); WriteServLog("%s", store->GetStrError().c_str()); diff --git a/projects/stargazer/user_impl.h b/projects/stargazer/user_impl.h index a581f2e5..6f6030ca 100644 --- a/projects/stargazer/user_impl.h +++ b/projects/stargazer/user_impl.h @@ -185,7 +185,8 @@ public: time_t GetConnectedModificationTime() const { return connected.ModificationTime(); } int GetAuthorized() const { return static_cast(authorizedBy.size()); } int Authorize(uint32_t ip, uint32_t enabledDirs, const AUTH * auth); - void Unauthorize(const AUTH * auth); + void Unauthorize(const AUTH * auth, + const std::string & reason = std::string()); bool IsAuthorizedBy(const AUTH * auth) const; std::vector GetAuthorizers() const; @@ -249,6 +250,7 @@ private: USER_PROPERTY currIP; uint32_t lastIPForDisconnect; // User's ip after unauth but before disconnect + std::string lastDisconnectReason; time_t pingTime; diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp index c4f63c64..97b4bbbc 100644 --- a/projects/stargazer/users_impl.cpp +++ b/projects/stargazer/users_impl.cpp @@ -298,7 +298,9 @@ AddToIPIdx(iter); return true; } //----------------------------------------------------------------------------- -bool USERS_IMPL::Unauthorize(const std::string & login, const AUTH * auth) +bool USERS_IMPL::Unauthorize(const std::string & login, + const AUTH * auth, + const std::string & reason) { user_iter iter; STG_LOCKER lock(&mutex, __FILE__, __LINE__); @@ -310,7 +312,7 @@ if (FindByNameNonLock(login, &iter)) uint32_t ip = iter->GetCurrIP(); -iter->Unauthorize(auth); +iter->Unauthorize(auth, reason); if (!iter->GetAuthorized()) DelFromIPIdx(ip); diff --git a/projects/stargazer/users_impl.h b/projects/stargazer/users_impl.h index 0c2af78d..70a5b9bd 100644 --- a/projects/stargazer/users_impl.h +++ b/projects/stargazer/users_impl.h @@ -95,7 +95,9 @@ public: bool Authorize(const std::string & login, uint32_t ip, uint32_t enabledDirs, const AUTH * auth); - bool Unauthorize(const std::string & login, const AUTH * auth); + bool Unauthorize(const std::string & login, + const AUTH * auth, + const std::string & reason = std::string()); int ReadUsers(); size_t Count() const { return users.size(); } -- 2.44.2 From 2a9477404c03229fc3be39f1b8c95b148fd227b2 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 14 Nov 2013 22:26:21 +0200 Subject: [PATCH 15/16] Added parameter description. --- .../etc/stargazer/conf-available.d/mod_ia.conf | 14 ++++++++++---- .../etc/stargazer/conf-available.d/mod_ia.conf | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_ia.conf b/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_ia.conf index 69b5eae3..df170dd0 100644 --- a/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_ia.conf +++ b/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_ia.conf @@ -8,14 +8,14 @@ # The time interval between sending an alive query to the user # and updating statistics - # Parameter: required + # Parameter: required # Values: 5 ... 600 (seconds) # Default: 60 UserDelay = 60 - # User timeout. If authorizer does not respond during this time, + # User timeout. If authorizer does not respond during this time, # the user will be disconnected - # Parameter: required + # Parameter: required # Values: 5 ... 600 # Default: 60 UserTimeout = 65 @@ -31,8 +31,14 @@ # FreeMb = cash - amount of money for which the user can download for free # FreeMb = none - no transfer # Default: cash - # Parameter: required + # Parameter: required # Values: different, see above # Default: cash FreeMb = cash + + # Enable protocol errors logging + # Parameter: optional + # Values: yes, no + # Default: no + # LogProtocolErrors = no diff --git a/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_ia.conf b/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_ia.conf index 69b5eae3..df170dd0 100644 --- a/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_ia.conf +++ b/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_ia.conf @@ -8,14 +8,14 @@ # The time interval between sending an alive query to the user # and updating statistics - # Parameter: required + # Parameter: required # Values: 5 ... 600 (seconds) # Default: 60 UserDelay = 60 - # User timeout. If authorizer does not respond during this time, + # User timeout. If authorizer does not respond during this time, # the user will be disconnected - # Parameter: required + # Parameter: required # Values: 5 ... 600 # Default: 60 UserTimeout = 65 @@ -31,8 +31,14 @@ # FreeMb = cash - amount of money for which the user can download for free # FreeMb = none - no transfer # Default: cash - # Parameter: required + # Parameter: required # Values: different, see above # Default: cash FreeMb = cash + + # Enable protocol errors logging + # Parameter: optional + # Values: yes, no + # Default: no + # LogProtocolErrors = no -- 2.44.2 From 04711171fa39f7b76f5f4f291a016ddbe4ddcccd Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 30 May 2014 11:02:02 +0300 Subject: [PATCH 16/16] Fixed XML. --- projects/stargazer/plugins/configuration/sgconfig/parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser.cpp b/projects/stargazer/plugins/configuration/sgconfig/parser.cpp index b6c49172..431d17f3 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/parser.cpp +++ b/projects/stargazer/plugins/configuration/sgconfig/parser.cpp @@ -289,7 +289,7 @@ answerList->push_back(s); s = ""; std::vector list(u->GetAuthorizers()); for (std::vector::const_iterator it = list.begin(); it != list.end(); ++it) - s += ""; + s += ""; s += ""; answerList->push_back(s); -- 2.44.2