View | Details | Raw Unified | Return to bug 39139
Collapse All | Expand All

(-)a/source4/dns_server/dlz_bind9.c (-1 / +53 lines)
 Lines 627-632    Link Here 
627
	if (dlz_bind9_state != NULL) {
627
	if (dlz_bind9_state != NULL) {
628
		*dbdata = dlz_bind9_state;
628
		*dbdata = dlz_bind9_state;
629
		dlz_bind9_state_ref_count++;
629
		dlz_bind9_state_ref_count++;
630
		dlz_bind9_state->log(ISC_LOG_INFO, "samba_dlz: dlz_create (%d)", dlz_bind9_state_ref_count);
630
		return ISC_R_SUCCESS;
631
		return ISC_R_SUCCESS;
631
	}
632
	}
632
633
 Lines 746-755    Link Here 
746
_PUBLIC_ void dlz_destroy(void *dbdata)
747
_PUBLIC_ void dlz_destroy(void *dbdata)
747
{
748
{
748
	struct dlz_bind9_data *state = talloc_get_type_abort(dbdata, struct dlz_bind9_data);
749
	struct dlz_bind9_data *state = talloc_get_type_abort(dbdata, struct dlz_bind9_data);
749
	state->log(ISC_LOG_INFO, "samba_dlz: shutting down");
750
	state->log(ISC_LOG_INFO, "samba_dlz: dlz_destroy called");
750
751
751
	dlz_bind9_state_ref_count--;
752
	dlz_bind9_state_ref_count--;
752
	if (dlz_bind9_state_ref_count == 0) {
753
	if (dlz_bind9_state_ref_count == 0) {
754
		state->log(ISC_LOG_INFO, "samba_dlz: dlz_destroy shutting down");
753
		talloc_unlink(state, state->samdb);
755
		talloc_unlink(state, state->samdb);
754
		talloc_free(state);
756
		talloc_free(state);
755
		dlz_bind9_state = NULL;
757
		dlz_bind9_state = NULL;
 Lines 1135-1140    Link Here 
1135
	return true;
1137
	return true;
1136
}
1138
}
1137
1139
1140
static bool b9_zone_del(struct dlz_bind9_data *state, const char *name)
1141
{
1142
	struct b9_zone *zone = state->zonelist;
1143
1144
	zone->name = talloc_strdup(zone, name);
1145
	if (zone->name == NULL) {
1146
		talloc_free(zone);
1147
		return false;
1148
	}
1149
1150
	while (zone != NULL) {
1151
		if (strcasecmp(name, zone->name) == 0) {
1152
			DLIST_REMOVE(state->zonelist, zone);
1153
			break;
1154
		}
1155
		zone = zone->next;
1156
	}
1157
1158
	return true;
1159
}
1160
1138
static bool b9_zone_exists(struct dlz_bind9_data *state, const char *name)
1161
static bool b9_zone_exists(struct dlz_bind9_data *state, const char *name)
1139
{
1162
{
1140
	struct b9_zone *zone = state->zonelist;
1163
	struct b9_zone *zone = state->zonelist;
 Lines 1165-1170    Link Here 
1165
	struct dlz_bind9_data *state = talloc_get_type_abort(dbdata, struct dlz_bind9_data);
1188
	struct dlz_bind9_data *state = talloc_get_type_abort(dbdata, struct dlz_bind9_data);
1166
	TALLOC_CTX *tmp_ctx;
1189
	TALLOC_CTX *tmp_ctx;
1167
	struct ldb_dn *dn;
1190
	struct ldb_dn *dn;
1191
	struct zone_partition_relation *known_zone;
1168
	int i;
1192
	int i;
1169
1193
1170
	state->log(ISC_LOG_INFO, "samba_dlz: starting configure");
1194
	state->log(ISC_LOG_INFO, "samba_dlz: starting configure");
 Lines 1173-1178    Link Here 
1173
		return ISC_R_FAILURE;
1197
		return ISC_R_FAILURE;
1174
	}
1198
	}
1175
1199
1200
	/* Do reload
1201
	if (state->zone->next) {
1202
		for (known_zone = state->zone; known_zone->next; known_zone = known_zone->next) {
1203
#if DLZ_DLOPEN_VERSION < 3
1204
			state->writeable_zone(view, known_zone->id);
1205
#else
1206
			state->writeable_zone(view, dlzdb, known_zone->id);
1207
#endif
1208
		}
1209
		state->log(ISC_LOG_INFO, "samba_dlz: Done reload");
1210
		return ISC_R_SUCCESS;
1211
	}
1212
	*/
1213
		
1214
	/* forget known zones (for reload) */
1215
	while (state->zone->next) {
1216
		known_zone = state->zone;
1217
		state->zone = state->zone->next;
1218
		b9_zone_del(state, known_zone->id);
1219
		talloc_free(known_zone);
1220
	}
1221
	/* */
1222
1176
	tmp_ctx = talloc_new(state);
1223
	tmp_ctx = talloc_new(state);
1177
1224
1178
	for (i=0; zone_prefixes[i]; i++) {
1225
	for (i=0; zone_prefixes[i]; i++) {
 Lines 1197-1202    Link Here 
1197
			continue;
1244
			continue;
1198
		}
1245
		}
1199
1246
1247
		state->log(ISC_LOG_INFO, "samba_dlz: dlz_configure: %d zones in partition %s", res->count, zone_prefixes[i]);
1200
		for (j=0; j<res->count; j++) {
1248
		for (j=0; j<res->count; j++) {
1201
			isc_result_t result;
1249
			isc_result_t result;
1202
			const char *zone = ldb_msg_find_attr_as_string(res->msgs[j], "name", NULL);
1250
			const char *zone = ldb_msg_find_attr_as_string(res->msgs[j], "name", NULL);
 Lines 1205-1210    Link Here 
1205
			if (zone == NULL) {
1253
			if (zone == NULL) {
1206
				continue;
1254
				continue;
1207
			}
1255
			}
1256
			state->log(ISC_LOG_INFO, "samba_dlz: dlz_configure: zone: '%s'", zone);
1208
			/* Ignore zones that are not handled in BIND */
1257
			/* Ignore zones that are not handled in BIND */
1209
			if ((strcmp(zone, "RootDNSServers") == 0) ||
1258
			if ((strcmp(zone, "RootDNSServers") == 0) ||
1210
			    (strcmp(zone, "..TrustAnchors") == 0)) {
1259
			    (strcmp(zone, "..TrustAnchors") == 0)) {
 Lines 1269-1277    Link Here 
1269
		}
1318
		}
1270
1319
1271
		// skip the application partitions if there is a pre-2k3 zone on the domain partition
1320
		// skip the application partitions if there is a pre-2k3 zone on the domain partition
1321
		/*
1272
		if (!strcmp(zone_prefixes[i], "CN=MicrosoftDNS,CN=System") && state->zone->next) {
1322
		if (!strcmp(zone_prefixes[i], "CN=MicrosoftDNS,CN=System") && state->zone->next) {
1323
			state->log(ISC_LOG_INFO, "samba_dlz: Skipping other partitions");
1273
			break;
1324
			break;
1274
		}
1325
		}
1326
		*/
1275
	}
1327
	}
1276
1328
1277
	talloc_free(tmp_ctx);
1329
	talloc_free(tmp_ctx);

Return to bug 39139