summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema/schema_prefixmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/dsdb/schema/schema_prefixmap.c')
-rw-r--r--source4/dsdb/schema/schema_prefixmap.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source4/dsdb/schema/schema_prefixmap.c b/source4/dsdb/schema/schema_prefixmap.c
index 969b357a39..89d33779e4 100644
--- a/source4/dsdb/schema/schema_prefixmap.c
+++ b/source4/dsdb/schema/schema_prefixmap.c
@@ -27,6 +27,25 @@
/**
+ * Determine range type for supplied ATTID
+ */
+enum dsdb_attid_type dsdb_pfm_get_attid_type(uint32_t attid)
+{
+ if (attid <= 0x7FFFFFFF) {
+ return dsdb_attid_type_pfm;
+ }
+ else if (attid <= 0xBFFFFFFF) {
+ return dsdb_attid_type_intid;
+ }
+ else if (attid <= 0xFFFEFFFF) {
+ return dsdb_attid_type_reserved;
+ }
+ else {
+ return dsdb_attid_type_internal;
+ }
+}
+
+/**
* Allocates schema_prefixMap object in supplied memory context
*/
static struct dsdb_schema_prefixmap *_dsdb_schema_prefixmap_talloc(TALLOC_CTX *mem_ctx,
@@ -303,6 +322,11 @@ WERROR dsdb_schema_pfm_oid_from_attid(struct dsdb_schema_prefixmap *pfm, uint32_
struct dsdb_schema_prefixmap_oid *pfm_entry;
WERROR werr = WERR_OK;
+ /* sanity check for attid requested */
+ if (dsdb_pfm_get_attid_type(attid) != dsdb_attid_type_pfm) {
+ return WERR_INVALID_PARAMETER;
+ }
+
/* crack attid value */
hi_word = attid >> 16;
lo_word = attid & 0xFFFF;