/* * See if a zone transfer is allowed */ isc_result_t dlz_allowzonexfr(void *dbdata, const char *name, const char *client) { isc_result_t result; bdbhpt_instance_t *db = (bdbhpt_instance_t *) dbdata; DBT key, data; /* check to see if we are authoritative for the zone first. */ #if DLZ_DLOPEN_VERSION >= 3 result = dlz_findzonedb(dbdata, name, NULL, NULL); #else result = dlz_findzonedb(dbdata, name); #endif if (result != ISC_R_SUCCESS) return (ISC_R_NOTFOUND); memset(&key, 0, sizeof(DBT)); key.flags = DB_DBT_MALLOC; key.data = strdup(name); if (key.data == NULL) { result = ISC_R_NOMEMORY; goto xfr_cleanup; } key.size = strlen(key.data); memset(&data, 0, sizeof(DBT)); data.flags = DB_DBT_MALLOC; data.data = strdup(client); if (data.data == NULL) { result = ISC_R_NOMEMORY; goto xfr_cleanup; } data.size = strlen(data.data); switch(db->client->get(db->client, NULL, &key, &data, DB_GET_BOTH)) { case DB_NOTFOUND: result = ISC_R_NOTFOUND; break; case 0: result = ISC_R_SUCCESS; break; default: result = ISC_R_FAILURE; } xfr_cleanup: /* free any memory duplicate string in the key field */ if (key.data != NULL) free(key.data); /* free any memory allocated to the data field. */ if (data.data != NULL) free(data.data); return result; }
/* * See if a zone transfer is allowed */ isc_result_t dlz_allowzonexfr(void *dbdata, const char *name, const char *client) { UNUSED(client); /* Just say yes for all our zones */ return (dlz_findzonedb(dbdata, name)); }
/* * DLZ methods */ isc_result_t dlz_allowzonexfr(void *dbdata, const char *name, const char *client) { isc_result_t result; /* check to see if we are authoritative for the zone first */ #if DLZ_DLOPEN_VERSION < 3 result = dlz_findzonedb(dbdata, name); #else result = dlz_findzonedb(dbdata, name, NULL, NULL); #endif if (result != ISC_R_SUCCESS) { return (result); } /* get all the zone data */ result = ldap_get_results(name, NULL, client, ALLOWXFR, dbdata, NULL); return (result); }
/*% Determine if the client is allowed to perform a zone transfer */ isc_result_t dlz_allowzonexfr(void *dbdata, const char *name, const char *client) { isc_result_t result; mysql_instance_t *db = (mysql_instance_t *)dbdata; MYSQL_RES *rs = NULL; my_ulonglong rows; /* first check if the zone is supported by the database. */ result = dlz_findzonedb(dbdata, name, NULL, NULL); if (result != ISC_R_SUCCESS) return (ISC_R_NOTFOUND); /* * if we get to this point we know the zone is supported by * the database the only questions now are is the zone * transfer is allowed for this client and did the config file * have an allow zone xfr query. */ result = mysql_get_resultset(name, NULL, client, ALLOWXFR, dbdata, &rs); if (result == ISC_R_NOTIMPLEMENTED) return (result); if (result != ISC_R_SUCCESS || rs == NULL) { if (rs != NULL) mysql_free_result(rs); db->log(ISC_LOG_ERROR, "MySQL module unable to return " "result set for allow xfr query"); return (ISC_R_FAILURE); } /* * count how many rows in result set; if we returned any, * zone xfr is allowed. */ rows = mysql_num_rows(rs); mysql_free_result(rs); if (rows > 0) return (ISC_R_SUCCESS); return (ISC_R_NOPERM); }
/* see if a zone transfer is allowed */ _PUBLIC_ isc_result_t dlz_allowzonexfr(void *dbdata, const char *name, const char *client) { /* just say yes for all our zones for now */ return dlz_findzonedb(dbdata, name); }