Magnus Holmgren wrote:
> If a value can contain ", " I'm afraid you're out of luck. Either you make 
> sure that no value contains ", ", perhaps by putting the space inside [ ] if 
> it's in a regexp, or change the separator string in src/lookups/ldap.c line 
> 683 and recompile Exim.

Ah, thanks for the pointer.  Here's an interim solution; it doubles any
contained commas.  List-ops like ${reduce can then be used to split on the 
comma;
the space gets dropped.  There's still a problem with spaces though.
I guess there's always ${sg


Cheers,
   Jeremy




*** ldap.c.orig 2008-01-15 21:18:12.000000000 +0000
--- ldap.c      2008-01-15 21:28:39.000000000 +0000
***************
*** 683,689 ****
                data = string_cat(data, &size, &ptr, US", ", 2);
  
              /* For multiple attributes, the data is in quotes. We must escape
!             internal quotes, backslashes, newlines. */
  
              if (attr_count != 1)
                {
--- 683,689 ----
                data = string_cat(data, &size, &ptr, US", ", 2);
  
              /* For multiple attributes, the data is in quotes. We must escape
!             internal quotes, backslashes & newlines and double commas. */
  
              if (attr_count != 1)
                {
***************
*** 692,697 ****
--- 692,699 ----
                  {
                  if (value[j] == '\n')
                    data = string_cat(data, &size, &ptr, US"\\n", 2);
+               else if (value[j] == ',')
+                 data = string_cat(data, &size, &ptr, US",,", 2);
                  else
                    {
                    if (value[j] == '\"' || value[j] == '\\')
***************
*** 701,709 ****
                  }
                }
  
!             /* For single attributes, copy the value verbatim */
  
!             else data = string_cat(data, &size, &ptr, value, len);
  
              /* Move on to the next value */
  
--- 703,721 ----
                  }
                }
  
!             /* For single attributes, just double commas */
  
!           else
!               {
!               int j;
!               for (j = 0; j < len; j++)
!                 {
!               if (value[j] == ',')
!                 data = string_cat(data, &size, &ptr, US",,", 2);
!                 else
!                   data = string_cat(data, &size, &ptr, value+j, 1);
!                 }
!               }
  
              /* Move on to the next value */

-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to