diff options
author | Endi S. Dewata <edewata@redhat.com> | 2009-10-28 15:28:31 -0500 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-11-02 16:36:54 +1100 |
commit | e035433bab87cb5f2f12def900e194da877e6925 (patch) | |
tree | 12777d2026f53c9b7a5b495552b329b919d2b061 /source4/dsdb/samdb | |
parent | 40a06c0101bf6426e0752cd695044049a8058f54 (diff) | |
download | samba-e035433bab87cb5f2f12def900e194da877e6925.tar.gz samba-e035433bab87cb5f2f12def900e194da877e6925.tar.bz2 samba-e035433bab87cb5f2f12def900e194da877e6925.zip |
s4 - SID allocation using FDS DNA plugin
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 2a0bb2dfe6..0f314b241a 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -37,6 +37,7 @@ #include "librpc/gen_ndr/ndr_security.h" #include "../lib/util/util_ldb.h" #include "ldb_wrap.h" +#include "param/param.h" struct samldb_ctx; @@ -923,6 +924,8 @@ static int samldb_add_entry(struct samldb_ctx *ac) static int samldb_fill_object(struct samldb_ctx *ac, const char *type) { struct ldb_context *ldb; + struct loadparm_context *lp_ctx; + enum sid_generator sid_generator; int ret; ldb = ldb_module_get_ctx(ac->module); @@ -997,19 +1000,25 @@ static int samldb_fill_object(struct samldb_ctx *ac, const char *type) if (ret != LDB_SUCCESS) return ret; } - /* check if we have a valid SID */ - ac->sid = samdb_result_dom_sid(ac, ac->msg, "objectSid"); - if ( ! ac->sid) { - ret = samldb_add_step(ac, samldb_new_sid); - if (ret != LDB_SUCCESS) return ret; - } else { - ret = samldb_add_step(ac, samldb_get_sid_domain); + lp_ctx = talloc_get_type(ldb_get_opaque(ldb, "loadparm"), + struct loadparm_context); + + sid_generator = lp_sid_generator(lp_ctx); + if (sid_generator == SID_GENERATOR_INTERNAL) { + /* check if we have a valid SID */ + ac->sid = samdb_result_dom_sid(ac, ac->msg, "objectSid"); + if ( ! ac->sid) { + ret = samldb_add_step(ac, samldb_new_sid); + if (ret != LDB_SUCCESS) return ret; + } else { + ret = samldb_add_step(ac, samldb_get_sid_domain); + if (ret != LDB_SUCCESS) return ret; + } + + ret = samldb_add_step(ac, samldb_notice_sid); if (ret != LDB_SUCCESS) return ret; } - ret = samldb_add_step(ac, samldb_notice_sid); - if (ret != LDB_SUCCESS) return ret; - /* finally proceed with adding the entry */ ret = samldb_add_step(ac, samldb_add_entry); if (ret != LDB_SUCCESS) return ret; |