#ifndef _DSDB_PREFIXMAP_H
#define _DSDB_PREFIXMAP_H
+/**
+ * ATTRTYP ranges
+ * Ref: MS-ADTS, 3.1.1.2.6 ATTRTYP
+ */
+enum dsdb_attid_type {
+ dsdb_attid_type_pfm = 1, /* attid in [0x00000000..0x7FFFFFFF] */
+ dsdb_attid_type_intid = 2, /* attid in [0x80000000..0xBFFFFFFF] */
+ dsdb_attid_type_reserved = 3, /* attid in [0xC0000000..0xFFFEFFFF] */
+ dsdb_attid_type_internal = 4, /* attid in [0xFFFF0000..0xFFFFFFFF] */
+};
+
/**
* oid-prefix in prefixmap
*/
#include "../lib/util/asn1.h"
+/**
+ * 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
*/
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;