Fix compilation of Samba 4.7.4 with disabled ADS

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fix compilation of Samba 4.7.4 with disabled ADS

Samba - samba-technical mailing list
Hi all!

If you compile Samba 4.7.4 without ADS support the compilation fails with
the:

[2207/3562] Compiling source3/libads/kerberos_keytab.c
../source3/libads/kerberos_keytab.c:643:9: warning: implicit declaration of
function 'ads_keytab_open' is invalid in C99
[-Wimplicit-function-declaration]
                ret = ads_keytab_open(context, &keytab);
                      ^
1 warning generated.
[3331/3562] Linking default/source3/libads-samba4.so
default/source3/libads/kerberos_keytab_63.o: In function `ads_keytab_list':
../source3/libads/kerberos_keytab.c:(.text+0xd9): undefined reference to
`ads_keytab_open'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Waf: Leaving directory `/wrkdirs/usr/ports/net/samba47/work/samba-4.7.4/bin'

This small fix allows to compile Samba cleanly. Not sure though about the
logic behind.

With regards,
Timur Bakeyev.

patch-source3__libads__kerberos_keytab.c (824 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fix compilation of Samba 4.7.4 with disabled ADS

Samba - samba-technical mailing list
On 12/23/2017 08:17 PM, Timur I. Bakeyev via samba-technical wrote:

> Hi all!
>
> If you compile Samba 4.7.4 without ADS support the compilation fails with
> the:
>
> [2207/3562] Compiling source3/libads/kerberos_keytab.c
> ../source3/libads/kerberos_keytab.c:643:9: warning: implicit declaration of
> function 'ads_keytab_open' is invalid in C99
> [-Wimplicit-function-declaration]
>                 ret = ads_keytab_open(context, &keytab);
>                       ^
> 1 warning generated.
> [3331/3562] Linking default/source3/libads-samba4.so
> default/source3/libads/kerberos_keytab_63.o: In function `ads_keytab_list':
> ../source3/libads/kerberos_keytab.c:(.text+0xd9): undefined reference to
> `ads_keytab_open'
> cc: error: linker command failed with exit code 1 (use -v to see invocation)
> Waf: Leaving directory `/wrkdirs/usr/ports/net/samba47/work/samba-4.7.4/bin'
>
> This small fix allows to compile Samba cleanly. Not sure though about the
> logic behind.
>
> With regards,
> Timur Bakeyev.
>

I can't see the immediate use case for that (KRB5 enabled and ADS
disabled), but I'd Ack either removing the #ifdef HAVE_ADS entirely, or
having it wrap the whole module like KRB5.

Libads used to be "everything ADS, Kerberos and LDAP". We seem to prefer
smaller and and more cohesive libraries nowadays. Libads will probably
have less and less code depending on it and maybe some useful code
moving out to its own library, until it either disappears or remain as a
toolbox for some LDAP-based operations (not saying that someone is
actually working on it, just that those are the types of patches that
are likely to be accepted. At least that's my understanding).

In that spirit, this specific code is useful for Kerberos and is not
dependent on the LDAP sides of libads, so it could be in another
library, which is the reasoning behind removal of the #ifdef entirely (I
tried it, it works). OTOH in current code, removing the #ifdef just
bloats the code, hence the reasoning for wrapping the entire module with
#ifdef HAVE_ADS - that compiles too and if this code goes out of libads,
the ifdefs can be removed then.

Thanks,
Uri.