[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-inetutils] [PATCH 2/4] rshd: detect __rcmd_errstr support in the C
From: |
Mike Frysinger |
Subject: |
[bug-inetutils] [PATCH 2/4] rshd: detect __rcmd_errstr support in the C lib |
Date: |
Fri, 19 Nov 2010 02:04:54 -0500 |
Not all C libraries support __rcmd_errstr, so add a configure test for it.
Signed-off-by: Mike Frysinger <address@hidden>
---
configure.ac | 2 +-
src/rshd.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index c1ac270..79d655c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -587,7 +587,7 @@ AC_CHECK_FUNCS(cfsetspeed cgetent dirfd fchdir flock \
setsid setregid setreuid setresgid setresuid setutent_r \
sigaction sigvec strchr setproctitle tcgetattr tzset utimes \
utime uname \
- updwtmp updwtmpx vhangup wait3 wait4 opendir2)
+ updwtmp updwtmpx vhangup wait3 wait4 opendir2 __rcmd_errstr)
dnl Functions that we will define if necessary.
AC_REPLACE_FUNCS(getpass getusershell memcmp memcpy memmove memset \
diff --git a/src/rshd.c b/src/rshd.c
index d49facd..9301ef2 100644
--- a/src/rshd.c
+++ b/src/rshd.c
@@ -284,7 +284,9 @@ extern char **environ;
void
doit (int sockfd, struct sockaddr_in *fromp)
{
+#ifdef HAVE___RCMD_ERRSTR
extern char *__rcmd_errstr; /* syslog hook from libc/net/rcmd.c. */
+#endif
struct hostent *hp;
struct passwd *pwd;
u_short port;
@@ -757,11 +759,13 @@ doit (int sockfd, struct sockaddr_in *fromp)
&& (iruserok (fromp->sin_addr.s_addr, pwd->pw_uid == 0,
remuser, locuser)) < 0))
{
+#ifdef HAVE___RCMD_ERRSTR
if (__rcmd_errstr)
syslog (LOG_INFO | LOG_AUTH,
"address@hidden as %s: permission denied (%s). cmd='%.80s'",
remuser, hostname, locuser, __rcmd_errstr, cmdbuf);
else
+#endif
syslog (LOG_INFO | LOG_AUTH,
"address@hidden as %s: permission denied. cmd='%.80s'",
remuser, hostname, locuser, cmdbuf);
--
1.7.3.2