Re: [PATCH] External ACLs sometimes need parameters with spaces in

From: Brian T. O'Neill <btoneill@dont-contact.us>
Date: Thu, 14 Nov 2002 10:02:43 -0600

I sent a patch to wb_check_group.c the other day that allows you to use
`group name` which squid has no issues with in squid.conf. Also, I
noticed that the other part of my patch for solving an issue I had with
not matching groups, was solved by using the new winbindd_nss.h in samba
2.2.6.
                                           
diff wb_check_group.c wb_check_group.c.good
82,85d81
< case '`':
< quoted = !quoted;
< p++;
< break;

Brian

Quoting Greg Sheard (greg@ecsc.co.uk) from :
> 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;

-- 
btoneill@misplaced.net
****************************************************************************
UNIX is simple and coherent, but it takes a genius (or at any rate a 
programmer) to understand and appreciate the simplicity."  - Dennis Ritchie
****************************************************************************
Received on Thu Nov 14 2002 - 09:02:47 MST

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