summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2015-08-28 07:07:40 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-09-01 12:50:49 +0200
commiteaccdcf75b651a0cc4fc02526180f5991a16c553 (patch)
treec0ba268be471258c944509bd8ff72cc766a5164f
parentc8fcc0597ad6399fe42111512d5dc2ff1362f3c8 (diff)
downloadsssd-rhel-7.2.zip
sssd-rhel-7.2.tar.gz
sssd-rhel-7.2.tar.xz
NSS: Don't ignore backslash in usernames with ldap providerrhel-7.2
The regression was caused by changing default domain regex for ldap provider in ticket #2717 Resolves: https://fedorahosted.org/sssd/ticket/2772 Reviewed-by: Sumit Bose <sbose@redhat.com>
-rw-r--r--src/responder/nss/nsssrv.c4
-rw-r--r--src/tests/cmocka/test_nss_srv.c4
-rw-r--r--src/util/usertools.c11
-rw-r--r--src/util/util.h3
4 files changed, 17 insertions, 5 deletions
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index 2b3bca8..d8eff79 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -552,9 +552,9 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
goto fail;
}
- ret = sss_names_init(nctx, nctx->rctx->cdb, NULL, &nctx->global_names);
+ ret = sss_ad_default_names_ctx(nctx, &nctx->global_names);
if (ret != EOK) {
- DEBUG(SSSDBG_CRIT_FAILURE, "sss_names_init failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "sss_ad_default_names_ctx failed.\n");
goto fail;
}
diff --git a/src/tests/cmocka/test_nss_srv.c b/src/tests/cmocka/test_nss_srv.c
index 84d3413..3cf9f06 100644
--- a/src/tests/cmocka/test_nss_srv.c
+++ b/src/tests/cmocka/test_nss_srv.c
@@ -1043,8 +1043,8 @@ void test_nss_setup(struct sss_test_conf_param params[],
nss_test_ctx->nctx = mock_nctx(nss_test_ctx);
assert_non_null(nss_test_ctx->nctx);
- ret = sss_names_init(nss_test_ctx->nctx, nss_test_ctx->tctx->confdb,
- NULL, &nss_test_ctx->nctx->global_names);
+ ret = sss_ad_default_names_ctx(nss_test_ctx->nctx,
+ &nss_test_ctx->nctx->global_names);
assert_int_equal(ret, EOK);
assert_non_null(nss_test_ctx->nctx->global_names);
diff --git a/src/util/usertools.c b/src/util/usertools.c
index 87a8d74..ccbf7a0 100644
--- a/src/util/usertools.c
+++ b/src/util/usertools.c
@@ -249,7 +249,8 @@ int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb,
}
if (!re_pattern) {
- re_pattern = talloc_strdup(tmpctx, IPA_AD_DEFAULT_RE);
+ re_pattern = talloc_strdup(tmpctx,
+ "(?P<name>[^@]+)@?(?P<domain>[^@]*$)");
if (!re_pattern) {
ret = ENOMEM;
goto done;
@@ -294,6 +295,14 @@ done:
return ret;
}
+int sss_ad_default_names_ctx(TALLOC_CTX *mem_ctx,
+ struct sss_names_ctx **_out)
+{
+ return sss_names_init_from_args(mem_ctx, IPA_AD_DEFAULT_RE,
+ CONFDB_DEFAULT_FULL_NAME_FORMAT,
+ _out);
+}
+
int sss_parse_name(TALLOC_CTX *memctx,
struct sss_names_ctx *snctx,
const char *orig, char **_domain, char **_name)
diff --git a/src/util/util.h b/src/util/util.h
index a20d1d8..c998e91 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -298,6 +298,9 @@ int sss_names_init(TALLOC_CTX *mem_ctx,
const char *domain,
struct sss_names_ctx **out);
+int sss_ad_default_names_ctx(TALLOC_CTX *mem_ctx,
+ struct sss_names_ctx **_out);
+
int sss_parse_name(TALLOC_CTX *memctx,
struct sss_names_ctx *snctx,
const char *orig, char **_domain, char **_name);