From SambaWiki
Revision as of 10:21, 26 August 2017 by Dimgrav (talk | contribs)

Improve libcli/dns

Samba comes with its own asynchronous DNS parser framework developed for the internal DNS server. Basic calls have been implemented for a client-side library as well, but a more fleshed out implementation would be needed. The goal of this project is to implement more high-level calls handling DNS requests, such as UDP/TCP switchover and client-side GSS-TSIG cryptography. A test suite excercising all the functions is required and can be used to cross-check and complement the existing DNS server tests already shipped by Samba. This testsuite should use cmocka.

  • Difficulty: Medium
  • Language(s): C
  • Mentors: Kai Blin, David Disseldorp
  • Student: Dimitris Gravanis

Project Information

Client-side DNS call handling with GSS-TSIG

Unix SMB/CIFS implementation

Dimitrios Gravanis (C) 2017

Based on the existing work by Samba Team


For the Samba AD DC, libcli/dns is a library that allows the handling of DNS calls (send/receive requests) and generates GSS-TSIG type encryption signature for signed packets, to accomodate encrypted client-server communication.

It consists of its respective function and structure libraries, that provide definitions for client-side functionality.

Test suites are also available, that inspect individual features of cli_dns.c

For more information on the project goals, read the GSoC proposal here.

The project timeline and development journal is documented in its dedicated blogspot.

DNS Client (with wrapper support)

Handles TCP and UDP requests.

The client may use either TCP or UDP protocols to send a DNS name request to the server, then handle the reception of the appropriate server response.


  • UDP request send/receive
  • TCP request send/receive
  • GSS-TSIG generation
  • DNS name packet parsing and signing

The library consists of cli_dns.c, that includes functions, and dns.h, libtcp.h, libtsig.h, libudp.h, that provide declarations, definitions and structures.


wrap_cli.c provides multiple wrapping of the above functionality, to hide buffer creation, DNS packet parsing and signature generation. Definitions of the wrapped functions are provided in libwrap.h.

Test suite

cli_tests.c provides a test suite for all client-side functionality, as defined by the functions in libcli/dns/cli_dns.c. The API used for unit testing is Cmocka.