]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
third_party/heimdal_build: Determine whether time_t is signed
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 24 Feb 2022 02:24:13 +0000 (15:24 +1300)
committerStefan Metzmacher <metze@samba.org>
Tue, 1 Mar 2022 18:07:50 +0000 (18:07 +0000)
Without this, Heimdal will assume time_t is unsigned, and a wrong
assumption will cause 'infinite' ticket lifetimes to be reckoned as from
the past, and thus requests will fail with KDC_ERR_NEVER_VALID.

This is an adaptation to Heimdal:

commit 9ae9902249732237aa1711591604a6adf24963fe
Author: Nicolas Williams <nico@twosigma.com>
Date:   Tue Feb 15 17:01:00 2022 -0600

    cf: Check if time_t is signed

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14995

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Mar  1 18:07:50 UTC 2022 on sn-devel-184

buildtools/wafsamba/samba_autoconf.py
third_party/heimdal_build/wscript_configure

index 8b49982523023e7aa3fb5132bdb9a3344535e84b..78927d851937a850aa7a4afc810a42a71ad0416b 100644 (file)
@@ -343,6 +343,23 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None, critical=True):
             sys.exit(1)
     return ret
 
+@conf
+def CHECK_SIGN(conf, v, headers=None):
+    '''check the sign of a type'''
+    define_name = v.upper().replace(' ', '_')
+    for op, signed in [('<', 'signed'),
+                       ('>', 'unsigned')]:
+        if CHECK_CODE(conf,
+                      f'static int test_array[1 - 2 * !((({v})-1) {op} 0)];',
+                      define=f'{define_name}_{signed.upper()}',
+                      quote=False,
+                      headers=headers,
+                      local_include=False,
+                      msg=f"Checking if '{v}' is {signed}"):
+            return True
+
+    return False
+
 @conf
 def CHECK_VALUEOF(conf, v, headers=None, define=None):
     '''check the value of a variable/define'''
index 023935d98c0d64b26916cdf97b7588f49810267c..0021cd328ecf7ac112605b29462f557e4ef7f639 100644 (file)
@@ -206,3 +206,5 @@ if conf.CONFIG_SET('USING_EMBEDDED_HEIMDAL'):
     conf.define('HAVE_KRB5_ADDLOG_FUNC_NEED_CONTEXT', 1)
 else:
     pass # TODO
+
+conf.CHECK_SIGN('time_t')