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

Lou Woods irnhorse4 at gmail.com
Mon May 6 17:39:33 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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/freebsd/lib/libc/net/rcmd.c b/freebsd/lib/libc/net/rcmd.c
index bc6a583..a35faa7 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 /* __rtems__ */
 
 #define max(a, b)	((a > b) ? a : b)
 
@@ -98,6 +100,7 @@ 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");
@@ -115,6 +118,7 @@ rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser,
 			return (rcmdsh(ahost, rport, locuser, remuser,
 			    cmd, NULL));
 	}
+#endif /* __rtems__ */
 
 	pid = getpid();
 
@@ -624,17 +628,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 /* __rtems__ */
+			    return(-1);
+#endif /* __rtems__ */
 			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 /* __rtems__ */
+				return(-1);
+#endif /* __rtems__ */
 			} else {
 				if (__icheckhost(raddr, salen,
 						 (char *)&buf[1]))
@@ -652,7 +664,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 /* __rtems__ */
+			    return(-1);
+#endif /* __rtems__ */
 			else	   /* match a user by direct specification */
 				userok = !(strcmp(ruser, user+1));
 			break;
@@ -661,9 +677,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 /* __rtems__ */
+					return(-1);
+#endif /* __rtems__ */
 				} else {
 					if (!strcmp(ruser, user+1))
 						return(-1);
-- 
1.8.3.1




More information about the devel mailing list