From 968b5366b7407212fdc60eb49938a4b5b2db2a4a Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Sun, 13 Jul 2025 06:46:54 -0400 Subject: [PATCH] Able to properly read remoteip to be scaned --- .gitignore | 2 +- app/scarmt.c | 1 + lib/devsql.c | 8 ++++---- lib/devsql.h | 4 ++-- lib/gessql.c | 15 +++++++++++---- lib/unimar.c | 4 ++-- lib/unimar.h | 4 ++-- lib/unipos.c | 4 ++-- lib/unipos.h | 4 ++-- 9 files changed, 27 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index e6a5b11..7577b88 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ data-sender/ data-sorter/ data-sorter2/ *.swp -bin/ +bin shared/ lib/numver.h diff --git a/app/scarmt.c b/app/scarmt.c index a42aec4..42fa784 100644 --- a/app/scarmt.c +++ b/app/scarmt.c @@ -69,6 +69,7 @@ while (proceed==true) { break; case 3 : //check entries for (int i=0;rmtip[i]!=(char *)0;i++) { + (void) rou_alert(0,"%s JMPDBG need to scan <%s>",OPEP,rmtip[i]); if ((hangup==true)||((reload==true))) break; //No need to check other remote } diff --git a/lib/devsql.c b/lib/devsql.c index c4be9ff..003f04c 100644 --- a/lib/devsql.c +++ b/lib/devsql.c @@ -352,7 +352,7 @@ return unixdate; /* string (data-base compatible). */ /* */ /********************************************************/ -PUBLIC time_t sql_tounixtime(SQLPTR *sqlptr,char *date) +PUBLIC time_t sql_tounixtime(SQLPTR *sqlptr,const char *date) { #define OPEP "devsql.c:sql_tounixtime," @@ -508,15 +508,15 @@ return number; /* in a specific tuple + name in sqlresult. */ /* */ /********************************************************/ -PUBLIC char *sql_getvalue(SQLPTR *sqlptr,SQLRES *rs,int row,const char *name) +PUBLIC const char *sql_getvalue(SQLPTR *sqlptr,SQLRES *rs,int row,const char *name) { #define OPEP "devsql.c:sql_getvalue," -char *value; +const char *value; SQLTYP *sql; -value=(char *)0; +value=(const char *)0; sql=(SQLTYP *)sqlptr; switch(sql->sqldb) { case db_postgres : diff --git a/lib/devsql.h b/lib/devsql.h index 6fc4570..ec8eb8d 100644 --- a/lib/devsql.h +++ b/lib/devsql.h @@ -30,7 +30,7 @@ extern SQLPTR *sql_closesql(SQLPTR *sqlptr); extern const char *sql_fromunixtime(SQLPTR *sqlptr,time_t timestamp); //converting a database time representation to unix time -extern time_t sql_tounixtime(SQLPTR *sqlptr,char *date); +extern time_t sql_tounixtime(SQLPTR *sqlptr,const char *date); //procedure to LOCK access to a database table extern _Bool sql_lock(SQLPTR *sqlPTR,char *tablename); @@ -42,7 +42,7 @@ extern _Bool sql_unlock(SQLPTR *sqlptr,_Bool commit); extern int sql_request(SQLPTR *sqlptr,const char *fmt,...); //to extract data from database -extern char *sql_getvalue(SQLPTR *sqlptr,SQLRES *rs,int row,const char *name); +extern const char *sql_getvalue(SQLPTR *sqlptr,SQLRES *rs,int row,const char *name); //to extract data from database extern SQLRES *sql_gettupple(SQLPTR *sqlptr,const char *fmt,...); diff --git a/lib/gessql.c b/lib/gessql.c index 5d918dc..39f52f6 100644 --- a/lib/gessql.c +++ b/lib/gessql.c @@ -205,9 +205,9 @@ while (proceed==true) { isok=true; locusr=(USRTYP *)calloc(1,sizeof(USRTYP)); for (int i=0;(usrfield[i].name!=(char *)0)&&(isok==true);i++) { - char *locval; + const char *locval; - if ((locval=sql_getvalue(sqlptr,rs,0,usrfield[i].name))==(char *)0) + if ((locval=sql_getvalue(sqlptr,rs,0,usrfield[i].name))==(const char *)0) continue; switch (usrfield[i].num) { case 1 : //user email @@ -321,9 +321,9 @@ while (proceed==true) { isok=true; locsrv=(SRVTYP *)calloc(1,sizeof(SRVTYP)); for (int i=0;(usrfield[i].name!=(char *)0)&&(isok==true);i++) { - char *locval; + const char *locval; - if ((locval=sql_getvalue(sqlptr,rs,0,usrfield[i].name))==(char *)0) + if ((locval=sql_getvalue(sqlptr,rs,0,usrfield[i].name))==(const char *)0) continue; switch (usrfield[i].num) { case 1 : //user remoteip @@ -742,6 +742,13 @@ while (proceed==true) { break; case 2 : //extracting list (void) rou_alert(0,"JMPDG NUM='%d'",num); + for (int i=0;i