aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/inetutils/inetutils-1.8/inetutils-1.8-1002-rshd-detect-__rcmd_errstr-support-in-the-C-lib.patch
blob: 7708c404561b59bbddf9079deb476596b5c4ab3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 730015f060fe76eee615f361a65eb719cdf22eef Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier at gentoo.org>
Date: Thu, 18 Nov 2010 22:20:39 -0500
Subject: [PATCH] rshd: detect __rcmd_errstr support in the C lib

Not all C libraries support __rcmd_errstr, so add a configure test for it.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 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,
 		"%s@%s as %s: permission denied (%s). cmd='%.80s'",
 		remuser, hostname, locuser, __rcmd_errstr, cmdbuf);
       else
+#endif
 	syslog (LOG_INFO | LOG_AUTH,
 		"%s@%s as %s: permission denied. cmd='%.80s'",
 		remuser, hostname, locuser, cmdbuf);
-- 
1.7.3.2