summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2016-07-07 21:06:40 +0200
committerSumit Bose <sbose@redhat.com>2016-07-13 15:45:07 +0200
commit355b404f7494a8bd3067f13a908b41ae8b9fa0e2 (patch)
tree2482614deff06371dcd2819c9ddb7e69508fda8d
parentaa691837a2fa2fe2e38a55d576644074e0f45bd8 (diff)
downloadsssd-355b404f7494a8bd3067f13a908b41ae8b9fa0e2.zip
sssd-355b404f7494a8bd3067f13a908b41ae8b9fa0e2.tar.gz
sssd-355b404f7494a8bd3067f13a908b41ae8b9fa0e2.tar.xz
memberOf: use defaultOverrideName if available
-rw-r--r--src/ldb_modules/memberof.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
index af7147e..7d415db 100644
--- a/src/ldb_modules/memberof.c
+++ b/src/ldb_modules/memberof.c
@@ -28,6 +28,7 @@
#define DB_MEMBEROF "memberof"
#define DB_MEMBERUID "memberuid"
#define DB_NAME "name"
+#define DB_DEFAULT_OVERRIDE_NAME "defaultOverrideName"
#define DB_USER_CLASS "user"
#define DB_GROUP_CLASS "group"
#define DB_CACHE_EXPIRE "dataExpireTimestamp"
@@ -639,7 +640,7 @@ static int mbof_add_callback(struct ldb_request *req,
static int mbof_next_add(struct mbof_add_operation *addop)
{
- static const char *attrs[] = { DB_OC, DB_NAME,
+ static const char *attrs[] = { DB_OC, DB_NAME, DB_DEFAULT_OVERRIDE_NAME,
DB_MEMBER, DB_GHOST,
DB_MEMBEROF, NULL };
struct ldb_context *ldb;
@@ -887,9 +888,12 @@ static int mbof_add_operation(struct mbof_add_operation *addop)
switch (ret) {
case LDB_SUCCESS:
/* it's a user object */
- name = ldb_msg_find_attr_as_string(addop->entry, DB_NAME, NULL);
+ name = ldb_msg_find_attr_as_string(addop->entry, DB_DEFAULT_OVERRIDE_NAME, NULL);
if (!name) {
- return LDB_ERR_OPERATIONS_ERROR;
+ name = ldb_msg_find_attr_as_string(addop->entry, DB_NAME, NULL);
+ if (!name) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
}
for (i = 0; i < parents->num; i++) {
@@ -1314,7 +1318,7 @@ static void free_delop_contents(struct mbof_del_operation *delop);
static int memberof_del(struct ldb_module *module, struct ldb_request *req)
{
- static const char *attrs[] = { DB_OC, DB_NAME,
+ static const char *attrs[] = { DB_OC, DB_NAME, DB_DEFAULT_OVERRIDE_NAME,
DB_MEMBER, DB_MEMBEROF,
DB_GHOST, NULL };
struct ldb_context *ldb = ldb_module_get_ctx(module);
@@ -1767,7 +1771,7 @@ static int mbof_del_execute_op(struct mbof_del_operation *delop)
char *expression;
const char *dn;
char *clean_dn;
- static const char *attrs[] = { DB_OC, DB_NAME,
+ static const char *attrs[] = { DB_OC, DB_NAME, DB_DEFAULT_OVERRIDE_NAME,
DB_MEMBER, DB_MEMBEROF, NULL };
int ret;
@@ -2226,9 +2230,12 @@ static int mbof_del_mod_entry(struct mbof_del_operation *delop)
if (is_user && diff[0]) {
/* file memberuid removal operations */
- name = ldb_msg_find_attr_as_string(delop->entry, DB_NAME, NULL);
+ name = ldb_msg_find_attr_as_string(delop->entry, DB_DEFAULT_OVERRIDE_NAME, NULL);
if (!name) {
- return LDB_ERR_OPERATIONS_ERROR;
+ name = ldb_msg_find_attr_as_string(delop->entry, DB_NAME, NULL);
+ if (!name) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
}
for (i = 0; diff[i]; i++) {
@@ -2462,9 +2469,13 @@ static int mbof_del_fill_muop(struct mbof_del_ctx *del_ctx,
}
name = talloc_strdup(del_ctx,
- ldb_msg_find_attr_as_string(entry, DB_NAME, NULL));
+ ldb_msg_find_attr_as_string(entry, DB_DEFAULT_OVERRIDE_NAME, NULL));
if (!name) {
- return LDB_ERR_OPERATIONS_ERROR;
+ name = talloc_strdup(del_ctx,
+ ldb_msg_find_attr_as_string(entry, DB_NAME, NULL));
+ if (!name) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
}
for (i = 0; i < el->num_values; i++) {
@@ -3927,7 +3938,7 @@ static int memberof_recompute_task(struct ldb_module *module,
struct ldb_request *req)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
- static const char *attrs[] = { DB_NAME, DB_MEMBEROF, NULL };
+ static const char *attrs[] = { DB_NAME, DB_DEFAULT_OVERRIDE_NAME, DB_MEMBEROF, NULL };
static const char *filter = "(objectclass=user)";
struct mbof_rcmp_context *ctx;
struct ldb_request *src_req;
@@ -4034,7 +4045,7 @@ static int mbof_rcmp_search_groups(struct mbof_rcmp_context *ctx)
{
struct ldb_context *ldb = ldb_module_get_ctx(ctx->module);
static const char *attrs[] = { DB_MEMBEROF, DB_MEMBERUID,
- DB_NAME, DB_MEMBER, NULL };
+ DB_NAME, DB_DEFAULT_OVERRIDE_NAME, DB_MEMBER, NULL };
static const char *filter = "(objectclass=group)";
struct ldb_request *req;
int ret;