cppcheck silencing
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 3 Dec 2024 20:09:45 +0000 (20:09 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 3 Dec 2024 21:41:23 +0000 (21:41 +0000)
src/src/acl.c
src/src/daemon.c
src/src/exim.c
src/src/exim_lock.c

index 3f35a49466e3cbbc36fc961b3b17b44997e69180..882fddd3cd65d24c5c6d032574efbc7fbc3d239a 100644 (file)
@@ -153,9 +153,7 @@ static condition_def conditions[] = {
   [ACLC_ADD_HEADER] =          { US"add_header",       ACD_EXP | ACD_MOD,
                                  PERMITTED(ACL_BIT_MAIL | ACL_BIT_RCPT |
                                    ACL_BIT_PREDATA | ACL_BIT_DATA |
-#ifndef DISABLE_PRDR
                                    ACL_BIT_PRDR |
-#endif
                                    ACL_BIT_MIME | ACL_BIT_NOTSMTP |
                                    ACL_BIT_DKIM |
                                    ACL_BIT_NOTSMTP_START),
@@ -175,9 +173,7 @@ static condition_def conditions[] = {
                                  FORBIDDEN(ACL_BIT_AUTH |
                                    ACL_BIT_CONNECT | ACL_BIT_HELO |
                                    ACL_BIT_DATA | ACL_BIT_MIME |
-# ifndef DISABLE_PRDR
                                    ACL_BIT_PRDR |
-# endif
                                    ACL_BIT_ETRN | ACL_BIT_EXPN |
                                    ACL_BIT_MAILAUTH |
                                    ACL_BIT_MAIL | ACL_BIT_STARTTLS |
@@ -198,9 +194,7 @@ static condition_def conditions[] = {
 #ifdef EXPERIMENTAL_DCC
   [ACLC_DCC] =                 { US"dcc",              ACD_EXP,
                                  PERMITTED(ACL_BIT_DATA |
-# ifndef DISABLE_PRDR
                                  ACL_BIT_PRDR |
-# endif
                                  ACL_BIT_NOTSMTP),
   },
 #endif
@@ -224,9 +218,7 @@ static condition_def conditions[] = {
 # endif
                                  ACD_EXP,
                                  PERMITTED(ACL_BIT_DKIM | ACL_BIT_DATA | ACL_BIT_MIME
-# ifndef DISABLE_PRDR
                                  | ACL_BIT_PRDR
-# endif
       ),
   },
 #endif
@@ -246,9 +238,7 @@ static condition_def conditions[] = {
 
   [ACLC_DOMAINS] =             { US"domains",          0,
                                  PERMITTED(ACL_BIT_RCPT | ACL_BIT_VRFY
-#ifndef DISABLE_PRDR
                                  | ACL_BIT_PRDR
-#endif
       ),
   },
   [ACLC_ENCRYPTED] =           { US"encrypted",        0,
@@ -265,9 +255,7 @@ static condition_def conditions[] = {
   },
   [ACLC_LOCAL_PARTS] =         { US"local_parts",      0,
                                  PERMITTED(ACL_BIT_RCPT | ACL_BIT_VRFY
-#ifndef DISABLE_PRDR
                                  | ACL_BIT_PRDR
-#endif
       ),
   },
 
@@ -281,9 +269,7 @@ static condition_def conditions[] = {
 #ifdef WITH_CONTENT_SCAN
   [ACLC_MALWARE] =             { US"malware",          ACD_EXP,
                                  PERMITTED(ACL_BIT_DATA |
-# ifndef DISABLE_PRDR
                                    ACL_BIT_PRDR |
-# endif
                                    ACL_BIT_NOTSMTP),
   },
 #endif
@@ -297,9 +283,7 @@ static condition_def conditions[] = {
 
   [ACLC_QUEUE] =               { US"queue",            ACD_EXP | ACD_MOD,
                                  FORBIDDEN(ACL_BIT_NOTSMTP |
-#ifndef DISABLE_PRDR
                                  ACL_BIT_PRDR |
-#endif
                                  ACL_BIT_DATA),
   },
 
@@ -311,9 +295,7 @@ static condition_def conditions[] = {
 #ifdef WITH_CONTENT_SCAN
   [ACLC_REGEX] =               { US"regex",            ACD_EXP,
                                  PERMITTED(ACL_BIT_DATA |
-# ifndef DISABLE_PRDR
                                    ACL_BIT_PRDR |
-# endif
                                    ACL_BIT_NOTSMTP |
                                    ACL_BIT_MIME),
   },
@@ -322,9 +304,7 @@ static condition_def conditions[] = {
   [ACLC_REMOVE_HEADER] =       { US"remove_header",    ACD_EXP | ACD_MOD,
                                  PERMITTED(ACL_BIT_MAIL|ACL_BIT_RCPT |
                                    ACL_BIT_PREDATA | ACL_BIT_DATA |
-#ifndef DISABLE_PRDR
                                    ACL_BIT_PRDR |
-#endif
                                    ACL_BIT_MIME | ACL_BIT_NOTSMTP |
                                    ACL_BIT_NOTSMTP_START),
   },
@@ -351,9 +331,7 @@ static condition_def conditions[] = {
 #ifdef WITH_CONTENT_SCAN
   [ACLC_SPAM] =                        { US"spam",             ACD_EXP,
                                  PERMITTED(ACL_BIT_DATA |
-# ifndef DISABLE_PRDR
                                  ACL_BIT_PRDR |
-# endif
                                  ACL_BIT_NOTSMTP),
   },
 #endif
@@ -531,9 +509,7 @@ static control_def controls_list[] = {
 [CONTROL_DKIM_VERIFY] =
   { US"dkim_disable_verify",     FALSE,
                                  ACL_BIT_DATA | ACL_BIT_NOTSMTP |
-# ifndef DISABLE_PRDR
                                  ACL_BIT_PRDR |
-# endif
                                  ACL_BIT_NOTSMTP_START
   },
 #endif
@@ -567,9 +543,7 @@ static control_def controls_list[] = {
          (unsigned)
          ~(ACL_BIT_MAIL | ACL_BIT_RCPT |
            ACL_BIT_PREDATA | ACL_BIT_DATA |
-#ifndef DISABLE_PRDR
            ACL_BIT_PRDR |
-#endif
            ACL_BIT_MIME)
   },
 [CONTROL_FAKEREJECT] =
@@ -577,9 +551,7 @@ static control_def controls_list[] = {
          (unsigned)
          ~(ACL_BIT_MAIL | ACL_BIT_RCPT |
            ACL_BIT_PREDATA | ACL_BIT_DATA |
-#ifndef DISABLE_PRDR
          ACL_BIT_PRDR |
-#endif
          ACL_BIT_MIME)
   },
 [CONTROL_FREEZE] =
@@ -2509,7 +2481,7 @@ BOOL leaky = FALSE, strict = FALSE, readonly = FALSE;
 BOOL noupdate = FALSE, badacl = FALSE;
 int mode = RATE_PER_WHAT;
 int old_pool, rc;
-tree_node **anchor, *t;
+tree_node ** anchor = NULL, * t;
 open_db dbblock, *dbm;
 int dbdb_size;
 dbdata_ratelimit *dbd;
@@ -2680,7 +2652,6 @@ else switch(mode)
     anchor = &ratelimiters_cmd;
     break;
   default:
-    anchor = NULL; /* silence an "unused" complaint */
     log_write(0, LOG_MAIN|LOG_PANIC_DIE,
       "internal ACL error: unknown ratelimit mode %d", mode);
     /*NOTREACHED*/
@@ -5215,7 +5186,7 @@ acl_standalone_setvar(const uschar * s, BOOL taint)
 {
 acl_condition_block * cond = store_get(sizeof(acl_condition_block), GET_UNTAINTED);
 uschar * errstr = NULL, * log_msg = NULL;
-BOOL endpass_seen;
+BOOL endpass_seen = FALSE;
 int e;
 
 cond->next = NULL;
index 0c6ed4da0a27484b76db76fe8843e792e87defb1..e68d4dba13aa6b0c6d35b5387ec8248b3b47ab45 100644 (file)
@@ -1890,6 +1890,7 @@ if (f.daemon_listen && !f.inetd_wait_mode)
   if (override_local_interfaces)
     {
     gstring * new_smtp_port = NULL, * new_local_interfaces = NULL;
+    uschar joinstr[4] = {0};           /* cppcheck silencing */
 
     if (!override_pid_file_path) write_pid = FALSE;
 
@@ -1902,7 +1903,6 @@ if (f.daemon_listen && !f.inetd_wait_mode)
 
     for (int sep = 0; s = string_nextinlist(&list, &sep, NULL, 0); )
       {
-      uschar joinstr[4];
       gstring ** gp = Ustrpbrk(s, ".:") ? &new_local_interfaces : &new_smtp_port;
       if (!*gp)
         {
index 7a067c03f03f92b88dd09991e71ddcb56df3f86a..201bf6e8e5cb92d17a601cf45bab882c0c5592c3 100644 (file)
@@ -1393,7 +1393,7 @@ DEBUG(D_any)
 # ifdef __VERSION__
   g = string_fmt_append(g, "Compiler: GCC [%s]\n", __VERSION__);
 # else
-  g = string_fmt_append(g, "Compiler: GCC [%s]\n", "? unknown version ?";
+  g = string_fmt_append(g, "Compiler: GCC [%s]\n", "? unknown version ?");
 # endif
 #else
   g = string_cat(g, US"Compiler: <unknown>\n");
index 070dfd780710f4d80f32b9ae79ae693dfacf8b29..d16d862250835acc3cbebef83cfe3d913b8ad6b8 100644 (file)
@@ -337,15 +337,21 @@ for (j = 0; j < lock_retries; j++)
     /* Apply hitching post algorithm. */
 
     if ((rc = link(hitchname, lockname)) != 0)
-     rc2 = fstat(hd, &statbuf);
-    (void)close(hd);
-    unlink(hitchname);
-
-    if (rc != 0 && (rc2 != 0 || statbuf.st_nlink != 2))
       {
-      printf("exim_lock: failed to link hitching post to lock file\n");
-      hd = -1;
-      goto RETRY;
+      rc2 = fstat(hd, &statbuf);
+      (void)close(hd);
+      unlink(hitchname);
+      if ((rc2 != 0 || statbuf.st_nlink != 2))
+       {
+       printf("exim_lock: failed to link hitching post to lock file\n");
+       hd = -1;
+       goto RETRY;
+       }
+      }
+    else
+      {
+      (void)close(hd);
+      unlink(hitchname);
       }
 
     if (!quiet) printf("exim_lock: lock file successfully created\n");