summaryrefslogtreecommitdiffstats
path: root/source4/dns_server/dns_server.c
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2010-10-22 09:37:38 +0200
committerKai Blin <kai@samba.org>2010-10-23 10:17:05 +0000
commit719a6bbfede5b124c96f7c84d27e68ac285b073a (patch)
treed6a0ce0cdaa7f319d1fa3286ccf1417877f5fcb6 /source4/dns_server/dns_server.c
parent96195b2c0c239781c47f51bbf62156a8804f9525 (diff)
downloadsamba-719a6bbfede5b124c96f7c84d27e68ac285b073a.tar.gz
samba-719a6bbfede5b124c96f7c84d27e68ac285b073a.tar.xz
samba-719a6bbfede5b124c96f7c84d27e68ac285b073a.zip
ndr dns: Add simple parser
Diffstat (limited to 'source4/dns_server/dns_server.c')
-rw-r--r--source4/dns_server/dns_server.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source4/dns_server/dns_server.c b/source4/dns_server/dns_server.c
index de9ad5336f..5d9a5086ba 100644
--- a/source4/dns_server/dns_server.c
+++ b/source4/dns_server/dns_server.c
@@ -33,6 +33,8 @@
#include "lib/socket/netif.h"
#include "dns_server/dns_server.h"
#include "param/param.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/ndr_dns.h"
/* hold information about one dns socket */
struct dns_socket {
@@ -87,7 +89,21 @@ bool dns_process(struct dns_server *dns,
DATA_BLOB *in,
DATA_BLOB *out)
{
- DEBUG(0, ("FIXME: actually process DNS packet here\n"));
+ enum ndr_err_code ndr_err;
+ struct dns_name_packet *packet = talloc(mem_ctx, struct dns_name_packet);
+ if (packet == NULL) return false;
+
+ dump_data(0, in->data, in->length);
+
+ ndr_err = ndr_pull_struct_blob(in, packet, packet,
+ (ndr_pull_flags_fn_t)ndr_pull_dns_name_packet);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ TALLOC_FREE(packet);
+ DEBUG(0, ("Failed to parse packet %d!\n", ndr_err));
+ return false;
+ }
+
+ NDR_PRINT_DEBUG(dns_name_packet, packet);
return true;
}