summaryrefslogtreecommitdiff
path: root/source4
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
parent96195b2c0c239781c47f51bbf62156a8804f9525 (diff)
downloadsamba-719a6bbfede5b124c96f7c84d27e68ac285b073a.tar.gz
samba-719a6bbfede5b124c96f7c84d27e68ac285b073a.tar.bz2
samba-719a6bbfede5b124c96f7c84d27e68ac285b073a.zip
ndr dns: Add simple parser
Diffstat (limited to 'source4')
-rw-r--r--source4/dns_server/dns_server.c18
-rwxr-xr-xsource4/librpc/wscript_build4
2 files changed, 20 insertions, 2 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;
}
diff --git a/source4/librpc/wscript_build b/source4/librpc/wscript_build
index 734274379a..a7d10e5ddd 100755
--- a/source4/librpc/wscript_build
+++ b/source4/librpc/wscript_build
@@ -96,7 +96,9 @@ bld.SAMBA_LIBRARY('NDR_STANDARD',
source='../../librpc/gen_ndr/ndr_atsvc.c ../../librpc/gen_ndr/ndr_eventlog6.c',
vnum='0.0.1',
pc_files='../../librpc/ndr_standard.pc',
- deps='NDR_SECURITY NDR_LSA NDR_SAMR NDR_NETLOGON NDR_EVENTLOG NDR_DFS NDR_NTSVCS NDR_SVCCTL NDR_INITSHUTDOWN NDR_WKSSVC NDR_SRVSVC NDR_WINREG NDR_ECHO LIBSECURITY',
+ deps='''NDR_SECURITY NDR_LSA NDR_SAMR NDR_NETLOGON NDR_EVENTLOG NDR_DFS
+ NDR_NTSVCS NDR_SVCCTL NDR_INITSHUTDOWN NDR_WKSSVC NDR_SRVSVC NDR_WINREG
+ NDR_ECHO LIBSECURITY NDR_DNS''',
public_deps='LIBNDR',
public_headers='../../librpc/gen_ndr/samr.h ../../librpc/gen_ndr/ndr_samr.h ../../librpc/gen_ndr/lsa.h ../../librpc/gen_ndr/netlogon.h ../../librpc/gen_ndr/atsvc.h ../../librpc/gen_ndr/ndr_atsvc.h ../../librpc/gen_ndr/ndr_svcctl.h ../../librpc/gen_ndr/svcctl.h',
header_path='gen_ndr'