Debug: indent ACL and expreassion tracing by evaluation depth
[exim.git] / src / src / malware.c
index e1eff16cf9df4c0ae1a0c60048e5d8f6bf10f821..547bc26e6dd9e3db905d33f534b24a581ff1dc32 100644 (file)
@@ -231,13 +231,13 @@ while ((rcv = read(fd, p, 1)) > 0)
   }
 if (!ok)
   {
-  DEBUG(D_acl) debug_printf("Malware scan: read %s (%s)\n",
+  DEBUG(D_acl) debug_printf_indent("Malware scan: read %s (%s)\n",
                rcv==0 ? "EOF" : "error", strerror(errno));
   return rcv==0 ? -1 : -2;
   }
 *p = '\0';
 
-DEBUG(D_acl) debug_printf("Malware scan: read '%s'\n", buffer);
+DEBUG(D_acl) debug_printf_indent("Malware scan: read '%s'\n", buffer);
 return p - buffer;
 }
 
@@ -475,7 +475,7 @@ if (*av_scanner == '$')
         expand_string_message));
 
   DEBUG(D_acl)
-    debug_printf("Expanded av_scanner global: %s\n", av_scanner_work);
+    debug_printf_indent("Expanded av_scanner global: %s\n", av_scanner_work);
   /* disable result caching in this case */
   malware_name = NULL;
   malware_ok = FALSE;
@@ -512,7 +512,7 @@ if (!malware_ok)
       return m_errlog_defer(scanent, CUS callout_address, errstr);
     break;
   }
-  DEBUG(D_acl) debug_printf("Malware scan: %s tmo %s\n", scanner_name, readconf_printtime(timeout));
+  DEBUG(D_acl) debug_printf_indent("Malware scan: %s tmo %s\n", scanner_name, readconf_printtime(timeout));
 
   switch (scanent->scancode)
     {
@@ -535,7 +535,7 @@ if (!malware_ok)
        par_count++;
        }
       scanrequest = string_sprintf("%s HTTP/1.0\r\n\r\n", scanrequest);
