uint32_t dsdb_dn_val_rmd_flags(const struct ldb_val *val)
{
	const char *p;
	uint32_t flags;
	char *end;
	int error = 0;

	if (val->length < 13) {
		return 0;
	}
	p = memmem(val->data, val->length, "<RMD_FLAGS=", 11);
	if (!p) {
		return 0;
	}
	flags = smb_strtoul(p+11, &end, 10, &error, SMB_STR_STANDARD);
	if (!end || *end != '>' || error != 0) {
		/* it must end in a > */
		return 0;
	}
	return flags;
}
uint32_t dsdb_dn_val_rmd_flags(const struct ldb_val *val)
{
	const char *p;
	uint32_t flags;
	char *end;
	int error = 0;

	if (val->length < 13) {
		return 0;
	}
	p = memmem(val->data, val->length, "<RMD_FLAGS=", 11);
	if (!p) {
		return 0;
	}
	flags = smb_strtoul(p+11, &end, 10, &error, SMB_STR_STANDARD);
	if (!end || *end != '>' || error != 0) {
		 
		return 0;
	}
	return flags;
}