[PATCH] External ACLs sometimes need parameters with spaces in

From: Greg Sheard <greg@dont-contact.us>
Date: 14 Nov 2002 10:46:38 +0000

Hi all,

I needed to pass a group to wb_group, and I was trying to pass "Domain
Admins". Bare quotes tried to load the text from a file (yes, I know
that's a feature), and single quotes didn't work for wb_group. Escaping
the quotes with \ stopped it trying to load a file, but passed the \ to
wb_group, which didn't like that either.

In the end, I just wrote a handler. This could be the wrong thing to do,
the wrong way to do it, or the right way coded badly, but I hope the
intention's clear from it -- and it worked for me (tm).

Comments/hints/suggestions welcome.

Cheers,

Greg Sheard
Technical Director
ECSC Ltd.
www.ecsc.co.uk

--- squid-2.5.STABLE1/src/external_acl.c Sat Sep 7 15:58:41 2002
+++ squid-built/src/external_acl.c Tue Oct 1 10:48:19 2002
@@ -551,9 +551,26 @@
     for (arg = acl_data->arguments; arg; arg = arg->next) {
         if (!first)
             memBufAppend(&mb, " ", 1);
- strwordquote(&mb, arg->key);
+ debug (82, 4) ("makeExternalAclKey: appending %s to key.\n", arg->key);
+ {
+ const char *str = arg->key;
+ int i=0;
+ for(;i<strlen(arg->key);i++) {
+ if (*str == '\\' && *(str+1) == '"') {
+ debug (82, 4) ("makeExternalAclKey: stripping escape.\n");
+ str++;
+ }
+ if (*str == '\0') {
+ debug (82, 4) ("makeExternalAclKey: stripping NULL.\n");
+ break;
+ }
+ memBufAppend(&mb, str, 1);
+ str++;
+ }
+ }
         first = 0;
     }
+ debug (82, 3) ("makeExternalAclKey: completed key is %s.\n", mb.buf);
     return mb.buf;
   error:
     return NULL;

Received on Thu Nov 14 2002 - 03:49:31 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:18:43 MST