1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-12 03:00:28 +00:00

If hostname > UT_HOSTSIZE, write its numeric address instead to keep

valid information in utmp and lastlog
This commit is contained in:
Andrey A. Chernov 1996-06-17 16:14:19 +00:00
parent ecb027411b
commit 61772e4269
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=3244
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,24 @@
*** login.c.bak Thu Jun 6 15:39:34 1996
--- login.c Mon Jun 17 19:56:43 1996
***************
*** 236,241 ****
--- 236,254 ----
strncpy(u.ut_user, user, sizeof(u.ut_user));
#endif /* HAVE_NAME_IN_UTMP */
#ifdef HAVE_HOST_IN_UTMP
+ #ifdef __FreeBSD__
+ if (strlen(host) > UT_HOSTSIZE) {
+ struct hostent *hp = gethostbyname(host);
+
+ if (hp != NULL) {
+ struct in_addr in;
+
+ memmove(&in, hp->h_addr, sizeof(in));
+ host = inet_ntoa(in);
+ } else
+ host = "invalid hostname";
+ }
+ #endif
strncpy(u.ut_host, host, sizeof(u.ut_host));
#endif /* HAVE_HOST_IN_UTMP */
#ifdef HAVE_ADDR_IN_UTMP

View File

@ -0,0 +1,24 @@
*** login.c.bak Thu Jun 6 15:39:34 1996
--- login.c Mon Jun 17 19:56:43 1996
***************
*** 236,241 ****
--- 236,254 ----
strncpy(u.ut_user, user, sizeof(u.ut_user));
#endif /* HAVE_NAME_IN_UTMP */
#ifdef HAVE_HOST_IN_UTMP
+ #ifdef __FreeBSD__
+ if (strlen(host) > UT_HOSTSIZE) {
+ struct hostent *hp = gethostbyname(host);
+
+ if (hp != NULL) {
+ struct in_addr in;
+
+ memmove(&in, hp->h_addr, sizeof(in));
+ host = inet_ntoa(in);
+ } else
+ host = "invalid hostname";
+ }
+ #endif
strncpy(u.ut_host, host, sizeof(u.ut_host));
#endif /* HAVE_HOST_IN_UTMP */
#ifdef HAVE_ADDR_IN_UTMP