]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
configure: ensure sizeof(int) >= 4
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 7 Jul 2023 00:50:13 +0000 (12:50 +1200)
committerJeremy Allison <jra@samba.org>
Tue, 11 Jul 2023 22:44:15 +0000 (22:44 +0000)
There are multiple places we make this assumption. For example, in
source3/lib/tldap.c, we have this line

      if (ld->msgid == 2147483647) {

where ld->msgid is an int. And in librpc/idl/security.idl we have
several lines like:

      const int SEC_MASK_GENERIC        = 0xF0000000;

In lib/replace/inet_pton.c and inet_ntop.c we have

  /*
   * WARNING: Don't even consider trying to compile this on a system where
   * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
   */

but no attempt to enforce that as far as I can see, until now.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 11 22:44:15 UTC 2023 on atb-devel-224

lib/replace/wscript

index f5c597c04c2a99b1dd177552bad3b7507ab1f829..199e636aa022e2cff5e485f92620eb25299270c3 100644 (file)
@@ -184,6 +184,10 @@ def configure(conf):
     conf.CHECK_TYPE('blkcnt_t', 'long', headers='sys/types.h sys/stat.h unistd.h')
 
     conf.CHECK_SIZEOF('bool char int "long long" long short size_t ssize_t')
+    sizeof_int = conf.env["SIZEOF_INT"]
+    if sizeof_int < 4:
+        conf.fatal(f"Samba won't work with int of size {sizeof_int} (requires >= 4)")
+
     conf.CHECK_SIZEOF('int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t')
     conf.CHECK_SIZEOF('void*', define='SIZEOF_VOID_P')
     conf.CHECK_SIZEOF('off_t dev_t ino_t time_t')