[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-206-gb7a80
From: |
Mats Erik Andersson |
Subject: |
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-206-gb7a8038 |
Date: |
Fri, 16 Nov 2012 12:44:09 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".
The branch, master has been updated
via b7a8038f64cd995f8a2afc563b80d320dc0b2866 (commit)
from a6766e1a0e7b4fb9403f64b548b8c32701692673 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=b7a8038f64cd995f8a2afc563b80d320dc0b2866
commit b7a8038f64cd995f8a2afc563b80d320dc0b2866
Author: Mats Erik Andersson <address@hidden>
Date: Fri Nov 16 12:30:02 2012 +0100
syslogd, talkd: Alternative utmp access.
These servers are now functional with FreeBSD 9.
diff --git a/ChangeLog b/ChangeLog
index 8f242a9..6cf857f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2012-11-16 Mats Erik Andersson <address@hidden>
+
+ syslogd, talkd: Alternative utmp access.
+
+ * configure.ac: Check for getutxuser.
+ * src/syslogd.c (wallmsg) [!UTMP_NAME_FUNCTION]:
+ Remove UTMPBUF and COUNT. Call setutxent(),
+ getutxent(), and endutxent().
+ * talkd/process.c (find_user) [HAVE_GETUTXUSER]:
+ Remove UTMPBUF and UTMP_COUNT. Call setutxent(),
+ getutxuser(), and endutxent().
+ * tests/readutmp.c (main) [HAVE_GETUTXUSER]: Remove
+ UTMPP, UPTR, and COUNT. Call setutxent(), getutxuser(),
+ and endutxent().
+ [!HAVE_GETUTXUSER]: Free UTMPP.
+
2012-11-15 Mats Erik Andersson <address@hidden>
Disable targets robustly.
diff --git a/configure.ac b/configure.ac
index 296db8b..477726f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -737,7 +737,7 @@ AC_FUNC_MMAP
AC_CHECK_FUNCS(cfsetspeed cgetent dirfd fchdir flock \
fork fpathconf ftruncate \
- getcwd getmsg getpwuid_r getspnam \
+ getcwd getmsg getpwuid_r getspnam getutxuser \
initgroups initsetproctitle killpg \
ptsname pututline pututxline \
setegid seteuid setpgid \
@@ -957,8 +957,9 @@ AH_BOTTOM(
case "$host" in
*-freebsd9* | *-freebsd10*)
# FreeBSD 9.0 has implemented a non-standard and singular
- # UTMPX interface. We do not support it, nor does the
- # readutmp module from GNUlib.
+ # UTMPX interface. The readutmp module from GNUlib does
+ # not support it, but we can fall back to getutxuser() for
+ # use in syslogd and talkd.
IU_DISABLE_TARGET(ftpd)
IU_DISABLE_TARGET(rlogind)
IU_DISABLE_TARGET(telnetd)
diff --git a/src/syslogd.c b/src/syslogd.c
index 1c36250..f8e1f6d 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -1511,14 +1511,17 @@ fprintlog (struct filed *f, const char *from, int
flags, const char *msg)
f->f_prevcount = 0;
}
-/* Write the specified message to either the entire world, or a list
- of approved users. */
+/* Write the specified message to either the entire world,
+ * or to a list of approved users. */
void
wallmsg (struct filed *f, struct iovec *iov)
{
- static int reenter; /* avoid calling ourselves */
- STRUCT_UTMP *utmpbuf, *utp;
+ static int reenter; /* Avoid calling ourselves. */
+ STRUCT_UTMP *utp;
+#ifdef UTMP_NAME_FUNCTION /* From module readutmp. */
+ STRUCT_UTMP *utmpbuf;
size_t utmp_count;
+#endif /* UTMP_NAME_FUNCTION */
int i;
char *p;
char line[sizeof (utp->ut_line) + 1];
@@ -1526,10 +1529,16 @@ wallmsg (struct filed *f, struct iovec *iov)
if (reenter++)
return;
+#ifndef UTMP_NAME_FUNCTION
+ setutxent ();
+
+ while ((utp = getutxent ()))
+#else /* UTMP_NAME_FUNCTION */
read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS);
for (utp = utmpbuf; utp < utmpbuf + utmp_count; utp++)
+#endif /* UTMP_NAME_FUNCTION */
{
strncpy (line, utp->ut_line, sizeof (utp->ut_line));
line[sizeof (utp->ut_line)] = '\0';
@@ -1560,7 +1569,11 @@ wallmsg (struct filed *f, struct iovec *iov)
break;
}
}
+#ifdef UTMP_NAME_FUNCTION
free (utmpbuf);
+#else /* !UTMP_NAME_FUNCTION */
+ endutxent ();
+#endif
reenter = 0;
}
diff --git a/talkd/process.c b/talkd/process.c
index 8b02779..b2974b0 100644
--- a/talkd/process.c
+++ b/talkd/process.c
@@ -169,12 +169,15 @@ do_announce (CTL_MSG * mp, CTL_RESPONSE * rp)
}
}
-/* Search utmp for the local user */
+/* Search utmp for the local user. */
int
find_user (char *name, char *tty)
{
- STRUCT_UTMP *utmpbuf, *uptr;
+ STRUCT_UTMP *uptr;
+#ifndef HAVE_GETUTXUSER
+ STRUCT_UTMP *utmpbuf;
size_t utmp_count;
+#endif /* HAVE_GETUTXUSER */
int status;
struct stat statb;
char ftty[sizeof (PATH_TTY_PFX) + sizeof (uptr->ut_line)];
@@ -186,12 +189,18 @@ find_user (char *name, char *tty)
status = NOT_HERE;
strcpy (ftty, PATH_TTY_PFX);
+#ifdef HAVE_GETUTXUSER
+ setutxent ();
+
+ while ((uptr = getutxuser (name)))
+#else /* !HAVE_GETUTXUSER */
read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS);
for (uptr = utmpbuf; uptr < utmpbuf + utmp_count; uptr++)
{
if (!strncmp (UT_USER (uptr), name, sizeof (UT_USER (uptr))))
+#endif /* !HAVE_GETUTXUSER */
{
if (notty)
{
@@ -224,8 +233,12 @@ find_user (char *name, char *tty)
break;
}
}
+#ifndef HAVE_GETUTXUSER
}
-
free (utmpbuf);
+#else /* HAVE_GETUTXUSER */
+ endutxent ();
+#endif
+
return status;
}
diff --git a/tests/readutmp.c b/tests/readutmp.c
index 07d29ad..59b788d 100644
--- a/tests/readutmp.c
+++ b/tests/readutmp.c
@@ -47,10 +47,12 @@
int
main (int argc, char *argv[])
{
+#ifndef HAVE_GETUTXUSER
STRUCT_UTMP *utmpp, *uptr;
+ size_t count;
+#endif
struct passwd *pw;
char *name;
- size_t count;
int found = 0;
set_program_name (argv[0]);
@@ -69,9 +71,14 @@ main (int argc, char *argv[])
return EXIT_FAILURE;
}
+#ifdef HAVE_GETUTXUSER
+ setutxent ();
+ found = (getutxuser (name) != 0);
+ endutxent ();
+#else /* !HAVE_GETUTXUSER */
if (read_utmp (UTMP_FILE, &count, &utmpp, READ_UTMP_USER_PROCESS))
{
- perror ("read_utmp:");
+ perror ("read_utmp");
return EXIT_FAILURE;
}
@@ -82,6 +89,9 @@ main (int argc, char *argv[])
break;
}
+ free (utmpp);
+#endif /* HAVE_GETUTXUSER */
+
if (found)
return EXIT_SUCCESS;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 16 ++++++++++++++++
configure.ac | 7 ++++---
src/syslogd.c | 21 +++++++++++++++++----
talkd/process.c | 19 ++++++++++++++++---
tests/readutmp.c | 14 ++++++++++++--
5 files changed, 65 insertions(+), 12 deletions(-)
hooks/post-receive
--
GNU Inetutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-206-gb7a8038,
Mats Erik Andersson <=