コード例 #1
0
/*% if zone is supported, lookup up a (or multiple) record(s) in it */
static isc_result_t
mysql_lookup(const char *zone, const char *name, void *driverarg,
	     void *dbdata, dns_sdlzlookup_t *lookup,
	     dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo)
{
	isc_result_t result;
	MYSQL_RES *rs = NULL;

	UNUSED(driverarg);
	UNUSED(methods);
	UNUSED(clientinfo);

	/* run the query and get the result set from the database. */
	result = mysql_get_resultset(zone, name, NULL, LOOKUP, dbdata, &rs);
	/* if we didn't get a result set, log an err msg. */
	if (result != ISC_R_SUCCESS) {
		if (rs != NULL)
			mysql_free_result(rs);
		isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
			      DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
			      "mysql driver unable to return "
			      "result set for lookup query");
		return (ISC_R_FAILURE);
	}
	/*
	 * lookup and authority result sets are processed in the same manner
	 * mysql_process_rs does the job for both functions.
	 */
	return mysql_process_rs(lookup, rs);
}
コード例 #2
0
/*% If zone is supported, lookup up a (or multiple) record(s) in it */
isc_result_t
dlz_lookup(const char *zone, const char *name,
	   void *dbdata, dns_sdlzlookup_t *lookup,
	   dns_clientinfomethods_t *methods,
	   dns_clientinfo_t *clientinfo)
{
	isc_result_t result;
	MYSQL_RES *rs = NULL;
	mysql_instance_t *db = (mysql_instance_t *)dbdata;

	UNUSED(methods);
	UNUSED(clientinfo);

	result = mysql_get_resultset(zone, name, NULL, LOOKUP, dbdata, &rs);

	/* if we didn't get a result set, log an err msg. */
	if (result != ISC_R_SUCCESS) {
		if (rs != NULL)
			mysql_free_result(rs);
		db->log(ISC_LOG_ERROR,
			"MySQL module unable to return "
			"result set for lookup query");
		return (ISC_R_FAILURE);
	}

	/*
	 * lookup and authority result sets are processed in the same
	 * manner: mysql_process_rs does the job for both functions.
	 */
	return (mysql_process_rs(db, lookup, rs));
}
コード例 #3
0
static isc_result_t
mysql_authority(const char *zone, void *driverarg, void *dbdata,
		dns_sdlzlookup_t *lookup)
{
	isc_result_t result;
	MYSQL_RES *rs = NULL;

	UNUSED(driverarg);

	/* run the query and get the result set from the database. */
	result = mysql_get_resultset(zone, NULL, NULL, AUTHORITY, dbdata, &rs);
	/* if we get "not implemented", send it along */
	if (result == ISC_R_NOTIMPLEMENTED)
		return result;
	/* if we didn't get a result set, log an err msg. */
	if (result != ISC_R_SUCCESS) {
		if (rs != NULL)
			mysql_free_result(rs);
		isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
			      DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
			      "mysql driver unable to return "
			      "result set for authority query");
		return (ISC_R_FAILURE);
	}
	/*
	 * lookup and authority result sets are processed in the same
	 * manner mysql_process_rs does the job for both functions.
	 */
	return mysql_process_rs(lookup, rs);
}
コード例 #4
0
/*%
 * If the lookup function does not return SOA or NS records for the zone,
 * use this function to get that information for named.
 */
isc_result_t
dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) {
	isc_result_t result;
	MYSQL_RES *rs = NULL;
	mysql_instance_t *db = (mysql_instance_t *)dbdata;

	result = mysql_get_resultset(zone, NULL, NULL, AUTHORITY, dbdata, &rs);
	if (result == ISC_R_NOTIMPLEMENTED)
		return (result);

	if (result != ISC_R_SUCCESS) {
		if (rs != NULL)
			mysql_free_result(rs);
		db->log(ISC_LOG_ERROR,
			"MySQL module unable to return "
			"result set for authority query");
		return (ISC_R_FAILURE);
	}

	/*
	 * lookup and authority result sets are processed in the same
	 * manner: mysql_process_rs does the job for both functions.
	 */
	return (mysql_process_rs(db, lookup, rs));
}