From 79a8ef3a60523ccbd2e0714407a209a156c93b2d Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Tue, 7 Feb 2012 12:30:34 +0200 Subject: [PATCH 01/16] C-style pointer cast replaced with normal static_cast --- projects/stargazer/users_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp index 61ee90ff..fc2b8d2f 100644 --- a/projects/stargazer/users_impl.cpp +++ b/projects/stargazer/users_impl.cpp @@ -359,7 +359,7 @@ sigfillset(&signalSet); pthread_sigmask(SIG_BLOCK, &signalSet, NULL); printfd(__FILE__, "=====================| pid: %d |===================== \n", getpid()); -USERS_IMPL * us = (USERS_IMPL*) d; +USERS_IMPL * us = static_cast(d); struct tm t; time_t tt = stgTime; -- 2.44.2 From 251f3f94c0813a2b6950e38a854ea980042152f4 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Tue, 7 Feb 2012 12:32:55 +0200 Subject: [PATCH 02/16] Unused struct member removed --- projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp b/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp index 60672048..a949433e 100644 --- a/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp +++ b/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp @@ -54,7 +54,6 @@ $Date: 2010/09/10 06:43:03 $ struct DIVERT_DATA { int sock; short int port; -unsigned char buffer[BUFF_LEN]; char iface[10]; }; //----------------------------------------------------------------------------- -- 2.44.2 From 6f32961aa7316bf314ff18f3bc74d77a73c081ca Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Tue, 7 Feb 2012 12:35:22 +0200 Subject: [PATCH 03/16] Unused variable removed --- projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp index 5835d077..24705111 100644 --- a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp +++ b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp @@ -73,8 +73,6 @@ return bcc.GetPlugin(); //----------------------------------------------------------------------------- int BPF_CAP_SETTINGS::ParseSettings(const MODULE_SETTINGS & s) { -std::string ifaces; - iface.erase(iface.begin(), iface.end()); if (s.moduleParams.empty()) -- 2.44.2 From 2e6fab3ee7df25d343fb30b006126e7817dfeb12 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Tue, 7 Feb 2012 12:35:40 +0200 Subject: [PATCH 04/16] C-style cast replaced with sattic_cast --- projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp b/projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp index 632c1846..093aea72 100644 --- a/projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp +++ b/projects/stargazer/plugins/capture/ether_linux/ether_cap.cpp @@ -154,7 +154,7 @@ sigset_t signalSet; sigfillset(&signalSet); pthread_sigmask(SIG_BLOCK, &signalSet, NULL); -ETHER_CAP * dc = (ETHER_CAP *)d; +ETHER_CAP * dc = static_cast(d); dc->isRunning = true; struct ETH_IP -- 2.44.2 From b95edc0574dc2ebc65b197b1b1ad464821dfe519 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Tue, 7 Feb 2012 12:41:33 +0200 Subject: [PATCH 05/16] Minor echo fix --- projects/sgauth/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sgauth/Makefile b/projects/sgauth/Makefile index 88e1fb9c..99cd0e47 100644 --- a/projects/sgauth/Makefile +++ b/projects/sgauth/Makefile @@ -87,7 +87,7 @@ endif deps: $(SRCS) ../../Makefile.conf sgauth.css $(MAKE) -C $(DIR_LIBSRC) @>deps ;\ - ./make_css.sh + ./make_css.sh ;\ for file in $(SRCS); do\ echo "$$file" | grep ".c$$" > /dev/null;\ if [ $$? -eq 0 ];\ -- 2.44.2 From 78c67dad18539233b81cfb16144339dc389d5981 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 9 Feb 2012 10:47:57 +0200 Subject: [PATCH 06/16] Add to fix missing header in xmlrpc-c --- .../plugins/configuration/rpcconfig/admins_methods.cpp | 2 ++ .../stargazer/plugins/configuration/rpcconfig/info_methods.cpp | 2 ++ .../plugins/configuration/rpcconfig/messages_methods.cpp | 2 ++ .../stargazer/plugins/configuration/rpcconfig/rpcconfig.cpp | 2 ++ .../stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp | 2 ++ .../plugins/configuration/rpcconfig/tariffs_methods.cpp | 2 ++ 6 files changed, 12 insertions(+) diff --git a/projects/stargazer/plugins/configuration/rpcconfig/admins_methods.cpp b/projects/stargazer/plugins/configuration/rpcconfig/admins_methods.cpp index 3607a806..0016babe 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/admins_methods.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/admins_methods.cpp @@ -1,3 +1,5 @@ +#include // xmlrpc-c devs have missed something :) + #include "stg/common.h" #include "admins_methods.h" #include "rpcconfig.h" diff --git a/projects/stargazer/plugins/configuration/rpcconfig/info_methods.cpp b/projects/stargazer/plugins/configuration/rpcconfig/info_methods.cpp index b971c638..c4684c1b 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/info_methods.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/info_methods.cpp @@ -1,5 +1,7 @@ #include +#include // xmlrpc-c devs have missed something :) + #include "stg/version.h" #include "stg/common.h" #include "info_methods.h" diff --git a/projects/stargazer/plugins/configuration/rpcconfig/messages_methods.cpp b/projects/stargazer/plugins/configuration/rpcconfig/messages_methods.cpp index 14319aa1..e4d05636 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/messages_methods.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/messages_methods.cpp @@ -1,3 +1,5 @@ +#include // xmlrpc-c devs have missed something :) + #include "stg/message.h" #include "stg/common.h" #include "utils.h" diff --git a/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.cpp b/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.cpp index d4419b40..56a188f1 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -9,6 +10,7 @@ #include #include #include +#include // xmlrpc-c devs have missed something :) #include "stg/common.h" #include "stg/admin.h" diff --git a/projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp b/projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp index 91f60062..fad12886 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp @@ -1,3 +1,5 @@ +#include // xmlrpc-c devs have missed something :) + #include "tariff_helper.h" void TARIFF_HELPER::GetTariffInfo(xmlrpc_c::value * info) const diff --git a/projects/stargazer/plugins/configuration/rpcconfig/tariffs_methods.cpp b/projects/stargazer/plugins/configuration/rpcconfig/tariffs_methods.cpp index 1643fbef..77d73b02 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/tariffs_methods.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/tariffs_methods.cpp @@ -1,3 +1,5 @@ +#include // xmlrpc-c devs have missed something :) + #include "tariffs_methods.h" #include "rpcconfig.h" #include "tariff_helper.h" -- 2.44.2 From daa6cb18a0ff8451a9599905a01d66d6515fdb86 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 9 Feb 2012 11:19:16 +0200 Subject: [PATCH 07/16] Plugin loading order fixed --- projects/stargazer/plugins/authorization/ao/ao.h | 4 ++-- .../stargazer/plugins/authorization/inetaccess/inetaccess.h | 4 ++-- projects/stargazer/plugins/authorization/stress/stress.cpp | 4 ++-- projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp | 4 ++-- projects/stargazer/plugins/capture/cap_nf/cap_nf.h | 4 ++-- .../stargazer/plugins/capture/divert_freebsd/divert_cap.h | 4 ++-- projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h | 4 ++-- projects/stargazer/plugins/capture/ether_linux/ether_cap.h | 4 ++-- projects/stargazer/plugins/capture/ipq_linux/ipq_cap.h | 4 ++-- .../stargazer/plugins/configuration/rpcconfig/rpcconfig.h | 4 ++-- .../stargazer/plugins/configuration/sgconfig-ng/stgconfig.h | 4 ++-- projects/stargazer/plugins/configuration/sgconfig/stgconfig.h | 4 ++-- .../stargazer/plugins/configuration/sgconfig2/stgconfig.cpp | 4 ++-- .../stargazer/plugins/configuration/xrconfig/xrconfig.cpp | 4 ++-- projects/stargazer/plugins/other/ping/ping.h | 4 ++-- projects/stargazer/plugins/other/radius/radius.h | 4 ++-- projects/stargazer/plugins/other/rscript/rscript.h | 4 ++-- projects/stargazer/plugins/other/smux/smux.h | 4 ++-- projects/stargazer/plugins/other/userstat/userstat.h | 4 ++-- 19 files changed, 38 insertions(+), 38 deletions(-) diff --git a/projects/stargazer/plugins/authorization/ao/ao.h b/projects/stargazer/plugins/authorization/ao/ao.h index fe267c4e..205ebf5a 100644 --- a/projects/stargazer/plugins/authorization/ao/ao.h +++ b/projects/stargazer/plugins/authorization/ao/ao.h @@ -94,8 +94,8 @@ public: int ParseSettings() { return 0; } const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const; - uint16_t GetStartPosition() const { return 70; } - uint16_t GetStopPosition() const { return 70; } + uint16_t GetStartPosition() const { return 30; } + uint16_t GetStopPosition() const { return 30; } void AddUser(USER_PTR u); void DelUser(USER_PTR u); diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h index 1158955f..d0f6b5ac 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h @@ -252,8 +252,8 @@ public: const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const { return "InetAccess authorization plugin v.1.4"; } - uint16_t GetStartPosition() const { return 50; } - uint16_t GetStopPosition() const { return 50; } + uint16_t GetStartPosition() const { return 30; } + uint16_t GetStopPosition() const { return 30; } int SendMessage(const STG_MSG & msg, uint32_t ip) const; diff --git a/projects/stargazer/plugins/authorization/stress/stress.cpp b/projects/stargazer/plugins/authorization/stress/stress.cpp index 7273ed48..39e74b0d 100644 --- a/projects/stargazer/plugins/authorization/stress/stress.cpp +++ b/projects/stargazer/plugins/authorization/stress/stress.cpp @@ -205,12 +205,12 @@ return isRunning; //----------------------------------------------------------------------------- uint16_t AUTH_STRESS::GetStartPosition() const { -return 70; +return 30; } //----------------------------------------------------------------------------- uint16_t AUTH_STRESS::GetStopPosition() const { -return 70; +return 30; } //----------------------------------------------------------------------------- void AUTH_STRESS::SetUserNotifiers(USER_PTR u) diff --git a/projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp b/projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp index 595c45fc..85fd602b 100644 --- a/projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp +++ b/projects/stargazer/plugins/capture/cap_debug/debug_cap.cpp @@ -434,12 +434,12 @@ return NULL; //----------------------------------------------------------------------------- uint16_t DEBUG_CAP::GetStartPosition() const { -return 0; +return 40; } //----------------------------------------------------------------------------- uint16_t DEBUG_CAP::GetStopPosition() const { -return 0; +return 40; } //----------------------------------------------------------------------------- RAW_PACKET MakeTCPPacket(const char * src, diff --git a/projects/stargazer/plugins/capture/cap_nf/cap_nf.h b/projects/stargazer/plugins/capture/cap_nf/cap_nf.h index e6961643..43d6e098 100644 --- a/projects/stargazer/plugins/capture/cap_nf/cap_nf.h +++ b/projects/stargazer/plugins/capture/cap_nf/cap_nf.h @@ -39,8 +39,8 @@ $Author: faust $ #include "stg/module_settings.h" #define VERSION "CAP_NF v. 0.4" -#define START_POS 10 -#define STOP_POS 10 +#define START_POS 40 +#define STOP_POS 40 class USERS; class USER; diff --git a/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h b/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h index 65ee87d3..62a78a43 100644 --- a/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h +++ b/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h @@ -59,8 +59,8 @@ public: int ParseSettings(); const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const; - uint16_t GetStartPosition() const { return 10; } - uint16_t GetStopPosition() const { return 10; } + uint16_t GetStartPosition() const { return 40; } + uint16_t GetStopPosition() const { return 40; } private: DIVERT_CAP(const DIVERT_CAP & rvalue); diff --git a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h index 8f7e1f2f..ad9ff9f1 100644 --- a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h +++ b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h @@ -107,8 +107,8 @@ public: const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const; - uint16_t GetStartPosition() const { return 10; } - uint16_t GetStopPosition() const { return 10; } + uint16_t GetStartPosition() const { return 40; } + uint16_t GetStopPosition() const { return 40; } private: BPF_CAP(const BPF_CAP & rvalue); diff --git a/projects/stargazer/plugins/capture/ether_linux/ether_cap.h b/projects/stargazer/plugins/capture/ether_linux/ether_cap.h index 64560ca4..44c4ae7e 100644 --- a/projects/stargazer/plugins/capture/ether_linux/ether_cap.h +++ b/projects/stargazer/plugins/capture/ether_linux/ether_cap.h @@ -59,8 +59,8 @@ public: int ParseSettings() { return 0; } const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const; - uint16_t GetStartPosition() const { return 10; } - uint16_t GetStopPosition() const { return 10; } + uint16_t GetStartPosition() const { return 40; } + uint16_t GetStopPosition() const { return 40; } private: ETHER_CAP(const ETHER_CAP & rvalue); diff --git a/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.h b/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.h index 308234b4..7c78da89 100644 --- a/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.h +++ b/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.h @@ -54,8 +54,8 @@ public: int ParseSettings() { return 0; } const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const; - uint16_t GetStartPosition() const { return 10; } - uint16_t GetStopPosition() const { return 10; } + uint16_t GetStartPosition() const { return 40; } + uint16_t GetStopPosition() const { return 40; } private: IPQ_CAP(const IPQ_CAP & rvalue); diff --git a/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.h b/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.h index 87ef9470..8525f889 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.h +++ b/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.h @@ -76,8 +76,8 @@ public: const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const { return RPC_CONFIG_VERSION; } - uint16_t GetStartPosition() const { return 220; } - uint16_t GetStopPosition() const { return 220; } + uint16_t GetStartPosition() const { return 20; } + uint16_t GetStopPosition() const { return 20; } bool GetAdminInfo(const std::string & cookie, ADMIN_INFO * info); diff --git a/projects/stargazer/plugins/configuration/sgconfig-ng/stgconfig.h b/projects/stargazer/plugins/configuration/sgconfig-ng/stgconfig.h index fd3a9e62..7678c8b0 100644 --- a/projects/stargazer/plugins/configuration/sgconfig-ng/stgconfig.h +++ b/projects/stargazer/plugins/configuration/sgconfig-ng/stgconfig.h @@ -40,8 +40,8 @@ public: const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const { return PLUGIN_VERSION; } - uint16_t GetStartPosition() const { return 220; } - uint16_t GetStopPosition() const { return 220; } + uint16_t GetStartPosition() const { return 20; } + uint16_t GetStopPosition() const { return 20; } private: USERS * users; diff --git a/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h b/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h index 9db9fd93..cdce9668 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h +++ b/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h @@ -45,8 +45,8 @@ public: const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const; - uint16_t GetStartPosition() const { return 220; } - uint16_t GetStopPosition() const { return 220; } + uint16_t GetStartPosition() const { return 20; } + uint16_t GetStopPosition() const { return 20; } private: STG_CONFIG(const STG_CONFIG & rvalue); diff --git a/projects/stargazer/plugins/configuration/sgconfig2/stgconfig.cpp b/projects/stargazer/plugins/configuration/sgconfig2/stgconfig.cpp index c5864cc4..f08286ca 100644 --- a/projects/stargazer/plugins/configuration/sgconfig2/stgconfig.cpp +++ b/projects/stargazer/plugins/configuration/sgconfig2/stgconfig.cpp @@ -155,12 +155,12 @@ return NULL; uint16_t STG_CONFIG::GetStartPosition() const { -return 220; +return 20; } uint16_t STG_CONFIG::GetStopPosition() const { -return 220; +return 20; } bool PrepareNetwork() diff --git a/projects/stargazer/plugins/configuration/xrconfig/xrconfig.cpp b/projects/stargazer/plugins/configuration/xrconfig/xrconfig.cpp index 1b9237ca..e23df01d 100644 --- a/projects/stargazer/plugins/configuration/xrconfig/xrconfig.cpp +++ b/projects/stargazer/plugins/configuration/xrconfig/xrconfig.cpp @@ -180,12 +180,12 @@ return NULL; //----------------------------------------------------------------------------- uint16_t XR_CONFIG::GetStartPosition() const { -return 221; +return 20; } //----------------------------------------------------------------------------- uint16_t XR_CONFIG::GetStopPosition() const { -return 221; +return 20; } //----------------------------------------------------------------------------- int XR_CONFIG::SetUserCash(const string & admLogin, const string & usrLogin, double cash) const diff --git a/projects/stargazer/plugins/other/ping/ping.h b/projects/stargazer/plugins/other/ping/ping.h index 63b86a6e..6c31eb95 100644 --- a/projects/stargazer/plugins/other/ping/ping.h +++ b/projects/stargazer/plugins/other/ping/ping.h @@ -116,8 +116,8 @@ public: const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const { return "Pinger v.1.01"; } - uint16_t GetStartPosition() const { return 100; } - uint16_t GetStopPosition() const { return 100; } + uint16_t GetStartPosition() const { return 10; } + uint16_t GetStopPosition() const { return 10; } void AddUser(USER_PTR u); void DelUser(USER_PTR u); diff --git a/projects/stargazer/plugins/other/radius/radius.h b/projects/stargazer/plugins/other/radius/radius.h index 731753a0..92cfcab2 100644 --- a/projects/stargazer/plugins/other/radius/radius.h +++ b/projects/stargazer/plugins/other/radius/radius.h @@ -102,8 +102,8 @@ public: const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const { return "RADIUS data access plugin v 0.6"; } - uint16_t GetStartPosition() const { return 20; } - uint16_t GetStopPosition() const { return 20; } + uint16_t GetStartPosition() const { return 30; } + uint16_t GetStopPosition() const { return 30; } int SendMessage(const STG_MSG &, uint32_t) const { return 0; } diff --git a/projects/stargazer/plugins/other/rscript/rscript.h b/projects/stargazer/plugins/other/rscript/rscript.h index 461fcacd..794c4c2b 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.h +++ b/projects/stargazer/plugins/other/rscript/rscript.h @@ -170,8 +170,8 @@ public: const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const { return "Remote script v 0.3"; } - uint16_t GetStartPosition() const { return 20; } - uint16_t GetStopPosition() const { return 20; } + uint16_t GetStartPosition() const { return 10; } + uint16_t GetStopPosition() const { return 10; } void DelUser(USER_PTR u) { UnSetUserNotifier(u); } void AddUser(USER_PTR u) { SetUserNotifier(u); } diff --git a/projects/stargazer/plugins/other/smux/smux.h b/projects/stargazer/plugins/other/smux/smux.h index 9d0e516d..24f7de32 100644 --- a/projects/stargazer/plugins/other/smux/smux.h +++ b/projects/stargazer/plugins/other/smux/smux.h @@ -122,8 +122,8 @@ public: const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const { return "Stg SMUX Plugin 1.1"; } - uint16_t GetStartPosition() const { return 100; } - uint16_t GetStopPosition() const { return 100; } + uint16_t GetStartPosition() const { return 10; } + uint16_t GetStopPosition() const { return 10; } bool UpdateTables(); diff --git a/projects/stargazer/plugins/other/userstat/userstat.h b/projects/stargazer/plugins/other/userstat/userstat.h index 1c5776f8..18b128c1 100644 --- a/projects/stargazer/plugins/other/userstat/userstat.h +++ b/projects/stargazer/plugins/other/userstat/userstat.h @@ -56,8 +56,8 @@ public: virtual bool IsRunning() { return isRunning; } virtual const string & GetStrError() const { return errorStr; } virtual const string GetVersion() const { return version; } - virtual uint16_t GetStartPosition() const { return 0; } - virtual uint16_t GetStopPosition() const { return 0; } + virtual uint16_t GetStartPosition() const { return 10; } + virtual uint16_t GetStopPosition() const { return 10; } private: struct IsDone : public unary_function -- 2.44.2 From 865babd697ac02050f82ea4b4bd3e0cc703c827e Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 9 Feb 2012 12:14:43 +0200 Subject: [PATCH 08/16] ChangeLog update --- ChangeLog | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 971c2f2e..8a91cbc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ General: * Большая часть кода приведена в соответствие с рекомендациями Скотта Мейерса. * Вычищена куча кода. Но это еще не конец. + * Исправлена ошибка установки в случае наличия предыдущей установки. + * Добавлена поддержка FreeBSD9. Compilation: * При проверке условий сборки теперь используются переменные CC и CXX @@ -29,6 +31,7 @@ Compilation: и gcc, и clang и ekopath). * Существенно переработана система сборки. Теперь она не сорит заголовочными файлами и библотеками там где не нужно. + * Убрана зависимость от bash. Libraries: * Использование динамических внутренних библиотек признано @@ -37,6 +40,7 @@ Libraries: * Добавлена специализация x2str для беззнаковых типов. * Библиотеки crypto.lib и scriptexecuter.lib теперь содержат 100% кода на языке C! + * Исправлена работа библиотеки ia.lib на платформах с Big Endian. Plugins: * В плагин для PostgreSQL добавлен параметр retries указывающий количество @@ -79,6 +83,9 @@ Plugins: корректной остановки плагина. Привет мейнтейнерам Debian которые до сих пор не обновили xmlrpc-c! Зато минус одно падение с SIGSEGV и General Protection Fault при останове! + * Плагин remote_script больше не сообщает об ошибке и позволяет системе + запуститься если файл привязки подсетей пуст. + * Пересмотрен порядок загрузки плагинов. stargazer: * Исправлена ошибка приводящая к неправильному сообщению о причине @@ -95,7 +102,3 @@ stargazer: USERS что позволило избавиться от дедлока в определенных условиях. * Устранена возможность выгрузки активного плагина. Минус одно потенциальное падение с SIGSEGV и General Protection Fault! - -rscriptd: - * В примере конфигурационного файла для rscriptd путь /etc/rscriptd - заменен на /etc/stargazer. -- 2.44.2 From 6fea72fd20cb3c2f7d0203b50b5e200ca4a930bf Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 9 Feb 2012 13:24:37 +0200 Subject: [PATCH 09/16] Minor ChangeLog fix --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8a91cbc1..cca2afcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ General: * Вычищена куча кода. Но это еще не конец. * Исправлена ошибка установки в случае наличия предыдущей установки. * Добавлена поддержка FreeBSD9. + * Структура базы для Firebird больше не создается при make install-data, + нужно создавать вручную. Compilation: * При проверке условий сборки теперь используются переменные CC и CXX @@ -63,6 +65,7 @@ Plugins: - количество абонентов с положительным кредитом; - количество абонентов с положительным предоплаченным трафиком; - количество абонентов меняющих тарифный план в следующем месяце; + - количество абонентов с ненулевым трафиком за сессию; - общее количество тарифов; - количество абонентов потарифно; - общее количество админов; -- 2.44.2 From 89f1d1cdd56a9caf4fe87d54f9dbeaa6b50774ed Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 9 Feb 2012 15:00:17 +0200 Subject: [PATCH 10/16] Snake replaced with Camel --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cca2afcf..0879a49e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ General: - * Стандартизован стиль именования параметров: SnakeCase. + * Стандартизован стиль именования параметров: CamelCase. * В документации к XML-RPC API добавлено пропущенное поле 'password' для метода chg_admin. * Приведена в порядок работа с сигналами. Теперь сигналы перехватываются -- 2.44.2 From 436c79ec702363fc2c13dfc794334b1c1b331c1c Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 16 Feb 2012 14:20:24 +0200 Subject: [PATCH 11/16] Default scripts search path changed for rscriptd --- projects/rscriptd/rscriptd.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/rscriptd/rscriptd.conf b/projects/rscriptd/rscriptd.conf index 96f5d465..d668d46a 100644 --- a/projects/rscriptd/rscriptd.conf +++ b/projects/rscriptd/rscriptd.conf @@ -4,5 +4,5 @@ ConfigDir=/etc/rscriptd Password=123456 Port=9999 UserTimeout=60 -ScriptOnConnect=/etc/stargazer/OnConnect -ScriptOnDisconnect=/etc/stargazer/OnDisconnect +ScriptOnConnect=/etc/rscriptd/OnConnect +ScriptOnDisconnect=/etc/rscriptd/OnDisconnect -- 2.44.2 From c2b2f6538f1c946c2da36cde22b43c174ea19a34 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sun, 26 Feb 2012 14:29:12 +0200 Subject: [PATCH 12/16] Fix dependency on fbclient for mod_store_firebird.so --- projects/stargazer/plugins/store/firebird/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/stargazer/plugins/store/firebird/Makefile b/projects/stargazer/plugins/store/firebird/Makefile index b4cce929..be9b4373 100644 --- a/projects/stargazer/plugins/store/firebird/Makefile +++ b/projects/stargazer/plugins/store/firebird/Makefile @@ -22,5 +22,11 @@ STGLIBS = ibpp \ locker \ crypto +FB_CFLAGS = $(shell fb_config --cflags) +FB_LDFLAGS = $(shell fb_config --libs) + +CXXFLAGS += $(FB_CFLAGS) +LDFLAGS += $(FB_LDFLAGS) + include ../../Makefile.in -- 2.44.2 From d7d8cffb85a42301bac662c4e2cd3f36ae50a66a Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Wed, 29 Feb 2012 14:59:03 +0200 Subject: [PATCH 13/16] New fee charge algo added --- projects/stargazer/settings_impl.cpp | 2 +- projects/stargazer/user_impl.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/stargazer/settings_impl.cpp b/projects/stargazer/settings_impl.cpp index 2bf8d082..16a2ac47 100644 --- a/projects/stargazer/settings_impl.cpp +++ b/projects/stargazer/settings_impl.cpp @@ -375,7 +375,7 @@ while (node) if (strcasecmp(node->getName(), "FeeChargeType") == 0) { - if (ParseUnsignedInRange(node->getValue(0), 0, 2, &feeChargeType) != 0) + if (ParseUnsignedInRange(node->getValue(0), 0, 3, &feeChargeType) != 0) { strError = "Incorrect FeeChargeType value: \'" + string(node->getValue(0)) + "\'"; return -1; diff --git a/projects/stargazer/user_impl.cpp b/projects/stargazer/user_impl.cpp index 733e6256..3639060a 100644 --- a/projects/stargazer/user_impl.cpp +++ b/projects/stargazer/user_impl.cpp @@ -1250,6 +1250,10 @@ switch (settings->GetFeeChargeType()) if (c + credit >= fee) property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge"); break; + case 3: + if (c >= 0) + property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge"); + break; } ResetPassiveTime(); } @@ -1312,6 +1316,13 @@ switch (settings->GetFeeChargeType()) SetPrepaidTraff(); } break; + case 3: + if (c >= 0) + { + property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge"); + SetPrepaidTraff(); + } + break; } } //----------------------------------------------------------------------------- -- 2.44.2 From b6f9db38b4be65b8893ae726a6d78e7ac657dc35 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Wed, 29 Feb 2012 15:01:14 +0200 Subject: [PATCH 14/16] Fix occasional crash on second and more reload in SMUX plugin --- projects/stargazer/plugins/other/smux/smux.cpp | 1 + projects/stargazer/plugins/other/smux/smux.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/other/smux/smux.cpp b/projects/stargazer/plugins/other/smux/smux.cpp index f1c94d11..551a28f1 100644 --- a/projects/stargazer/plugins/other/smux/smux.cpp +++ b/projects/stargazer/plugins/other/smux/smux.cpp @@ -473,4 +473,5 @@ while (it != notifiers.end()) it->GetUserPtr()->GetProperty().tariffName.DelAfterNotifier(&(*it)); ++it; } +notifiers.clear(); } diff --git a/projects/stargazer/plugins/other/smux/smux.h b/projects/stargazer/plugins/other/smux/smux.h index 24f7de32..adeb50af 100644 --- a/projects/stargazer/plugins/other/smux/smux.h +++ b/projects/stargazer/plugins/other/smux/smux.h @@ -65,7 +65,7 @@ public: smux(rvalue.smux), userPtr(rvalue.userPtr) {} void Notify(const std::string &, const std::string &); - USER_PTR GetUserPtr() { return userPtr; } + USER_PTR GetUserPtr() const { return userPtr; } private: CHG_AFTER_NOTIFIER & operator=(const CHG_AFTER_NOTIFIER & rvalue); -- 2.44.2 From f8054f164b10a7b42a5250856ec83dca71ad3545 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sat, 3 Mar 2012 23:42:04 +0200 Subject: [PATCH 15/16] Validate data for a forbidden combination of alwaysOnline and ips --- .../configuration/rpcconfig/user_helper.cpp | 58 +++++++++++++------ .../plugins/configuration/sgconfig/parser.cpp | 31 ++++++++-- 2 files changed, 66 insertions(+), 23 deletions(-) diff --git a/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp b/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp index fceaa3ab..ce339573 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp @@ -136,15 +136,24 @@ std::map structVal( std::map::iterator it; -if ((it = structVal.find("password")) != structVal.end()) +bool check = false; +bool alwaysOnline = ptr->GetProperty().alwaysOnline; +if ((it = structVal.find("aonline")) != structVal.end()) { - std::string value(xmlrpc_c::value_string(it->second)); - if (ptr->GetProperty().password.Get() != value) - if (!ptr->GetProperty().password.Set(value, - admin, - login, - &store)) - return true; + check = true; + alwaysOnline = xmlrpc_c::value_boolean(it->second); + } +bool onlyOneIP = ptr->GetProperty().ips.ConstData().OnlyOneIP(); +if ((it = structVal.find("ips")) != structVal.end()) + { + check = true; + onlyOneIP = StrToIPS(xmlrpc_c::value_string(it->second)).OnlyOneIP(); + } + +if (check && alwaysOnline && !onlyOneIP) + { + printfd(__FILE__, "Requested change leads to a forbidden state: AlwaysOnline with multiple IP's\n"); + return true; } if ((it = structVal.find("ips")) != structVal.end()) @@ -158,6 +167,28 @@ if ((it = structVal.find("ips")) != structVal.end()) return true; } +if ((it = structVal.find("aonline")) != structVal.end()) + { + bool value(xmlrpc_c::value_boolean(it->second)); + if (ptr->GetProperty().alwaysOnline.Get() != value) + if (!ptr->GetProperty().alwaysOnline.Set(value, + admin, + login, + &store)) + return true; + } + +if ((it = structVal.find("password")) != structVal.end()) + { + std::string value(xmlrpc_c::value_string(it->second)); + if (ptr->GetProperty().password.Get() != value) + if (!ptr->GetProperty().password.Set(value, + admin, + login, + &store)) + return true; + } + if ((it = structVal.find("address")) != structVal.end()) { std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-RU")); @@ -257,17 +288,6 @@ if ((it = structVal.find("passive")) != structVal.end()) return true; } -if ((it = structVal.find("aonline")) != structVal.end()) - { - bool value(xmlrpc_c::value_boolean(it->second)); - if (ptr->GetProperty().alwaysOnline.Get() != value) - if (!ptr->GetProperty().alwaysOnline.Set(value, - admin, - login, - &store)) - return true; - } - if ((it = structVal.find("disableddetailstat")) != structVal.end()) { bool value(xmlrpc_c::value_boolean(it->second)); diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser.cpp b/projects/stargazer/plugins/configuration/sgconfig/parser.cpp index c63edfe0..bfe2f7bc 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/parser.cpp +++ b/projects/stargazer/plugins/configuration/sgconfig/parser.cpp @@ -13,6 +13,7 @@ #include "stg/tariffs.h" #include "stg/user_property.h" #include "stg/settings.h" +#include "stg/logger.h" #include "parser.h" #define UNAME_LEN (256) @@ -996,6 +997,7 @@ switch (res) //----------------------------------------------------------------------------- int PARSER_CHG_USER::AplayChanges() { +printfd(__FILE__, "PARSER_CHG_USER::AplayChanges()\n"); USER_PTR u; res = 0; @@ -1005,12 +1007,29 @@ if (users->FindByName(login, &u)) return -1; } +bool check = false; +bool alwaysOnline = u->GetProperty().alwaysOnline; +if (!ucr->alwaysOnline.res_empty()) + { + check = true; + alwaysOnline = ucr->alwaysOnline.const_data(); + } +bool onlyOneIP = u->GetProperty().ips.ConstData().OnlyOneIP(); if (!ucr->ips.res_empty()) - if (!u->GetProperty().ips.Set(ucr->ips.const_data(), currAdmin, login, store)) - res = -1; + { + check = true; + onlyOneIP = ucr->ips.const_data().OnlyOneIP(); + } -if (!ucr->address.res_empty()) - if (!u->GetProperty().address.Set(ucr->address.const_data(), currAdmin, login, store)) +if (check && alwaysOnline && !onlyOneIP) + { + printfd(__FILE__, "Requested change leads to a forbidden state: AlwaysOnline with multiple IP's\n"); + GetStgLogger()("%s Requested change leads to a forbidden state: AlwaysOnline with multiple IP's", currAdmin->GetLogStr().c_str()); + return -1; + } + +if (!ucr->ips.res_empty()) + if (!u->GetProperty().ips.Set(ucr->ips.const_data(), currAdmin, login, store)) res = -1; if (!ucr->alwaysOnline.res_empty()) @@ -1018,6 +1037,10 @@ if (!ucr->alwaysOnline.res_empty()) currAdmin, login, store)) res = -1; +if (!ucr->address.res_empty()) + if (!u->GetProperty().address.Set(ucr->address.const_data(), currAdmin, login, store)) + res = -1; + if (!ucr->creditExpire.res_empty()) if (!u->GetProperty().creditExpire.Set(ucr->creditExpire.const_data(), currAdmin, login, store)) -- 2.44.2 From 7e83231167050fafe58357d533772e7d5e7082a6 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sun, 22 Apr 2012 10:25:05 +0300 Subject: [PATCH 16/16] Explicitly recurse through subdirs in stglibs. --- stglibs/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stglibs/Makefile b/stglibs/Makefile index 912be63d..6b9fbe40 100644 --- a/stglibs/Makefile +++ b/stglibs/Makefile @@ -7,9 +7,9 @@ include ../Makefile.conf .PHONY: all $(STG_LIBS) .PHONY: clean install uninstall includes all: $(STG_LIBS) - -$(STG_LIBS): - $(MAKE) $(MAKECMDGOALS) -C $@ + for LIB in $(STG_LIBS); do\ + $(MAKE) $(MAKECMDGOALS) -C $$LIB;\ + done includes: all -- 2.44.2