summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-09-28 21:38:30 (GMT)
committerStephen Gallagher <sgallagh@redhat.com>2011-10-03 14:44:47 (GMT)
commit2f0eb4434eab740b0cdb2e33f2a2f0d3fbe143b7 (patch)
treeba0f20c021fbe255d588ef039969e1a1beb2a62e
parent9afbe1b2daef7783c7843cfffa1ba248b3bd2cf2 (diff)
downloadsssd-2f0eb4434eab740b0cdb2e33f2a2f0d3fbe143b7.zip
sssd-2f0eb4434eab740b0cdb2e33f2a2f0d3fbe143b7.tar.gz
sssd-2f0eb4434eab740b0cdb2e33f2a2f0d3fbe143b7.tar.xz
Return users and groups based on alias
-rw-r--r--src/db/sysdb.h6
-rw-r--r--src/db/sysdb_search.c7
-rw-r--r--src/responder/pam/pam_LOCAL_domain.c5
3 files changed, 10 insertions, 8 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 6aa3d37..9153f65 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -108,15 +108,15 @@
#define SYSDB_NC "objectclass="SYSDB_NETGROUP_CLASS
#define SYSDB_MPGC "|("SYSDB_UC")("SYSDB_GC")"
-#define SYSDB_PWNAM_FILTER "(&("SYSDB_UC")("SYSDB_NAME"=%s))"
+#define SYSDB_PWNAM_FILTER "(&("SYSDB_UC")(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))"
#define SYSDB_PWUID_FILTER "(&("SYSDB_UC")("SYSDB_UIDNUM"=%lu))"
#define SYSDB_PWENT_FILTER "("SYSDB_UC")"
-#define SYSDB_GRNAM_FILTER "(&("SYSDB_GC")("SYSDB_NAME"=%s))"
+#define SYSDB_GRNAM_FILTER "(&("SYSDB_GC")(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))"
#define SYSDB_GRNA2_FILTER "(&("SYSDB_UC")("SYSDB_MEMBEROF"=%s))"
#define SYSDB_GRGID_FILTER "(&("SYSDB_GC")("SYSDB_GIDNUM"=%lu))"
#define SYSDB_GRENT_FILTER "("SYSDB_GC")"
-#define SYSDB_GRNAM_MPG_FILTER "(&("SYSDB_MPGC")("SYSDB_NAME"=%s))"
+#define SYSDB_GRNAM_MPG_FILTER "(&("SYSDB_MPGC")(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))"
#define SYSDB_GRGID_MPG_FILTER "(&("SYSDB_MPGC")("SYSDB_GIDNUM"=%lu))"
#define SYSDB_GRENT_MPG_FILTER "("SYSDB_MPGC")"
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index bb4fe04..52b470a 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -63,7 +63,7 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attrs, SYSDB_PWNAM_FILTER,
- sanitized_name);
+ sanitized_name, sanitized_name);
if (ret) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -248,7 +248,7 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attrs, fmt_filter,
- sanitized_name);
+ sanitized_name, sanitized_name);
if (ret) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -512,7 +512,8 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx,
ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attributes,
- SYSDB_PWNAM_FILTER, sanitized_name);
+ SYSDB_PWNAM_FILTER, sanitized_name,
+ sanitized_name);
if (ret) {
ret = sysdb_error_to_errno(ret);
goto done;
diff --git a/src/responder/pam/pam_LOCAL_domain.c b/src/responder/pam/pam_LOCAL_domain.c
index 6e0631a..ba8a77f 100644
--- a/src/responder/pam/pam_LOCAL_domain.c
+++ b/src/responder/pam/pam_LOCAL_domain.c
@@ -265,11 +265,12 @@ int LOCAL_pam_handler(struct pam_auth_req *preq)
if (res->count < 1) {
DEBUG(4, ("No user found with filter ["SYSDB_PWNAM_FILTER"]\n",
- pd->user));
+ pd->user, pd->user));
pd->pam_status = PAM_USER_UNKNOWN;
goto done;
} else if (res->count > 1) {
- DEBUG(4, ("More than one object found with filter ["SYSDB_PWNAM_FILTER"]\n"));
+ DEBUG(4, ("More than one object found with filter ["SYSDB_PWNAM_FILTER"]\n",
+ pd->user, pd->user));
lreq->error = EFAULT;
goto done;
}