summaryrefslogtreecommitdiff
path: root/source3/smbd/session.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-04-24 09:52:29 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-04-24 09:52:29 +0000
commit596de71fc60b622d7a9d5e12baf234db0bf22499 (patch)
tree3b7ad2e4a2fce6bc1ffc9142716477ccdaa35802 /source3/smbd/session.c
parent29133d967761908a0f1492c1b907350a076f4a01 (diff)
downloadsamba-596de71fc60b622d7a9d5e12baf234db0bf22499.tar.gz
samba-596de71fc60b622d7a9d5e12baf234db0bf22499.tar.bz2
samba-596de71fc60b622d7a9d5e12baf234db0bf22499.zip
When possible, store the IP address of the connecting client, not just the
hostname. This makes 'last -i' show the IP. Thanks to Philip Anderson <pza@australia.op.org> for the idea. Andrew Bartlett (This used to be commit 107731c080da1e3e4e13e966f8b79bfd2692a952)
Diffstat (limited to 'source3/smbd/session.c')
-rw-r--r--source3/smbd/session.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 54b7a24b07..2478b34d6e 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -33,6 +33,8 @@ BOOL session_claim(user_struct *vuser)
{
int i = 0;
TDB_DATA data;
+ struct sockaddr sa;
+ struct in_addr *client_ip;
struct sessionid sessionid;
uint32 pid = (uint32)sys_getpid();
TDB_DATA key;
@@ -117,6 +119,8 @@ BOOL session_claim(user_struct *vuser)
fstrcpy(sessionid.remote_machine, get_remote_machine_name());
fstrcpy(sessionid.ip_addr, client_addr());
+ client_ip = client_inaddr(&sa);
+
if (!smb_pam_claim_session(sessionid.username, sessionid.id_str, sessionid.hostname)) {
DEBUG(1,("pam_session rejected the session for %s [%s]\n",
sessionid.username, sessionid.id_str));
@@ -136,6 +140,7 @@ BOOL session_claim(user_struct *vuser)
#if WITH_UTMP
if (lp_utmp()) {
sys_utmp_claim(sessionid.username, sessionid.hostname,
+ client_ip,
sessionid.id_str, sessionid.id_num);
}
#endif
@@ -153,7 +158,8 @@ void session_yield(user_struct *vuser)
{
TDB_DATA dbuf;
struct sessionid sessionid;
- TDB_DATA key;
+ struct in_addr client_ip;
+ TDB_DATA key;
if (!tdb) return;
@@ -171,11 +177,14 @@ void session_yield(user_struct *vuser)
memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
+ inet_pton(AF_INET, sessionid.ip_addr, &client_ip);
+
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