diff options
-rw-r--r-- | src/db/sysdb_ops.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 4bbc76c5..5bc826a7 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -74,6 +74,38 @@ static uint32_t get_attr_as_uint32(struct ldb_message *msg, const char *attr) return l; } +static int sss_ldb_modify_permissive(struct ldb_context *ldb, + struct ldb_message *msg) +{ + struct ldb_request *req; + int ret = EOK; + + ret = ldb_build_mod_req(&req, ldb, ldb, + msg, + NULL, + NULL, + ldb_op_default_callback, + NULL); + + if (ret != LDB_SUCCESS) return ret; + + ret = ldb_request_add_control(req, LDB_CONTROL_PERMISSIVE_MODIFY_OID, + false, NULL); + if (ret != LDB_SUCCESS) { + talloc_free(req); + return ret; + } + + ret = ldb_request(ldb, req); + if (ret == LDB_SUCCESS) { + ret = ldb_wait(req->handle, LDB_WAIT_ALL); + } + + talloc_free(req); + + return ret; +} + #define ERROR_OUT(v, r, l) do { v = r; goto l; } while(0) @@ -1096,7 +1128,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb, } } - ret = ldb_modify(sysdb->ldb, msg); + ret = sss_ldb_modify_permissive(sysdb->ldb, msg); ret = sysdb_error_to_errno(ret); if (ret != EOK) { goto done; |