summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap_async_users.c
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2014-11-07 21:33:36 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-11-20 10:52:48 +0100
commit933326b4180b72636af84643d4811f6ad645fbe8 (patch)
treecfd96b3d421b10ff85d082c85f28d99938895ff8 /src/providers/ldap/sdap_async_users.c
parent7964d2bd7ea6a0f5bf5acdf94279d72122eca6ad (diff)
downloadsssd-933326b4180b72636af84643d4811f6ad645fbe8.tar.gz
sssd-933326b4180b72636af84643d4811f6ad645fbe8.tar.xz
sssd-933326b4180b72636af84643d4811f6ad645fbe8.zip
LDAP: always store UUID if available
Related to https://fedorahosted.org/sssd/ticket/2481 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/providers/ldap/sdap_async_users.c')
-rw-r--r--src/providers/ldap/sdap_async_users.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
index 2331ba9df..367e3d795 100644
--- a/src/providers/ldap/sdap_async_users.c
+++ b/src/providers/ldap/sdap_async_users.c
@@ -140,6 +140,7 @@ int sdap_save_user(TALLOC_CTX *memctx,
TALLOC_CTX *tmpctx = NULL;
bool use_id_mapping;
char *sid_str;
+ const char *uuid;
char *dom_sid_str = NULL;
struct sss_domain_info *subdomain;
@@ -165,7 +166,7 @@ int sdap_save_user(TALLOC_CTX *memctx,
ret = sysdb_attrs_add_string(user_attrs, SYSDB_SID_STR, sid_str);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE, "Could not add SID string: [%s]\n",
- strerror(ret));
+ sss_strerror(ret));
goto done;
}
} else if (ret == ENOENT) {
@@ -173,10 +174,28 @@ int sdap_save_user(TALLOC_CTX *memctx,
sid_str = NULL;
} else {
DEBUG(SSSDBG_MINOR_FAILURE, "Could not identify objectSID: [%s]\n",
- strerror(ret));
+ sss_strerror(ret));
sid_str = NULL;
}
+ /* Always store UUID if available */
+ ret = sysdb_attrs_get_string(attrs,
+ opts->user_map[SDAP_AT_USER_UUID].sys_name,
+ &uuid);
+ if (ret == EOK) {
+ ret = sysdb_attrs_add_string(user_attrs, SYSDB_UUID, uuid);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_MINOR_FAILURE, "Could not add UUID string: [%s]\n",
+ sss_strerror(ret));
+ goto done;
+ }
+ } else if (ret == ENOENT) {
+ DEBUG(SSSDBG_TRACE_ALL, "UUID not available for user.\n");
+ } else {
+ DEBUG(SSSDBG_MINOR_FAILURE, "Could not identify UUID [%s]\n",
+ sss_strerror(ret));
+ }
+
/* If this object has a SID available, we will determine the correct
* domain by its SID. */
if (sid_str != NULL) {