summaryrefslogtreecommitdiff
path: root/server/util
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2009-08-31 20:30:46 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-09-01 14:51:18 -0400
commitb641864b0250923e279dadd1866c7b8cea6c1372 (patch)
tree481e0278eaf8751425e0b2443052091baaeefedb /server/util
parentd5450bc3c771bcc4c70f07b7028c9dffd80a5281 (diff)
downloadsssd-b641864b0250923e279dadd1866c7b8cea6c1372.tar.gz
sssd-b641864b0250923e279dadd1866c7b8cea6c1372.tar.bz2
sssd-b641864b0250923e279dadd1866c7b8cea6c1372.zip
check if libpcre version is above or below 7
PCRE_DUPNAMES is a new feature of libpcre 7. It is used in sssd to make the splitting of fully qualified user names more flexible.
Diffstat (limited to 'server/util')
-rw-r--r--server/util/usertools.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/server/util/usertools.c b/server/util/usertools.c
index 220b52cb..21348391 100644
--- a/server/util/usertools.c
+++ b/server/util/usertools.c
@@ -29,6 +29,12 @@
#define NAMES_CONFIG "config/names"
+#ifdef HAVE_LIBPCRE_LESSER_THAN_7
+#define NAME_DOMAIN_PATTERN_OPTIONS (PCRE_EXTENDED)
+#else
+#define NAME_DOMAIN_PATTERN_OPTIONS (PCRE_DUPNAMES | PCRE_EXTENDED)
+#endif
+
char *get_username_from_uid(TALLOC_CTX *mem_ctx, uid_t uid)
{
char *username;
@@ -63,6 +69,12 @@ int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb, struct sss_names
ret = ENOMEM;
goto done;
}
+#ifdef HAVE_LIBPCRE_LESSER_THAN_7
+ 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));
+#endif
}
ret = confdb_get_string(cdb, ctx, NAMES_CONFIG,
@@ -78,7 +90,7 @@ int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb, struct sss_names
}
ctx->re = pcre_compile2(ctx->re_pattern,
- PCRE_DUPNAMES | PCRE_EXTENDED,
+ NAME_DOMAIN_PATTERN_OPTIONS,
&errval, &errstr, &errpos, NULL);
if (!ctx->re) {
DEBUG(1, ("Invalid Regular Expression pattern at position %d."