[PATCH 2/2] rcmd.c: Removed references to unsupported functions

Lou Woods irnhorse4 at gmail.com
Fri May 3 21:44:57 UTC 2019


From: Lou Woods <Lou.Woods at OARCorp.com>

rcmdsh() and innetgr() are referenced by rcmd, but aren’t available
in libbsd and are unresolvable external symbols when libbsd.a is
processed by the RTL.

innetgr() is part of netgroup and could be ported in at some point
in the future.

rcmdsh() uses fork() and exec() so uses of rcmdsh function have been
removed.
---
 freebsd/lib/libc/net/rcmd.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/freebsd/lib/libc/net/rcmd.c b/freebsd/lib/libc/net/rcmd.c
index bc6a583..08d1a78 100644
--- a/freebsd/lib/libc/net/rcmd.c
+++ b/freebsd/lib/libc/net/rcmd.c
@@ -64,7 +64,9 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 #include "libc_private.h"
 
+#ifndef __rtems__ /* netgroup/innetgr not supported in RTEMS */
 extern int innetgr( const char *, const char *, const char *, const char * );
+#endif
 
 #define max(a, b)	((a > b) ? a : b)
 
@@ -98,6 +100,8 @@ rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser,
 	char num[8];
 	static char canonnamebuf[MAXDNAME];	/* is it proper here? */
 
+#ifndef __rtems__ /* rcmdsh not supported in RTEMS */
+
 	/* call rcmdsh() with specified remote shell if appropriate. */
 	if (!issetugid() && (p = getenv("RSH"))) {
 		struct servent *sp = getservbyname("shell", "tcp");
@@ -116,6 +120,8 @@ rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser,
 			    cmd, NULL));
 	}
 
+#endif
+
 	pid = getpid();
 
 	memset(&hints, 0, sizeof(hints));
@@ -624,17 +630,25 @@ __ivaliduser_sa(FILE *hostf, const struct sockaddr *raddr, socklen_t salen,
 				break;
 			}
 			if (buf[1] == '@')  /* match a host by netgroup */
+#ifndef __rtems__
 				hostok = hname[0] != '\0' &&
 				    innetgr(&buf[2], hname, NULL, ypdomain);
+#else
+			    return(-1);
+#endif
 			else		/* match a host by addr */
 				hostok = __icheckhost(raddr, salen,
 						      (char *)&buf[1]);
 			break;
 		case '-':     /* reject '-' hosts and all their users */
 			if (buf[1] == '@') {
+#ifndef __rtems__
 				if (hname[0] == '\0' ||
 				    innetgr(&buf[2], hname, NULL, ypdomain))
 					return(-1);
+#else
+				return(-1);
+#endif
 			} else {
 				if (__icheckhost(raddr, salen,
 						 (char *)&buf[1]))
@@ -652,7 +666,11 @@ __ivaliduser_sa(FILE *hostf, const struct sockaddr *raddr, socklen_t salen,
 				break;
 			}
 			if (*(user+1) == '@')  /* match a user by netgroup */
+#ifndef __rtems__
 				userok = innetgr(user+2, NULL, ruser, ypdomain);
+#else
+			    return(-1);
+#endif
 			else	   /* match a user by direct specification */
 				userok = !(strcmp(ruser, user+1));
 			break;
@@ -661,9 +679,13 @@ __ivaliduser_sa(FILE *hostf, const struct sockaddr *raddr, socklen_t salen,
 				if (!*(user+1))
 					return(-1);
 				if (*(user+1) == '@') {
+#ifndef __rtems__
 					if (innetgr(user+2, NULL,
 							ruser, ypdomain))
 						return(-1);
+#else
+					return(-1);
+#endif
 				} else {
 					if (!strcmp(ruser, user+1))
 						return(-1);
-- 
1.8.3.1




More information about the devel mailing list