(not) Building Samba-fork!

Dimitris Gravanis dimgrav at gmail.com
Mon Aug 21 16:19:33 UTC 2017


Hi,

This is gonna be a really long email... :)

I'm trying to build my Samba-fork to implement changes in libcli/dns.

I edited top-level wscripts as needed and then in Samba/, I run:

|$ waf configure (completes succesfully)||
||$ waf build (everything goes to ruin!)|

I get many inconsistencies, with some of which I'm a really confused.

There are several errors concerning DATA_BLOB and NTTIME types:

|In file included from default/librpc/gen_ndr/dns.h:10:0,||
||                 from ../source4/dns_server/dns_server.h:25,||
||                 from ../libcli/dns/libtcp.h:27,||
||                 from ../libcli/dns/cli_dns.c:32:||
||default/librpc/gen_ndr/misc.h:98:2: error: unknown type name ‘DATA_BLOB’||
||  DATA_BLOB binary;/* [case(REG_BINARY),flag(LIBNDR_FLAG_REMAINING)] */||
||  ^||
||default/librpc/gen_ndr/misc.h:101:2: error: unknown type name 
‘DATA_BLOB’||
||  DATA_BLOB data;/* [default,flag(LIBNDR_FLAG_REMAINING)] */||
||  ^||
||In file included from default/librpc/gen_ndr/dns.h:11:0,||
||                 from ../source4/dns_server/dns_server.h:25,||
||                 from ../libcli/dns/libtcp.h:27,||
||                 from ../libcli/dns/cli_dns.c:32:||
||default/librpc/gen_ndr/dnsp.h:303:2: error: unknown type name ‘NTTIME’||
||  NTTIME timestamp;/* [case(DNS_TYPE_TOMBSTONE)] */||
||  ^||
||default/librpc/gen_ndr/dnsp.h:314:2: error: unknown type name 
‘DATA_BLOB’||
||  DATA_BLOB data;/* [default,flag(LIBNDR_FLAG_REMAINING)] */||
||  ^||
||default/librpc/gen_ndr/dnsp.h:333:2: error: unknown type name ‘NTTIME’||
||  NTTIME zone_secure_time;/* [case(DSPROPERTY_ZONE_SECURE_TIME)] */||
||  ^||
||In file included from ../source4/dns_server/dns_server.h:25:0,||
||                 from ../libcli/dns/libtcp.h:27,||
||                 from ../libcli/dns/cli_dns.c:32:||
||default/librpc/gen_ndr/dns.h:341:2: error: unknown type name ‘DATA_BLOB’||
||  DATA_BLOB unexpected;|

This leads me to believe that my preprocessor include statements in 
cli_dns.c are insufficient, or that my wscript_build lacks some deps, or 
maybe both of these occur.

I tried adding all dependencies from dns_server.c and then narrowing it 
down to those that are really needed, but I get a fatal error: ldb.h not 
found, which really had me lost, cause this can't be supposed to happen, 
since dns_server.c compiles.

There are also other issues (of course!).

tstream_read_pdu_blob_recv returns int, though it is cast to NTSTATUS in 
dns_server.c. Several implicitly declared functions throw warnings (as 
expected), though they do not do so when used the same way in the 
server-side code. From what I've searched, they are not elsewhere declared.

implicit declarations:
|dns_process_send||
||    dns_process_recv||
||    tstream_read_pdu_blob_send||
||    tstream_read_pdu_bloc_recv|

Finally, I'm getting "dereferencing pointer to incomplete type" errors 
on some structs that I've defined in libtcp.h, libtsig.h:

|../libcli/dns/cli_dns.c:340:11: warning: implicit declaration of 
function ‘dns_process_send’ [-Wimplicit-function-declaration]||
||  subreq = dns_process_send(call, dns->task->event_ctx, dns, &call->in);||
||           ^||
||../libcli/dns/cli_dns.c:340:43: error: dereferencing pointer to 
incomplete type ‘struct task_server’||
||  subreq = dns_process_send(call, dns->task->event_ctx, dns, &call->in);||
||                                           ^||
||../libcli/dns/cli_dns.c:348:11: warning: implicit declaration of 
function ‘tstream_read_pdu_blob_send’ [-Wimplicit-function-declaration]||
||  subreq = tstream_read_pdu_blob_send(dns_conn,||
||           ^||
||../libcli/dns/cli_dns.c:349:24: error: dereferencing pointer to 
incomplete type ‘struct stream_connection’||
||          dns_conn->conn->event.ctx,|
                         ^

It really is overwhelming, Samba has so much pre-existing code that I'm 
not familiar with. So, if anyone has an idea about what's going on in 
any of the cases above, please feel free to reply!

The fork can be found here 
<https://github.com/dimgrav/samba/tree/master/libcli/dns>.

Cheers,
Dimitris

On 21/08/2017 02:21 πμ, David Disseldorp via samba-technical wrote:
> Hi Dimitris,
>
> On Sat, 19 Aug 2017 18:26:23 +0300, Dimitris Gravanis via samba-technical wrote:
>
>> In my Samba fork
>> <https://github.com/dimgrav/samba/tree/master/libcli/dns>, in
>> libcli/dns/cmocka-tests/, I've written a wscript to configure and build
>> the unit tests in the directory. The script is attached below.
>>
>> Running |wax configure| completes successfully, |wax build| results in
>> this error:
>>
>> |AttributeError: 'BuildContext' object has no attribute 'SAMBA_BINARY'|
>>
>> The wscript_build in libcli/dns (top level) is:
>>
>> |bld.SAMBA_SUBSYSTEM('clidns',||
>> ||        source='cli_dns.c',||
>> ||        public_deps='LIBTSOCKET tevent-util')|
>>
>> Can anyone help me fix the script to properly use SAMBA_BINARY as an
>> object attribute? I looked into testsuites/unittests/ and The Waf Book
>> to figure out Waf scripting for cmocka unit tests, I've also gone
>> through top level wscript and wscript_build scripts, as well as almost
>> every other in Samba, I believe I have understood the recursive building
>> concept well enough, but obviously I lack significant background in Waf
>> and its Samba implementations :).
> You're looking in the right places :). You just need to get waf to
> recurse to your cmocka-tests directory as part of the top level build
>   e.g.
> --- a/wscript_build
> +++ b/wscript_build
> @@ -120,6 +120,7 @@ bld.RECURSE('libcli/lsarpc')
>   bld.RECURSE('libcli/drsuapi')
>   bld.RECURSE('libcli/echo')
>   bld.RECURSE('libcli/dns')
> +bld.RECURSE('libcli/dns/cmocka-tests')
>
> Cheers, David
>



More information about the samba-technical mailing list