utmp stores IP not hostname

Andrew Bartlett abartlet at pcug.org.au
Sat Mar 9 15:55:02 GMT 2002

ian j hart wrote:
> I would like to start using wtmp for recording
> logons. This is with 2.2.3a under FreeBSD 4.5.
> It appears that session.c doesn't do a name lookup
> and so the IP address is stored in the wtmp file.
> <quote>
> /* Don't resolve the hostname in smbd as we can pause for a long
> time while waiting for DNS timeouts to occur.  The correct
> place to do this is in the code that displays the session
> information. */
> hostname = client_addr();
> </quote>
> Fair enough, but, we have dynamic IP addresses.
> Quite often I need to check on some "mischief" which
> happened many days ago.

This is why I 'fixed' this in HEAD, I wasn't aware it had been broken in
2.2 as well.  I've just looked at HEAD again, and I'll be making a
couple more changes.

> e.g. spoofing email sender.
> Since the hostname is in the mail header I can use
> "last" to find who was logged into the box at that
> time. I need to be able to do this even if the IP
> address has changed.
> Two questions:-
> Does the tdb support storing IPs AND hostnames (Or
> will this corrupt it)?.
> Is there a drop in function for the line of code above.
> A function like...
> char * client_hostname(void);

That should be fine, the function is 'client_name()'.  In HEAD I made
this conditional on 'hostname lookups = yes'.  This paramater needs to
be moved into 2.2.

Andrew Bartlett

Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net

More information about the samba-technical mailing list