-      DEBUG(D_acl) debug_printf("Malware scan: issuing %s: %s\n",
+      DEBUG(D_acl) debug_printf_indent("Malware scan: issuing %s: %s\n",
        scanner_name, scanrequest);
 
       /* send scan request */
@@ -615,7 +615,7 @@ if (!malware_ok)
        drweb_slen = htonl(fsize);
        lseek(drweb_fd, 0, SEEK_SET);
 
-       DEBUG(D_acl) debug_printf("Malware scan: issuing %s remote scan [%s]\n",
+       DEBUG(D_acl) debug_printf_indent("Malware scan: issuing %s remote scan [%s]\n",
            scanner_name, scanner_options);
 
        /* send scan request */
@@ -664,7 +664,7 @@ if (!malware_ok)
        {
        drweb_slen = htonl(Ustrlen(eml_filename));
 
-       DEBUG(D_acl) debug_printf("Malware scan: issuing %s local scan [%s]\n",
+       DEBUG(D_acl) debug_printf_indent("Malware scan: issuing %s local scan [%s]\n",
            scanner_name, scanner_options);
 
        /* send scan request */
@@ -782,7 +782,7 @@ if (!malware_ok)
                                                eml_filename);
 
       /* and send it */
-      DEBUG(D_acl) debug_printf("Malware scan: issuing %s %s\n",
+      DEBUG(D_acl) debug_printf_indent("Malware scan: issuing %s %s\n",
        scanner_name, buf);
       if (m_sock_send(sock, buf, Ustrlen(buf), &errstr) < 0)
        return m_errlog_defer(scanent, CUS callout_address, errstr);
@@ -842,7 +842,7 @@ if (!malware_ok)
 
       malware_name = NULL;
 
-      DEBUG(D_acl) debug_printf("Malware scan: issuing %s scan [%s]\n",
+      DEBUG(D_acl) debug_printf_indent("Malware scan: issuing %s scan [%s]\n",
          scanner_name, scanner_options);
       /* pass options */
       memset(av_buffer, 0, sizeof(av_buffer));
@@ -938,7 +938,7 @@ if (!malware_ok)
       if (p)
        *p = '\0';
 
-      DEBUG(D_acl) debug_printf("Malware scan: issuing %s scan [%s]\n",
+      DEBUG(D_acl) debug_printf_indent("Malware scan: issuing %s scan [%s]\n",
          scanner_name, scanner_options);
 
       /* send scan request */
@@ -1069,7 +1069,7 @@ if (!malware_ok)
       /* redirect STDERR too */
       commandline = string_sprintf("%s 2>&1", commandline);
 
-      DEBUG(D_acl) debug_printf("Malware scan: issuing %s scan [%s]\n",
+      DEBUG(D_acl) debug_printf_indent("Malware scan: issuing %s scan [%s]\n",
              scanner_name, commandline);
 
       /* store exims signal handlers */
@@ -1172,7 +1172,7 @@ if (!malware_ok)
       if ((p = Ustrrchr(file_name, '/')))
        *p = '\0';
 
-      DEBUG(D_acl) debug_printf("Malware scan: issuing %s scan [%s]\n",
+      DEBUG(D_acl) debug_printf_indent("Malware scan: issuing %s scan [%s]\n",
          scanner_name, scanner_options);
 
       if (  write(sock, file_name, Ustrlen(file_name)) < 0
@@ -1346,7 +1346,7 @@ if (!malware_ok)
          int i = random_number( num_servers );
          clamd_address * cd = cv[i];
 
-         DEBUG(D_acl) debug_printf("trying server name %s, port %u\n",
+         DEBUG(D_acl) debug_printf_indent("trying server name %s, port %u\n",
                         cd->hostspec, cd->tcp_port);
 
          /* Lookup the host. This is to ensure that we connect to the same IP
@@ -1402,7 +1402,7 @@ if (!malware_ok)
         * that port on a second connection; then in the scan-method-neutral
         * part, read the response back on the original connection. */
 
-       DEBUG(D_acl) debug_printf(
+       DEBUG(D_acl) debug_printf_indent(
            "Malware scan: issuing %s old-style remote scan (PORT)\n",
            scanner_name);
 
@@ -1444,7 +1444,7 @@ if (!malware_ok)
        chunks, <n> a 4-byte number (network order), terminated by a zero-length
        chunk. */
 
-       DEBUG(D_acl) debug_printf(
+       DEBUG(D_acl) debug_printf_indent(
            "Malware scan: issuing %s new-style remote scan (zINSTREAM)\n",
            scanner_name);
 
@@ -1555,7 +1555,7 @@ if (!malware_ok)
        /* Pass the string to ClamAV (7 = "SCAN \n" + \0) */
        file_name = string_sprintf("SCAN %s\n", eml_filename);
 
-       DEBUG(D_acl) debug_printf(
+       DEBUG(D_acl) debug_printf_indent(
            "Malware scan: issuing %s local-path scan [%s]\n",
            scanner_name, scanner_options);
 
@@ -1616,7 +1616,7 @@ if (!malware_ok)
       p = av_buffer + Ustrlen(av_buffer) - 1;
       if (*p == '\n') *p = '\0';
 
-      DEBUG(D_acl) debug_printf("Malware response: %s\n", av_buffer);
+      DEBUG(D_acl) debug_printf_indent("Malware response: %s\n", av_buffer);
 
       while (isspace(*--p) && (p > av_buffer))
        *p = '\0';
@@ -1653,7 +1653,7 @@ if (!malware_ok)
            *p = '\0';
          }
        malware_name = string_copy(vname);
-       DEBUG(D_acl) debug_printf("Malware found, name \"%s\"\n", malware_name);
+       DEBUG(D_acl) debug_printf_indent("Malware found, name \"%s\"\n", malware_name);
 
        }
       else if (Ustrcmp(result_tag, "ERROR") == 0)
@@ -1664,7 +1664,7 @@ if (!malware_ok)
        {
        /* Everything should be OK */
        malware_name = NULL;
-       DEBUG(D_acl) debug_printf("Malware not found\n");
+       DEBUG(D_acl) debug_printf_indent("Malware not found\n");
 
        }
       else
@@ -1770,7 +1770,7 @@ if (!malware_ok)
 
       malware_name = NULL;
 
-      DEBUG(D_acl) debug_printf("Malware scan: issuing %s scan\n", scanner_name);
+      DEBUG(D_acl) debug_printf_indent("Malware scan: issuing %s scan\n", scanner_name);
 
       if ((retval = mksd_scan_packed(scanent, sock, eml_filename, tmo)) != OK)
        {
@@ -1812,7 +1812,7 @@ if (!malware_ok)
        int slen = Ustrlen(buf);
        if (slen >= 1)
          {
-         DEBUG(D_acl) debug_printf("got from avast: %s\n", buf);
+         DEBUG(D_acl) debug_printf_indent("got from avast: %s\n", buf);
          switch (avast_stage)
            {
            case AVA_HELO:
@@ -1923,7 +1923,7 @@ if (!malware_ok)
 /* match virus name against pattern (caseless ------->----------v) */
 if (malware_name && regex_match_and_setup(re, malware_name, 0, -1))
   {
-  DEBUG(D_acl) debug_printf(
+  DEBUG(D_acl) debug_printf_indent(
       "Matched regex to malware [%s] [%s]\n", malware_re, malware_name);
   return OK;
   }