From 0aed55494aebabe1416b764a4cf92de80ded817e Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Sun, 24 Feb 2019 00:05:50 +0100 Subject: [PATCH] moved from automake to rtmake and makeheaders --- doc/todo.txt | 21 -- makefile | 3 +- rtmake | 4 - src/2_makefile_deps | 19 ++ src/3_documents/makefile.txt | 91 +++++++ {doc => src/3_documents}/makeheaders.txt | 0 src/3_to_do.txt | 10 + src/5_scratch/common.lib.h | 4 + src/5_scratch/dbprintf.lib.h | 3 + src/5_scratch/dispatch_exec.lib.h | 4 + src/5_scratch/dispatch_f.lib.h | 5 + src/5_scratch/dispatch_useradd.lib.h | 5 + src/5_scratch/makefile | 148 ++++++++++ src/5_scratch/subu-config.lib.h | 9 + src/5_scratch/subu-init.cli.h | 10 + src/5_scratch/subu-mk-0.cli.h | 8 + src/5_scratch/subu-mk-0.lib.h | 13 + src/5_scratch/subu-number.cli.h | 10 + src/{duck/local_common.h => common.lib.c} | 3 +- src/common.lib.h | 4 + src/common.lib.o | Bin 0 -> 1280 bytes src/dbprintf.lib.c | 3 +- src/dbprintf.lib.h | 3 + src/dispatch_exec.lib.c | 7 +- src/dispatch_exec.lib.h | 4 + src/dispatch_f.lib.c | 5 +- src/dispatch_f.lib.h | 5 + src/dispatch_useradd.lib.c | 25 +- src/dispatch_useradd.lib.h | 16 ++ src/dispatch_useradd.lib.o | Bin 0 -> 7824 bytes src/local_common.h | 4 - src/makefile | 316 ++++++---------------- src/subu-config.lib.c | 11 +- src/subu-config.lib.h | 2 +- src/subu-config.lib.o | Bin 8760 -> 0 bytes src/subu-init.cli.h | 2 + src/subu-init.cli.o | Bin 6872 -> 0 bytes src/subu-mk-0.cli.h | 8 + src/subu-mk-0.lib.c | 66 +++-- src/subu-mk-0.lib.h | 29 ++ src/subu-mk-0.lib.o | Bin 0 -> 21184 bytes src/subu-number.cli.h | 10 + 42 files changed, 570 insertions(+), 320 deletions(-) delete mode 100755 rtmake create mode 100644 src/2_makefile_deps create mode 100644 src/3_documents/makefile.txt rename {doc => src/3_documents}/makeheaders.txt (100%) create mode 100644 src/3_to_do.txt create mode 100644 src/5_scratch/common.lib.h create mode 100644 src/5_scratch/dbprintf.lib.h create mode 100644 src/5_scratch/dispatch_exec.lib.h create mode 100644 src/5_scratch/dispatch_f.lib.h create mode 100644 src/5_scratch/dispatch_useradd.lib.h create mode 100755 src/5_scratch/makefile create mode 100644 src/5_scratch/subu-config.lib.h create mode 100644 src/5_scratch/subu-init.cli.h create mode 100644 src/5_scratch/subu-mk-0.cli.h create mode 100644 src/5_scratch/subu-mk-0.lib.h create mode 100644 src/5_scratch/subu-number.cli.h rename src/{duck/local_common.h => common.lib.c} (58%) create mode 100644 src/common.lib.h create mode 100644 src/common.lib.o create mode 100644 src/dbprintf.lib.h create mode 100644 src/dispatch_exec.lib.h create mode 100644 src/dispatch_f.lib.h create mode 100644 src/dispatch_useradd.lib.h create mode 100644 src/dispatch_useradd.lib.o delete mode 100644 src/local_common.h delete mode 100644 src/subu-config.lib.o delete mode 100644 src/subu-init.cli.o create mode 100644 src/subu-mk-0.cli.h create mode 100644 src/subu-mk-0.lib.h create mode 100644 src/subu-mk-0.lib.o create mode 100644 src/subu-number.cli.h diff --git a/doc/todo.txt b/doc/todo.txt index 52d1998..139597f 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -1,23 +1,2 @@ -2019-02-05T23:14:40Z morpheus@manorhouse§~/src/subu§ - error can cause subu-mk-0 to leave the creating of a subu - in an intermediate state. Rather than bailing on some - of the errors we need to clean up instead. Perhaps the - yet to be written subu-rm program will be resilent enough - to do more general cleanup. - -2019-02-21T22:02:15Z morpheus@manorhouse§~/src/subu§ - subu-mk-0 only gives x privs via setfacl to subu on masteru home and on - subuland. Hence a subu can not run subu-mk-0 and be guaranteed access to the - subu's newly made subu. I.e. cd might not work for recurisve subu. - - The easy fix would be to use perms instead of facls, and give all home - directories other 'x' privs. Another fix would be to take apart the subu - home path, and make sure that all sub paths have 'x'. - - For now, I'm just leaving it to one layer. - -2019-02-23T18:56:31Z morpheus@manorhouse§~/subu_land/subu/src§ - need to modify subu-init to take a configuration file name argument - might want to add arguments to other subu commands also diff --git a/makefile b/makefile index 6e5ff7d..f5487c9 100755 --- a/makefile +++ b/makefile @@ -1,4 +1,5 @@ -subdirectories=$(shell /usr/bin/find . -maxdepth 1 -printf "%f " | sed y/\./\ /) +#subdirectories=$(shell /usr/bin/find . -maxdepth 1 -printf "%f " | sed y/\./\ /) +subdirectories=src all : $(foreach dir, $(subdirectories), \ diff --git a/rtmake b/rtmake deleted file mode 100755 index 6fac2ab..0000000 --- a/rtmake +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -make --no-print-directory -f $RT_BASE/bin/source_local_makefile $@ - diff --git a/src/2_makefile_deps b/src/2_makefile_deps new file mode 100644 index 0000000..8bf3e2d --- /dev/null +++ b/src/2_makefile_deps @@ -0,0 +1,19 @@ +common.lib.o: common.lib.c +dispatch_useradd.lib.o: dispatch_useradd.lib.c dispatch_useradd.lib.h +subu-mk-0.lib.o: subu-mk-0.lib.c subu-mk-0.lib.h +subu-config.lib.o: subu-config.lib.c subu-config.lib.h +dispatch_exec.lib.o: dispatch_exec.lib.c dispatch_exec.lib.h +dbprintf.lib.o: dbprintf.lib.c dbprintf.lib.h +dispatch_f.lib.o: dispatch_f.lib.c dispatch_f.lib.h +subu-number.cli.o: subu-number.cli.c subu-number.cli.h +subu-mk-0.cli.o: subu-mk-0.cli.c subu-mk-0.lib.h +subu-init.cli.o: subu-init.cli.c subu-init.cli.h + +subu-init : subu-init.cli.o . /libsubu.a + g++ -o subu-init subu-init.cli.o -L. -lsubu + +subu-mk-0 : subu-mk-0.cli.o . /libsubu.a + g++ -o subu-mk-0 subu-mk-0.cli.o -L. -lsubu + +subu-number : subu-number.cli.o . /libsubu.a + g++ -o subu-number subu-number.cli.o -L. -lsubu diff --git a/src/3_documents/makefile.txt b/src/3_documents/makefile.txt new file mode 100644 index 0000000..722de84 --- /dev/null +++ b/src/3_documents/makefile.txt @@ -0,0 +1,91 @@ +these are the comments from my RT makefile: + +# +# 2010 11 20 TWL Created +# 2011 05 26 TWL Modified to generalize +# 2012 02 23 NLS Add ECHO variable to use on different environnement +# corrected setup macro --> add include directory in the path to copy +# corrected install macro --> change the name of installed library : lib$(LIB)$(LIBSUFFIX) +# changed DOC_DIR directory name to 5_documents +# 2012 02 23 TWL removed LIB variable which is now set from the command line so +# so that all source dirs can use the same makefile +# 2012 02 23 TWL added target make dist_clean which also deletes the 2_makefile_deps file +# 2012 04 11 AWW added creation of temporary disk before each test is run +# 2012 06 05 TWL moved tests and try .cc files to directories. caused rtmake tests to +# dist_clean and make deps +# +# +#---------------------------------------------------------------------------- +# use this makefile to compile and test the code: +# +# for a first time run, or for regression use the following: +# +# $ make setup # makes the directories, though should already exist +# $ make regress +# +# the usual development workflow makes use of these: +# +# $ make deps # only when needed, for example if headers includes change or new files introduced +# $ cd tests; make deps # only when needed +# $ make lib # this makes the local library +# $ make tests # this updates tests and compiles +# $ make clean # deletes the .o files and library to force a recompile +# $ cd 1_tests; make clean +# +# for a release of a component +# +# $ make regress +# $ make install # this will only work if all the tests in 1_tests are passing +# +# before a checkin +# +# $ make dist_clean # will also clean the tests and try directories +# +# .lib.cc c++ files taken as source of object files for local build library +# .exl.cc c++ files taken to have main calls and are linked against local build libary +# .ex.cc c++ files taken to have main calls and are not linked against the local build library +# there are no rules for other files in this makefile +# +# about dependencies +# The makefile has no way of knowing if an edit changed the dependencies. Often they do not +# and it would be unwieldy to make the deps every time. Hence *the programmer* must delete +# the deps file if he has made any changes that change the dependencies. +# +# The makefile will make the 2_makefile_deps if the file is missing. +# +# +# about testing +# +# the name of the directory you run make in is taken to also be: the name of the library, +# the name of the main include file (with a .h added), and the name of the include directory +# where the individual headers are found. It is called LIB +# +# test programs are kept in a subdirectory called 1_tests, and are either .exl.cc, ex.cc, +# .sh files. When 'make tests' target is invoked they are all run. Test executables return 0 +# if the test fails, non-zero otherwise. +# +# to remove a test from the pool move it into the subdirectory in 1_tests, 9_broken, +# 5_more_tests of 5_scratch. broken tests are things that are known but must be fixed +# before a release. 5_more_tests are tests being worked on. 5_scratch is stuff that is +# probably going to be deleted. if there is a 5_deprecated, that is for good stuff but it +# is no longer used for some reason or other. +# +# There is a standard source code template and a +# messaging convention. Also, the names, by convention,are test_xxxx_ where xxx is a +# hexadecimal series nummber. If all the test executables pass the file 1_TESTS_PASSED is +# left in the directory. Otherwise the file 1_TESTS_FAILED is left in the directory. +# +# about release directory +# +# this is set in the ApplicationBase variable by rt_init +# +# after the tests pass stuff might be copied to the release directory using +# +# make install +# +# the release directory must have these subdirectories: +# +# bin documents include src +# +# +# diff --git a/doc/makeheaders.txt b/src/3_documents/makeheaders.txt similarity index 100% rename from doc/makeheaders.txt rename to src/3_documents/makeheaders.txt diff --git a/src/3_to_do.txt b/src/3_to_do.txt new file mode 100644 index 0000000..d5f0e34 --- /dev/null +++ b/src/3_to_do.txt @@ -0,0 +1,10 @@ +2019-02-05T23:14:40Z morpheus@manorhouse§~/src/subu§ + error can cause subu-mk-0 to leave the creating of a subu in an intermediate + state. Rather than bailing on some of the errors we need to clean up instead. + Perhaps the yet to be written subu-rm program will be resilent enough to do + more general cleanup. + +2019-02-23T18:56:31Z morpheus@manorhouse§~/subu_land/subu/src§ + need to modify subu-init to take a configuration file name argument instead of + using a global variabel value. might want to add arguments to other subu + commands also diff --git a/src/5_scratch/common.lib.h b/src/5_scratch/common.lib.h new file mode 100644 index 0000000..6b7f7c9 --- /dev/null +++ b/src/5_scratch/common.lib.h @@ -0,0 +1,4 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +typedef unsigned int uint; +#define INTERFACE 0 diff --git a/src/5_scratch/dbprintf.lib.h b/src/5_scratch/dbprintf.lib.h new file mode 100644 index 0000000..3056cf6 --- /dev/null +++ b/src/5_scratch/dbprintf.lib.h @@ -0,0 +1,3 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +int dbprintf(const char *format,...); diff --git a/src/5_scratch/dispatch_exec.lib.h b/src/5_scratch/dispatch_exec.lib.h new file mode 100644 index 0000000..877a38e --- /dev/null +++ b/src/5_scratch/dispatch_exec.lib.h @@ -0,0 +1,4 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +int dbprintf(const char *format,...); +int dispatch_exec(char **argv,char **envp); diff --git a/src/5_scratch/dispatch_f.lib.h b/src/5_scratch/dispatch_f.lib.h new file mode 100644 index 0000000..994592d --- /dev/null +++ b/src/5_scratch/dispatch_f.lib.h @@ -0,0 +1,5 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +int dispatch_f_euid_egid(char *fname,int(*f)(void *arg),void *f_arg,uid_t euid,gid_t egid); +int dbprintf(const char *format,...); +int dispatch_f(char *fname,int(*f)(void *arg),void *f_arg); diff --git a/src/5_scratch/dispatch_useradd.lib.h b/src/5_scratch/dispatch_useradd.lib.h new file mode 100644 index 0000000..ce62797 --- /dev/null +++ b/src/5_scratch/dispatch_useradd.lib.h @@ -0,0 +1,5 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +typedef unsigned int uint; +int dispatch_exec(char **argv,char **envp); +struct dispatch_useradd_ret_t dispatch_useradd(char **argv,char **envp); diff --git a/src/5_scratch/makefile b/src/5_scratch/makefile new file mode 100755 index 0000000..268cf34 --- /dev/null +++ b/src/5_scratch/makefile @@ -0,0 +1,148 @@ + +# a single space literal, for example if you wanted to subsitute commas to +# spaces: $(subst $(space),;,$(string)) we ran into this out of a need to send +# multiple separate command arguments to a shell script from one variable value +blank := +space :=$(blank) $(blank) + +# some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo .. +ECHO= echo +#ECHO= echo -e + +SHELL=/bin/bash +SCRATCHDIR= 5_scratch # clean and others put things here +CC=gcc +CFLAGS="-std=c11 -fPIC -I. -ggdb -DDEBUG" +LIB="libsubu.a" +LIBPATH="." #no trailing slash +LINKFLAGS="-L. -lsubu" + +SOURCES_LIB= $(wildcard *.lib.c) +SOURCES_CLI= $(wildcard *.cli.c) +SOURCES= $(SOURCES_LIB) $(SOURCES_CLI) + +OBJECTS_LIB= $(patsubst %.c, %.o, $(SOURCES_LIB)) +OBJECTS_CLI= $(patsubst %.c, %.o, $(SOURCES_CLI)) +OBJECTS= $(OBJECTS_LIB) $(OBJECTS_CLI) + +# sort causes compiles to go in lexical order by file name, this is used to order the tests e.g. +EXECS= $(sort $(patsubst %.cli.c, %, $(wildcard *.cli.c))) + +version: + @echo '---- make $@:------------------------------------------------------------' + @echo `pwd`'>' + @echo makefile version 2.0 + @echo "CC: " $(CC) + @echo "CFLAGS: " $(CFLAGS) + @echo "LIB: " $(LIB) + @echo "LIBPATH: " $(LIBPATH) + @echo "LINKFLAGS: " $(LINKFLAGS) + @echo '______end make $@_____' + +# safe to run this in an already setup or partially setup directory +setup: + @echo '---- make $@:------------------------------------------------------------' + @echo `pwd`'>' + if [ ! -e $(SCRATCHDIR) ]; then mkdir $(SCRATCHDIR); fi + if [ ! -e 1_tests ]; then mkdir 1_tests; fi + if [ ! -e 1_try ]; then mkdir 1_try; fi + if [ ! -e 2_bin ]; then mkdir 2_bin; fi + if [ ! -e 3_documents ]; then mkdir 3_documents; fi + if [ ! -e 3_to_do.txt ]; then touch 3_to_do.txt; fi + if [ ! -e 5_deprecated ]; then mkdir 5_deprecated; fi + @echo '______end make $@_____' + + +deps: + @echo '---- make $@:------------------------------------------------------------' + @echo `pwd`'>' + $(CC) $(CFLAGS) -MM $(SOURCES) 1> 2_makefile_deps + for i in $(EXECS) ; do\ + echo >> 2_makefile_deps;\ + $(ECHO) "$$i : $$i.cli.o" >> 2_makefile_deps;\ + $(ECHO) " $(CC) -o $$i $$i.cli.o" >> 2_makefile_deps;\ + done + @echo '______end make $@_____' + +lib: clear_test_flags + @echo '---- make $@:------------------------------------------------------------' + @echo `pwd`'>' + if [ ! -e 2_makefile_deps ]; then make deps; fi # the user must delete 2_makefile_deps if deps change! + make sub_lib + @echo '______end make $@_____' + +sub_lib: $(LIB) + + +$(LIBPATH)/$(LIB): + @if [ "$(LIBPATH)" != "$(APPLICATION_BASE)" ]; then \ + echo "LIBPATH: " "$(LIBPATH)";\ + echo "$APPLICATION_BASE: " "$(APPLICATION_BASE)";\ + echo "The library path is not the same as the application base so don't know how to make it.";\ + fi + [ "$(LIBPATH)" == "$(APPLICATION_BASE)" ] + cd $(APPLICATION_BASE); make lib + +execs: $(LIBPATH)/$(LIB) + @echo '---- make $@:------------------------------------------------------------' + @echo `pwd`'>' + if [ ! -e 2_makefile_deps ]; then make deps; fi + make sub_execs + # for i in $(EXEC_OBJECTS); do rm $$i; done + @echo '______end make $@_____' + +sub_execs: $(EXECS) + +install: all + @echo '---- make $@:------------------------------------------------------------' + @echo `pwd`'>' + @if[ ! -e 1_tests_passed ]; then echo "can't install as tests have not passed"; fi + @test -e test_passed + for i in $(BIN); do cp $$i $(RT_BASE)/bin; done + cp $(LIB) $(RT_BASE)/lib + cp $(APPLICATION).h $(RT_BASE)/include + if [ -d $(APPLICATION) ]; then cp $(APPLICATION)/*.h $(RT_BASE)/include/$(APPLICATION); fi + @echo '______end make $@_____' + +# "make lib" "make execs" now cleans up the .o files afterward, so clean should not be needed often +# clean works on the current working directory, dist_clean also descends into 1_tests and 1_try +# +clean: + @echo '---- make $@:------------------------------------------------------------' + @echo `pwd`'>' + for i in $(wildcard *~); do mv $$i $(SCRATCHDIR); done + for i in $(wildcard *.lib.o) $(wildcard *.exl.o) $(wildcard *.ex.o); do rm $$i; done + if [ -f 2_makefile_deps ]; then rm 2_makefile_deps; fi + if [ -f $(LIB) ]; then mv $(LIB) 5_scratch; fi + for i in $(EXEC_WL) $(EXEC); do if [ -e $$i ]; then rm $$i; fi; done + @echo '______end make $@_____' + + +# dist_clean is used to clean thing up before doing a checkin, hg add should be safe after a dist_clean +# dist_clean will recurse into the include directory = $(APPLICATION), tests, and try if they are present +# +dist_clean: + @echo '---- make $@:------------------------------------------------------------' + @echo `pwd`'>' + make clean + if [ -d $(APPLICATION) ]; then cd $(APPLICATION); make clean; fi + if [ -d 1_tests ]; then cd 1_tests; make clean; fi + if [ -d 1_try ] ; then cd 1_try; make clean; fi + @echo '______end make $@_____' + + +-include 2_makefile_deps + +# recipe for making object files: +# +%.o : %.cc + $(CC) $(CFLAGS) -c $< + + +# +$(LIB) : $(LIB_OBJECTS) + ar rcs $(LIB) $(LIB_OBJECTS) +# for i in $(LIB_OBJECTS); do rm $$i; done + + + diff --git a/src/5_scratch/subu-config.lib.h b/src/5_scratch/subu-config.lib.h new file mode 100644 index 0000000..d2b1f97 --- /dev/null +++ b/src/5_scratch/subu-config.lib.h @@ -0,0 +1,9 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +#include +typedef unsigned int uint; +int subu_number(sqlite3 *db,uint&subu_number); +int schema(sqlite3 *db,uint max_subu_number); +extern char config_file[]; +#define ERR_CONFIG_FILE -1 +#define INTERFACE 0 diff --git a/src/5_scratch/subu-init.cli.h b/src/5_scratch/subu-init.cli.h new file mode 100644 index 0000000..46bfd20 --- /dev/null +++ b/src/5_scratch/subu-init.cli.h @@ -0,0 +1,10 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +#include +#define ERR_CONFIG_FILE -1 +typedef unsigned int uint; +int schema(sqlite3 *db,uint max_subu_number); +extern char config_file[]; +int main(); +int main(); +int main(int argc,char **argv,char **env); diff --git a/src/5_scratch/subu-mk-0.cli.h b/src/5_scratch/subu-mk-0.cli.h new file mode 100644 index 0000000..075b350 --- /dev/null +++ b/src/5_scratch/subu-mk-0.cli.h @@ -0,0 +1,8 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +#include +extern char config_file[]; +int subu_mk_0(char *subuname,char *config_file); +int main(); +int main(); +int main(int argc,char **argv,char **env); diff --git a/src/5_scratch/subu-mk-0.lib.h b/src/5_scratch/subu-mk-0.lib.h new file mode 100644 index 0000000..8f6969c --- /dev/null +++ b/src/5_scratch/subu-mk-0.lib.h @@ -0,0 +1,13 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +int dispatch_exec(char **argv,char **envp); +struct dispatch_useradd_ret_t dispatch_useradd(char **argv,char **envp); +int dispatch_f_euid_egid(char *fname,int(*f)(void *arg),void *f_arg,uid_t euid,gid_t egid); +#include +#define ERR_CONFIG_FILE -1 +int dbprintf(const char *format,...); +extern char config_file[]; +int subu_mk_0(char *subuname,char *config_file); +int masteru_makes_subuhome(void *arg); +int allowed_subuname(char *subuname); +typedef unsigned int uint; diff --git a/src/5_scratch/subu-number.cli.h b/src/5_scratch/subu-number.cli.h new file mode 100644 index 0000000..7605c8e --- /dev/null +++ b/src/5_scratch/subu-number.cli.h @@ -0,0 +1,10 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +#include +typedef unsigned int uint; +int subu_number(sqlite3 *db,uint&subu_number); +#define ERR_CONFIG_FILE -1 +extern char config_file[]; +int main(); +int main(); +int main(int argc,char **argv,char **env); diff --git a/src/duck/local_common.h b/src/common.lib.c similarity index 58% rename from src/duck/local_common.h rename to src/common.lib.c index bb60b59..d998b3b 100644 --- a/src/duck/local_common.h +++ b/src/common.lib.c @@ -1,4 +1,5 @@ +#if INTERFACE typedef unsigned int uint; - +#endif diff --git a/src/common.lib.h b/src/common.lib.h new file mode 100644 index 0000000..6b7f7c9 --- /dev/null +++ b/src/common.lib.h @@ -0,0 +1,4 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +typedef unsigned int uint; +#define INTERFACE 0 diff --git a/src/common.lib.o b/src/common.lib.o new file mode 100644 index 0000000000000000000000000000000000000000..88e45138c95fe4f429360b750f6406d9dd062db8 GIT binary patch literal 1280 zcmbVKO-lnY5S_Mu3xYSnOFY?vn|6zqB2*R@twIqIya{DLVq5I)%5E0w$-6(zlSfbf z2Tyv_Nt@6%-BRg5cr$P2Ws*r=&RZAxTn?1w;0(r*VgaoDggvO&Zmw)7ccXxngD8ILvNS0tshhU@PUsK4auRz0P1`;tMLa`k;Q_{X z(LHhZ75Mtqc@Y;fCnNZY;Y>O0&4>Lv-g%uPG(elKLo$5NnTLl$Cb7;#2%y!bMX_c+^mDP|v4V&?iytU0^s zfAc`<^-2F%e~9`GT+8Z@WPgMyv!W4w@%1d^;KyRXZ`*kS@0oo6HzQNYhimM7;^gTMe1EP+L3h%^!~e;$kKnx!h0o@ HsO$d#sB~o8 literal 0 HcmV?d00001 diff --git a/src/dbprintf.lib.c b/src/dbprintf.lib.c index edea747..d9d236b 100644 --- a/src/dbprintf.lib.c +++ b/src/dbprintf.lib.c @@ -1,7 +1,8 @@ +#include "dbprintf.lib.h" + #include #include -#include "dbprintf.aux.h" int dbprintf(const char *format, ...){ va_list args; diff --git a/src/dbprintf.lib.h b/src/dbprintf.lib.h new file mode 100644 index 0000000..3056cf6 --- /dev/null +++ b/src/dbprintf.lib.h @@ -0,0 +1,3 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +int dbprintf(const char *format,...); diff --git a/src/dispatch_exec.lib.c b/src/dispatch_exec.lib.c index 1c3b4ae..024bff8 100644 --- a/src/dispatch_exec.lib.c +++ b/src/dispatch_exec.lib.c @@ -10,18 +10,19 @@ command passed in, and wants better behavior, he or she can spin a special version of dispatch for that command. */ +#include "dispatch_exec.lib.h" // without this #define execvpe is undefined #define _GNU_SOURCE + #include #include - #include #include #include #include -#include "local_common.h" -#include "dispatch_exec.lib.h" + + int dispatch_exec(char **argv, char **envp){ if( !argv || !argv[0] ){ diff --git a/src/dispatch_exec.lib.h b/src/dispatch_exec.lib.h new file mode 100644 index 0000000..877a38e --- /dev/null +++ b/src/dispatch_exec.lib.h @@ -0,0 +1,4 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +int dbprintf(const char *format,...); +int dispatch_exec(char **argv,char **envp); diff --git a/src/dispatch_f.lib.c b/src/dispatch_f.lib.c index 1548124..cfa75a8 100644 --- a/src/dispatch_f.lib.c +++ b/src/dispatch_f.lib.c @@ -11,18 +11,17 @@ version of dispatch for that command. */ +#include "dispatch_f.lib.h" + // without this #define execvpe is undefined #define _GNU_SOURCE #include #include - #include #include #include #include -#include "local_common.h" -#include "dispatch_f.lib.h" int dispatch_f(char *fname, int (*f)(void *arg), void *f_arg){ char *perror_src = "dispatch_f_as"; diff --git a/src/dispatch_f.lib.h b/src/dispatch_f.lib.h new file mode 100644 index 0000000..994592d --- /dev/null +++ b/src/dispatch_f.lib.h @@ -0,0 +1,5 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +int dispatch_f_euid_egid(char *fname,int(*f)(void *arg),void *f_arg,uid_t euid,gid_t egid); +int dbprintf(const char *format,...); +int dispatch_f(char *fname,int(*f)(void *arg),void *f_arg); diff --git a/src/dispatch_useradd.lib.c b/src/dispatch_useradd.lib.c index e94ee88..7b75291 100644 --- a/src/dispatch_useradd.lib.c +++ b/src/dispatch_useradd.lib.c @@ -1,17 +1,28 @@ /* -There is no C library interface to useradd(8), but if there were, these functions +There is no C library interface to useradd(8), but if there were, this function would be found there instead. */ +#include "dispatch_useradd.lib.h" #include #include #include #include #include -#include "local_common.h" -#include "dispatch_exec.lib.h" -#include "dispatch_useradd.lib.h" + +#if INTERFACE +#include +#include +#define ERR_DISPATCH_USERADD_ARGC 1 +#define ERR_DISPATCH_USERADD_DISPATCH 2 +#define ERR_DISPATCH_USERADD_PWREC 3 +struct dispatch_useradd_ret_t{ + uint error; + struct passwd *pw_record; +}; +#endif + // we have a contract with the caller that argv[1] is always the subuname struct dispatch_useradd_ret_t dispatch_useradd(char **argv, char **envp){ @@ -19,7 +30,7 @@ struct dispatch_useradd_ret_t dispatch_useradd(char **argv, char **envp){ { if( !argv || !argv[0] || !argv[1]){ fprintf(stderr,"useradd() needs a first argument as the name of the user to be made"); - ret.error = DISPATCH_USERADD_ERR_ARGC; + ret.error = ERR_DISPATCH_USERADD_ARGC; ret.pw_record = NULL; return ret; } @@ -29,7 +40,7 @@ struct dispatch_useradd_ret_t dispatch_useradd(char **argv, char **envp){ subu_name = argv[1]; if( dispatch_exec(argv, envp) == -1 ){ fprintf(stderr,"%s failed\n", argv[0]); - ret.error = DISPATCH_USERADD_ERR_DISPATCH; + ret.error = ERR_DISPATCH_USERADD_DISPATCH; ret.pw_record = NULL; return ret; }} @@ -46,7 +57,7 @@ struct dispatch_useradd_ret_t dispatch_useradd(char **argv, char **envp){ count++; } if( !pw_record ){ - ret.error = DISPATCH_USERADD_ERR_PWREC; + ret.error = ERR_DISPATCH_USERADD_PWREC; ret.pw_record = NULL; return ret; } diff --git a/src/dispatch_useradd.lib.h b/src/dispatch_useradd.lib.h new file mode 100644 index 0000000..0ce7e9d --- /dev/null +++ b/src/dispatch_useradd.lib.h @@ -0,0 +1,16 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +int dispatch_exec(char **argv,char **envp); +#include +#include +typedef struct dispatch_useradd_ret_t dispatch_useradd_ret_t; +typedef unsigned int uint; +struct dispatch_useradd_ret_t { + uint error; + struct passwd *pw_record; +}; +struct dispatch_useradd_ret_t dispatch_useradd(char **argv,char **envp); +#define ERR_DISPATCH_USERADD_PWREC 3 +#define ERR_DISPATCH_USERADD_DISPATCH 2 +#define ERR_DISPATCH_USERADD_ARGC 1 +#define INTERFACE 0 diff --git a/src/dispatch_useradd.lib.o b/src/dispatch_useradd.lib.o new file mode 100644 index 0000000000000000000000000000000000000000..079dd048353da24035c2f3c58325c6cb06a50edb GIT binary patch literal 7824 zcmbtYeQX>@6`#HHp4UG6V&{@LCPCe{N$ZsOE>0cCO`61Udg(d1O=+7pZQ5S_N8ZZR6tn&-ggc_^Hm%& z{nQ?$FXH7~YJpSdQs)tZ!a{oH$ob#?RREA4G1B$a1t8CI`TCpb`Z?}8{kKcOela|Z zyg1TRJGfB&+&tEDkPzyrgUlj11LC9z16@3qdJ6-3cW@^4R{aMQ>XOuJ*vUmz$7yhc zoLpoVn47H^;06v%0d{fF zCkE=$4P(C?NN?k9F_7NA`WD{7gVS5r;oKs|S-8@q+n~veD?+OZU>7kkMjrfy$bj)@ z*rt5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ysn)iHBv6t`5Zzw$cz{1N<6&?AW`;}rJBK&*BUhb1iiv1|*$MD4qMdo>!f^B^N z$~M}`GnYEAcG@p0Z=w?vlx@rdOL&h=z()_%zANgYY`IR^O8Cx{&l3E*FOl^;mT;>A z@Lt==28B$ilCOddZ(G@{>r8?fIuqqul>+?y(a6E?CysQ1@mL~PoxtDKS)x+)odkTL zz{e4M!I6_wgpW@AjQxL$2?Cg##$2N22wtGb`#~UKE8AFafPY-75%_N`b9A&fDgSr| z#HReBSWm{+5Kr5HSondI{1ypnsPtCgQS*QG9{^v}ylf8umg66Xc4Lw8OAgOdYE0Od zBtet*v9wohZ-9tFMamZm&$1eldZ2TIHFY|=si%6I z{}E|OwVc1CUw}rl{GDo&KirbiU*@&h*j$@F`THoaIFNWIRQ)l{N{YFAA3Z-@j+QR! U{PDfh%zusoJiFw|TdMzm06|CG5dZ)H literal 0 HcmV?d00001 diff --git a/src/local_common.h b/src/local_common.h deleted file mode 100644 index bb60b59..0000000 --- a/src/local_common.h +++ /dev/null @@ -1,4 +0,0 @@ - - -typedef unsigned int uint; - diff --git a/src/makefile b/src/makefile index 85e94a5..ddfcfdd 100755 --- a/src/makefile +++ b/src/makefile @@ -1,260 +1,103 @@ # Copyright 2011 (C) Reasoning Technology Ltd. All Rights Reserved # # 2010 11 20 TWL Created -# 2011 05 26 TWL Modified to generalize -# 2012 02 23 NLS Add ECHO variable to use on different environnement -# corrected setup macro --> add include directory in the path to copy -# corrected install macro --> change the name of installed library : lib$(LIB)$(LIBSUFFIX) -# changed DOC_DIR directory name to 5_documents -# 2012 02 23 TWL removed LIB variable which is now set from the command line so -# so that all source dirs can use the same makefile -# 2012 02 23 TWL added target make dist_clean which also deletes the 2_makefile_deps file -# 2012 04 11 AWW added creation of temporary disk before each test is run -# 2012 06 05 TWL moved tests and try .cc files to directories. caused rtmake tests to -# dist_clean and make deps -# -# -#---------------------------------------------------------------------------- -# use this makefile to compile and test the code: -# -# for a first time run, or for regression use the following: -# -# $ make setup # makes the directories, though should already exist -# $ make regress -# -# the usual development workflow makes use of these: -# -# $ make deps # only when needed, for example if headers includes change or new files introduced -# $ cd tests; make deps # only when needed -# $ make lib # this makes the local library -# $ make tests # this updates tests and compiles -# $ make clean # deletes the .o files and library to force a recompile -# $ cd 1_tests; make clean -# -# for a release of a component -# -# $ make regress -# $ make install # this will only work if all the tests in 1_tests are passing -# -# before a checkin -# -# $ make dist_clean # will also clean the tests and try directories -# -# .lib.cc c++ files taken as source of object files for local build library -# .exl.cc c++ files taken to have main calls and are linked against local build libary -# .ex.cc c++ files taken to have main calls and are not linked against the local build library -# there are no rules for other files in this makefile -# -# about dependencies -# The makefile has no way of knowing if an edit changed the dependencies. Often they do not -# and it would be unwieldy to make the deps every time. Hence *the programmer* must delete -# the deps file if he has made any changes that change the dependencies. -# -# The makefile will make the 2_makefile_deps if the file is missing. -# -# -# about testing -# -# the name of the directory you run make in is taken to also be: the name of the library, -# the name of the main include file (with a .h added), and the name of the include directory -# where the individual headers are found. It is called LIB -# -# test programs are kept in a subdirectory called 1_tests, and are either .exl.cc, ex.cc, -# .sh files. When 'make tests' target is invoked they are all run. Test executables return 0 -# if the test fails, non-zero otherwise. -# -# to remove a test from the pool move it into the subdirectory in 1_tests, 9_broken, -# 5_more_tests of 5_scratch. broken tests are things that are known but must be fixed -# before a release. 5_more_tests are tests being worked on. 5_scratch is stuff that is -# probably going to be deleted. if there is a 5_deprecated, that is for good stuff but it -# is no longer used for some reason or other. -# -# There is a standard source code template and a -# messaging convention. Also, the names, by convention,are test_xxxx_ where xxx is a -# hexadecimal series nummber. If all the test executables pass the file 1_TESTS_PASSED is -# left in the directory. Otherwise the file 1_TESTS_FAILED is left in the directory. -# -# about release directory -# -# this is set in the ApplicationBase variable by rt_init -# -# after the tests pass stuff might be copied to the release directory using -# -# make install -# -# the release directory must have these subdirectories: -# -# bin documents include src -# -# -# - -# set the shell to use -SHELL=/bin/bash +# 2019 02 24 TWL modified for subu project and placed under MIT license -# the LIB variable is now passed in to us as a parameter to make, see 'rtmake' -# LIB= +# a single space literal, for example if you wanted to subsitute commas to +# spaces: $(subst $(space),;,$(string)) we ran into this out of a need to send +# multiple separate command arguments to a shell script from one variable value +blank := +space :=$(blank) $(blank) # some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo .. ECHO= echo #ECHO= echo -e -# a single space literal, for example if you wanted to subsitute commas to spaces: $(subst $(space),;,$(string)) -# we ran into this out of a need to send multiple separate command arguments to a shell script from one variable value -# -blank := -space :=$(blank) $(blank) - - +SHELL=/bin/bash SCRATCHDIR= 5_scratch # clean and others put things here +CC=gcc +CFLAGS=-std=c11 -fPIC -I. -ggdb -DDEBUG +LIB="libsubu.a" +LIBPATH="." #no trailing slash +LINKFLAGS="-L. -lsubu" +#these are the source files that exist +SOURCES_LIB= $(wildcard *.lib.c) +SOURCES_CLI= $(wildcard *.cli.c) +SOURCES= $(SOURCES_LIB) $(SOURCES_CLI) -# see 2_bin/local_build for the compile and link flags -SOURCES= $(wildcard *.lib.cc) $(wildcard *.exl.cc) $(wildcard *.ex.cc) +#these are the object files to be made +OBJECTS_LIB= $(patsubst %.c, %.o, $(SOURCES_LIB)) +OBJECTS_CLI= $(patsubst %.c, %.o, $(SOURCES_CLI)) +OBJECTS= $(OBJECTS_LIB) $(OBJECTS_CLI) -OBJECTS= $(patsubst %.cc, %.o, $(SOURCES)) -LIB_OBJECTS= $(patsubst %.cc, %.o, $(wildcard *.lib.cc)) -EXEC_OBJECTS= $(patsubst %.cc, %.o, $(wildcard *.ex.cc) $(wildcard *.exl.cc) ) +#these are the header files that exist, makeheaders will want to see them +HFILES = $(wildcard *.lib.h) $(wildcard *.cli.h) -# the sort causes compiles to go in lexical order by file name, this is used to order the tests e.g. -EXEC= $(sort $(patsubst %.ex.cc, %, $(wildcard *.ex.cc))) -EXEC_WL= $(sort $(patsubst %.exl.cc, %, $(wildcard *.exl.cc))) -EXECS= $(sort $(EXEC_WL) $(EXEC)) +# sort causes compiles to go in lexical order by file name, this is used to order the tests e.g. +EXECS= $(sort $(patsubst %.cli.c, %, $(wildcard *.cli.c))) + +all: version deps lib execs version: - @echo '---- rtmake $@:------------------------------------------------------------' - @echo `pwd`'>' - @echo source_local_makefile version 4.0 - @echo "RT_BASE: " $(RT_BASE) - @echo "APPLICATION_BASE: " $(APPLICATION_BASE) - @echo "APPLICATION: " $(APPLICATION) - @echo "CXX: " $(CXX) - @echo "CXXFLAGS: " $(CXXFLAGS) + @echo '---- make $@:------------------------------------------------------------' + @echo `pwd`'>' + @echo makefile version 2.0 + @echo "CC: " $(CC) + @echo "CFLAGS: " $(CFLAGS) @echo "LIB: " $(LIB) @echo "LIBPATH: " $(LIBPATH) @echo "LINKFLAGS: " $(LINKFLAGS) - @echo "note, the rt bin directory, and the application 2_bin directory must be in the path for rtmake to work:" - @echo "PATH: " $(PATH) - @echo '______end rtmake $@_____' - - -# chances are if you got to this makefile that rt_init has been run, but we can catch application_init here -# -init: - @if [ "$(RT_BASE)" == "" ]; then echo "init_rt has not been sourced"; exit 1; fi - @if [ "$(APPLICATION_BASE)" == "" ]; then echo "init_application has not been sourced"; exit 1; fi - - - -all: regress + @echo '______end make $@_____' # safe to run this in an already setup or partially setup directory setup: - @echo '---- rtmake $@:------------------------------------------------------------' + @echo '---- make $@:------------------------------------------------------------' @echo `pwd`'>' if [ ! -e $(SCRATCHDIR) ]; then mkdir $(SCRATCHDIR); fi - if [ ! -e $(RT_BASE)/include/$(APPLICATION) ]; then mkdir $(RT_BASE)/include/$(APPLICATION); fi # a place to put the individual header files - if [ ! -e 0_Copyright_Notice.txt ]; then cp $(RT_BASE)/documents/0_Copyright_Notice.txt .; fi if [ ! -e 1_tests ]; then mkdir 1_tests; fi if [ ! -e 1_try ]; then mkdir 1_try; fi if [ ! -e 2_bin ]; then mkdir 2_bin; fi if [ ! -e 3_documents ]; then mkdir 3_documents; fi if [ ! -e 3_to_do.txt ]; then touch 3_to_do.txt; fi if [ ! -e 5_deprecated ]; then mkdir 5_deprecated; fi - @echo '______end rtmake $@_____' + @echo '______end make $@_____' -deps: init - @echo '---- rtmake $@:------------------------------------------------------------' +deps: + @echo '---- make $@:------------------------------------------------------------' @echo `pwd`'>' - $(CXX) $(CXXFLAGS) -MM $(SOURCES) 1> 2_makefile_deps - for i in $(EXEC_WL) ; do\ - $(ECHO) >> 2_makefile_deps;\ - $(ECHO) "$$i : $$i.exl.o $(LIBPATH)/$(LIB)" >> 2_makefile_deps;\ - $(ECHO) " $(CXX) -o $$i $$i.exl.o $(LINKFLAGS)" >> 2_makefile_deps;\ - done - for i in $(EXEC) ; do\ - echo >> 2_makefile_deps;\ - $(ECHO) "$$i : $$i.ex.o" >> 2_makefile_deps;\ - $(ECHO) " $(CXX) -o $$i $$i.ex.o" >> 2_makefile_deps;\ - done - @echo '______end rtmake $@_____' - -lib: init clear_test_flags - @echo '---- rtmake $@:------------------------------------------------------------' + makeheaders $(SOURCES) $(HFILES) + $(CC) $(CFLAGS) -MM $(SOURCES) 1> 2_makefile_deps + for i in $(EXECS) ; do\ + $(ECHO) >> 2_makefile_deps;\ + $(ECHO) "$$i : $$i.cli.o $(LIBPATH)/$(LIB)" >> 2_makefile_deps;\ + $(ECHO) " $(CXX) -o $$i $$i.cli.o $(LINKFLAGS)" >> 2_makefile_deps;\ + done + @echo '______end make $@_____' + +lib: + @echo '---- make $@:------------------------------------------------------------' @echo `pwd`'>' - if [ ! -e 2_makefile_deps ]; then rtmake deps; fi # the user must delete 2_makefile_deps if deps change! - rtmake sub_lib - @echo '______end rtmake $@_____' + if [ ! -e 2_makefile_deps ]; then make deps; fi # the user must delete 2_makefile_deps if deps change! + make sub_lib + @echo '______end make $@_____' sub_lib: $(LIB) -$(LIBPATH)/$(LIB): - @if [ "$(LIBPATH)" != "$(APPLICATION_BASE)" ]; then \ - echo "LIBPATH: " "$(LIBPATH)";\ - echo "$APPLICATION_BASE: " "$(APPLICATION_BASE)";\ - echo "The library path is not the same as the application base so don't know how to make it.";\ - fi - [ "$(LIBPATH)" == "$(APPLICATION_BASE)" ] - cd $(APPLICATION_BASE); rtmake lib - -execs: init $(LIBPATH)/$(LIB) - @echo '---- rtmake $@:------------------------------------------------------------' +execs: $(LIBPATH)/$(LIB) + @echo '---- make $@:------------------------------------------------------------' @echo `pwd`'>' - if [ ! -e 2_makefile_deps ]; then rtmake deps; fi - rtmake sub_execs - # for i in $(EXEC_OBJECTS); do rm $$i; done - @echo '______end rtmake $@_____' + if [ ! -e 2_makefile_deps ]; then make deps; fi + make sub_execs + @echo '______end make $@_____' sub_execs: $(EXECS) - -clear_test_flags: - @if [ ! -d 1_tests ]; then echo "can only rtmake tests when there is a 1_tests directory, did you mean: rtmake execs ?"; fi - @ test -d 1_tests # we only need to clear tests flags when there is a tests dir - @echo '---- rtmake $@:------------------------------------------------------------' - @echo `pwd`'>' - echo `date_stamp` $(APPLICATION) > 1_tests_log - if [ -f 1_tests_passed ]; then \ - if [ `repo_tracks 1_tests_passed` == "y" ]; then hg rm 1_tests_passed; else rm 1_tests_passed; fi; \ - fi - if [ -f 1_tests_failed ]; then \ - if [ `repo_tracks 1_tests_failed` == "y" ]; then hg rm 1_tests_failed; else rm 1_tests_failed; fi; \ - fi - echo "tests have not been run" > 1_tests_log - @echo '______end rtmake $@_____' - -tests: clear_test_flags - @echo '---- rtmake $@:------------------------------------------------------------' - @echo `pwd`'>' - echo `date_stamp` $(APPLICATION) > 1_tests_log - cd 1_tests; rtmake sub_test; - @echo '______end rtmake $@_____' - -sub_test: - rtmake execs - for i in $(EXECS); do \ - echo >> ../1_tests_log; \ - echo ">$$i launching .." | tee -a ../1_tests_log;\ - if ./$$i 2>> ../1_tests_log; then echo ">$$i passed" | tee -a ../1_tests_log; else echo "#>$$i failed" | tee -a ../1_tests_log; touch ../1_tests_failed; fi;\ - done - if [ -e ../1_tests_failed ]; then echo "test set FAIL" | tee -a ../1_tests_log; \ - else echo "test set PASS" | tee -a ../1_tests_log; touch ../1_tests_passed; fi #if none failed, then they passed - -regress: init - @if [ ! -d 1_tests ]; then echo "can only do regression when there is a 1_tests directory"; fi - @test -d 1_tests - @echo '---- rtmake $@:------------------------------------------------------------' - @echo `pwd`'>' - rtmake dist_clean - rtmake deps - rtmake lib - rtmake tests - @echo '______end rtmake $@_____' - +#not ready yet install: all - @echo '---- rtmake $@:------------------------------------------------------------' + @echo '---- make $@:------------------------------------------------------------' @echo `pwd`'>' @if[ ! -e 1_tests_passed ]; then echo "can't install as tests have not passed"; fi @test -e test_passed @@ -262,47 +105,42 @@ install: all cp $(LIB) $(RT_BASE)/lib cp $(APPLICATION).h $(RT_BASE)/include if [ -d $(APPLICATION) ]; then cp $(APPLICATION)/*.h $(RT_BASE)/include/$(APPLICATION); fi - @echo '______end rtmake $@_____' + @echo '______end make $@_____' -# "rtmake lib" "rtmake execs" now cleans up the .o files afterward, so clean should not be needed often -# clean works on the current working directory, dist_clean also descends into 1_tests and 1_try -# -clean: init - @echo '---- rtmake $@:------------------------------------------------------------' +clean: + @echo '---- make $@:------------------------------------------------------------' @echo `pwd`'>' for i in $(wildcard *~); do mv $$i $(SCRATCHDIR); done - for i in $(wildcard *.lib.o) $(wildcard *.exl.o) $(wildcard *.ex.o); do rm $$i; done + for i in $(wildcard *.lib.o) $(wildcard *.cli.o); do rm $$i; done + for i in $(HFILES); do mv $$i 5_scratch; done # just in case someone wrote a header file if [ -f 2_makefile_deps ]; then rm 2_makefile_deps; fi - if [ -f $(LIB) ]; then mv $(LIB) 5_scratch; fi - for i in $(EXEC_WL) $(EXEC); do if [ -e $$i ]; then rm $$i; fi; done - @echo '______end rtmake $@_____' + if [ -f $(LIB) ]; then rm $(LIB); fi + for i in $(EXECS); do if [ -e $$i ]; then rm $$i; fi; done + @echo '______end make $@_____' +# not ready ... # dist_clean is used to clean thing up before doing a checkin, hg add should be safe after a dist_clean # dist_clean will recurse into the include directory = $(APPLICATION), tests, and try if they are present # -dist_clean: init - @echo '---- rtmake $@:------------------------------------------------------------' +dist_clean: + @echo '---- make $@:------------------------------------------------------------' @echo `pwd`'>' - rtmake clean - if [ -d $(APPLICATION) ]; then cd $(APPLICATION); rtmake clean; fi - if [ -d 1_tests ]; then cd 1_tests; rtmake clean; fi - if [ -d 1_try ] ; then cd 1_try; rtmake clean; fi - @echo '______end rtmake $@_____' + make clean + if [ -d $(APPLICATION) ]; then cd $(APPLICATION); make clean; fi + if [ -d 1_tests ]; then cd 1_tests; make clean; fi + if [ -d 1_try ] ; then cd 1_try; make clean; fi + @echo '______end make $@_____' -include 2_makefile_deps # recipe for making object files: # -%.o : %.cc - $(CXX) $(CXXFLAGS) -c $< +%.o : %.c + $(CC) $(CFLAGS) -c $< # -$(LIB) : $(LIB_OBJECTS) - ar rcs $(LIB) $(LIB_OBJECTS) -# for i in $(LIB_OBJECTS); do rm $$i; done - - - +$(LIB) : $(OBJECTS_LIB) + ar rcs $(LIB) $(OBJECTS_LIB) diff --git a/src/subu-config.lib.c b/src/subu-config.lib.c index 7577d30..8706aaf 100644 --- a/src/subu-config.lib.c +++ b/src/subu-config.lib.c @@ -10,14 +10,16 @@ starting point for subu numbering. currently a unit converted to base 10 will always fit in a 21 bit buffer. */ +#include "subu-config.lib.h" #if INTERFACE #include #define ERR_CONFIG_FILE -1 #endif + #include #include -#include "subu-config.lib.h" +#include //char config_file[] = "/etc/subu.db"; char config_file[] = "subu.db"; @@ -48,8 +50,8 @@ int schema(sqlite3 *db, uint max_subu_number){ return sqlite3_exec(db, sql, NULL, NULL, NULL); } -int subu_number(sqlite3 *db, uint &subu_number){ - subu_number = 0; +int subu_number(sqlite3 *db, uint **subu_number){ + *subu_number = 0; char *sql = "BEGIN TRANSACTION;" "UPDATE Key_Int SET value = value + 1 WHERE key = 'max_subu_number';" @@ -60,9 +62,6 @@ int subu_number(sqlite3 *db, uint &subu_number){ sqlite3_stmt *stmt; ret = sqlite3_prepare_v2(db, sql, sql_len, &stmt, NULL); if( ret != SQLITE_OK ){ - free(subuland); - free(subuhome); - sqlite3_close(db); return ERR_CONFIG_FILE; } sqlite3_stmt *res; diff --git a/src/subu-config.lib.h b/src/subu-config.lib.h index d2b1f97..c359b52 100644 --- a/src/subu-config.lib.h +++ b/src/subu-config.lib.h @@ -2,7 +2,7 @@ #undef INTERFACE #include typedef unsigned int uint; -int subu_number(sqlite3 *db,uint&subu_number); +int subu_number(sqlite3 *db,uint **subu_number); int schema(sqlite3 *db,uint max_subu_number); extern char config_file[]; #define ERR_CONFIG_FILE -1 diff --git a/src/subu-config.lib.o b/src/subu-config.lib.o deleted file mode 100644 index ff2496902864427a09874f321ea62e78d3259947..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8760 zcmbtZdvF!i89#e(HrYH#LT<}La_M28k zL76z*#&n1+mOpAstz#WK)6(a}R4odEj(-%}8Ds`pX~h}Zu^pYUR!dv@edm#E4mZ?j{NDNBeXsoIh=oI42@sa;b7#?j3T&#hkWGX z!F?BR-rZyjsfdmIYh$f&eieiHB{EbtdJW1SpYwxYblv7ixI3bE8)M@ z+o9daA2IMW>RPtBB^S#XV@>I(g9sFxm|`1MWTI(H?~ZIU#<~~i4oFe4gDLu$BA1R? zw%%ckb#VzO`k7*YDopOg$VU#Gi5%M2J%2^dnaGp+^&#G4?FHj%X57GxJ2Gz5PT&;Gr%~{( z-yiPWYK%p;H0krw(E(6=#1x-Vg-J)9fgIsD=Pdxg`9Z=0&}e@bK&L~8rw8AI8Zm}> z7iZYSy*?DVIDCT-XcWSvQd&8G@Pu+Ga-r(ykqbuEt7naae^QM6*0Z#pKXM$UX9h>n zAr#IYW9$nP?1`~zY(`_{>`Pdu>&N)p$HvYR)yDi&u)vIiCm`m?o5m3QhL5oEpA&%? zL)(F!6tXc~>o;IA8u`;k{#_bwAypnn2Hi3_AKiq-FkfqIyhi>c^unf=Gs;OC5l@Jr zoQFUm2e0!~oPazZW&=LT2i%cA6@CTt@!yYn6#5v2QL}aL9W}6%Bc!9|Ax;bf($hI) z$>NUu8`5w(l`EafB_sd4iNxlh^Fh4U!}L0SiAIhGA?eJ2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zkjLC9em#;P_@u$(jNZWrHl{`W+(vpvIr1PVUxtpKw{@&ygQ*0e)8Fze)HJjlYNRcQpPJ!Y^q21&Z@k zjenTpc}L?rN&mMRe~I`@8n5=uzi9k@7uTm6*A?;-q<#-Atrq{bhheot%s z1>#@O_@ji?eWUV;uUaVL^9YoRf0_6TnxCtLFKWEH4?oiQ7ln7m{-*KI5x%DJ_vl^VZ`^w(+pDe7-RU6R?apt7i(n&oZ7XfoLu9LbGB!jj{_mqMk1l zJU$I-XiSv&Y>1{U4qlD9GJ*bBrs&q|9NxS#@Eww8;6$AE12|Tb5wF6zI$!5v4FAu? z0%OcgIG5;e0xuxyye5&90LaZ-1Asq(Kgyl5n7iunY=aivCn}E<`K%V0 zuDcO*+vTs1Zju?A7|b75RsSk~dx6t^0>yrfPC@h+8C~~Y(9t=x`xPBB*B}Uqu8a9; z7ymJOF;n&!Kc3h0_>Tgo`vi(bXxtmMMh&tW=(g+sEcLJQg#F`Nk>3A9z@bkSCsc)O zrbF$m3(TL2;}~eSvoGUD3L-z0$~s<^ohna;xRw^&cVr*tu&(SB{~~ev`aMJT<4TcA zHGV~Z7b@-Y_g +extern char config_file[]; +int subu_mk_0(char *subuname,char *config_file); +int main(); +int main(); +int main(int argc,char **argv,char **env); diff --git a/src/subu-mk-0.lib.c b/src/subu-mk-0.lib.c index 7c3836c..5c1bc88 100644 --- a/src/subu-mk-0.lib.c +++ b/src/subu-mk-0.lib.c @@ -16,6 +16,7 @@ */ +#include "subu-mk-0.lib.h" // without this #define we get the warning: implicit declaration of function ‘seteuid’/‘setegid’ #define _GNU_SOURCE @@ -30,12 +31,19 @@ #include #include #include -#include "dispatch_f.lib.h" -#include "dispatch_exec.lib.h" -#include "dispatch_useradd.lib.h" -#include "subu-mk-0.lib.h" -typedef unsigned int uint; +#if INTERFACE +#define ERR_SUBU_MK_0_CONFIG_FILE 1 +#define ERR_SUBU_MK_0_SETUID_ROOT 2 +#define ERR_SUBU_MK_0_BAD_MASTERU_HOME 3 +#define ERR_SUBU_MK_0_MALLOC 4 +#define ERR_SUBU_MK_0_MK_SUBUHOME 5 +#define ERR_SUBU_MK_0_FAILED_MKDIR_SUBU 6 +#define ERR_SUBU_MK_0_BUG_SSS 7 +#define ERR_SUBU_MK_0_FAILED_USERADD 8 +#define ERR_SUBU_MK_0_SETFACL 9 +#endif + /* Fedora 29's sss_cache is checking the inherited uid instead of the effective @@ -50,30 +58,30 @@ static uint max_subuname_len = 128; // a well formed subuname // returns the length of the subuname, or -1 int allowed_subuname(char *subuname){ - char *ch = token; + char *ch = subuname; uint i = 0; while( *ch && i < max_subuname_len && - ( ch >= 'a' && ch <= 'z' + ( *ch >= 'a' && *ch <= 'z' || - ch >= 'A' && ch <= 'Z' + *ch >= 'A' && *ch <= 'Z' || - ch >= '0' && ch <= '9' + *ch >= '0' && *ch <= '9' || - ch == '_' + *ch == '_' || - ch == '.' + *ch == '.' || - ch == ' ' + *ch == ' ' ) ){ ch++; i++; } - if( !*ch && i < max_len; ) + if( !*ch && i < max_subuname_len ) return i; else return -1; @@ -100,8 +108,8 @@ int subu_mk_0(char *subuname, char *config_file){ sqlite3 *db; { if( sqlite3_open(config_file, &db) ){ - fprintf(stderr, "error exit, could not open config file, \"%s\"\n", file); - return ERR_CONFIG_FILE; + fprintf(stderr, "error exit, could not open config file, \"%s\"\n", config_file); + return ERR_SUBU_MK_0_CONFIG_FILE; } } @@ -124,7 +132,7 @@ int subu_mk_0(char *subuname, char *config_file){ if( masteru_uid == 0 || set_euid != 0 ){ fprintf(stderr, "error exit, this program must be run setuid root from a user account\n"); sqlite3_close(db); - return ERR_SETUID_ROOT; + return ERR_SUBU_MK_0_SETUID_ROOT; } } @@ -141,7 +149,7 @@ int subu_mk_0(char *subuname, char *config_file){ if( subuname_len == -1 ){ fprintf(stderr, "error exit, subuname is not in [ _.a-zA-Z0-9]* less than %u characters", max_subuname_len); sqlite3_close(db); - return ERR_CONFIG_FILE; + return ERR_SUBU_MK_0_CONFIG_FILE; } } @@ -159,7 +167,7 @@ int subu_mk_0(char *subuname, char *config_file){ char *subuhome; size_t subuhome_len; { - masteru_pw_record_pt = getpwuid(masteru_uid); // reading /etc/passwd + struct passwd *masteru_pw_record_pt = getpwuid(masteru_uid); // reading /etc/passwd masteru_name = masteru_pw_record_pt->pw_name; #ifdef DEBUG dbprintf("masteru_name \"%s\"\n", masteru_name); @@ -171,7 +179,7 @@ int subu_mk_0(char *subuname, char *config_file){ if( masteru_name_len == -1 ){ fprintf(stderr, "error exit, masteru_name is not in [ _.a-zA-Z0-9]* less than %u characters", max_subuname_len); sqlite3_close(db); - return ERR_CONFIG_FILE; + return ERR_SUBU_MK_0_CONFIG_FILE; } masteru_home = masteru_pw_record_pt->pw_dir; #ifdef DEBUG @@ -181,7 +189,7 @@ int subu_mk_0(char *subuname, char *config_file){ if( masteru_home_len == 0 || masteru_home[0] == '(' ){ fprintf(stderr,"error exit, %s has no home directory\n", masteru_name); sqlite3_close(db); - return ERR_BAD_MASTERU_HOME; + return ERR_SUBU_MK_0_BAD_MASTERU_HOME; } char *subuland_extension = "/subuland/"; size_t subuland_extension_len = strlen(subuland_extension); @@ -198,7 +206,7 @@ int subu_mk_0(char *subuname, char *config_file){ perror(perror_src); free(subuland); sqlite3_close(db); - return ERR_MALLOC; + return ERR_SUBU_MK_0_MALLOC; } strcpy (subuhome, subuland); strcpy (subuhome + subuland_len, subuname); @@ -220,7 +228,7 @@ int subu_mk_0(char *subuname, char *config_file){ free(subuland); free(subuhome); sqlite3_close(db); - return ERR_MK_SUBUHOME; + return ERR_SUBU_MK_0_MK_SUBUHOME; } int ret = dispatch_f_euid_egid ( @@ -235,7 +243,7 @@ int subu_mk_0(char *subuname, char *config_file){ free(subuland); free(subuhome); sqlite3_close(db); - return ERR_FAILED_MKDIR_SUBU; + return ERR_SUBU_MK_0_FAILED_MKDIR_SUBU; } } #ifdef DEBUG @@ -267,7 +275,7 @@ int subu_mk_0(char *subuname, char *config_file){ free(subuland); free(subuhome); sqlite3_close(db); - return ERR_BUG_SSS; + return ERR_SUBU_MK_0_BUG_SSS; } #endif char *command = "/usr/sbin/useradd"; @@ -287,7 +295,7 @@ int subu_mk_0(char *subuname, char *config_file){ free(subuland); free(subuhome); sqlite3_close(db); - return ERR_FAILED_USERADD; + return ERR_SUBU_MK_0_FAILED_USERADD; } #ifdef DEBUG dbprintf("useradd finished\n"); @@ -344,7 +352,7 @@ int subu_mk_0(char *subuname, char *config_file){ free(subuland); free(subuhome); sqlite3_close(db); - return ERR_SETFACL; + return ERR_SUBU_MK_0_SETFACL; } // 2.1 x acls on subuland // setfacl -m u:subuname:x subuland @@ -357,7 +365,7 @@ int subu_mk_0(char *subuname, char *config_file){ free(subuland); free(subuhome); sqlite3_close(db); - return ERR_SETFACL; + return ERR_SUBU_MK_0_SETFACL; } // 2.2 x acls on masteru_home // setfacl -m u:subuname:x masteru_home @@ -367,7 +375,7 @@ int subu_mk_0(char *subuname, char *config_file){ free(subuland); free(subuhome); sqlite3_close(db); - return ERR_SETFACL; + return ERR_SUBU_MK_0_SETFACL; } // 3. give subu ownership of subuhome @@ -406,7 +414,7 @@ int subu_mk_0(char *subuname, char *config_file){ free(subuland); free(subuhome); sqlite3_close(db); - return ERR_SETFACL; + return ERR_SUBU_MK_0_SETFACL; } #ifdef DEBUG dbprintf("masteru now has default access\n"); diff --git a/src/subu-mk-0.lib.h b/src/subu-mk-0.lib.h new file mode 100644 index 0000000..82c7e14 --- /dev/null +++ b/src/subu-mk-0.lib.h @@ -0,0 +1,29 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +int dispatch_exec(char **argv,char **envp); +#include +#include +typedef struct dispatch_useradd_ret_t dispatch_useradd_ret_t; +typedef unsigned int uint; +struct dispatch_useradd_ret_t { + uint error; + struct passwd *pw_record; +}; +struct dispatch_useradd_ret_t dispatch_useradd(char **argv,char **envp); +int dispatch_f_euid_egid(char *fname,int(*f)(void *arg),void *f_arg,uid_t euid,gid_t egid); +int dbprintf(const char *format,...); +#include +extern char config_file[]; +int subu_mk_0(char *subuname,char *config_file); +int masteru_makes_subuhome(void *arg); +int allowed_subuname(char *subuname); +#define ERR_SUBU_MK_0_SETFACL 9 +#define ERR_SUBU_MK_0_FAILED_USERADD 8 +#define ERR_SUBU_MK_0_BUG_SSS 7 +#define ERR_SUBU_MK_0_FAILED_MKDIR_SUBU 6 +#define ERR_SUBU_MK_0_MK_SUBUHOME 5 +#define ERR_SUBU_MK_0_MALLOC 4 +#define ERR_SUBU_MK_0_BAD_MASTERU_HOME 3 +#define ERR_SUBU_MK_0_SETUID_ROOT 2 +#define ERR_SUBU_MK_0_CONFIG_FILE 1 +#define INTERFACE 0 diff --git a/src/subu-mk-0.lib.o b/src/subu-mk-0.lib.o new file mode 100644 index 0000000000000000000000000000000000000000..03225366669c3659170e38e91849c7a8a014a533 GIT binary patch literal 21184 zcmcIs4SZD9m47pnmrOGGA_*S>S|1-lK=K8M5I&j!!3iHi1u6(QOlDq^k;zP)c>@6j zsUa=XG%cy5vaW5z$GZG1rF7LT2(|%Pq3UkYZH4Yy*Vf{~Vz;!lD_!Zj=iGbl%+1Y= zuG`)FYk2qk@44sv@44sR_uidnAFf}z$ZoS~qS&-~T2d0IrtMsotk<$?tu|CE(N??T zm)-I0SKM9oSKRUX8|UiZ!`5rr?vDB!wvPJuY|wI};BU2E{Z^z)$F^DZ??sylowIR= zOH{Y*cv)0yljyxWo)u_i5}mcSh2f%F4h^qI)e=ae#C6l-Bb6uy47{7 zR=Pj`?s3-jdG~(-f%vnvc{z1-&Q=pJ;E7SOYH^%pLHIoo6t^AN8;OV@t7o}%mVuGsOeWv9AU_jlEwt&3kz zL9b)`S#7$p${7l&cS;SXY2-v`w`cZ$(- zT;jD4c0zCwobMj&fD!|lH4 zj$dTCmQYVM{R7;^J6o8GUVed001olajeL!;%RokJu%+X9ylAoM;P-rjuHZ;vRB|%| z!|{|8=YyDcGFtq|2}hO4;^e@1r&I$YdnuZ_dspBN(WQEXO~<-dnps$9bAV>5 zb;i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f(xFRis;r>_$CalR)k+$L@i2e`%;>*Gk?S<5KhYrAy!_I&N&2zS4y)4 zGzDsCQ|*6&`X>~rqVlf>95Fd(P*wC7zh5ARMeyg62LEq&yuXme^%5S=L-Emi;L>1S zeBMtLzuj|r4>^7~N5VgzbzxZyf9jYJpN)r$P+ z(2$CMEgjH^{y6^_3YGr@fTi+(ll;G|OsuLKOyj?e{EIlDf81hK|J%vG;0Yot=f?8u zJY``B|KhqE)UdAh*C+A*<@}QPSM(Ft9%vEugc4MyQhyo4x~lsmVQT))r2fcHE@J!w z+Ygmg^S7Jg=O#srUm^U7{vxi(NA-sXv TJI74b{{rzp#;hg(QTzWlyMJmU literal 0 HcmV?d00001 diff --git a/src/subu-number.cli.h b/src/subu-number.cli.h new file mode 100644 index 0000000..759d808 --- /dev/null +++ b/src/subu-number.cli.h @@ -0,0 +1,10 @@ +/* This file was automatically generated. Do not edit! */ +#undef INTERFACE +#include +typedef unsigned int uint; +int subu_number(sqlite3 *db,uint **subu_number); +#define ERR_CONFIG_FILE -1 +extern char config_file[]; +int main(); +int main(); +int main(int argc,char **argv,char **env); -- 2.20.1