From 3f09cfc6598d34ff42be1c85f448b5c0635410e0 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Mon, 20 Jun 2016 12:57:43 +0200 Subject: [PATCH 04/14] sysdb: include email in UPN searches Email addresses and Kerberos user principals names (UPNs) do not only look similar they also can be used to identify a user uniquely. In future this approach should be replace by a more generic one where the attributes which can uniquely identifies a user can be configured to support even a wider range of login names. --- src/db/sysdb.h | 2 +- src/db/sysdb_ops.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/db/sysdb.h b/src/db/sysdb.h index bbc07ac00656ebe510211985f0288199212689a8..5314ae082542c5a415216d16a6fc2b754fb6384b 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -185,7 +185,7 @@ #define SYSDB_PWNAM_FILTER "(&("SYSDB_UC")(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))" #define SYSDB_PWUID_FILTER "(&("SYSDB_UC")("SYSDB_UIDNUM"=%lu))" #define SYSDB_PWSID_FILTER "(&("SYSDB_UC")("SYSDB_SID_STR"=%s))" -#define SYSDB_PWUPN_FILTER "(&("SYSDB_UC")(|("SYSDB_UPN"=%s)("SYSDB_CANONICAL_UPN"=%s)))" +#define SYSDB_PWUPN_FILTER "(&("SYSDB_UC")(|("SYSDB_UPN"=%s)("SYSDB_CANONICAL_UPN"=%s)("SYSDB_USER_EMAIL"=%s)))" #define SYSDB_PWENT_FILTER "("SYSDB_UC")" #define SYSDB_GRNAM_FILTER "(&("SYSDB_GC")(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))" diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 4755ea3427b99a51d73b7b9134e357cf2b987613..f59e1ebcd46441497290155949703ef03c832f91 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -537,7 +537,7 @@ int sysdb_search_user_by_upn_res(TALLOC_CTX *mem_ctx, struct ldb_dn *base_dn; int ret; const char *def_attrs[] = { SYSDB_NAME, SYSDB_UPN, SYSDB_CANONICAL_UPN, - NULL }; + SYSDB_USER_EMAIL, NULL }; tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { @@ -553,7 +553,7 @@ int sysdb_search_user_by_upn_res(TALLOC_CTX *mem_ctx, ret = ldb_search(domain->sysdb->ldb, tmp_ctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs ? attrs : def_attrs, - SYSDB_PWUPN_FILTER, upn, upn); + SYSDB_PWUPN_FILTER, upn, upn, upn); if (ret != EOK) { ret = sysdb_error_to_errno(ret); goto done; -- 2.1.0