Hi,

older versions of libpcre only support the Python naming style,
?P<name>, for subpatterns. This patch changes our default pattern and
adds some hints about this.

bye,
Sumit
>From d5730a503f6d923c1cc21b27d7693a496e13e054 Mon Sep 17 00:00:00 2001
From: sbose <sb...@sles10.site>
Date: Wed, 9 Sep 2009 12:10:53 +0200
Subject: [PATCH] more fixes for older libpcre versions

- older version of libpcre only support the Python syntax (?P<name>)
  for named subpatterns
---
 server/man/sssd.conf.5.xml |    7 ++++++-
 server/util/usertools.c    |    6 ++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/server/man/sssd.conf.5.xml b/server/man/sssd.conf.5.xml
index f4cb87a..b64899a 100644
--- a/server/man/sssd.conf.5.xml
+++ b/server/man/sssd.conf.5.xml
@@ -133,7 +133,7 @@
                             containing user name and domain into these 
components.
                         </para>
                         <para>
-                            Default: 
<quote>(?&lt;name&gt;[...@]+)@?(?&lt;domain&gt;[...@]*$)</quote>
+                            Default: 
<quote>(?P&lt;name&gt;[...@]+)@?(?P&lt;domain&gt;[...@]*$)</quote>
                             which translates to "the name is everything up to 
the
                             <quote>@</quote> sign, the domain everything after 
that"
                         </para>
@@ -144,6 +144,11 @@
                             libpcre version 7 or higher can support non-unique
                             named subpatterns.
                         </para>
+                        <para>
+                            PLEASE NOTE ALSO: older version of libpcre only
+                            support the Python syntax (?P&lt;name&gt;) to label
+                            subpatterns.
+                        </para>
                     </listitem>
                 </varlistentry>
                 <varlistentry>
diff --git a/server/util/usertools.c b/server/util/usertools.c
index 2134839..e4e941a 100644
--- a/server/util/usertools.c
+++ b/server/util/usertools.c
@@ -64,16 +64,18 @@ int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx 
*cdb, struct sss_names
 
     if (!ctx->re_pattern) {
         ctx->re_pattern = talloc_strdup(ctx,
-                                "(?<name>[...@]+)@?(?<domain>[...@]*$)");
+                                "(?P<name>[...@]+)@?(?P<domain>[...@]*$)");
         if (!ctx->re_pattern) {
             ret = ENOMEM;
             goto done;
         }
 #ifdef HAVE_LIBPCRE_LESSER_THAN_7
+    } else {
         DEBUG(2, ("This binary was build with a version of libpcre that does "
                   "not support non-unique named subpatterns.\n"));
         DEBUG(2, ("Please make sure that your pattern [%s] only contains "
-                  "subpatterns with a unique name.\n", ctx->re_pattern));
+                  "subpatterns with a unique name and uses "
+                  "the Python syntax (?P<name>).\n", ctx->re_pattern));
 #endif
     }
 
-- 
1.6.2.5

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to