コード例 #1
0
ファイル: lwdgrbn.c プロジェクト: VargMon/netbsd-cvs-mirror
static void
start_lookup(ns_lwdclient_t *client) {
	isc_result_t result;
	ns_lwdclientmgr_t *cm;
	dns_fixedname_t absname;

	cm = client->clientmgr;

	INSIST(client->lookup == NULL);

	dns_fixedname_init(&absname);
	result = ns_lwsearchctx_current(&client->searchctx,
					dns_fixedname_name(&absname));
	/*
	 * This will return failure if relative name + suffix is too long.
	 * In this case, just go on to the next entry in the search path.
	 */
	if (result != ISC_R_SUCCESS)
		start_lookup(client);

	result = dns_lookup_create(cm->mctx,
				   dns_fixedname_name(&absname),
				   client->rdtype, cm->view,
				   client->options, cm->task, lookup_done,
				   client, &client->lookup);
	if (result != ISC_R_SUCCESS) {
		ns_lwdclient_errorpktsend(client, LWRES_R_FAILURE);
		return;
	}
}
コード例 #2
0
static isc_result_t
store_realname(ns_lwdclient_t *client) {
	isc_buffer_t b;
	isc_result_t result;
	dns_name_t *tname;

	b = client->recv_buffer;

	tname = dns_fixedname_name(&client->target_name);
	result = ns_lwsearchctx_current(&client->searchctx, tname);
	if (result != ISC_R_SUCCESS)
		return (result);

	/*
	 * Render the new name to the buffer.
	 */
	result = dns_name_totext(tname, ISC_TRUE, &client->recv_buffer);
	if (result != ISC_R_SUCCESS)
		return (result);

	/*
	 * Save this name away as the current real name.
	 */
	client->gabn.realname = (char *) b.base + b.used;
	client->gabn.realnamelen = client->recv_buffer.used - b.used;

	return (ISC_R_SUCCESS);
}