summaryrefslogtreecommitdiff
path: root/source4/dsdb/common/util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-12-30 20:04:17 +1100
committerAndrew Tridgell <tridge@samba.org>2010-01-02 08:16:56 +1100
commit9819d280d69e5870d61a177923912eae0c573709 (patch)
tree3c13840e014570e41565975f59a78161a72d1146 /source4/dsdb/common/util.c
parent23eb9f49a75f599a78d2f70fb4b864f1e0c6e0a1 (diff)
downloadsamba-9819d280d69e5870d61a177923912eae0c573709.tar.gz
samba-9819d280d69e5870d61a177923912eae0c573709.tar.bz2
samba-9819d280d69e5870d61a177923912eae0c573709.zip
s4-dsdb: added dsdb_tombstone_lifetime()
Diffstat (limited to 'source4/dsdb/common/util.c')
-rw-r--r--source4/dsdb/common/util.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 25d915d0bc..ea216ec67b 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -3024,3 +3024,29 @@ int dsdb_get_deleted_objects_dn(struct ldb_context *ldb,
talloc_free(nc_root);
return ret;
}
+
+/*
+ return the tombstoneLifetime, in days
+ */
+int dsdb_tombstone_lifetime(struct ldb_context *ldb, uint32_t *lifetime)
+{
+ struct ldb_dn *dn;
+ dn = samdb_config_dn(ldb);
+ if (!dn) {
+ return LDB_ERR_NO_SUCH_OBJECT;
+ }
+ dn = ldb_dn_copy(ldb, dn);
+ if (!dn) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ /* see MS-ADTS section 7.1.1.2.4.1.1. There doesn't appear to
+ be a wellknown GUID for this */
+ if (!ldb_dn_add_child_fmt(dn, "CN=Directory Service,CN=Windows NT")) {
+ talloc_free(dn);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ *lifetime = samdb_search_uint(ldb, dn, 180, dn, "tombstoneLifetime", "objectClass=nTDSService");
+ talloc_free(dn);
+ return LDB_SUCCESS;
+}