summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/configure.in45
-rw-r--r--source3/param/loadparm.c4
-rw-r--r--source3/smbd/session.c6
-rw-r--r--source3/smbd/utmp.c23
4 files changed, 51 insertions, 27 deletions
diff --git a/source3/configure.in b/source3/configure.in
index 6405138185..a90721c152 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1367,6 +1367,9 @@ if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
fi
+##############
+# Check utmp details, but only if our OS offers utmp.h
+if test x"$ac_cv_header_utmp_h" = x"yes"; then
dnl utmp and utmpx come in many flavours
dnl We need to check for many of them
dnl But we don't need to do each and every one, because our code uses
@@ -1484,6 +1487,9 @@ 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
+fi
+# end utmp details
+
ICONV_LOCATION=standard
LOOK_DIRS="/usr /usr/local /sw"
@@ -2308,6 +2314,7 @@ AC_ARG_WITH(ldap,
AC_MSG_RESULT($with_ldap_support)
+SMBLDAP=""
if test x"$with_ldap_support" = x"yes"; then
ac_save_LIBS="$LIBS"
LIBS=""
@@ -2325,13 +2332,11 @@ if test x"$with_ldap_support" = x"yes"; then
AC_CHECK_LIB(ldap, ldap_domain2hostlist, [
AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])
AC_CHECK_HEADERS([ldap.h lber.h],
- [default_static_modules="$default_static_modules pdb_ldap idmap_ldap"])
+ [default_static_modules="$default_static_modules pdb_ldap idmap_ldap";
+ SMBLDAP="lib/smbldap.o"])
])
])
- ## we have ldap so build the list of files for the generic samba ldap library
- SMBLDAP="lib/smbldap.o"
-
########################################################
# If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
# Check found in pam_ldap 145.
@@ -2879,20 +2884,36 @@ fi
# check for experimental utmp accounting
AC_MSG_CHECKING(whether to support utmp accounting)
+WITH_UTMP=yes
AC_ARG_WITH(utmp,
-[ --with-utmp Include experimental utmp accounting (default=no)],
+[ --with-utmp Include utmp accounting (default, if supported by OS)],
[ case "$withval" in
- yes)
- AC_MSG_RESULT(yes)
- AC_DEFINE(WITH_UTMP,1,[Whether to include experimental utmp accounting])
- ;;
+ no)
+ WITH_UTMP=no
+ ;;
*)
- AC_MSG_RESULT(no)
- ;;
+ WITH_UTMP=yes
+ ;;
esac ],
- AC_MSG_RESULT(no)
)
+# utmp requires utmp.h
+# Note similar check earlier, when checking utmp details.
+
+if test x"$WITH_UTMP" = x"yes" -a x"$ac_cv_header_utmp_h" = x"no"; then
+ utmp_no_reason=", no utmp.h on $host_os"
+ WITH_UTMP=no
+fi
+
+# Display test results
+
+if test x"$WITH_UTMP" = x"yes"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_UTMP,1,[Whether to include experimental utmp accounting])
+else
+ AC_MSG_RESULT(no$utmp_no_reason)
+fi
+
#################################################
# choose native language(s) of man pages
AC_MSG_CHECKING(chosen man pages' language(s))
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index a5e9b1467f..49f0bbd2a4 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -158,11 +158,9 @@ typedef struct
char *szAbortShutdownScript;
char *szWINSHook;
char *szWINSPartners;
-#ifdef WITH_UTMP
char *szUtmpDir;
char *szWtmpDir;
BOOL bUtmp;
-#endif
char *szSourceEnv;
char *szIdmapUID;
char *szIdmapGID;
@@ -1575,11 +1573,9 @@ FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
-#ifdef WITH_UTMP
FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
-#endif
FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
FN_GLOBAL_STRING(lp_source_environment, &Globals.szSourceEnv)
FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index b7f3bc43e7..4d8826d332 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -66,7 +66,6 @@ BOOL session_claim(user_struct *vuser)
data.dptr = NULL;
data.dsize = 0;
-#if WITH_UTMP
if (lp_utmp()) {
for (i=1;i<MAX_SESSION_ID;i++) {
slprintf(keystr, sizeof(keystr)-1, "ID/%d", i);
@@ -84,7 +83,6 @@ BOOL session_claim(user_struct *vuser)
slprintf(sessionid.id_str, sizeof(sessionid.id_str)-1, SESSION_UTMP_TEMPLATE, i);
tdb_store_flag = TDB_MODIFY;
} else
-#endif
{
slprintf(keystr, sizeof(keystr)-1, "ID/%lu/%u",
(long unsigned int)sys_getpid(),
@@ -137,13 +135,11 @@ BOOL session_claim(user_struct *vuser)
return False;
}
-#if WITH_UTMP
if (lp_utmp()) {
sys_utmp_claim(sessionid.username, sessionid.hostname,
client_ip,
sessionid.id_str, sessionid.id_num);
}
-#endif
vuser->session_keystr = strdup(keystr);
if (!vuser->session_keystr) {
@@ -181,13 +177,11 @@ void session_yield(user_struct *vuser)
SAFE_FREE(dbuf.dptr);
-#if WITH_UTMP
if (lp_utmp()) {
sys_utmp_yield(sessionid.username, sessionid.hostname,
client_ip,
sessionid.id_str, sessionid.id_num);
}
-#endif
smb_pam_close_session(sessionid.username, sessionid.id_str, sessionid.hostname);
diff --git a/source3/smbd/utmp.c b/source3/smbd/utmp.c
index 2c5a1abc82..9833a11f2d 100644
--- a/source3/smbd/utmp.c
+++ b/source3/smbd/utmp.c
@@ -21,8 +21,6 @@
#include "includes.h"
-#ifdef WITH_UTMP
-
/****************************************************************************
Reflect connection status in utmp/wtmp files.
T.D.Lee@durham.ac.uk September 1999
@@ -110,6 +108,23 @@ Notes:
****************************************************************************/
+#ifndef WITH_UTMP
+/*
+ * Not WITH_UTMP? Simply supply dummy routines.
+ */
+
+void sys_utmp_claim(const char *username, const char *hostname,
+ struct in_addr *ipaddr,
+ const char *id_str, int id_num)
+{}
+
+void sys_utmp_yield(const char *username, const char *hostname,
+ struct in_addr *ipaddr,
+ const char *id_str, int id_num)
+{}
+
+#else /* WITH_UTMP */
+
#include <utmp.h>
#ifdef HAVE_UTMPX_H
@@ -571,6 +586,4 @@ void sys_utmp_claim(const char *username, const char *hostname,
sys_utmp_update(&u, hostname, True);
}
-#else /* WITH_UTMP */
- void dummy_utmp(void) {}
-#endif
+#endif /* WITH_UTMP */