From: Maksym Mamontov Date: Sun, 28 Jun 2020 15:14:35 +0000 (+0300) Subject: Fix trailing whitespaces. X-Git-Tag: 2.409~10 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/da585bb94c437f06762a2042ef4c52166b8aafce Fix trailing whitespaces. --- diff --git a/projects/make_tarball/get_from_cvs b/projects/make_tarball/get_from_cvs index 362f4029..989c7668 100755 --- a/projects/make_tarball/get_from_cvs +++ b/projects/make_tarball/get_from_cvs @@ -15,7 +15,7 @@ send_user "checkout module $module"; spawn ssh $user@$host expect { - "(yes/no)? " { + "(yes/no)? " { send "yes\r" send_user "Key accepted"; } @@ -24,13 +24,13 @@ expect { send_user "Key accepting dont needed"; } } - -spawn cvs -d :ext:$user@$host:$cvsroot co -N -d $dir $module + +spawn cvs -d :ext:$user@$host:$cvsroot co -N -d $dir $module expect { "assword:" { send "$pass\r" expect { - "assword:" { + "assword:" { send_user "

cvs checkout $module failed. Incorrect password

"; exit 1 } @@ -46,13 +46,13 @@ expect { } } } - + "aborted" { send_user "

cvs checkout $module failed.

"; exit 1 } } - + diff --git a/projects/rlm_stg/stg_client.cpp b/projects/rlm_stg/stg_client.cpp index 113e71c9..284c1e2b 100644 --- a/projects/rlm_stg/stg_client.cpp +++ b/projects/rlm_stg/stg_client.cpp @@ -84,7 +84,7 @@ return 0; int STG_CLIENT::Send(const RAD_PACKET & packet) { /*char buf[RAD_MAX_PACKET_LEN]; - + Encrypt(&ctx, buf, (char *)&packet, sizeof(RAD_PACKET) / 8); int res = sendto(sock, buf, sizeof(RAD_PACKET), 0, (struct sockaddr *)&outerAddr, sizeof(outerAddr)); diff --git a/projects/rscriptd/rscriptd.conf b/projects/rscriptd/rscriptd.conf index 45b7b5c0..47d94466 100644 --- a/projects/rscriptd/rscriptd.conf +++ b/projects/rscriptd/rscriptd.conf @@ -9,7 +9,7 @@ LogFileName = /var/log/rscriptd.log # Amount of rscriptd-exec processes. -# These processes are responsible for the execution of scripts +# These processes are responsible for the execution of scripts # OnConnect and OnDisconnect. # Amount of processes means how many scripts can be executed simultaneously. # Recommend to leave 1 to avoid errors when executing scripts diff --git a/projects/stargazer/Makefile b/projects/stargazer/Makefile index e127d4f8..70aa6b4b 100644 --- a/projects/stargazer/Makefile +++ b/projects/stargazer/Makefile @@ -60,7 +60,7 @@ all: libs plugins $(PROG) libs: $(MAKE) -C $(DIR_LIBSRC) -plugins: libs +plugins: libs $(MAKE) -C $(DIR_PLUGINS) $(PROG): $(OBJS) @@ -114,7 +114,7 @@ endif install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/ - + # Install file db mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/admins mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/tariffs diff --git a/projects/stargazer/actions.inl.h b/projects/stargazer/actions.inl.h index b5b3f8a5..392626ab 100644 --- a/projects/stargazer/actions.inl.h +++ b/projects/stargazer/actions.inl.h @@ -29,7 +29,7 @@ ACTIONS_LIST::~ACTIONS_LIST() STG_LOCKER lock(&mutex); parent::iterator it(parent::begin()); - while (it != parent::end()) + while (it != parent::end()) { delete *it++; } @@ -40,28 +40,28 @@ pthread_mutex_destroy(&mutex); inline ACTIONS_LIST::parent::iterator ACTIONS_LIST::begin() -{ +{ STG_LOCKER lock(&mutex); return parent::begin(); } inline ACTIONS_LIST::parent::iterator ACTIONS_LIST::end() -{ +{ STG_LOCKER lock(&mutex); return parent::end(); } inline ACTIONS_LIST::parent::const_iterator ACTIONS_LIST::begin() const -{ +{ STG_LOCKER lock(&mutex); return parent::begin(); } inline ACTIONS_LIST::parent::const_iterator ACTIONS_LIST::end() const -{ +{ STG_LOCKER lock(&mutex); return parent::end(); } diff --git a/projects/stargazer/inst/freebsd/etc/stargazer/OnConnect b/projects/stargazer/inst/freebsd/etc/stargazer/OnConnect index 912ed7d9..95c31ae9 100755 --- a/projects/stargazer/inst/freebsd/etc/stargazer/OnConnect +++ b/projects/stargazer/inst/freebsd/etc/stargazer/OnConnect @@ -1,7 +1,7 @@ #! /bin/sh #Этот скрипт вызывается в момент, когда пользователь -#успешно прошел авторизацию на сервере. Задача скрипта - перестроить +#успешно прошел авторизацию на сервере. Задача скрипта - перестроить #файрвол так, что бы пользователь получил доступ в интернет # Login diff --git a/projects/stargazer/inst/freebsd/etc/stargazer/OnDisconnect b/projects/stargazer/inst/freebsd/etc/stargazer/OnDisconnect index 6169ddc8..4069b178 100755 --- a/projects/stargazer/inst/freebsd/etc/stargazer/OnDisconnect +++ b/projects/stargazer/inst/freebsd/etc/stargazer/OnDisconnect @@ -3,7 +3,7 @@ # Этот скрипт вызывается в момент, когда пользователь # желает отключится от интернета или вышел таймаут у пользователя # и сервер сам отключает пользователя -# Задача скрипта подобна задаче скрипта OnConnect - перестроить +# Задача скрипта подобна задаче скрипта OnConnect - перестроить # файрвол так, что бы пользователю закрыть доступ в интернет # Login diff --git a/projects/stargazer/inst/freebsd/etc/stargazer/OnUserAdd b/projects/stargazer/inst/freebsd/etc/stargazer/OnUserAdd index 22d321cc..923569c7 100755 --- a/projects/stargazer/inst/freebsd/etc/stargazer/OnUserAdd +++ b/projects/stargazer/inst/freebsd/etc/stargazer/OnUserAdd @@ -2,7 +2,7 @@ # Использование (неиспользование) этого скрипта дело вкуса. # Он не выполняет критических функций. Его задача автматизировать -# действия характерные при добавлении пользователя сети, например добавлекние +# действия характерные при добавлении пользователя сети, например добавлекние # пользователю почты # Login 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..50d35f81 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,7 +31,7 @@ # 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 diff --git a/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_radius.conf b/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_radius.conf index edc94d50..881eb038 100644 --- a/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_radius.conf +++ b/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_radius.conf @@ -18,7 +18,7 @@ # Default: 6666 Port = 6666 - # List of services for which will be carried out FreeRADIUS authentication + # List of services for which will be carried out FreeRADIUS authentication # Note: Parameter can be blank # Parameter: required # Value: any, supported by software @@ -31,4 +31,4 @@ # Value: any, supported by software # Default: Framed-User AcctServices = Framed-User - \ No newline at end of file + diff --git a/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_remote_script.conf b/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_remote_script.conf index a71350c8..9f4e8ec5 100644 --- a/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_remote_script.conf +++ b/projects/stargazer/inst/freebsd/etc/stargazer/conf-available.d/mod_remote_script.conf @@ -26,10 +26,10 @@ # Define which user parameters are transferred to a remote server in addition to # other parameters that transfered by default (ID, IP, Login, Cash, Dirs). - # Note: Parameter can be blank. - # Parameter: required - # Values: Cash, FreeMb, Passive, Disabled, AlwaysOnline, TariffName, - # NextTariff, Address, Note, Group, Email, RealName, Credit, EnabledDirs, + # Note: Parameter can be blank. + # Parameter: required + # Values: Cash, FreeMb, Passive, Disabled, AlwaysOnline, TariffName, + # NextTariff, Address, Note, Group, Email, RealName, Credit, EnabledDirs, # Userdata0...Userdata9 # Default: Cash Tariff EnabledDirs UserParams = Cash Tariff EnabledDirs diff --git a/projects/stargazer/inst/freebsd/etc/stargazer/stargazer.conf b/projects/stargazer/inst/freebsd/etc/stargazer/stargazer.conf index c1f4fe92..76919609 100644 --- a/projects/stargazer/inst/freebsd/etc/stargazer/stargazer.conf +++ b/projects/stargazer/inst/freebsd/etc/stargazer/stargazer.conf @@ -44,7 +44,7 @@ DayFee = 1 # Fee charged at the last (yes) or first (no) day of tariffication period. # Defines how the fee will be charged in the transition to the new tariff. # User has tariff A with fee 100. Changing it to tariff B with fee 200 -# will result in charging user's account at 100 if DayFeeIsLastDay = yes +# will result in charging user's account at 100 if DayFeeIsLastDay = yes # and at 200, if DayFeeIsLastDay = no # Parameter: required # Values: yes, no @@ -74,7 +74,7 @@ FreeMbAllowInet = no # Defines what will be written in the traffic cost in detail_stat. # If user still has the prepaid traffic and WriteFreeMbTraffCost = no, # then the traffic cost willn't be written in detail_stat. -# If user doestn't have prepaid traffic and WriteFreeMbTraffCost = no, +# If user doestn't have prepaid traffic and WriteFreeMbTraffCost = no, # then the traffic cost will be written in detail_stat. # When WriteFreeMbTraffCost = yes the traffic cost will be recorded in any case. # Parameter: required @@ -82,14 +82,14 @@ FreeMbAllowInet = no # Default: yes WriteFreeMbTraffCost = yes -# Charge a full monthly fee even if user was "frozen" a part +# Charge a full monthly fee even if user was "frozen" a part # of the tariffication period # Parameter: optional # Values: yes, no # Default: no FullFee = no -# Allow user to see and use a full cash (yes) or hide a part of it (no) +# Allow user to see and use a full cash (yes) or hide a part of it (no) # for the next fee charge # Parameter: optional # Values: yes, no @@ -115,8 +115,8 @@ FullFee = no # Amount of stg-exec processes. -# These processes are responsible for the execution of scripts OnConnect, -# OnDisconnect, etc. +# These processes are responsible for the execution of scripts OnConnect, +# OnDisconnect, etc. # Amount of processes means how many scripts can be executed simultaneously. # Recommend to leave 1 to avoid errors when executing scripts # Parameter: optional @@ -140,9 +140,9 @@ ModulesPath = /usr/lib/stg # Directory where the "monitor" files are located. # A blank files will be created in this directory. The modification time of such -# files will be changed about once a minute. If server crashes or some of server +# files will be changed about once a minute. If server crashes or some of server # component hang, the files will stop refreshing, and on this basis we can define -# the failure of the server and if necessary restart. +# the failure of the server and if necessary restart. # If option is omitted or blank, the monitoring is not performed. # Parameter: optional # Value: file path 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..bddc5644 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 + + # Enables extended protocol logging. + # Parameter: optional + # Values: yes, no + # Default: no + # LogProtocolErrors = no diff --git a/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_radius.conf b/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_radius.conf index edc94d50..881eb038 100644 --- a/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_radius.conf +++ b/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_radius.conf @@ -18,7 +18,7 @@ # Default: 6666 Port = 6666 - # List of services for which will be carried out FreeRADIUS authentication + # List of services for which will be carried out FreeRADIUS authentication # Note: Parameter can be blank # Parameter: required # Value: any, supported by software @@ -31,4 +31,4 @@ # Value: any, supported by software # Default: Framed-User AcctServices = Framed-User - \ No newline at end of file + diff --git a/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_remote_script.conf b/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_remote_script.conf index a71350c8..9f4e8ec5 100644 --- a/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_remote_script.conf +++ b/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_remote_script.conf @@ -26,10 +26,10 @@ # Define which user parameters are transferred to a remote server in addition to # other parameters that transfered by default (ID, IP, Login, Cash, Dirs). - # Note: Parameter can be blank. - # Parameter: required - # Values: Cash, FreeMb, Passive, Disabled, AlwaysOnline, TariffName, - # NextTariff, Address, Note, Group, Email, RealName, Credit, EnabledDirs, + # Note: Parameter can be blank. + # Parameter: required + # Values: Cash, FreeMb, Passive, Disabled, AlwaysOnline, TariffName, + # NextTariff, Address, Note, Group, Email, RealName, Credit, EnabledDirs, # Userdata0...Userdata9 # Default: Cash Tariff EnabledDirs UserParams = Cash Tariff EnabledDirs diff --git a/projects/stargazer/inst/linux/etc/stargazer/stargazer.conf b/projects/stargazer/inst/linux/etc/stargazer/stargazer.conf index c1f4fe92..76919609 100644 --- a/projects/stargazer/inst/linux/etc/stargazer/stargazer.conf +++ b/projects/stargazer/inst/linux/etc/stargazer/stargazer.conf @@ -44,7 +44,7 @@ DayFee = 1 # Fee charged at the last (yes) or first (no) day of tariffication period. # Defines how the fee will be charged in the transition to the new tariff. # User has tariff A with fee 100. Changing it to tariff B with fee 200 -# will result in charging user's account at 100 if DayFeeIsLastDay = yes +# will result in charging user's account at 100 if DayFeeIsLastDay = yes # and at 200, if DayFeeIsLastDay = no # Parameter: required # Values: yes, no @@ -74,7 +74,7 @@ FreeMbAllowInet = no # Defines what will be written in the traffic cost in detail_stat. # If user still has the prepaid traffic and WriteFreeMbTraffCost = no, # then the traffic cost willn't be written in detail_stat. -# If user doestn't have prepaid traffic and WriteFreeMbTraffCost = no, +# If user doestn't have prepaid traffic and WriteFreeMbTraffCost = no, # then the traffic cost will be written in detail_stat. # When WriteFreeMbTraffCost = yes the traffic cost will be recorded in any case. # Parameter: required @@ -82,14 +82,14 @@ FreeMbAllowInet = no # Default: yes WriteFreeMbTraffCost = yes -# Charge a full monthly fee even if user was "frozen" a part +# Charge a full monthly fee even if user was "frozen" a part # of the tariffication period # Parameter: optional # Values: yes, no # Default: no FullFee = no -# Allow user to see and use a full cash (yes) or hide a part of it (no) +# Allow user to see and use a full cash (yes) or hide a part of it (no) # for the next fee charge # Parameter: optional # Values: yes, no @@ -115,8 +115,8 @@ FullFee = no # Amount of stg-exec processes. -# These processes are responsible for the execution of scripts OnConnect, -# OnDisconnect, etc. +# These processes are responsible for the execution of scripts OnConnect, +# OnDisconnect, etc. # Amount of processes means how many scripts can be executed simultaneously. # Recommend to leave 1 to avoid errors when executing scripts # Parameter: optional @@ -140,9 +140,9 @@ ModulesPath = /usr/lib/stg # Directory where the "monitor" files are located. # A blank files will be created in this directory. The modification time of such -# files will be changed about once a minute. If server crashes or some of server +# files will be changed about once a minute. If server crashes or some of server # component hang, the files will stop refreshing, and on this basis we can define -# the failure of the server and if necessary restart. +# the failure of the server and if necessary restart. # If option is omitted or blank, the monitoring is not performed. # Parameter: optional # Value: file path diff --git a/projects/stargazer/inst/var/00-alter-01.postgresql.sql b/projects/stargazer/inst/var/00-alter-01.postgresql.sql index 7fd81117..781a941e 100644 --- a/projects/stargazer/inst/var/00-alter-01.postgresql.sql +++ b/projects/stargazer/inst/var/00-alter-01.postgresql.sql @@ -27,7 +27,7 @@ BEGIN RAISE EXCEPTION 'User % not found', _login; RETURN -1; END IF; - + INSERT INTO tb_sessions_log (fk_user, event_time, diff --git a/projects/stargazer/inst/var/00-alter-01.sql b/projects/stargazer/inst/var/00-alter-01.sql index f76ae5f8..3e9dd8f8 100644 --- a/projects/stargazer/inst/var/00-alter-01.sql +++ b/projects/stargazer/inst/var/00-alter-01.sql @@ -7,15 +7,15 @@ alter table tb_users add disabled_detail_stat dm_bool; drop procedure sp_add_user; set term !! ; -create procedure sp_add_user(name varchar(32), dirs integer) -as +create procedure sp_add_user(name varchar(32), dirs integer) +as declare variable pk_user integer; -declare variable pk_stat integer; -begin - pk_user = gen_id(gn_pk_user, 1); +declare variable pk_stat integer; +begin + pk_user = gen_id(gn_pk_user, 1); insert into tb_users(pk_user, fk_tariff, fk_tariff_change, fk_corporation, address, always_online, credit, credit_expire, disabled, disabled_detail_stat, email, grp, note, passive, passwd, phone, name, real_name) values (:pk_user, NULL, NULL, NULL, '', 0, 0, 'now', 0, 0, '', '_', '', 0, '', '', :name, ''); - pk_stat = gen_id(gn_pk_stat, 1); - insert into tb_stats values (:pk_stat, :pk_user, 0, 0, 'now', 0, 'now', 0, 'now'); + pk_stat = gen_id(gn_pk_stat, 1); + insert into tb_stats values (:pk_stat, :pk_user, 0, 0, 'now', 0, 'now', 0, 'now'); while (dirs > 0) do begin insert into tb_stats_traffic (fk_stat, dir_num, upload, download) values (:pk_stat, :dirs - 1, 0, 0); diff --git a/projects/stargazer/inst/var/00-base-00.postgresql.sql b/projects/stargazer/inst/var/00-base-00.postgresql.sql index 6b48d75c..6d4b5c47 100644 --- a/projects/stargazer/inst/var/00-base-00.postgresql.sql +++ b/projects/stargazer/inst/var/00-base-00.postgresql.sql @@ -592,7 +592,7 @@ BEGIN RAISE EXCEPTION 'User % not found', _login; RETURN -1; END IF; - + INSERT INTO tb_sessions_log (fk_user, event_time, diff --git a/projects/stargazer/inst/var/00-base-00.sql b/projects/stargazer/inst/var/00-base-00.sql index a452d810..f8785795 100644 --- a/projects/stargazer/inst/var/00-base-00.sql +++ b/projects/stargazer/inst/var/00-base-00.sql @@ -54,7 +54,7 @@ * CREATE DATABASE 'localhost:/var/stg/stargazer.fdb' USER 'stg' PASSWORD '123456' DEFAULT CHARACTER SET UTF8; */ - + /* ***************************************************************************** @@ -526,7 +526,7 @@ set term ; !! set term !! ; create procedure sp_add_message(pk_message integer, login varchar(32), ver integer, msg_type integer, last_send_time integer, creation_time integer, show_time integer, repeat integer, repeat_period integer, msg_text varchar(256)) returns(res integer) -as +as begin if (:pk_message is null) then begin @@ -536,7 +536,7 @@ begin :ver, :msg_type, :last_send_time, - :creation_time, + :creation_time, :show_time, :repeat, :repeat_period, @@ -582,8 +582,8 @@ begin insert into tb_tariffs (pk_tariff, name, fee, free, passive_cost, traff_type) values (:pk_tariff, :name, 0, 0, 0, 0); while (dirs > 0) do begin - insert into tb_tariffs_params (fk_tariff, dir_num, price_day_a, - price_day_b, price_night_a, price_night_b, + insert into tb_tariffs_params (fk_tariff, dir_num, price_day_a, + price_day_b, price_night_a, price_night_b, threshold, time_day_begins, time_day_ends) values (:pk_tariff, :dirs - 1, 0, 0, 0, 0, 0, '0:0', '0:0'); dirs = dirs - 1; diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp index 3aec35ae..9d5d6e91 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp @@ -23,7 +23,7 @@ $Date: 2010/03/25 15:18:48 $ $Author: faust $ */ - + #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif diff --git a/projects/stargazer/plugins/capture/cap_debug/checksum.h b/projects/stargazer/plugins/capture/cap_debug/checksum.h index 2698a526..8d4955a7 100644 --- a/projects/stargazer/plugins/capture/cap_debug/checksum.h +++ b/projects/stargazer/plugins/capture/cap_debug/checksum.h @@ -1,4 +1,4 @@ -/* $Id: checksum.h,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ +/* $Id: checksum.h,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ Copyright (C) 2002 Marc Kirchner diff --git a/projects/stargazer/plugins/capture/cap_debug/constants.h b/projects/stargazer/plugins/capture/cap_debug/constants.h index e845a44c..15d32c2f 100644 --- a/projects/stargazer/plugins/capture/cap_debug/constants.h +++ b/projects/stargazer/plugins/capture/cap_debug/constants.h @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* * Network Layer -*/ +*/ #define PKT_NET_IP 0x01 #define PKT_NET_ICMP 0x02 #define PKT_NET_IGMP 0x04 diff --git a/projects/stargazer/plugins/capture/cap_debug/ip.c b/projects/stargazer/plugins/capture/cap_debug/ip.c index a2627177..02bd10f1 100644 --- a/projects/stargazer/plugins/capture/cap_debug/ip.c +++ b/projects/stargazer/plugins/capture/cap_debug/ip.c @@ -1,4 +1,4 @@ -/* $Id: ip.c,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ +/* $Id: ip.c,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ Copyright (C) 2002 Marc Kirchner @@ -37,7 +37,7 @@ pkt_ip_header(struct packet *pkt, if (!pkt) return EPKTINVALPTR; - + ip = (struct ip *) pkt->pkt_ptr; ip->ip_hl = iphdr_len; diff --git a/projects/stargazer/plugins/capture/cap_debug/libpal.h b/projects/stargazer/plugins/capture/cap_debug/libpal.h index fa28d8e8..5f4761cf 100644 --- a/projects/stargazer/plugins/capture/cap_debug/libpal.h +++ b/projects/stargazer/plugins/capture/cap_debug/libpal.h @@ -50,7 +50,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * packet payload pointer pkt. You do NOT want to do that. Use the provided * library functions. * To be clear: don't do _anything_ with this struct. Just pass it as a -* parameter, be happy and your programs will (hopefully) work. +* parameter, be happy and your programs will (hopefully) work. */ struct packet { unsigned long pkt_type; @@ -70,7 +70,7 @@ struct pkt_socket { int rawfd; struct sockaddr_in *sckad; /*struct sockaddr_ll *sckll;*/ - socklen_t sckad_len; + socklen_t sckad_len; }; /* memory management */ @@ -88,7 +88,7 @@ int pkt_tcp_header(struct packet *pkt, unsigned short int sport, unsigned short int pkt_tcp_cksum(struct packet *pkt, char *saddr, char *daddr, unsigned int tcp_pkt_size); int pkt_tcp_option(struct packet *pkt, unsigned char kind, unsigned char len, void *optval, size_t optlen); -/* functions that might be useful and might be added some day ... +/* functions that might be useful and might be added some day ... int pkt_shift_data(struct packet *pkt, unsigned int from, unsigned int to, unsigned int len); int pkt_tcp_change_seqno(int rel_seq, int rel_ackseq); int pkt_tcp_set_seqno(unsigned int seq, unsigned int ackseq); diff --git a/projects/stargazer/plugins/capture/cap_debug/packet.c b/projects/stargazer/plugins/capture/cap_debug/packet.c index 9405818e..b7cdc172 100644 --- a/projects/stargazer/plugins/capture/cap_debug/packet.c +++ b/projects/stargazer/plugins/capture/cap_debug/packet.c @@ -1,4 +1,4 @@ -/* $Id: packet.c,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ +/* $Id: packet.c,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ Copyright (C) 2002 Marc Kirchner @@ -67,13 +67,13 @@ pkt_free(struct packet *pkt) /* <++doc++> -@name int pkt_move_actptr(struct packet *pkt, int relmov) +@name int pkt_move_actptr(struct packet *pkt, int relmov) @desc This function moves the active pointer inside the packet. @param pkt the packet whose active ptr is to be moved @param relmov number of bytes the active ptr shall be moved. To move it backward, negative values may be used. <--doc--> */ -int +int pkt_move_actptr(struct packet *pkt, int relmov) { if (!pkt) diff --git a/projects/stargazer/plugins/capture/cap_debug/tcp.c b/projects/stargazer/plugins/capture/cap_debug/tcp.c index ad39931d..48d898b0 100644 --- a/projects/stargazer/plugins/capture/cap_debug/tcp.c +++ b/projects/stargazer/plugins/capture/cap_debug/tcp.c @@ -1,4 +1,4 @@ -/* $Id: tcp.c,v 1.2 2009/06/19 12:50:47 faust Exp $ +/* $Id: tcp.c,v 1.2 2009/06/19 12:50:47 faust Exp $ Copyright (C) 2002 Marc Kirchner @@ -37,7 +37,7 @@ pkt_tcp_header(struct packet *pkt, if (!pkt) return EPKTINVALPTR; - + tcp = (struct tcphdr *) pkt->pkt_ptr; tcp->source = htons(sport); tcp->dest = htons(dport); @@ -63,10 +63,10 @@ pkt_tcp_header(struct packet *pkt, # error "Adjust your defines" # endif } else { - tcp->fin = 0; + tcp->fin = 0; tcp->syn = 0; tcp->rst = 0; - tcp->psh = 0; + tcp->psh = 0; tcp->ack = 0; tcp->urg = 0; tcp->res2 = 0; @@ -76,7 +76,7 @@ pkt_tcp_header(struct packet *pkt, } int -pkt_tcp_cksum(struct packet *pkt, char *saddr, char *daddr, +pkt_tcp_cksum(struct packet *pkt, char *saddr, char *daddr, unsigned int tcp_pkt_size) { char *tosum; @@ -86,17 +86,17 @@ pkt_tcp_cksum(struct packet *pkt, char *saddr, char *daddr, if (!pkt || !saddr || !daddr) return EPKTINVALPTR; - + if ((tcp_pkt_size + pkt->pkt_pos) > pkt->pkt_size -1) return EPKTRANGE; - + if ((tosum = (char *) malloc(tcp_pkt_size+sizeof(struct pseudohdr))) != NULL) { memset(tosum, 0, tcp_pkt_size+sizeof(struct pseudohdr)); psh = (struct pseudohdr *) tosum; tcp = (struct tcphdr *) pkt->pkt_ptr; tcp->check = 0; - + if (inet_pton(AF_INET, saddr, &addr) < 0) return EERRNO; psh->saddr = addr.s_addr; @@ -106,7 +106,7 @@ pkt_tcp_cksum(struct packet *pkt, char *saddr, char *daddr, psh->zero = 0x00; psh->protocol = IPPROTO_TCP; psh->length = htons(tcp_pkt_size); - + memcpy(tosum + sizeof(struct pseudohdr), tcp, tcp_pkt_size); tcp->check = in_cksum((unsigned short *)tosum, tcp_pkt_size + sizeof(struct pseudohdr)); free(tosum); @@ -114,9 +114,9 @@ pkt_tcp_cksum(struct packet *pkt, char *saddr, char *daddr, } else return EERRNO; } - + int -pkt_tcp_option(struct packet *pkt, unsigned char kind, +pkt_tcp_option(struct packet *pkt, unsigned char kind, unsigned char len, void *optval, size_t optlen) { void *vp; @@ -124,10 +124,10 @@ pkt_tcp_option(struct packet *pkt, unsigned char kind, if (!pkt) return EPKTINVALPTR; - + if ((pkt->pkt_size) < (pkt->pkt_pos+2+optlen)) return EPKTRANGE; - + vp = (void *)pkt->pkt_ptr; memcpy(vp, &kind, 1); diff --git a/projects/stargazer/plugins/capture/cap_debug/types.h b/projects/stargazer/plugins/capture/cap_debug/types.h index 3d428fe9..bb8b8a3f 100644 --- a/projects/stargazer/plugins/capture/cap_debug/types.h +++ b/projects/stargazer/plugins/capture/cap_debug/types.h @@ -1,4 +1,4 @@ -/* $Id: types.h,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ +/* $Id: types.h,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ Copyright (C) 2002 Marc Kirchner diff --git a/projects/stargazer/plugins/capture/ipq_linux/libipq.c b/projects/stargazer/plugins/capture/ipq_linux/libipq.c index d0eb33b3..4c734110 100644 --- a/projects/stargazer/plugins/capture/ipq_linux/libipq.c +++ b/projects/stargazer/plugins/capture/ipq_linux/libipq.c @@ -87,7 +87,7 @@ struct ipq_errmap_t static int ipq_errno = IPQ_ERR_NONE; -static ssize_t ipq_netlink_sendto(const struct ipq_handle *h, +static ssize_t ipq_netlink_sendto(const struct ipq_handle *h, const void *msg, size_t len); static ssize_t ipq_netlink_recvfrom(const struct ipq_handle *h, @@ -296,7 +296,7 @@ int ipq_set_mode(const struct ipq_handle *h, ipq_peer_msg_t pm; char s[FAKE_ARRAY_SIZE]; } req; - + memset(&req, 0, sizeof(req)); req.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(req)-FAKE_ARRAY_SIZE); req.nlh.nlmsg_flags = NLM_F_REQUEST; diff --git a/projects/stargazer/plugins/capture/ipq_linux/libipq.h b/projects/stargazer/plugins/capture/ipq_linux/libipq.h index 17d4c9cb..d2c56e75 100644 --- a/projects/stargazer/plugins/capture/ipq_linux/libipq.h +++ b/projects/stargazer/plugins/capture/ipq_linux/libipq.h @@ -18,7 +18,7 @@ * GNU General Public License for more details. * */ - + #ifndef _LIBIPQ_H #define _LIBIPQ_H diff --git a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp index 56167bc2..3242240f 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp @@ -88,7 +88,7 @@ if (users->FindByName(login, &u)) *retvalPtr = xmlrpc_c::value_boolean(true); return; } - + *retvalPtr = xmlrpc_c::value_boolean(false); return; } diff --git a/projects/stargazer/plugins/other/smux/STG-MIB.mib b/projects/stargazer/plugins/other/smux/STG-MIB.mib index bccf5a28..ef5fbaca 100644 --- a/projects/stargazer/plugins/other/smux/STG-MIB.mib +++ b/projects/stargazer/plugins/other/smux/STG-MIB.mib @@ -9,9 +9,9 @@ IMPORTS stgMIB MODULE-IDENTITY LAST-UPDATED "201101060000Z" ORGANIZATION "STG" - CONTACT-INFO + CONTACT-INFO "Primary Contact: Maxim Mamontov - email: faust@stg.dp.ua" + email: stg@madf.info" DESCRIPTION "This MIB module defines objects for Stargazer data." REVISION "201101060000Z" diff --git a/projects/stargazer/plugins/other/smux/handlers.cpp b/projects/stargazer/plugins/other/smux/handlers.cpp index ac179da9..4d117aff 100644 --- a/projects/stargazer/plugins/other/smux/handlers.cpp +++ b/projects/stargazer/plugins/other/smux/handlers.cpp @@ -102,7 +102,7 @@ asn_long2INTEGER(&msg->request_id, id); asn_long2INTEGER(&msg->error_status, 0); asn_long2INTEGER(&msg->error_index, 0); -const VarBindList_t * vbl = &getRequest->variable_bindings; +const VarBindList_t * vbl = &getRequest->variable_bindings; for (int i = 0; i < vbl->list.count; ++i) { VarBind_t * vb = getRequest->variable_bindings.list.array[i]; @@ -148,7 +148,7 @@ asn_long2INTEGER(&msg->request_id, id); asn_long2INTEGER(&msg->error_status, 0); asn_long2INTEGER(&msg->error_index, 0); -const VarBindList_t * vbl = &getRequest->variable_bindings; +const VarBindList_t * vbl = &getRequest->variable_bindings; for (int i = 0; i < vbl->list.count; ++i) { VarBind_t * vb = getRequest->variable_bindings.list.array[i]; diff --git a/projects/stargazer/plugins/store/files/file_store.cpp b/projects/stargazer/plugins/store/files/file_store.cpp index 6f316072..e23b2030 100644 --- a/projects/stargazer/plugins/store/files/file_store.cpp +++ b/projects/stargazer/plugins/store/files/file_store.cpp @@ -1606,7 +1606,7 @@ if (e) printfd(__FILE__, "FILES_STORE::WriteDetailStat - chmod/chown failed for user '%s'. Error: '%s'\n", login.c_str(), strerror(errno)); } -snprintf(dn, FN_STR_LEN, "%s/%s/detail_stat/%d/%s%d", +snprintf(dn, FN_STR_LEN, "%s/%s/detail_stat/%d/%s%d", storeSettings.GetUsersDir().c_str(), login.c_str(), lt->tm_year+1900, diff --git a/projects/stargazer/plugins/store/mysql/mysql_store.cpp b/projects/stargazer/plugins/store/mysql/mysql_store.cpp index 8108de09..cef72671 100644 --- a/projects/stargazer/plugins/store/mysql/mysql_store.cpp +++ b/projects/stargazer/plugins/store/mysql/mysql_store.cpp @@ -31,10 +31,10 @@ template int GetInt(const std::string & str, T * val, T defaultVal = T()) { char *res; - + *val = static_cast(strtoll(str.c_str(), &res, 10)); - - if (*res != 0) + + if (*res != 0) { *val = defaultVal; //Error! return EINVAL; @@ -46,10 +46,10 @@ int GetInt(const std::string & str, T * val, T defaultVal = T()) int GetDouble(const std::string & str, double * val, double defaultVal) { char *res; - + *val = strtod(str.c_str(), &res); - - if (*res != 0) + + if (*res != 0) { *val = defaultVal; //Error! return EINVAL; @@ -61,10 +61,10 @@ int GetDouble(const std::string & str, double * val, double defaultVal) int GetTime(const std::string & str, time_t * val, time_t defaultVal) { char *res; - + *val = strtol(str.c_str(), &res, 10); - - if (*res != 0) + + if (*res != 0) { *val = defaultVal; //Error! return EINVAL; @@ -87,17 +87,17 @@ std::string ReplaceStr(std::string source, const std::string & symlist, const ch int GetULongLongInt(const std::string & str, uint64_t * val, uint64_t defaultVal) { char *res; - + *val = strtoull(str.c_str(), &res, 10); - - if (*res != 0) + + if (*res != 0) { *val = defaultVal; //Error! return EINVAL; } return 0; -} +} PLUGIN_CREATOR msc; } @@ -175,7 +175,7 @@ int MYSQL_STORE::MysqlQuery(const char* sQuery,MYSQL * sock) const return 0; } } - + return ret; } //----------------------------------------------------------------------------- @@ -210,7 +210,7 @@ else if(mysql_select_db(sock, storeSettings.GetDBName().c_str())) { std::string res = "CREATE DATABASE " + storeSettings.GetDBName(); - + if(MysqlQuery(res.c_str(),sock)) { errorStr = "Couldn't create database! With error:\n"; @@ -313,7 +313,7 @@ if(!IsTablePresent("admins",sock)) "ChgPassword TINYINT DEFAULT 0,ChgStat TINYINT DEFAULT 0,"\ "ChgCash TINYINT DEFAULT 0,UsrAddDel TINYINT DEFAULT 0,"\ "ChgTariff TINYINT DEFAULT 0,ChgAdmin TINYINT DEFAULT 0)"); - + if(MysqlQuery(qbuf,sock)) { errorStr = "Couldn't create admin table list With error:\n"; @@ -325,7 +325,7 @@ if(!IsTablePresent("admins",sock)) sprintf(qbuf,"INSERT INTO admins SET login='admin',"\ "password='geahonjehjfofnhammefahbbbfbmpkmkmmefahbbbfbmpkmkmmefahbbbfbmpkmkaa',"\ "ChgConf=1,ChgPassword=1,ChgStat=1,ChgCash=1,UsrAddDel=1,ChgTariff=1,ChgAdmin=1"); - + if(MysqlQuery(qbuf,sock)) { errorStr = "Couldn't create default admin. With error:\n"; @@ -340,40 +340,40 @@ std::string param, res; if(!IsTablePresent("tariffs",sock)) { res = "CREATE TABLE tariffs (name VARCHAR(40) DEFAULT '' PRIMARY KEY,"; - + for (int i = 0; i < DIR_NUM; i++) { - strprintf(¶m, " PriceDayA%d DOUBLE DEFAULT 0.0,", i); + strprintf(¶m, " PriceDayA%d DOUBLE DEFAULT 0.0,", i); res += param; - + strprintf(¶m, " PriceDayB%d DOUBLE DEFAULT 0.0,", i); res += param; - + strprintf(¶m, " PriceNightA%d DOUBLE DEFAULT 0.0,", i); res += param; - + strprintf(¶m, " PriceNightB%d DOUBLE DEFAULT 0.0,", i); res += param; - + strprintf(¶m, " Threshold%d INT DEFAULT 0,", i); res += param; - + strprintf(¶m, " Time%d VARCHAR(15) DEFAULT '0:0-0:0',", i); res += param; - + strprintf(¶m, " NoDiscount%d INT DEFAULT 0,", i); res += param; - + strprintf(¶m, " SinglePrice%d INT DEFAULT 0,", i); res += param; } - + res += "PassiveCost DOUBLE DEFAULT 0.0, Fee DOUBLE DEFAULT 0.0," "Free DOUBLE DEFAULT 0.0, TraffType VARCHAR(10) DEFAULT ''," "period VARCHAR(32) NOT NULL DEFAULT 'month'," "change_policy VARCHAR(32) NOT NULL DEFAULT 'allow'," "change_policy_timeout TIMESTAMP NOT NULL DEFAULT 0)"; - + if(MysqlQuery(res.c_str(),sock)) { errorStr = "Couldn't create tariffs table list With error:\n"; @@ -383,52 +383,52 @@ if(!IsTablePresent("tariffs",sock)) } res = "INSERT INTO tariffs SET name='tariff',"; - + for (int i = 0; i < DIR_NUM; i++) { strprintf(¶m, " NoDiscount%d=1,", i); res += param; - + strprintf(¶m, " Threshold%d=0,", i); res += param; - + strprintf(¶m, " Time%d='0:0-0:0',", i); res += param; - + if(i != 0 && i != 1) { strprintf(¶m, " SinglePrice%d=0,", i); - res += param; + res += param; } - + if(i != 1) { - strprintf(¶m, " PriceDayA%d=0.0,", i); - res += param; + strprintf(¶m, " PriceDayA%d=0.0,", i); + res += param; } if(i != 1) { - strprintf(¶m, " PriceDayB%d=0.0,", i); - res += param; + strprintf(¶m, " PriceDayB%d=0.0,", i); + res += param; } - + if(i != 0) { - strprintf(¶m, " PriceNightA%d=0.0,", i); - res += param; + strprintf(¶m, " PriceNightA%d=0.0,", i); + res += param; } if(i != 0) { - strprintf(¶m, " PriceNightB%d=0.0,", i); - res += param; + strprintf(¶m, " PriceNightB%d=0.0,", i); + res += param; } } - + res += "PassiveCost=0.0, Fee=10.0, Free=0,"\ "SinglePrice0=1, SinglePrice1=1,PriceDayA1=0.75,PriceDayB1=0.75,"\ "PriceNightA0=1.0,PriceNightB0=1.0,TraffType='up+down',period='month',"\ "change_policy='allow', change_policy_timeout=0"; - + if(MysqlQuery(res.c_str(),sock)) { errorStr = "Couldn't create default tariff. With error:\n"; @@ -457,34 +457,34 @@ if(!IsTablePresent("users",sock)) "Address VARCHAR(254) NOT NULL DEFAULT '',Phone VARCHAR(128) NOT NULL DEFAULT '',Email VARCHAR(50) NOT NULL DEFAULT '',"\ "Note TEXT NOT NULL,RealName VARCHAR(254) NOT NULL DEFAULT '',StgGroup VARCHAR(40) NOT NULL DEFAULT '',"\ "Credit DOUBLE DEFAULT 0, TariffChange VARCHAR(40) NOT NULL DEFAULT '',"; - + for (int i = 0; i < USERDATA_NUM; i++) { strprintf(¶m, " Userdata%d VARCHAR(254) NOT NULL,", i); res += param; } - + param = " CreditExpire INT(11) DEFAULT 0,"; res += param; - + strprintf(¶m, " IP VARCHAR(254) DEFAULT '*',"); res += param; - + for (int i = 0; i < DIR_NUM; i++) { strprintf(¶m, " D%d BIGINT(30) DEFAULT 0,", i); res += param; - + strprintf(¶m, " U%d BIGINT(30) DEFAULT 0,", i); res += param; } - + strprintf(¶m, "Cash DOUBLE DEFAULT 0,FreeMb DOUBLE DEFAULT 0,LastCashAdd DOUBLE DEFAULT 0,"\ "LastCashAddTime INT(11) DEFAULT 0,PassiveTime INT(11) DEFAULT 0,LastActivityTime INT(11) DEFAULT 0,"\ "NAS VARCHAR(17) NOT NULL, INDEX (AlwaysOnline), INDEX (IP), INDEX (Address),"\ " INDEX (Tariff),INDEX (Phone),INDEX (Email),INDEX (RealName))"); res += param; - + if(MysqlQuery(res.c_str(),sock)) { errorStr = "Couldn't create users table list With error:\n"; @@ -498,25 +498,25 @@ if(!IsTablePresent("users",sock)) "Credit=0.0,CreditExpire=0,Down=0,Email='',DisabledDetailStat=0,"\ "StgGroup='',IP='192.168.1.1',Note='',Passive=0,Password='123456',"\ "Phone='', RealName='',Tariff='tariff',TariffChange='',NAS='',"; - + for (int i = 0; i < USERDATA_NUM; i++) { strprintf(¶m, " Userdata%d='',", i); res += param; } - + for (int i = 0; i < DIR_NUM; i++) { strprintf(¶m, " D%d=0,", i); res += param; - + strprintf(¶m, " U%d=0,", i); res += param; } - + res += "Cash=10.0,FreeMb=0.0,LastActivityTime=0,LastCashAdd=0,"\ "LastCashAddTime=0, PassiveTime=0"; - + if(MysqlQuery(res.c_str(),sock)) { errorStr = "Couldn't create default user. With error:\n"; @@ -530,7 +530,7 @@ if(!IsTablePresent("users",sock)) if(!IsTablePresent("logs")) { sprintf(qbuf,"CREATE TABLE logs (unid INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, login VARCHAR(40),text TEXT)"); - + if(MysqlQuery(qbuf)) { errorStr = "Couldn't create admin table list With error:\n"; @@ -545,7 +545,7 @@ if(!IsTablePresent("messages",sock)) sprintf(qbuf,"CREATE TABLE messages (login VARCHAR(40) DEFAULT '', id BIGINT, "\ "type INT, lastSendTime INT, creationTime INT, showTime INT,"\ "stgRepeat INT, repeatPeriod INT, text TEXT)"); - + if(MysqlQuery(qbuf,sock)) { errorStr = "Couldn't create messages table. With error:\n"; @@ -559,18 +559,18 @@ if(!IsTablePresent("messages",sock)) if(!IsTablePresent("stat",sock)) { res = "CREATE TABLE stat (login VARCHAR(50), month TINYINT, year SMALLINT,"; - + for (int i = 0; i < DIR_NUM; i++) { - strprintf(¶m, " U%d BIGINT,", i); + strprintf(¶m, " U%d BIGINT,", i); res += param; - - strprintf(¶m, " D%d BIGINT,", i); + + strprintf(¶m, " D%d BIGINT,", i); res += param; } - + res += " cash DOUBLE, INDEX (login))"; - + if(MysqlQuery(res.c_str(),sock)) { errorStr = "Couldn't create stat table. With error:\n"; @@ -629,18 +629,18 @@ return 0; } //----------------------------------------------------------------------------- -int MYSQL_STORE::GetAllParams(std::vector * ParamList, +int MYSQL_STORE::GetAllParams(std::vector * ParamList, const std::string & table, const std::string & name) const { MYSQL_RES *res; MYSQL_ROW row; MYSQL * sock=NULL; my_ulonglong num, i; - + ParamList->clear(); - + sprintf(qbuf,"SELECT %s FROM %s", name.c_str(), table.c_str()); - + if(MysqlGetQuery(qbuf,sock)) { errorStr = "Couldn't GetAllParams Query for: "; @@ -662,7 +662,7 @@ num = mysql_num_rows(res); for(i = 0; i < num; i++) { - row = mysql_fetch_row(res); + row = mysql_fetch_row(res); ParamList->push_back(row[0]); } @@ -717,7 +717,7 @@ return 0; int MYSQL_STORE::DelUser(const std::string & login) const { sprintf(qbuf,"DELETE FROM users WHERE login='%s' LIMIT 1", login.c_str()); - + if(MysqlSetQuery(qbuf)) { errorStr = "Couldn't delete user:\n"; @@ -749,7 +749,7 @@ query += "CreditExpire, IP FROM users WHERE login='"; query += login + "' LIMIT 1"; //sprintf(qbuf,"SELECT * FROM users WHERE login='%s' LIMIT 1", login.c_str()); - + if(MysqlGetQuery(query.c_str(),sock)) { errorStr = "Couldn't restore Tariff(on query):\n"; @@ -819,7 +819,7 @@ if (GetInt(row[5], &conf->alwaysOnline) != 0) conf->tariffName = row[6]; -if (conf->tariffName.empty()) +if (conf->tariffName.empty()) { mysql_free_result(res); errorStr = "User \'" + login + "\' tariff is blank."; @@ -850,7 +850,7 @@ for (int i = 0; i < USERDATA_NUM; i++) } GetTime(row[15+USERDATA_NUM], &conf->creditExpire, 0); - + std::string ipStr = row[16+USERDATA_NUM]; USER_IPS i; try @@ -893,7 +893,7 @@ query += "Cash, FreeMb, LastCashAdd, LastCashAddTime, PassiveTime, LastActivityT query += login + "'"; //sprintf(qbuf,"SELECT * FROM users WHERE login='%s' LIMIT 1", login.c_str()); - + if(MysqlGetQuery(query.c_str() ,sock)) { errorStr = "Couldn't restore UserStat(on query):\n"; @@ -1002,7 +1002,7 @@ std::string res; strprintf(&res,"UPDATE users SET Password='%s', Passive=%d, Down=%d, DisabledDetailStat = %d, "\ "AlwaysOnline=%d, Tariff='%s', Address='%s', Phone='%s', Email='%s', "\ - "Note='%s', RealName='%s', StgGroup='%s', Credit=%f, TariffChange='%s', ", + "Note='%s', RealName='%s', StgGroup='%s', Credit=%f, TariffChange='%s', ", conf.password.c_str(), conf.passive, conf.disabled, @@ -1021,11 +1021,11 @@ strprintf(&res,"UPDATE users SET Password='%s', Passive=%d, Down=%d, DisabledDet for (int i = 0; i < USERDATA_NUM; i++) { - strprintf(¶m, " Userdata%d='%s',", i, + strprintf(¶m, " Userdata%d='%s',", i, (ReplaceStr(conf.userdata[i],badSyms,repSym)).c_str()); res += param; } - + strprintf(¶m, " CreditExpire=%d,", conf.creditExpire); res += param; @@ -1065,7 +1065,7 @@ for (int i = 0; i < DIR_NUM; i++) } strprintf(¶m, " Cash=%f, FreeMb=%f, LastCashAdd=%f, LastCashAddTime=%d,"\ - " PassiveTime=%d, LastActivityTime=%d", + " PassiveTime=%d, LastActivityTime=%d", stat.cash, stat.freeMb, stat.lastCashAdd, @@ -1120,7 +1120,7 @@ if (num_rows < 1) { sprintf(qbuf,"CREATE TABLE logs_%02d_%4d (unid INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, login VARCHAR(40),text TEXT)", lt->tm_mon+1, lt->tm_year+1900); - + if(MysqlQuery(qbuf,sock)) { errorStr = "Couldn't create WriteDetailedStat table:\n"; @@ -1210,24 +1210,24 @@ logStr += "\'"; return WriteLogString(logStr, login); } //----------------------------------------------------------------------------- -int MYSQL_STORE::SaveMonthStat(const USER_STAT & stat, int month, int year, +int MYSQL_STORE::SaveMonthStat(const USER_STAT & stat, int month, int year, const std::string & login) const { std::string param, res; -strprintf(&res, "INSERT INTO stat SET login='%s', month=%d, year=%d,", +strprintf(&res, "INSERT INTO stat SET login='%s', month=%d, year=%d,", login.c_str(), month+1, year+1900); - + for (int i = 0; i < DIR_NUM; i++) { - strprintf(¶m, " U%d=%lld,", i, stat.monthUp[i]); + strprintf(¶m, " U%d=%lld,", i, stat.monthUp[i]); res += param; - strprintf(¶m, " D%d=%lld,", i, stat.monthDown[i]); + strprintf(¶m, " D%d=%lld,", i, stat.monthDown[i]); res += param; } - -strprintf(¶m, " cash=%f", stat.cash); + +strprintf(¶m, " cash=%f", stat.cash); res += param; if(MysqlSetQuery(res.c_str())) @@ -1243,7 +1243,7 @@ return 0; int MYSQL_STORE::AddAdmin(const std::string & login) const { sprintf(qbuf,"INSERT INTO admins SET login='%s'", login.c_str()); - + if(MysqlSetQuery(qbuf)) { errorStr = "Couldn't add admin:\n"; @@ -1257,7 +1257,7 @@ return 0; int MYSQL_STORE::DelAdmin(const std::string & login) const { sprintf(qbuf,"DELETE FROM admins where login='%s' LIMIT 1", login.c_str()); - + if(MysqlSetQuery(qbuf)) { errorStr = "Couldn't delete admin:\n"; @@ -1293,7 +1293,7 @@ Encode12(passwordE, pass, ADM_PASSWD_LEN); sprintf(qbuf,"UPDATE admins SET password='%s', ChgConf=%d, ChgPassword=%d, "\ "ChgStat=%d, ChgCash=%d, UsrAddDel=%d, ChgTariff=%d, ChgAdmin=%d "\ - "WHERE login='%s' LIMIT 1", + "WHERE login='%s' LIMIT 1", passwordE, ac.priv.userConf, ac.priv.userPasswd, @@ -1329,7 +1329,7 @@ MYSQL_RES *res; MYSQL_ROW row; MYSQL * sock; sprintf(qbuf,"SELECT * FROM admins WHERE login='%s' LIMIT 1", login.c_str()); - + if(MysqlGetQuery(qbuf,sock)) { errorStr = "Couldn't restore admin:\n"; @@ -1353,7 +1353,7 @@ if ( mysql_num_rows(res) == 0) mysql_close(sock); return -1; } - + row = mysql_fetch_row(res); p = row[1]; @@ -1390,7 +1390,7 @@ ac->password = password; uint16_t a; -if (GetInt(row[2], &a) == 0) +if (GetInt(row[2], &a) == 0) ac->priv.userConf = a; else { @@ -1400,7 +1400,7 @@ else return -1; } -if (GetInt(row[3], &a) == 0) +if (GetInt(row[3], &a) == 0) ac->priv.userPasswd = a; else { @@ -1410,7 +1410,7 @@ else return -1; } -if (GetInt(row[4], &a) == 0) +if (GetInt(row[4], &a) == 0) ac->priv.userStat = a; else { @@ -1420,7 +1420,7 @@ else return -1; } -if (GetInt(row[5], &a) == 0) +if (GetInt(row[5], &a) == 0) ac->priv.userCash = a; else { @@ -1430,7 +1430,7 @@ else return -1; } -if (GetInt(row[6], &a) == 0) +if (GetInt(row[6], &a) == 0) ac->priv.userAddDel = a; else { @@ -1440,7 +1440,7 @@ else return -1; } -if (GetInt(row[7], &a) == 0) +if (GetInt(row[7], &a) == 0) ac->priv.tariffChg = a; else { @@ -1450,7 +1450,7 @@ else return -1; } -if (GetInt(row[8], &a) == 0) +if (GetInt(row[8], &a) == 0) ac->priv.adminChg = a; else { @@ -1468,7 +1468,7 @@ return 0; int MYSQL_STORE::AddTariff(const std::string & name) const { sprintf(qbuf,"INSERT INTO tariffs SET name='%s'", name.c_str()); - + if(MysqlSetQuery(qbuf)) { errorStr = "Couldn't add tariff:\n"; @@ -1482,7 +1482,7 @@ return 0; int MYSQL_STORE::DelTariff(const std::string & name) const { sprintf(qbuf,"DELETE FROM tariffs WHERE name='%s' LIMIT 1", name.c_str()); - + if(MysqlSetQuery(qbuf)) { errorStr = "Couldn't delete tariff: "; @@ -1499,7 +1499,7 @@ MYSQL_RES *res; MYSQL_ROW row; MYSQL * sock; sprintf(qbuf,"SELECT * FROM tariffs WHERE name='%s' LIMIT 1", tariffName.c_str()); - + if(MysqlGetQuery(qbuf,sock)) { errorStr = "Couldn't restore Tariff:\n"; @@ -1534,10 +1534,10 @@ for (int i = 0; idirPrice[i].hDay, - td->dirPrice[i].mDay, - td->dirPrice[i].hNight, + ParseTariffTimeStr(str.c_str(), + td->dirPrice[i].hDay, + td->dirPrice[i].mDay, + td->dirPrice[i].hNight, td->dirPrice[i].mNight); strprintf(¶m, "PriceDayA%d", i); @@ -1634,7 +1634,7 @@ if (GetDouble(row[1+8*DIR_NUM], &td->tariffConf.passiveCost, 0.0) < 0) str = row[4+8*DIR_NUM]; param = "TraffType"; - + if (str.length() == 0) { mysql_free_result(res); @@ -1712,30 +1712,30 @@ std::string res="UPDATE tariffs SET"; for (int i = 0; i < DIR_NUM; i++) { - strprintf(¶m, " PriceDayA%d=%f,", i, + strprintf(¶m, " PriceDayA%d=%f,", i, td.dirPrice[i].priceDayA * pt_mega); res += param; - strprintf(¶m, " PriceDayB%d=%f,", i, - td.dirPrice[i].priceDayB * pt_mega); + strprintf(¶m, " PriceDayB%d=%f,", i, + td.dirPrice[i].priceDayB * pt_mega); res += param; - + strprintf(¶m, " PriceNightA%d=%f,", i, td.dirPrice[i].priceNightA * pt_mega); res += param; - strprintf(¶m, " PriceNightB%d=%f,", i, + strprintf(¶m, " PriceNightB%d=%f,", i, td.dirPrice[i].priceNightB * pt_mega); res += param; - - strprintf(¶m, " Threshold%d=%d,", i, + + strprintf(¶m, " Threshold%d=%d,", i, td.dirPrice[i].threshold); res += param; std::string s; strprintf(¶m, " Time%d", i); - strprintf(&s, "%0d:%0d-%0d:%0d", + strprintf(&s, "%0d:%0d-%0d:%0d", td.dirPrice[i].hDay, td.dirPrice[i].mDay, td.dirPrice[i].hNight, @@ -1743,11 +1743,11 @@ for (int i = 0; i < DIR_NUM; i++) res += (param + "='" + s + "',"); - strprintf(¶m, " NoDiscount%d=%d,", i, + strprintf(¶m, " NoDiscount%d=%d,", i, td.dirPrice[i].noDiscount); res += param; - strprintf(¶m, " SinglePrice%d=%d,", i, + strprintf(¶m, " SinglePrice%d=%d,", i, td.dirPrice[i].singlePrice); res += param; } @@ -1783,8 +1783,8 @@ if(MysqlSetQuery(res.c_str())) return 0; } //----------------------------------------------------------------------------- -int MYSQL_STORE::WriteDetailedStat(const std::map & statTree, - time_t lastStat, +int MYSQL_STORE::WriteDetailedStat(const std::map & statTree, + time_t lastStat, const std::string & login) const { std::string res, stTime, endTime, tempStr; @@ -1828,7 +1828,7 @@ if (num_rows < 1) "IP VARCHAR(17) DEFAULT '',dir INT DEFAULT 0,"\ "down BIGINT DEFAULT 0,up BIGINT DEFAULT 0, cash DOUBLE DEFAULT 0.0, INDEX (login), INDEX(dir), INDEX(day), INDEX(IP))", lt->tm_mon+1, lt->tm_year+1900); - + if(MysqlQuery(qbuf,sock)) { errorStr = "Couldn't create WriteDetailedStat table:\n"; @@ -1855,12 +1855,12 @@ lt2 = localtime(&t); h2 = lt2->tm_hour; m2 = lt2->tm_min; s2 = lt2->tm_sec; - + strprintf(&stTime, "%02d:%02d:%02d", h1, m1, s1); strprintf(&endTime, "%02d:%02d:%02d", h2, m2, s2); strprintf(&res,"INSERT INTO detailstat_%02d_%4d SET login='%s',"\ - "day=%d,startTime='%s',endTime='%s',", + "day=%d,startTime='%s',endTime='%s',", lt->tm_mon+1, lt->tm_year+1900, login.c_str(), lt->tm_mday, @@ -1873,14 +1873,14 @@ stIter = statTree.begin(); while (stIter != statTree.end()) { - strprintf(&tempStr,"IP='%s', dir=%d, down=%lld, up=%lld, cash=%f", + strprintf(&tempStr,"IP='%s', dir=%d, down=%lld, up=%lld, cash=%f", inet_ntostring(stIter->first.ip).c_str(), - stIter->first.dir, - stIter->second.down, - stIter->second.up, + stIter->first.dir, + stIter->second.down, + stIter->second.up, stIter->second.cash ); - + if( MysqlQuery((res+tempStr).c_str(),sock) ) { errorStr = "Couldn't insert data in WriteDetailedStat:\n"; @@ -1907,11 +1907,11 @@ gettimeofday(&tv, NULL); msg->header.id = static_cast(tv.tv_sec) * 1000000 + static_cast(tv.tv_usec); -sprintf(qbuf,"INSERT INTO messages SET login='%s', id=%lld", +sprintf(qbuf,"INSERT INTO messages SET login='%s', id=%lld", login.c_str(), static_cast(msg->header.id) ); - + if(MysqlSetQuery(qbuf)) { errorStr = "Couldn't add message:\n"; @@ -1928,7 +1928,7 @@ std::string res; strprintf(&res,"UPDATE messages SET type=%d, lastSendTime=%u, creationTime=%u, "\ "showTime=%u, stgRepeat=%d, repeatPeriod=%u, text='%s' "\ - "WHERE login='%s' AND id=%lld LIMIT 1", + "WHERE login='%s' AND id=%lld LIMIT 1", msg.header.type, msg.header.lastSendTime, msg.header.creationTime, @@ -1958,7 +1958,7 @@ MYSQL * sock; sprintf(qbuf,"SELECT * FROM messages WHERE login='%s' AND id=%llu LIMIT 1", login.c_str(), static_cast(id)); - + if(MysqlGetQuery(qbuf,sock)) { errorStr = "Couldn't GetMessage:\n"; @@ -2035,9 +2035,9 @@ return 0; //----------------------------------------------------------------------------- int MYSQL_STORE::DelMessage(uint64_t id, const std::string & login) const { -sprintf(qbuf,"DELETE FROM messages WHERE login='%s' AND id=%lld LIMIT 1", +sprintf(qbuf,"DELETE FROM messages WHERE login='%s' AND id=%lld LIMIT 1", login.c_str(), static_cast(id)); - + if(MysqlSetQuery(qbuf)) { errorStr = "Couldn't delete Message:\n"; @@ -2054,7 +2054,7 @@ MYSQL_RES *res; MYSQL_ROW row; MYSQL * sock; sprintf(qbuf,"SELECT * FROM messages WHERE login='%s'", login.c_str()); - + if(MysqlGetQuery(qbuf,sock)) { errorStr = "Couldn't GetMessageHdrs:\n"; @@ -2080,9 +2080,9 @@ for (i = 0; i < num_rows; i++) row = mysql_fetch_row(res); if (str2x(row[1], id)) continue; - + STG_MSG_HDR hdr; - if (row[2]) + if (row[2]) if(str2x(row[2], hdr.type)) continue; diff --git a/projects/stargazer/plugins/store/mysql/mysql_store.h b/projects/stargazer/plugins/store/mysql/mysql_store.h index 4a492b38..d7ed130e 100644 --- a/projects/stargazer/plugins/store/mysql/mysql_store.h +++ b/projects/stargazer/plugins/store/mysql/mysql_store.h @@ -38,7 +38,7 @@ private: const MODULE_SETTINGS * settings; - int ParseParam(const std::vector & moduleParams, + int ParseParam(const std::vector & moduleParams, const std::string & name, std::string & result); std::string errorStr; diff --git a/projects/stargazer/scripts/clean_db b/projects/stargazer/scripts/clean_db index 31a85a97..81f6011d 100755 --- a/projects/stargazer/scripts/clean_db +++ b/projects/stargazer/scripts/clean_db @@ -26,12 +26,12 @@ do for ys in $usr/detail_stat/* do year=`basename $ys` - + for ms in $ys/* do month=`basename $ms` - stat_time=`date --date="$year/$month/01" +%s` - + stat_time=`date --date="$year/$month/01" +%s` + if (( $NOW - $stat_time > $DT )) then rm -fr $ms diff --git a/projects/stargazer/scripts/monitor b/projects/stargazer/scripts/monitor index 1f608a71..93cc5a62 100755 --- a/projects/stargazer/scripts/monitor +++ b/projects/stargazer/scripts/monitor @@ -1,21 +1,21 @@ #!/bin/bash -# Данный скрипт производит мониторинг СТГ-сервера на зависание и в +# Данный скрипт производит мониторинг СТГ-сервера на зависание и в # случае его зависания перезапускает. # Для работы скрипта в настройках СТГ должен быть указан параметер -# MonitorDir -# Скрипт отрабатывает один раз и выходит. Т.е. он не работает постоянно +# MonitorDir +# Скрипт отрабатывает один раз и выходит. Т.е. он не работает постоянно # и следит за СТГ. Его нужно вызывать по крону или как-то еще с нужной # периодичностью!!! -# Путь к файлам монитора. Должен совпадать со значением MonitorDir +# Путь к файлам монитора. Должен совпадать со значением MonitorDir # в настройках сервера MONITOR_DIR=/var/stargazer/monitor/ # Максимальная задержка обновления файлов монитора в секундах. -# При привышении этого значения сервер считается зависшим и будет +# При привышении этого значения сервер считается зависшим и будет # перезапущен DT=300 @@ -46,21 +46,21 @@ do fi file_time=`stat -c%Y $mon` - if (( $now - $file_time > $DT )) + if (( $now - $file_time > $DT )) then echo "Stargazer is deadlocked!" - + # Команда остаовки СТГ killall -KILL stargazer - + rm -f $MONITOR_DIR/* sleep 15 - + # Команда запуска СТГ /etc/init.d/stargazer start - + fi - + done diff --git a/projects/stargazer/scripts/shaper/OnConnect b/projects/stargazer/scripts/shaper/OnConnect index 67bf32bf..e5991637 100755 --- a/projects/stargazer/scripts/shaper/OnConnect +++ b/projects/stargazer/scripts/shaper/OnConnect @@ -28,13 +28,13 @@ default_speed=32kbit # maximum) speedkb=512kbit;; # 512 kbit # *) speedkb=$default_speed;; # default speed #esac -# ========= shaping by tariff end ========= +# ========= shaping by tariff end ========= # ========= shaping by userdata0 ========== speedR=$(grep -i "^Userdata0=" /var/stargazer/users/$LOGIN/conf | cut -f 2 -d"=") speed=$(echo $speedR | grep "^[0-9]*[0-9]$") -if [ -z "$speed" ] +if [ -z "$speed" ] then speedkb=$default_speed else diff --git a/projects/stargazer/scripts/shaper/Readme.txt b/projects/stargazer/scripts/shaper/Readme.txt index a5fd925e..a7f13952 100644 --- a/projects/stargazer/scripts/shaper/Readme.txt +++ b/projects/stargazer/scripts/shaper/Readme.txt @@ -3,19 +3,19 @@ По мотивам форума: http://local.com.ua/forum/index.php?showtopic=7920 -Настройка сводится к указанию сетевого интерфейса, обращенного к пользователю -в скриптах shaper.sh, shaper.stop.sh, OnConnect и OnDisconnect, и уточнению +Настройка сводится к указанию сетевого интерфейса, обращенного к пользователю +в скриптах shaper.sh, shaper.stop.sh, OnConnect и OnDisconnect, и уточнению скоростоей и тарифов в скрипте OnConnect (если нужно). -Скрипты сделаны для БД на файлах, однако, сделать их для БД на Firebird или +Скрипты сделаны для БД на файлах, однако, сделать их для БД на Firebird или MySQL не составит большого труда. В OnConnect есть два типа шейпинга. -1. На основании тарифа. Т.е. для каждого тарифа у задана скорость и задано -дефолтное значение, на случай отсутсвия тарифа в списке скоростей или +1. На основании тарифа. Т.е. для каждого тарифа у задана скорость и задано +дефолтное значение, на случай отсутсвия тарифа в списке скоростей или забывчивости админа. -2. На основании Userdata0. В этом поле просто прописывается число равное -скорости в kbit/sec. Также есть дефолтное значение скорости в 32 kbit/sec +2. На основании Userdata0. В этом поле просто прописывается число равное +скорости в kbit/sec. Также есть дефолтное значение скорости в 32 kbit/sec на случай отсутсвия в Userdata0 корректного значения. В скрипте первый способ закомментирован. Для того чтобы выбрать один из них нужно @@ -37,8 +37,8 @@ MySQL не составит большого труда. Скрипт shaper.sh должен быть выполнен один раз при загрузке системы. Интерфейс обращенный к пользователю определяется в переменной -int_iface= -(присутствует во всех 4-х файлах shaper.sh, shaper.stop.sh, OnConnect и +int_iface= +(присутствует во всех 4-х файлах shaper.sh, shaper.stop.sh, OnConnect и OnDisconnect !!!) Скорость по умолчанию в OnConnect в переменной default_speed @@ -51,9 +51,9 @@ case $tariff in *) speedkb=$default_speed;; esac -Т.е. тут нужно вместо minimum, ... maximum подставить имена ваших тарифов -и соотв. скорость. Пользователи с тарифами не указанными в списке будут иметь +Т.е. тут нужно вместо minimum, ... maximum подставить имена ваших тарифов +и соотв. скорость. Пользователи с тарифами не указанными в списке будут иметь дефолтную скорость. -Скорость ограничевается только для входящего тарафика, однако расширить +Скорость ограничевается только для входящего тарафика, однако расширить эти скрипты для исходящего не составит труда. diff --git a/projects/stargazer/scripts/shaper_vpn_radius/Readme b/projects/stargazer/scripts/shaper_vpn_radius/Readme index 772ddddc..3ef11071 100644 --- a/projects/stargazer/scripts/shaper_vpn_radius/Readme +++ b/projects/stargazer/scripts/shaper_vpn_radius/Readme @@ -15,44 +15,44 @@ PPP MPPE compression (encryption) (EXPERIMENTAL) PPP over Ethernet (EXPERIMENTAL) В файле /etc/pptpd.conf прописываем файл настроек PPP (параметр option). Также -указываем адреса сервера внутри сети VPN (параметр localip) и диапазон адресов +указываем адреса сервера внутри сети VPN (параметр localip) и диапазон адресов клиентов (параметр remoteip). См. пример файла конфигурации. -В настройках PPP указываем имя сервера (параметр name), параметры шифрования. -Для использования шифрования MPPE необходима его поддержка в ядре. Кроме того, -в процессе аутентификации MPPE использует MS-CHAPv2. По этому при -использовании шифрования MPPE также необходимо указать необходимость -поддержки MS-CHAPv2 клиентом. По желанию указываем proxyarp (для того чтобы -клиенты в сети VPN "видели" друг друга) и defaultroute. Прописываем в файле -/etc/ppp/chap-secrets тестового пользователя и проверяем работоспособность +В настройках PPP указываем имя сервера (параметр name), параметры шифрования. +Для использования шифрования MPPE необходима его поддержка в ядре. Кроме того, +в процессе аутентификации MPPE использует MS-CHAPv2. По этому при +использовании шифрования MPPE также необходимо указать необходимость +поддержки MS-CHAPv2 клиентом. По желанию указываем proxyarp (для того чтобы +клиенты в сети VPN "видели" друг друга) и defaultroute. Прописываем в файле +/etc/ppp/chap-secrets тестового пользователя и проверяем работоспособность VPN. 2. Настройка авторизации VPN через FreeRADIUS Необходимо установить пакет freeradius. -Настройку сервера (файл radiusd.conf) проводим в соответствии с документацией +Настройку сервера (файл radiusd.conf) проводим в соответствии с документацией на модуль rlm_stg.so (см. документацию на систему Stargazer). -Настройку Stargazer с плагином для FreeRADIUS проводим в соответствиии с +Настройку Stargazer с плагином для FreeRADIUS проводим в соответствиии с документацией на модуль mod_radius.so (см. документацию на систему Stargazer). -В файле clients.conf, расположенном в дирректории с конфигурационными файлами -FreeRADIUS, описываем, какие клиенты могут использовать FreeRADIUS. -Рекомендуется заменить стандартный пароль, которым шифруется обмен информации -с клиентом, "testing123" на что-то более приемлимое с точки зрения безопасности. -После этого запускаем FreeRADIUS и удостоверяемся, что он работает строчкой -"Mon Mar 31 16:06:17 2008 : Info: Ready to process requests." в журнале -(обычно, /var/log/radius/radius.log). Если журнал FreeRADIUS не позволяет -определить проблему - можно запустить сервер в отладочном режме с ключем -X. +В файле clients.conf, расположенном в дирректории с конфигурационными файлами +FreeRADIUS, описываем, какие клиенты могут использовать FreeRADIUS. +Рекомендуется заменить стандартный пароль, которым шифруется обмен информации +с клиентом, "testing123" на что-то более приемлимое с точки зрения безопасности. +После этого запускаем FreeRADIUS и удостоверяемся, что он работает строчкой +"Mon Mar 31 16:06:17 2008 : Info: Ready to process requests." в журнале +(обычно, /var/log/radius/radius.log). Если журнал FreeRADIUS не позволяет +определить проблему - можно запустить сервер в отладочном режме с ключем -X. В этом режиме более детальное журналирование проводится в консоль. -Если на данном этапе все работает - в файл насттроек PPP прописываем строчку -plugin radius.so. После этого VPN должен нормально авторизоваться +Если на данном этапе все работает - в файл насттроек PPP прописываем строчку +plugin radius.so. После этого VPN должен нормально авторизоваться пользователями системы Stargazer. 3. Настройка шейпера -Собственно настройки шейпер не требует. Всё, что нужно прописано в скриптах -OnConnect и OnDisconnect. Шейпер предназначен для работы с хранилищем на +Собственно настройки шейпер не требует. Всё, что нужно прописано в скриптах +OnConnect и OnDisconnect. Шейпер предназначен для работы с хранилищем на файлах, однако, переделать скипт под MySQL или Firebird не составит труда. -Скорость для пользоватлея задается в поле Userdata0 в kbit/sec. В этом поле +Скорость для пользоватлея задается в поле Userdata0 в kbit/sec. В этом поле должно быть прописано просто число без всяких kbit/sec и т.п. Если в этом поле -у пользователя нет данных или стоит некорректное значение, пользователь будет -ограничен скоростью определенной в переменной default_speed в скрипте +у пользователя нет данных или стоит некорректное значение, пользователь будет +ограничен скоростью определенной в переменной default_speed в скрипте OnConnect. diff --git a/projects/stargazer/scripts/shaper_vpn_radius/firewall/firewall b/projects/stargazer/scripts/shaper_vpn_radius/firewall/firewall index 36a27032..c963ad7c 100755 --- a/projects/stargazer/scripts/shaper_vpn_radius/firewall/firewall +++ b/projects/stargazer/scripts/shaper_vpn_radius/firewall/firewall @@ -19,7 +19,7 @@ iptables -P FORWARD ACCEPT iptables -t nat -F iptables -t filter -F -# +# #iptables -A INPUT -d $ip1 -j ACCEPT #iptables -A OUTPUT -s $ip1 -j ACCEPT diff --git a/projects/stargazer/scripts/shaper_vpn_radius/freeradius/radiusd.conf b/projects/stargazer/scripts/shaper_vpn_radius/freeradius/radiusd.conf index c41d28d7..2c7a7446 100644 --- a/projects/stargazer/scripts/shaper_vpn_radius/freeradius/radiusd.conf +++ b/projects/stargazer/scripts/shaper_vpn_radius/freeradius/radiusd.conf @@ -321,9 +321,9 @@ log_auth_goodpass = no # usercollide = no -# lower_user / lower_pass: +# lower_user / lower_pass: # Lower case the username/password "before" or "after" -# attempting to authenticate. +# attempting to authenticate. # # If "before", the server will first modify the request and then try # to auth the user. If "after", the server will first auth using the @@ -399,7 +399,7 @@ security { # Normally this should be set to "no", because they're useless. # See: http://www.freeradius.org/rfc/rfc2865.html#Keep-Alives # - # However, certain NAS boxes may require them. + # However, certain NAS boxes may require them. # # When sent a Status-Server message, the server responds with # an Access-Accept packet, containing a Reply-Message attribute, @@ -431,7 +431,7 @@ $INCLUDE ${confdir}/proxy.conf # CLIENTS CONFIGURATION # -# Client configuration is defined in "clients.conf". +# Client configuration is defined in "clients.conf". # # The 'clients.conf' file contains all of the information from the old @@ -743,7 +743,7 @@ $INCLUDE ${confdir}/eap.conf # or repeat values for Acct-Session-Id, causing no end of # confusion. # - # This module will add a (probably) unique session id + # This module will add a (probably) unique session id # to an accounting packet based on the attributes listed # below found in the packet. See doc/rlm_acct_unique for # more information. @@ -793,7 +793,7 @@ $INCLUDE ${confdir}/eap.conf # If we want to believe the 'utmp' file, then this # configuration entry can be set to 'no'. # - check_with_nas = yes + check_with_nas = yes # Set the file permissions, as the contents of this file # are usually private. @@ -946,7 +946,7 @@ instantiate { # The order of the realm modules will determine the order that # we try to find a matching realm. # -# Make *sure* that 'preprocess' comes before any realm if you +# Make *sure* that 'preprocess' comes before any realm if you # need to setup hints for the remote radius server authorize { # @@ -1072,7 +1072,7 @@ accounting { } -# Session database, used for checking Simultaneous-Use. Either the radutmp +# Session database, used for checking Simultaneous-Use. Either the radutmp # or rlm_sql module can handle this. # The rlm_sql module is *much* faster session { diff --git a/projects/stargazer/scripts/shaper_vpn_radius/ppp/pptpd-options b/projects/stargazer/scripts/shaper_vpn_radius/ppp/pptpd-options index af58ba40..cf44b56e 100644 --- a/projects/stargazer/scripts/shaper_vpn_radius/ppp/pptpd-options +++ b/projects/stargazer/scripts/shaper_vpn_radius/ppp/pptpd-options @@ -13,7 +13,7 @@ # Authentication -# Name of the local system for authentication purposes +# Name of the local system for authentication purposes # (must match the second field in /etc/ppp/chap-secrets entries) name pptpd @@ -93,5 +93,5 @@ defaultroute lock # Disable BSD-Compress compression -nobsdcomp -plugin radius.so \ No newline at end of file +nobsdcomp +plugin radius.so diff --git a/projects/stargazer/scripts/shaper_vpn_radius/pptpd.conf b/projects/stargazer/scripts/shaper_vpn_radius/pptpd.conf index 5c64b837..a9cd362a 100644 --- a/projects/stargazer/scripts/shaper_vpn_radius/pptpd.conf +++ b/projects/stargazer/scripts/shaper_vpn_radius/pptpd.conf @@ -62,7 +62,7 @@ logwtmp # 1. No spaces are permitted between commas or within addresses. # # 2. If you give more IP addresses than MAX_CONNECTIONS, it will -# start at the beginning of the list and go until it gets +# start at the beginning of the list and go until it gets # MAX_CONNECTIONS IPs. Others will be ignored. # # 3. No shortcuts in ranges! ie. 234-8 does not mean 234 to 238, diff --git a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnConnect b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnConnect index 099a2194..cf67ae4f 100755 --- a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnConnect +++ b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnConnect @@ -1,7 +1,7 @@ #!/bin/bash #Этот скрипт вызывается в момент, когда пользователь -#успешно прошел авторизацию на сервере. Задача скрипта - перестроить +#успешно прошел авторизацию на сервере. Задача скрипта - перестроить #файрвол так, что бы пользователь получил доступ в интернет # Login @@ -32,7 +32,7 @@ speedR=$(grep -i "^Userdata0=" /var/stargazer/users/$LOGIN/conf | cut -f 2 -d"=" #echo "speedR=$speedR" >> /var/stargazer/users/$LOGIN/connect.log speed=$(echo $speedR | grep "^[0-9]*[0-9]$") -if [ -z "$speed" ] +if [ -z "$speed" ] then speed=$default_speed fi diff --git a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnDisconnect b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnDisconnect index 482e926c..e654387f 100755 --- a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnDisconnect +++ b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnDisconnect @@ -3,7 +3,7 @@ # Этот скрипт вызывается в момент, когда пользователь # желает отключится от интернета или вышел таймаут у пользователя # и сервер сам отключает пользователя -# Задача скрипта подобна задаче скрипта OnConnect - перестроить +# Задача скрипта подобна задаче скрипта OnConnect - перестроить # файрвол так, что бы пользователю закрыть доступ в интернет # Login diff --git a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnUserAdd b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnUserAdd index 22d321cc..923569c7 100755 --- a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnUserAdd +++ b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/OnUserAdd @@ -2,7 +2,7 @@ # Использование (неиспользование) этого скрипта дело вкуса. # Он не выполняет критических функций. Его задача автматизировать -# действия характерные при добавлении пользователя сети, например добавлекние +# действия характерные при добавлении пользователя сети, например добавлекние # пользователю почты # Login diff --git a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/rules b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/rules index 3fb48284..8fd842bc 100644 --- a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/rules +++ b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/rules @@ -1,3 +1,3 @@ -ALL 192.168.0.0/16 DIR1 +ALL 192.168.0.0/16 DIR1 ALL 10.0.0.0/8 DIR2 -ALL 0.0.0.0/0 DIR0 \ No newline at end of file +ALL 0.0.0.0/0 DIR0 diff --git a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/stargazer.conf b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/stargazer.conf index 221c85c9..007a0720 100644 --- a/projects/stargazer/scripts/shaper_vpn_radius/stargazer/stargazer.conf +++ b/projects/stargazer/scripts/shaper_vpn_radius/stargazer/stargazer.conf @@ -74,7 +74,7 @@ WriteFreeMbTraffCost = no # По умолчанию установлен в no # FullFee=no -# Необязательный параметр указывающий показывать на счету и позволять +# Необязательный параметр указывающий показывать на счету и позволять # использовать пользователю абонплату. По умолчанию установлен в yes # ShowFeeInCash=yes @@ -120,11 +120,11 @@ ExecutersNum = 2 ModulesPath = /usr/lib/stg # Определяет директорию, в которой будут находится файлы "монитора" -# работы сервера. В этой директории будут созданы пустые файлы, время -# модификации которых будет меняться примерно раз в минуту. Если какой-то -# компонент сервера зависнет, файл(ы) перестанет обновлятся, и по этому -# признаку можно определить сбой в работе сервера и при надобности -# перезапустить. Если параметр не указан или пустой, мониторинг производится +# работы сервера. В этой директории будут созданы пустые файлы, время +# модификации которых будет меняться примерно раз в минуту. Если какой-то +# компонент сервера зависнет, файл(ы) перестанет обновлятся, и по этому +# признаку можно определить сбой в работе сервера и при надобности +# перезапустить. Если параметр не указан или пустой, мониторинг производится # не будет. Параметр не является обязательным, по умолчанию пустой. # MonitorDir=/var/stargazer/monitor @@ -245,7 +245,7 @@ ModulesPath = /usr/lib/stg PingDelay = 15 - + Password = 123456 ServerIP = 127.0.0.1 diff --git a/projects/stargazer/settings_impl.h b/projects/stargazer/settings_impl.h index 9bcce5b0..f5d2dc2b 100644 --- a/projects/stargazer/settings_impl.h +++ b/projects/stargazer/settings_impl.h @@ -75,8 +75,8 @@ public: const std::string & GetRulesFileName() const { return rules; } const std::string & GetLogFileName() const { return logFile; } const std::string & GetPIDFileName() const { return pidFile; } - unsigned GetDetailStatWritePeriod() const - { return detailStatWritePeriod; } + unsigned GetDetailStatWritePeriod() const + { return detailStatWritePeriod; } unsigned GetStatWritePeriod() const { return statWritePeriod * 60; } unsigned GetDayFee() const { return dayFee; } bool GetFullFee() const { return fullFee; } diff --git a/stglibs/dotconfpp.lib/dotconfpp.cpp b/stglibs/dotconfpp.lib/dotconfpp.cpp index 8f766f01..391656a6 100644 --- a/stglibs/dotconfpp.lib/dotconfpp.cpp +++ b/stglibs/dotconfpp.lib/dotconfpp.cpp @@ -23,7 +23,7 @@ #include "mempool.h" DOTCONFDocumentNode::DOTCONFDocumentNode():previousNode(NULL), nextNode(NULL), parentNode(NULL), childNode(NULL), - values(NULL), valuesCount(0), + values(NULL), valuesCount(0), name(NULL), lineNum(0), fileName(NULL), closed(true) { } @@ -117,15 +117,15 @@ int DOTCONFDocument::cleanupLine(char * line) *line = ' ';continue; } if(*line == '\\' && (*(line+1) == '"' || *(line+1) == '\'')){ - *bg++ = *(line+1); + *bg++ = *(line+1); line+=2; continue; } if(*line == '\\' && *(line+1) == 'n'){ - *bg++ = '\n'; + *bg++ = '\n'; line+=2; continue; } if(*line == '\\' && *(line+1) == 'r'){ - *bg++ = '\r'; + *bg++ = '\r'; line+=2; continue; } if(*line == '\\' && (*(line+1) == '\n' || *(line+1) == '\r')){ //multiline @@ -170,7 +170,7 @@ int DOTCONFDocument::cleanupLine(char * line) continue; } *bg++ = *line++; - } + } if(quoted && !multiline){ error(curLine, fileName, "unterminated quote"); @@ -259,7 +259,7 @@ int DOTCONFDocument::parseLine() tagNode->pushValue(nodeValue); } } - + return 0; } int DOTCONFDocument::parseFile(DOTCONFDocumentNode * _parent) @@ -292,7 +292,7 @@ int DOTCONFDocument::parseFile(DOTCONFDocumentNode * _parent) if(ret == -1){ break; } - } + } } } @@ -331,7 +331,7 @@ int DOTCONFDocument::checkConfig(const std::list::iterator } int DOTCONFDocument::setContent(const char * _fileName) -{ +{ int ret = 0; char realpathBuf[PATH_MAX]; @@ -363,11 +363,11 @@ int DOTCONFDocument::setContent(const char * _fileName) } ret = parseFile(); - + (void) fclose(file); if(!ret){ - + if( (ret = checkConfig(nodeTree.begin())) == -1){ return -1; } @@ -443,7 +443,7 @@ int DOTCONFDocument::setContent(const char * _fileName) //free(fileName); fileName = strdup(realpathBuf); from = nodeTree.end(); --from; - + if(tagNode->parentNode){ DOTCONFDocumentNode * nd = tagNode->parentNode->childNode; while(nd){ @@ -455,7 +455,7 @@ int DOTCONFDocument::setContent(const char * _fileName) curPrev = nd; } ret = parseFile(tagNode->parentNode); - + //ret = parseFile(tagNode->parentNode); (void) fclose(file); if(ret == -1) @@ -487,7 +487,7 @@ int DOTCONFDocument::checkRequiredOptions() { for(std::list::const_iterator ci = requiredOptions.begin(); ci != requiredOptions.end(); ++ci){ bool matched = false; - for(std::list::iterator i = nodeTree.begin(); i!=nodeTree.end(); ++i){ + for(std::list::iterator i = nodeTree.begin(); i!=nodeTree.end(); ++i){ if(!cmp_func((*i)->name, *ci)){ matched = true; break; @@ -562,7 +562,7 @@ char * DOTCONFDocument::getSubstitution(char * macro, int lineNum) buf = mempool->strdup(subs); } else { std::list::iterator i = nodeTree.begin(); - for(; i!=nodeTree.end(); ++i){ + for(; i!=nodeTree.end(); ++i){ DOTCONFDocumentNode * tagNode = *i; if(!cmp_func(tagNode->name, variable)){ if(tagNode->valuesCount != 0){ @@ -629,7 +629,7 @@ const DOTCONFDocumentNode * DOTCONFDocument::getFirstNode() const const DOTCONFDocumentNode * DOTCONFDocument::findNode(const char * nodeName, const DOTCONFDocumentNode * parentNode, const DOTCONFDocumentNode * startNode) const { //printf("nodeName=%s, cont=%s, start=%s\n", nodeName, containingNode!=NULL?containingNode->name:"NULL", startNode!=NULL?startNode->name:"NULL"); - + std::list::const_iterator i = nodeTree.begin(); if(startNode == NULL)