Пример #1
0
WERROR dns_server_process_query(struct dns_server *dns,
				struct dns_request_state *state,
				TALLOC_CTX *mem_ctx,
				struct dns_name_packet *in,
				struct dns_res_rec **answers,    uint16_t *ancount,
				struct dns_res_rec **nsrecs,     uint16_t *nscount,
				struct dns_res_rec **additional, uint16_t *arcount)
{
	uint16_t num_answers=0, num_nsrecs=0, num_additional=0;
	struct dns_res_rec *ans=NULL, *ns=NULL, *adds=NULL;
	WERROR werror;

	if (in->qdcount != 1) {
		return DNS_ERR(FORMAT_ERROR);
	}

	/* Windows returns NOT_IMPLEMENTED on this as well */
	if (in->questions[0].question_class == DNS_QCLASS_NONE) {
		return DNS_ERR(NOT_IMPLEMENTED);
	}

	if (dns_authorative_for_zone(dns, in->questions[0].name)) {
		state->flags |= DNS_FLAG_AUTHORITATIVE;
		werror = handle_question(dns, mem_ctx, &in->questions[0],
					 &ans, &num_answers);
	} else {
		if (state->flags & DNS_FLAG_RECURSION_DESIRED &&
		    state->flags & DNS_FLAG_RECURSION_AVAIL) {
			DEBUG(2, ("Not authorative for '%s', forwarding\n",
				  in->questions[0].name));
			werror = ask_forwarder(dns, mem_ctx, &in->questions[0],
					       &ans, &num_answers,
					       &ns, &num_nsrecs,
					       &adds, &num_additional);
		} else {
			werror = DNS_ERR(NAME_ERROR);
		}
	}
	W_ERROR_NOT_OK_GOTO(werror, query_failed);

	*answers = ans;
	*ancount = num_answers;

	/*FIXME: Do something for these */
	*nsrecs  = ns;
	*nscount = num_nsrecs;

	*additional = adds;
	*arcount    = num_additional;

	return WERR_OK;

query_failed:
	/*FIXME: add our SOA record to nsrecs */
	return werror;
}
Пример #2
0
WERROR dns_server_process_query(struct dns_server *dns,
				TALLOC_CTX *mem_ctx,
				struct dns_name_packet *in,
				struct dns_res_rec **answers,    uint16_t *ancount,
				struct dns_res_rec **nsrecs,     uint16_t *nscount,
				struct dns_res_rec **additional, uint16_t *arcount)
{
	uint16_t num_answers=0;
	struct dns_res_rec *ans=NULL;
	WERROR werror;

	if (in->qdcount != 1) {
		return DNS_ERR(FORMAT_ERROR);
	}

	/* Windows returns NOT_IMPLEMENTED on this as well */
	if (in->questions[0].question_class == DNS_QCLASS_NONE) {
		return DNS_ERR(NOT_IMPLEMENTED);
	}

	werror = handle_question(dns, mem_ctx, &in->questions[0], &ans, &num_answers);
	W_ERROR_NOT_OK_GOTO(werror, query_failed);

	*answers = ans;
	*ancount = num_answers;

	/*FIXME: Do something for these */
	*nsrecs  = NULL;
	*nscount = 0;

	*additional = NULL;
	*arcount    = 0;

	return WERR_OK;

query_failed:
	/*FIXME: add our SOA record to nsrecs */
	return werror;
}
Пример #3
0
	void on_handle_message(Msgsender msgsender)
	{
		handle_question(msgsender);
		_process_count.clear();
	}
Пример #4
0
 void on_handle_message(qqGroup& group, webqq& qqclient)
 {
     handle_question(group, qqclient);
 }