From 9b743e1ab4e866776455c948d7eebc47a908d10d 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 c85901d15a7ced8033971fdbcfc2dbc04eda3870..3cae4643bb6481159064112a384fb2b26cb2a628 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 19d6be03ede1bcec3bc7a4ed777e326460d80591..ac16015cb636932e71b9f34b22473a84602c92bd 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