From 038b37a75cb95e23f691db7f41302d46e86dec06 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Sun, 13 Jul 2025 05:41:29 -0400 Subject: [PATCH] Able to debug scarmt (dbgscar) --- Makefile | 1 + Makefile.dbg | 18 +++++++++++++++++- app/Makefile | 1 + app/scarmt.c | 13 ++++++++++++- bin | 1 - lib/gessql.c | 17 +++++++++++++++++ lib/gessql.h | 3 +++ 7 files changed, 51 insertions(+), 3 deletions(-) delete mode 120000 bin diff --git a/Makefile b/Makefile index 4ee2faf..63cb1e2 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ clean : cleanrpm $(MAKE) -s -C $$i $@ ; \ done @ - rm -fr $(APPNAME)-* + @ - rm -fr bin posql : clean debug newtest @ ln -nsf bin-posql bin diff --git a/Makefile.dbg b/Makefile.dbg index 981daef..25abf78 100644 --- a/Makefile.dbg +++ b/Makefile.dbg @@ -1,4 +1,4 @@ -#==================================================================== +#=================================================================== #debug area definition SBINDIR = usr/sbin DATATST = data-feed @@ -68,6 +68,13 @@ onercvr : clean debug -f \ $(EMLPAR)$(TESTITER) +onescar: clean debug + @ echo "Starting scanner" + @ \ + bin/scarmt \ + -f \ + $(DBGPAR) + onefeed : debug @ \ bin/feeder \ @@ -163,6 +170,15 @@ dbgsortr: clean debug -c ./conf/mailleur.conf.dvl \ -r $(TESTDIR) +dbgscar: clean debug + @ \ + gdb \ + --args \ + bin/scarmt \ + -f \ + $(DBGPAR) + +onefeed : debug TODO = `basename -a \ $(TESTDIR)/var/spool/$(APPNAME)/queue/*.todo|\ tr '\\n' ' ' ` diff --git a/app/Makefile b/app/Makefile index 897e7d1..c428eb1 100644 --- a/app/Makefile +++ b/app/Makefile @@ -117,6 +117,7 @@ sorter.o: sorter.c \ scarmt.o: scarmt.c \ ../lib/devsql.h \ + ../lib/gessql.h \ ../lib/unipar.h \ ../lib/uniprc.h \ ../lib/unisig.h \ diff --git a/app/scarmt.c b/app/scarmt.c index d3870a6..c987e71 100644 --- a/app/scarmt.c +++ b/app/scarmt.c @@ -14,6 +14,7 @@ #include #include "devsql.h" +#include "gessql.h" #include "unipar.h" #include "uniprc.h" #include "unisig.h" @@ -35,11 +36,13 @@ static void doscanning() #define OPEP "scarmt.c:doscanning," SQLPTR *sqlptr; +char **rmtip; int delay; int phase; _Bool proceed; sqlptr=(SQLPTR *)0; +rmtip=(char **)0; delay=10; //10 second sleeping time phase=0; proceed=true; @@ -48,20 +51,28 @@ while (proceed==true) { case 0 : //opening database if ((sqlptr=sql_opensql())==(SQLPTR *)0) { (void) rou_alert(0,"%s Unable to open database (Config?)",OPEP); + phase=999; //Trouble trouble } break; case 1 : //check about signal + sleep(delay); if ((hangup==true)||((reload==true))) { (void) rou_alert(0,"%s got hangup or reload signal",OPEP); phase=999; } break; case 2 : //check for new entry + if ((rmtip=sql_getnewrmtip(sqlptr))==(char **)0) + phase=0; //nothing to be done break; case 3 : //check entries + for (int i=0;rmtip[i]!=(char *)0;i++) { + if ((hangup==true)||((reload==true))) + break; //No need to check other remote + } + rmtip=(char **)rou_freelist((void **)rmtip,(genfree_t)rou_freestr); break; case 4 : //let continue - sleep(delay); phase=0; //looping the job again break; default : //SAFE Guard diff --git a/bin b/bin deleted file mode 120000 index 48018e1..0000000 --- a/bin +++ /dev/null @@ -1 +0,0 @@ -bin-mysql \ No newline at end of file diff --git a/lib/gessql.c b/lib/gessql.c index ac893cc..8dda6a6 100644 --- a/lib/gessql.c +++ b/lib/gessql.c @@ -699,3 +699,20 @@ return isok; #undef OPEP } +/* + +*/ +/********************************************************/ +/* */ +/* Procedure to retreive a list of newly connected */ +/* remote IP to be scanned to establish credibilty.*/ +/* */ +/********************************************************/ +PUBLIC char **sql_getnewrmtip(SQLPTR *sqlptr) + +{ +char **rmtip; + +rmtip=(char **)0; +return rmtip; +} diff --git a/lib/gessql.h b/lib/gessql.h index 7c85752..87937c1 100644 --- a/lib/gessql.h +++ b/lib/gessql.h @@ -29,4 +29,7 @@ extern _Bool sql_newconnect(SQLPTR *sqlptr,char *rmtip,int delta); //procedure to extract the information about remotes server extern _Bool sql_mngremote(SQLPTR *sqlptr,SQLENUM action,char *key,SRVTYP **srv); + +//procedure to collect a list of "to be checked" remote IP +extern char **sql_getnewrmtip(SQLPTR *sqlptr); #endif -- 2.47.3