diff options
author | Joseph Sutton <josephsutton@catalyst.net.nz> | 2022-11-02 14:56:34 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2022-11-08 02:39:37 +0000 |
commit | 7d3416e8cb686453ecbedbc085073af95835001e (patch) | |
tree | 9439514760d794fba0a5edc6a30334d38c45ce95 /lib/krb5_wrap | |
parent | 6fe6992258d2c59dfc8cb979deb25ba6020a1c06 (diff) | |
download | samba-7d3416e8cb686453ecbedbc085073af95835001e.tar.gz |
krb5: Detect support for krb5_const_pac type
We can't unconditionally assume (as we did in
third_party/heimdal_build/wscript_configure) that Heimdal has this type,
since we may have an older system Heimdal that lacks it. We must also
check whether krb5_pac_get_buffer() is usable with krb5_const_pac, and
declare krb5_const_pac as a non-const typedef if not.
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/krb5_wrap')
-rw-r--r-- | lib/krb5_wrap/krb5_samba.h | 13 | ||||
-rw-r--r-- | lib/krb5_wrap/wscript_configure | 18 |
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h index 93a010323bf..79178ac8008 100644 --- a/lib/krb5_wrap/krb5_samba.h +++ b/lib/krb5_wrap/krb5_samba.h @@ -135,7 +135,18 @@ typedef struct { #endif /* HAVE_E_DATA_POINTER_IN_KRB5_ERROR */ #ifndef HAVE_KRB5_CONST_PAC -typedef krb5_pac krb5_const_pac; +#ifdef KRB5_CONST_PAC_GET_BUFFER +typedef const struct krb5_pac_data *krb5_const_pac; +#else +/* + * Certain Heimdal versions include a version of krb5_pac_get_buffer() that is + * unusable in certain cases, taking a krb5_pac when a krb5_const_pac may be all + * that we can supply. Furthermore, MIT Kerberos doesn't declare krb5_const_pac + * at all. In such cases, we must declare krb5_const_pac as a non-const typedef + * so that the build can succeed. + */ +typedef struct krb5_pac_data *krb5_const_pac; +#endif #endif krb5_error_code smb_krb5_parse_name(krb5_context context, diff --git a/lib/krb5_wrap/wscript_configure b/lib/krb5_wrap/wscript_configure new file mode 100644 index 00000000000..b595eef679c --- /dev/null +++ b/lib/krb5_wrap/wscript_configure @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +# Check whether we have the krb5_const_pac type, if we aren't sure already. +if conf.CONFIG_SET('HAVE_KRB5_CONST_PAC') or ( + conf.CHECK_TYPE('krb5_const_pac', + headers='krb5.h', + lib='krb5')): + # If the type is available, check whether krb5_pac_get_buffer() accepts it + # as its second parameter, or whether it takes krb5_pac instead. + conf.CHECK_C_PROTOTYPE('krb5_pac_get_buffer', + 'krb5_error_code krb5_pac_get_buffer(' + ' krb5_context context,' + ' krb5_const_pac p,' + ' uint32_t type,' + ' krb5_data *data)', + define='KRB5_CONST_PAC_GET_BUFFER', + headers='krb5.h', + lib='krb5') |