From e0744954b67096320bc734e3b254862804430ae8 Mon Sep 17 00:00:00 2001 From: b Date: Mon, 25 Mar 2024 16:32:47 +0000 Subject: [PATCH] continied perl generation --- .gitmodules | 3 +++ config | 2 +- exec | 1 + makefile | 41 +++++++++++++++++++++++----- makefile.1.mak | 41 +++++++++++++++++++++++----- mscha_lib.pm => mscha_lib.1.pm | 49 ++++++++++++++++++++++------------ settings-debug.txt | 12 +++++++++ settings.txt | 42 +++++++++++++++++++++-------- 8 files changed, 150 insertions(+), 41 deletions(-) create mode 160000 exec rename mscha_lib.pm => mscha_lib.1.pm (94%) diff --git a/.gitmodules b/.gitmodules index 330cc55..b6a0567 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "config"] path = config url = ../../../botm/config +[submodule "exec"] + path = exec + url = ../../../botm/exec diff --git a/config b/config index 778dbca..352e86f 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit 778dbca76f413af0b5d2c442a482b4d4eebaf2cb +Subproject commit 352e86fd3d4afab9adb6c340d236f501f3d91560 diff --git a/exec b/exec new file mode 160000 index 0000000..4cc21a9 --- /dev/null +++ b/exec @@ -0,0 +1 @@ +Subproject commit 4cc21a9192d4f85d7dcee52333e5810d8aadc109 diff --git a/makefile b/makefile index 7522610..b9e629c 100644 --- a/makefile +++ b/makefile @@ -25,6 +25,9 @@ TARGET = debug endif PERL = perl +CC =/usr/bin/gcc +CF =-g -Wall + CHMOD = /usr/bin/chmod CP = /usr/bin/cp MKDIR = /usr/bin/mkdir @@ -33,6 +36,7 @@ RM = /usr/bin/rm BIN_PATH = /botm/bin/test-ottbackup/mscha/ LIB_PATH = /botm/lib/test-ottbackup/mscha/ +LOG_PATH = /botm/log/test-ottbackup/mscha/ WWW_PATH = /botm/www/1190/mschatest/ CONF = /botm/etc/www/conf/1190/test-mscha.conf @@ -49,6 +53,7 @@ GENERATE_FROM=\ frame.1.pl\ frameaftertime.1.pl\ mscha.1.conf\ +mscha_lib.1.pm\ viewer.1.pl\ vieweraftertime.1.pl\ @@ -56,9 +61,22 @@ TO_GENERATE=\ frame.pl\ frameaftertime.pl\ mscha.conf\ +mscha_lib.pm\ viewer.pl\ vieweraftertime.pl\ +PERL_WRAP_EXEC=\ +frame\ +frameaftertime\ +viewer\ +vieweraftertime + +SETUID=\ +frame\ +frameaftertime\ +viewer\ +vieweraftertime + EXEC=\ frame.pl\ frameaftertime.pl\ @@ -66,18 +84,21 @@ viewer.pl\ vieweraftertime.pl BIN=\ -$(EXEC) +$(EXEC)\ +$(PERL_WRAP_EXEC) + LIB=\ mscha_lib.pm DIR=\ +$(LOG_PATH)\ $(BIN_PATH)\ $(LIB_PATH)\ $(WWW_PATH) -all: exec $(TO_GENERATE) +all: setuid exec $(TO_GENERATE) install: cp_bin cp_lib cp_conf cp_www @@ -94,6 +115,16 @@ configure.pl: $(CONFIGFILE) config/configure.1.pl $(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) configure.pl $(CONFIGURE_CMD) --v --in $(GENERATE_FROM) --out $(TO_GENERATE) +$(PERL_WRAP_EXEC): %: exec/exec.c exec/settings.txt configure.pl + $(PERL) configure.pl --do path=$(BIN_PATH) target=$*.pl io_path=$(LOG_PATH) stderr=$*-stderr.log exec/settings.txt --in exec/exec.c --out $*.c + $(CC) $(CF) -o $@ $*.c + +exec: $(EXEC) + $(CHMOD) +x $(EXEC) + +setuid: $(SETUID) + $(CHMOD) u+s,g+s $(SETUID) + mktree: $(MKDIR) -p $(DIR) @@ -120,13 +151,11 @@ cp_www: cp_www_data: $(CP) -p -r www-data/* $(WWW_PATH) -exec: $(EXEC) - $(CHMOD) +x $(EXEC) clean: - $(RM) -f configure.pl $(TO_GENERATE) + $(RM) -f configure.pl $(TO_GENERATE) $(PERL_WRAP_EXEC) $(PERL_WRAP_EXEC:=.c) $(PERL) config/configure.1.pl --do $(DEFAULT_CONFIGFILE) --in makefile.1.mak --out makefile -PHONY: all clean cp_bin cp_conf cp_lib cp_www cp_www_data exec install install_all mktree +PHONY: all clean cp_bin cp_conf cp_lib cp_www cp_www_data exec install install_all mktree setuid diff --git a/makefile.1.mak b/makefile.1.mak index 7f345e8..7d13bae 100644 --- a/makefile.1.mak +++ b/makefile.1.mak @@ -25,6 +25,9 @@ TARGET = $(DEFAULT_TARGET) ###MAKE_TARGET: endif PERL = perl +###MAKE_CC: CC=gcc +###MAKE_CF: CF=-g -Wall + ###MAKE_CHMOD: CHMOD = chmod ###MAKE_CP: CP = cp ###MAKE_MKDIR: MKDIR = mkdir @@ -33,6 +36,7 @@ PERL = perl ###MAKE_BIN_PATH: BIN_PATH = /botm/bin/ottbackup/mscha ###MAKE_LIB_PATH: LIB_PATH = /botm/lib/ottbackup/mscha +###MAKE_LOG_PATH: LOG_PATH = /botm/log/ottbackup/mscha ###MAKE_WWW_PATH: WWW_PATH = /botm/www/1190/mscha ###MAKE_CONF: CONF = /botm/etc/www/conf/1190/mscha.conf @@ -49,6 +53,7 @@ GENERATE_FROM=\ frame.1.pl\ frameaftertime.1.pl\ mscha.1.conf\ +mscha_lib.1.pm\ viewer.1.pl\ vieweraftertime.1.pl\ @@ -56,9 +61,22 @@ TO_GENERATE=\ frame.pl\ frameaftertime.pl\ mscha.conf\ +mscha_lib.pm\ viewer.pl\ vieweraftertime.pl\ +PERL_WRAP_EXEC=\ +frame\ +frameaftertime\ +viewer\ +vieweraftertime + +SETUID=\ +frame\ +frameaftertime\ +viewer\ +vieweraftertime + EXEC=\ frame.pl\ frameaftertime.pl\ @@ -66,18 +84,21 @@ viewer.pl\ vieweraftertime.pl BIN=\ -$(EXEC) +$(EXEC)\ +$(PERL_WRAP_EXEC) + LIB=\ mscha_lib.pm DIR=\ +$(LOG_PATH)\ $(BIN_PATH)\ $(LIB_PATH)\ $(WWW_PATH) -all: exec $(TO_GENERATE) +all: setuid exec $(TO_GENERATE) install: cp_bin cp_lib cp_conf cp_www @@ -94,6 +115,16 @@ configure.pl: $(CONFIGFILE) config/configure.1.pl $(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) configure.pl $(CONFIGURE_CMD) --v --in $(GENERATE_FROM) --out $(TO_GENERATE) +$(PERL_WRAP_EXEC): %: exec/exec.c exec/settings.txt configure.pl + $(PERL) configure.pl --do path=$(BIN_PATH) target=$*.pl io_path=$(LOG_PATH) stderr=$*-stderr.log exec/settings.txt --in exec/exec.c --out $*.c + $(CC) $(CF) -o $@ $*.c + +exec: $(EXEC) + $(CHMOD) +x $(EXEC) + +setuid: $(SETUID) + $(CHMOD) u+s,g+s $(SETUID) + mktree: $(MKDIR) -p $(DIR) @@ -120,13 +151,11 @@ cp_www: cp_www_data: $(CP) -p -r www-data/* $(WWW_PATH) -exec: $(EXEC) - $(CHMOD) +x $(EXEC) clean: - $(RM) -f configure.pl $(TO_GENERATE) + $(RM) -f configure.pl $(TO_GENERATE) $(PERL_WRAP_EXEC) $(PERL_WRAP_EXEC:=.c) $(PERL) config/configure.1.pl --do $(DEFAULT_CONFIGFILE) --in makefile.1.mak --out makefile -PHONY: all clean cp_bin cp_conf cp_lib cp_www cp_www_data exec install install_all mktree +PHONY: all clean cp_bin cp_conf cp_lib cp_www cp_www_data exec install install_all mktree setuid diff --git a/mscha_lib.pm b/mscha_lib.1.pm similarity index 94% rename from mscha_lib.pm rename to mscha_lib.1.pm index 52d456b..2934890 100644 --- a/mscha_lib.pm +++ b/mscha_lib.1.pm @@ -1,30 +1,50 @@ -# 04.03.2020 # Library of functions # # Library of functions # -# Copyright (C) 2020 Balthasar Szczepański +# Copyright (C) 2020, 2024 Balthasar Szczepański # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . package mscha_lib; use strict; #use warnings + +use utf8; +use Encode ('encode', 'decode'); use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); +###PERL_EXPORT_VERSION: our $VERSION = 'x.x.x'; +@ISA = qw(Exporter); +@EXPORT = (); +@EXPORT_OK = ( + 'failpage', + 'entityencode', + 'gethttpheader', + 'getcgi', + 'urldecode', + 'gettimeframe', + 'urlencode' + 'printframeselection', + 'gettatframe', + 'redirect' +); + +###PERL_LIB: use lib /botm/lib/ottbackub/mscha + use constant entitycode => { 'amp' => '&', 'gt' => '>', @@ -284,11 +304,6 @@ use constant time_data => '/eizm/www/time/mscha/time-data'; use constant time_data_period => '/eizm/www/time/mscha/time-data-period'; use constant tat_data => '/eizm/www/time/mscha/tat-data'; -$VERSION = 0.000001; -@ISA = qw(Exporter); -@EXPORT = (); -@EXPORT_OK = qw(failpage entityencode gethttpheader getcgi urldecode gettimeframe urlencode printframeselection gettatframe redirect); -%EXPORT_TAGS = (); # Function to show an error page # arguments: 1 - header fields, 2 - page title, 3 - error message, 4 method diff --git a/settings-debug.txt b/settings-debug.txt index abb4b57..d812ad9 100644 --- a/settings-debug.txt +++ b/settings-debug.txt @@ -9,6 +9,7 @@ bin_path : /botm/bin/test-ottbackup/mscha cgi_path : /mschatest conf_path: /botm/etc/www/conf/1190 lib_path : /botm/lib/test-ottbackup/mscha +log_path : /botm/log/test-ottbackup/mscha www_path : /botm/www/1190/mschatest @@ -17,3 +18,14 @@ chmod: /usr/bin/chmod mkdir: /usr/bin/mkdir perl : /usr/bin/perl rm : /usr/bin/rm + +oldlogs: /botm/bin/oldlogs/oldlogs.pl + +CC: /usr/bin/gcc +CF: -g -Wall + + +log_size_limit: 65536 +logs_uncompressed: 2 +logs_total: 10 +oldlogs_schedule: #0 3 * * * diff --git a/settings.txt b/settings.txt index 1e3369f..a76ebf1 100644 --- a/settings.txt +++ b/settings.txt @@ -15,11 +15,22 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -_bin_path = @_PATH($bin_path, ) -_bin_frame_path = @_PATH($bin_path, frame.pl ) -_bin_tat_frame_path = @_PATH($bin_path, frameaftertime.pl ) -_bin_tat_view_path = @_PATH($bin_path, vieweraftertime.pl) -_bin_view_path = @_PATH($bin_path, viewer.pl ) +_version: 1.1.0 + +_SHEBANG: #!$0 + +_PERL_STR: '@_ESCAPE($0,')' +_PERL_USE_2: use $0 $1; +_PERL_CONSTANT: use constant $0 => $1; +_PERL_CONSTANT_STR: @_PERL_CONSTANT($0,@_PERL_STR($1)) +_PERL_OUR: our $0 = $1; +_PERL_OUR_STR: @_PERL_OUR(\$$0,@_PERL_STR($1)) + +_bin_path = @_PATH($bin_path, ) +_bin_frame_path = @_PATH($bin_path, frame ) +_bin_tat_frame_path = @_PATH($bin_path, frameaftertime ) +_bin_tat_view_path = @_PATH($bin_path, vieweraftertime) +_bin_view_path = @_PATH($bin_path, viewer ) _cgi_path = @_PATH($cgi_path, ) _cgi_frame_path = @_PATH($cgi_path, frame ) @@ -32,6 +43,7 @@ _cgi_view_2_path = @_PATH($cgi_path, view.fcgi ) _conf_path = @_PATH($conf_path, $name\.conf) _lib_path = @_PATH($lib_path,) +_log_path = @_PATH($log_path,) _www_path = @_PATH($www_path,) @@ -48,11 +60,6 @@ CONF_CGI_TAT_VIEW_2 = $_cgi_tat_view_2_path CONF_CGI_VIEW = $_cgi_view_path CONF_CGI_VIEW_2 = $_cgi_view_2_path - - - - - MAKE_TARGET = TARGET = $target MAKE_CHMOD = CHMOD = $chmod @@ -61,8 +68,21 @@ MAKE_MKDIR = MKDIR = $mkdir MAKE_PERL = PERL = $perl MAKE_RM = RM = $rm +MAKE_CC = CC =$CC +MAKE_CF = CF =$CF + +MAKE_CONF = CONF = $_conf_path + MAKE_BIN_PATH = BIN_PATH = $_bin_path MAKE_LIB_PATH = LIB_PATH = $_lib_path +MAKE_LOG_PATH = LOG_PATH = $_log_path MAKE_WWW_PATH = WWW_PATH = $_www_path -MAKE_CONF = CONF = $_conf_path + +PERL_LIB = @_PERL_USE_2(lib, @_PERL_STR($lib_path)) + +PERL_SET_PATH = \$ENV{'PATH'} = @_PERL_STR($path); + +PERL_EXPORT_VERSION = @_PERL_OUR_STR( VERSION, $_version) + +# PERL_PATH_SEPARATOR = @_PERL_CONSTANT_STR( PATH_SEPARATOR, $_PATH_SEPARATOR) \ No newline at end of file -- 2.30.2