summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2014-08-25 11:42:14 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-09-01 13:56:56 +0200
commit84d50b69d286f041aa96a948b008d311d8755075 (patch)
tree11d0fb10d3c81512369186da000aae5483e61c41 /src/db
parent5c2f2023696d1ff79c3c5d94b89e7ef9cd4159e9 (diff)
downloadsssd-84d50b69d286f041aa96a948b008d311d8755075.tar.gz
sssd-84d50b69d286f041aa96a948b008d311d8755075.tar.xz
sssd-84d50b69d286f041aa96a948b008d311d8755075.zip
sysdb_get_real_name: allow UPN as input
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 626ec0de4..3bc27c84a 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -1891,6 +1891,7 @@ errno_t sysdb_get_real_name(TALLOC_CTX *mem_ctx,
TALLOC_CTX *tmp_ctx;
struct ldb_result *res;
const char *cname;
+ struct ldb_message *msg;
tmp_ctx = talloc_new(NULL);
if (!tmp_ctx) {
@@ -1904,17 +1905,22 @@ errno_t sysdb_get_real_name(TALLOC_CTX *mem_ctx,
}
if (res->count == 0) {
- /* User is not cached yet */
- ret = ENOENT;
- goto done;
- } else if (res->count != 1) {
+ ret = sysdb_search_user_by_upn(tmp_ctx, domain, name, NULL, &msg);
+ if (ret != EOK) {
+ /* User cannot be found in cache */
+ DEBUG(SSSDBG_OP_FAILURE, "Cannot find user [%s] in cache\n", name);
+ goto done;
+ }
+ } else if (res->count == 1) {
+ msg = res->msgs[0];
+ } else {
DEBUG(SSSDBG_CRIT_FAILURE,
"sysdb_getpwnam returned count: [%d]\n", res->count);
ret = EIO;
goto done;
}
- cname = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_NAME, NULL);
+ cname = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL);
if (!cname) {
DEBUG(SSSDBG_CRIT_FAILURE, "A user with no name?\n");
ret = ENOENT;