diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-04-24 09:52:29 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-04-24 09:52:29 +0000 |
commit | 107731c080da1e3e4e13e966f8b79bfd2692a952 (patch) | |
tree | 6ec59f51f8cfcf039821d10dad628a8a8f796c1d /source/smbd/utmp.c | |
parent | 0e04761abe375bfea48fa2c9ba9e1dc0d56d39f7 (diff) | |
download | samba-107731c080da1e3e4e13e966f8b79bfd2692a952.tar.gz samba-107731c080da1e3e4e13e966f8b79bfd2692a952.tar.xz samba-107731c080da1e3e4e13e966f8b79bfd2692a952.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
Diffstat (limited to 'source/smbd/utmp.c')
-rw-r--r-- | source/smbd/utmp.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/smbd/utmp.c b/source/smbd/utmp.c index 6c12cfac626..84ec3646549 100644 --- a/source/smbd/utmp.c +++ b/source/smbd/utmp.c @@ -484,6 +484,7 @@ static int ut_id_encode(int i, char *fourbyte) */ static BOOL sys_utmp_fill(struct utmp *u, const char *username, const char *hostname, + struct in_addr *ipaddr, const char *id_str, int id_num) { struct timeval timeval; @@ -538,8 +539,9 @@ static BOOL sys_utmp_fill(struct utmp *u, #if defined(HAVE_UT_UT_HOST) utmp_strcpy(u->ut_host, hostname, sizeof(u->ut_host)); #endif - #if defined(HAVE_UT_UT_ADDR) + if (ipaddr) + u->ut_addr = ipaddr->s_addr; /* * "(unsigned long) ut_addr" apparently exists on at least HP-UX 10.20. * Volunteer to implement, please ... @@ -561,6 +563,7 @@ static BOOL sys_utmp_fill(struct utmp *u, ****************************************************************************/ void sys_utmp_yield(const char *username, const char *hostname, + struct in_addr *ipaddr, const char *id_str, int id_num) { struct utmp u; @@ -576,7 +579,7 @@ void sys_utmp_yield(const char *username, const char *hostname, u.ut_type = DEAD_PROCESS; #endif - if (!sys_utmp_fill(&u, username, hostname, id_str, id_num)) return; + if (!sys_utmp_fill(&u, username, hostname, ipaddr, id_str, id_num)) return; sys_utmp_update(&u, NULL, False); } @@ -586,6 +589,7 @@ void sys_utmp_yield(const char *username, const char *hostname, ****************************************************************************/ void sys_utmp_claim(const char *username, const char *hostname, + struct in_addr *ipaddr, const char *id_str, int id_num) { struct utmp u; @@ -596,7 +600,7 @@ void sys_utmp_claim(const char *username, const char *hostname, u.ut_type = USER_PROCESS; #endif - if (!sys_utmp_fill(&u, username, hostname, id_str, id_num)) return; + if (!sys_utmp_fill(&u, username, hostname, ipaddr, id_str, id_num)) return; sys_utmp_update(&u, hostname, True); } |