s4-dsdb: added dsdb_dn_is_deleted_val()
authorAndrew Tridgell <tridge@samba.org>
Tue, 15 Dec 2009 00:00:30 +0000 (11:00 +1100)
committerAndrew Tridgell <tridge@samba.org>
Wed, 16 Dec 2009 09:56:20 +0000 (20:56 +1100)
This is used to determine if a extedned DN has the 'DELETED=1'
component

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/dsdb/common/util.c

index 5b8365a3e13571f43efff8cb5af98f9ae4007442..30eb28c69c84c3bd627356b6fca170a947d87a34 100644 (file)
@@ -2736,3 +2736,17 @@ NTSTATUS dsdb_get_extended_dn_guid(struct ldb_dn *dn, struct GUID *guid)
 
        return GUID_from_ndr_blob(v, guid);
 }
+
+/*
+  return true if a ldb_val containing a DN in storage form is deleted
+ */
+bool dsdb_dn_is_deleted_val(struct ldb_val *val)
+{
+       /* this relies on the sort order and exact format of
+          linearized extended DNs */
+       if (val->length >= 12 &&
+           strncmp((const char *)val->data, "<DELETED=1>;", 12) == 0) {
+               return true;
+       }
+       return false;
+}