static int samldb_verify_subnet(struct samldb_ctx *ac, struct ldb_dn *dn)
{
	struct ldb_context *ldb = ldb_module_get_ctx(ac->module);
	const char *cidr = NULL;
	const struct ldb_val *rdn_value = NULL;

	rdn_value = ldb_dn_get_rdn_val(dn);
	if (rdn_value == NULL) {
		ldb_set_errstring(ldb, "samldb: ldb_dn_get_rdn_val "
				  "failed");
		return LDB_ERR_UNWILLING_TO_PERFORM;
	}

	cidr = ldb_dn_escape_value(ac, *rdn_value);
	DBG_INFO("looking at cidr '%s'\n", cidr);
	if (cidr == NULL) {
		ldb_set_errstring(ldb,
				  "samldb: adding an empty subnet cidr seems wrong");
		return LDB_ERR_UNWILLING_TO_PERFORM;
	}

	if (verify_cidr(cidr)){
		ldb_set_errstring(ldb,
				  "samldb: subnet value is invalid");
		return LDB_ERR_INVALID_DN_SYNTAX;
	}

	return LDB_SUCCESS;
}
static int samldb_verify_subnet(struct samldb_ctx *ac, struct ldb_dn *dn)
{
	struct ldb_context *ldb = ldb_module_get_ctx(ac->module);
	const char *cidr = NULL;
	const struct ldb_val *rdn_value = NULL;

	rdn_value = ldb_dn_get_rdn_val(dn);
	if (rdn_value == NULL) {
		ldb_set_errstring(ldb, "samldb: ldb_dn_get_rdn_val "
				  "failed");
		return LDB_ERR_UNWILLING_TO_PERFORM;
	}

	cidr = ldb_dn_escape_value(ac, *rdn_value);
	DBG_INFO("looking at cidr '%s'\n", cidr);
	if (cidr == NULL) {
		ldb_set_errstring(ldb,
				  "samldb: adding an empty subnet cidr seems wrong");
		return LDB_ERR_UNWILLING_TO_PERFORM;
	}

	if (verify_cidr(cidr)){
		ldb_set_errstring(ldb,
				  "samldb: subnet value is invalid");
		return LDB_ERR_INVALID_DN_SYNTAX;
	}

	return LDB_SUCCESS;
}