]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:configure: check that struct utmp.ut_line is large enough for our use case
authorStefan Metzmacher <metze@samba.org>
Mon, 8 Oct 2012 09:15:50 +0000 (11:15 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 29 Oct 2012 12:03:07 +0000 (13:03 +0100)
We use "smb/%u" with a 32-bit number, "smb/4294967295\0" requires
15 chars (including the '\0').

metze

Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 92d53dd7dc8ca71ae28d2a8762524396cd3c6f58)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/configure.in
source3/wscript

index 6623eadd5531bd24e285a4a656e936169b534a45..16d89f44d7c44d1cec11d52b0f54abe2b289f97d 100644 (file)
@@ -2249,6 +2249,19 @@ if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
     AC_DEFINE(HAVE_UX_UT_SYSLEN,1,[Whether the utmpx struct has a property ut_syslen])
 fi
 
+AC_CACHE_CHECK([whether sizeof ut_line in utmp is ok],samba_cv_HAVE_UX_UT_LINE,[
+AC_TRY_RUN([#include <stdio.h>
+#include <sys/types.h>
+#include <utmp.h>
+int main(void) {
+ if (sizeof(((struct utmp *)NULL)->ut_line) < 15) {
+     return 1;
+ }
+ return 0;
+}
+],
+samba_cv_HAVE_UX_UT_LINE=yes,samba_cv_HAVE_UX_UT_LINE=no,samba_cv_HAVE_UX_UT_LINE=cross)])
+
 fi
 # end utmp details
 
@@ -4717,6 +4730,11 @@ if test x"$WITH_UTMP" = x"yes" -a x"$ac_cv_header_utmp_h" = x"no"; then
        WITH_UTMP=no
 fi
 
+if test x"$WITH_UTMP" = x"yes" -a x"$samba_cv_HAVE_UX_UT_LINE" != x"yes"; then
+       utmp_no_reason=", sizeof ut_line not ok"
+       WITH_UTMP=no
+fi
+
 # Display test results
 
 if test x"$WITH_UTMP" = x"yes"; then
index 75578eb2e784971484ef54d67861ad7ba6891018..76d05200f68e7fcf162351f92d64358bb381b798 100644 (file)
@@ -656,8 +656,16 @@ msg.msg_acctrightslen = sizeof(fd);
         conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
                         'PUTUTLINE_RETURNS_UTMP', headers='utmp.h',
                         msg="Checking whether pututline returns pointer")
+        conf.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers='utmp.h',
+                          define='SIZEOF_UTMP_UT_LINE')
+        if not conf.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
+            conf.env.with_utmp = False
+        elif int(conf.env.SIZEOF_UTMP_UT_LINE) < 15:
+            conf.env.with_utmp = False
         if conf.env.with_utmp:
             conf.DEFINE('WITH_UTMP', 1)
+        else:
+            Logs.warn("--with-utmp but utmp support not sufficient")
 
     if Options.options.with_avahi:
         conf.env.with_avahi = True