[PATCH] fix up external acl type dumping

From: Robert Collins <robertc_at_squid-cache.org>
Date: Thu, 14 Jun 2012 21:06:39 +1200

This patch does four things:
 - adds a helper macro for format strings with external acl type config dumping.
 - uses that to add a missing type dumper for %%, which currently
causes squid to FATAL if mgr:config is invoked.
 - refactors the SSL type dumping to use the macro as well, saving
some redundant code
 - fixes a typo
- case _external_acl_format::EXT_ACL_CA_CERT:
- storeAppendPrintf(sentry, " %%USER_CERT_%s", format->header);

Seeking review, will land in a couple days if there is none :)

-Rob

=== modified file 'src/external_acl.cc'
--- src/external_acl.cc 2012-05-08 01:21:10 +0000
+++ src/external_acl.cc 2012-06-14 08:58:33 +0000
@@ -568,6 +568,10 @@
             case _external_acl_format::EXT_ACL_##a: \
                 storeAppendPrintf(sentry, " %%%s", #a); \
                 break
+#define DUMP_EXT_ACL_TYPE_FMT(a, fmt, ...) \
+ case _external_acl_format::EXT_ACL_##a: \
+ storeAppendPrintf(sentry, fmt, ##__VA_ARGS__); \
+ break
 #if USE_AUTH
                 DUMP_EXT_ACL_TYPE(LOGIN);
 #endif
@@ -592,28 +596,17 @@
                 DUMP_EXT_ACL_TYPE(PATH);
                 DUMP_EXT_ACL_TYPE(METHOD);
 #if USE_SSL
-
- case _external_acl_format::EXT_ACL_USER_CERT_RAW:
- storeAppendPrintf(sentry, " %%USER_CERT");
- break;
-
- case _external_acl_format::EXT_ACL_USER_CERTCHAIN_RAW:
- storeAppendPrintf(sentry, " %%USER_CERTCHAIN");
- break;
-
- case _external_acl_format::EXT_ACL_USER_CERT:
- storeAppendPrintf(sentry, " %%USER_CERT_%s", format->header);
- break;
-
- case _external_acl_format::EXT_ACL_CA_CERT:
- storeAppendPrintf(sentry, " %%USER_CERT_%s", format->header);
- break;
+ DUMP_EXT_ACL_TYPE_FMT(USER_CERT_RAW, " %%USER_CERT_RAW");
+ DUMP_EXT_ACL_TYPE_FMT(USER_CERTCHAIN_RAW, "
%%USER_CERTCHAIN_RAW");
+ DUMP_EXT_ACL_TYPE_FMT(USER_CERT, " %%USER_CERT_%s",
format->header);
+ DUMP_EXT_ACL_TYPE_FMT(CA_CERT, " %%CA_CERT_%s",
format->header);
 #endif
 #if USE_AUTH
                 DUMP_EXT_ACL_TYPE(EXT_USER);
 #endif
                 DUMP_EXT_ACL_TYPE(EXT_LOG);
                 DUMP_EXT_ACL_TYPE(TAG);
+ DUMP_EXT_ACL_TYPE_FMT(PERCENT, " %%%%");
             default:
                 fatal("unknown external_acl format error");
                 break;
Received on Thu Jun 14 2012 - 09:30:29 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 14 2012 - 12:00:11 MDT