summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/session.c6
-rw-r--r--source3/smbd/utmp.c23
2 files changed, 18 insertions, 11 deletions
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 */