[SCM] Samba Shared Repository - branch master updated
Nadezhda Ivanova
nivanova at samba.org
Thu Aug 26 08:29:19 MDT 2010
The branch, master has been updated
via a571487 s4-dsdb: Added utility functions for retrieving dSHeuristics from the module stack
from 0de7954 Added values for the flags in dSHeuristics
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit a571487e6c6774e640abb67f3cefac2dedac9044
Author: Nadezhda Ivanova <nivanova at samba.org>
Date: Thu Aug 26 17:18:40 2010 +0300
s4-dsdb: Added utility functions for retrieving dSHeuristics from the module stack
Also a function to check dsHeuristics value to determine of anonymous access should be blocked
-----------------------------------------------------------------------
Summary of changes:
source4/dsdb/samdb/ldb_modules/util.c | 47 +++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index 23a8da2..86417e6 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -1150,3 +1150,50 @@ int dsdb_module_constrainted_update_uint64(struct ldb_module *module,
(const int64_t *)old_val,
(const int64_t *)new_val);
}
+
+
+const struct ldb_val *dsdb_module_find_dsheuristics(struct ldb_module *module,
+ TALLOC_CTX *mem_ctx)
+{
+ int ret;
+ struct ldb_dn *new_dn;
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
+ static const char *attrs[] = { "dsHeuristics", NULL };
+ struct ldb_result *res;
+
+ new_dn = ldb_dn_copy(mem_ctx, ldb_get_config_basedn(ldb));
+ if ( !ldb_dn_add_child_fmt(new_dn,
+ "CN=Directory Service,CN=Windows NT,CN=Services")) {
+ talloc_free(new_dn);
+ return NULL;
+ }
+ ret = dsdb_module_search_dn(module, mem_ctx, &res,
+ new_dn,
+ attrs,
+ DSDB_FLAG_NEXT_MODULE);
+ if (ret == LDB_SUCCESS && res->count == 1) {
+ return ldb_msg_find_ldb_val(res->msgs[0],
+ "dsHeuristics");
+ }
+ return NULL;
+}
+
+bool dsdb_block_anonymous_ops(struct ldb_module *module,
+ TALLOC_CTX *mem_ctx)
+{
+ TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
+ bool result;
+ const struct ldb_val *hr_val = dsdb_module_find_dsheuristics(module,
+ tmp_ctx);
+ if (hr_val == NULL || hr_val->length < DS_HR_BLOCK_ANONYMOUS_OPS) {
+ result = true;
+ } else if (hr_val->data[DS_HR_BLOCK_ANONYMOUS_OPS -1] == '2') {
+ result = false;
+ } else {
+ result = true;
+ }
+
+ talloc_free(tmp_ctx);
+ return result;
+}
--
Samba Shared Repository
More information about the samba-cvs
mailing list