summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-03-07 09:59:13 +0100
committerStephen Gallagher <sgallagh@redhat.com>2011-05-20 07:21:45 -0400
commit77bc3d93ddd41edee6046508884d7e95553ed5b7 (patch)
treef36de2fd8848118b46575e3230a1f84d8442ad65 /src
parentd4bfba145e74aa8c0f9e7c36e548fc9965822a12 (diff)
downloadsssd-77bc3d93ddd41edee6046508884d7e95553ed5b7.tar.gz
sssd-77bc3d93ddd41edee6046508884d7e95553ed5b7.tar.bz2
sssd-77bc3d93ddd41edee6046508884d7e95553ed5b7.zip
Change sysdb_add_fake_user to add OriginalDN
RFC2307bis code relies heavily on originalDN, so the fake users need to have an option to store it, too.
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb.h3
-rw-r--r--src/db/sysdb_ops.c9
-rw-r--r--src/providers/ldap/sdap_async_accounts.c2
3 files changed, 11 insertions, 3 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index c133072d..190e8120 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -495,7 +495,8 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx,
int sysdb_add_fake_user(struct sysdb_ctx *ctx,
struct sss_domain_info *domain,
- const char *name);
+ const char *name,
+ const char *original_dn);
/* Add group (only basic attrs and w/o checks) */
int sysdb_add_basic_group(TALLOC_CTX *mem_ctx,
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index d6260b97..1fb389da 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -934,7 +934,8 @@ done:
int sysdb_add_fake_user(struct sysdb_ctx *ctx,
struct sss_domain_info *domain,
- const char *name)
+ const char *name,
+ const char *original_dn)
{
TALLOC_CTX *tmpctx;
struct ldb_message *msg;
@@ -983,6 +984,12 @@ int sysdb_add_fake_user(struct sysdb_ctx *ctx,
(unsigned long) now-1);
if (ret) goto done;
+ if (original_dn) {
+ ret = add_string(msg, LDB_FLAG_MOD_ADD,
+ SYSDB_ORIG_DN, original_dn);
+ if (ret) goto done;
+ }
+
ret = ldb_add(ctx->ldb, msg);
ret = sysdb_error_to_errno(ret);
diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c
index 9e059bf8..3387e3ee 100644
--- a/src/providers/ldap/sdap_async_accounts.c
+++ b/src/providers/ldap/sdap_async_accounts.c
@@ -1406,7 +1406,7 @@ sdap_process_missing_member_2307(struct sdap_process_group_state *state,
*in_transaction = true;
}
- ret = sysdb_add_fake_user(state->sysdb, state->dom, username);
+ ret = sysdb_add_fake_user(state->sysdb, state->dom, username, NULL);
if (ret != EOK) {
DEBUG(1, ("Cannot store fake user entry: [%d]: %s\n",
ret, strerror(ret)));