]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Able to properly read remoteip to be scaned
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 13 Jul 2025 10:46:54 +0000 (06:46 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 13 Jul 2025 10:46:54 +0000 (06:46 -0400)
.gitignore
app/scarmt.c
lib/devsql.c
lib/devsql.h
lib/gessql.c
lib/unimar.c
lib/unimar.h
lib/unipos.c
lib/unipos.h

index e6a5b111978a10dbb7e967e8fc96bc2688f43dd7..7577b88fd48af2d72398ce73b8f03b6258d6f9a2 100644 (file)
@@ -4,6 +4,6 @@ data-sender/
 data-sorter/
 data-sorter2/
 *.swp
-bin/
+bin
 shared/
 lib/numver.h
index a42aec4c1e7ef20d704662ce503ec31f41a7c699..42fa7848504021a13d38633d10e57c81d8852881 100644 (file)
@@ -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
         }
index c4be9ffddae02a7704f637ecec92b0642a96d298..003f04cb5568523759d364b20a28d2ed0e7a27f4 100644 (file)
@@ -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    :
index 6fc45705b0f29161b81022cb74d280e84a327d95..ec8eb8d37634548214b6eae09ab40396cbc54c20 100644 (file)
@@ -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,...);
index 5d918dc4a3ca7a7c036cf0284c6602517dbf445f..39f52f62440b952214aa91b6182d0a74a2c25e50 100644 (file)
@@ -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<num;i++) {
+        const char *ip;
+
+        ip=sql_getvalue(sqlptr,rs,i,"remoteip");
+        if (ip!=(const char *)0)
+          rmtip=(char **)rou_addlist((void **)rmtip,(void *)strdup(ip));
+        }
       break;
     case 3      :       //clearing result
       rs=sql_droptupple(sqlptr,rs);
index e8cb7d2f8f9053b1790bcf635b2f594f8629a3d2..b9f2bd31f5aad9cfd3a36bc3229f651493b600f2 100644 (file)
@@ -189,7 +189,7 @@ return unixdate;
 /*      string (data-base compatible).                  */
 /*                                                     */
 /********************************************************/
-PUBLIC time_t mar_tounixtime(char *date)
+PUBLIC time_t mar_tounixtime(const char *date)
 
 {
 #define OPEP    "unimar.c:mar_tounixtime,"
@@ -350,7 +350,7 @@ return (MARRES *)0;
 /*      tupple under fieldname.                         */
 /*                                                     */
 /********************************************************/
-PUBLIC char *mar_getvalue(MARRES *rs,int tuple,const char *fieldname)
+PUBLIC const char *mar_getvalue(MARRES *rs,int tuple,const char *fieldname)
 
 {
 #define OPEP    "unimar.c:pos_getfield,"
index babbf389d70565337a2d8aa1bb60c2861c7c7ade..0dc555b4a8374c1ec5ae875d0eeee03657ebeeca 100644 (file)
@@ -27,7 +27,7 @@ extern char *mar_cleanquote(char *sequence);
 extern const char *mar_fromunixtime(time_t timestamp);
 
 //converting a database time representation to unix time
-extern time_t mar_tounixtime(char *date);
+extern time_t mar_tounixtime(const char *date);
 
 //locking database one table access
 extern _Bool mar_lock(MARPTR *marptr,char *tablename);
@@ -42,7 +42,7 @@ extern MARRES *mar_dropresult(MARRES *rs);
 extern char *mar_getfield(MARRES *rs,int tuple,int position);
 
 //procedure to extract specific field value within database
-extern char *mar_getvalue(MARRES *rs,int tuple,const char *fieldname);
+extern const char *mar_getvalue(MARRES *rs,int tuple,const char *fieldname);
 
 //procedure to extract data from database
 extern MARRES *mar_gettupple(MARPTR *marptr,char *command);
index 40105c7c45d98f833114e09af4b2c6c24e05f52f..16b27b3f358764f8f9802a29b8b528cd1c2deca5 100644 (file)
@@ -234,7 +234,7 @@ return unixdate;
 /*      string (data-base compatible).                  */
 /*                                                     */
 /********************************************************/
-PUBLIC time_t pos_tounixtime(char *date)
+PUBLIC time_t pos_tounixtime(const char *date)
 
 {
 #define OPEP    "unipos.c:pos_tounixtime,"
@@ -409,7 +409,7 @@ return got;
 /*      tupple under fieldname.                         */
 /*                                                     */
 /********************************************************/
-PUBLIC char *pos_getvalue(POSRES *rs,int tuple,const char *fieldname)
+PUBLIC const char *pos_getvalue(POSRES *rs,int tuple,const char *fieldname)
 
 {
 #define OPEP    "unipos.c:pos_getfield,"
index f2d4e4d6d4f32e7cf7ae57ad45ae0eb365879ad9..dccfd87ec45f08623a579374eb277dcd7403282d 100644 (file)
@@ -27,7 +27,7 @@ extern char *pos_cleanquote(char *sequence);
 extern const char *pos_fromunixtime(time_t timestamp);
 
 //converting a database time representation to unix time
-extern time_t pos_tounixtime(char *date);
+extern time_t pos_tounixtime(const char *date);
 
 //locking database one table access
 extern _Bool pos_lock(POSPTR *posptr,char *tablename);
@@ -42,7 +42,7 @@ extern POSRES *pos_dropresult(POSRES *rs);
 extern char *pos_getfield(POSRES *rs,int tuple,int position);
 
 //procedure to extract specific field value within database
-extern char *pos_getvalue(POSRES *rs,int tuple,const char *fieldname);
+extern const char *pos_getvalue(POSRES *rs,int tuple,const char *fieldname);
 
 //procedure to extract data from postgresql database
 extern POSRES *pos_gettupple(POSPTR *posptr,char *command);