File services-Do-not-require-non-standard-entries-in-etc-services.patch of Package mrsh.14951

From: Egbert Eich <eich@suse.de>
Date: Mon Oct 17 21:24:57 2016 +0200
Subject: [PATCH]services: Do not require non-standard entries in etc/services
Git-commit: 8802798e0454c7d350b3046e0917222590b321cb
References: 
Signed-off-by: Egbert Eich <eich@suse.com>

Non standard modifications of /etc/services are not allowed
on a default SUSE installation.
If no mrsh service specification exists, fall back to port
541/tcp.
if no msell service specification exists, fall back to port
21212/tcp.

Signed-off-by: Egbert Eich <eich@suse.de>
---
 doc/mrlogind.8    | 2 ++
 doc/mrshd.8       | 2 ++
 mrcp/mrcp.c       | 5 ++---
 mrlogin/mrlogin.c | 5 ++---
 mrsh/mrsh.c       | 5 ++---
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/doc/mrlogind.8 b/doc/mrlogind.8
index 73ed84c..22ecc70 100644
--- a/doc/mrlogind.8
+++ b/doc/mrlogind.8
@@ -95,6 +95,8 @@ Output package and protocol version.
 listens for service requests at the port indicated in
 the ``mlogin'' service specification; see
 .Xr services 5 .
+If no ``mlogin'' service specification exits, it falls back
+to port 541/tcp.
 .Pp
 Transport-level keepalive messages are enabled unless the
 .Fl n
diff --git a/doc/mrshd.8 b/doc/mrshd.8
index c0e3d15..80186c7 100644
--- a/doc/mrshd.8
+++ b/doc/mrshd.8
@@ -86,6 +86,8 @@ server
 listens for service requests at the port indicated in
 the ``mshell'' service specification; see
 .Xr services 5 .
+If no ``mshell'' service specification exits, it falls back
+to port 21212/tcp.
 .Pp
 Transport-level keepalive messages are enabled unless the
 .Fl n
diff --git a/mrcp/mrcp.c b/mrcp/mrcp.c
index d3f280d..1adc198 100644
--- a/mrcp/mrcp.c
+++ b/mrcp/mrcp.c
@@ -193,9 +193,8 @@ main(int argc, char *argv[])
 	argv += optind;
 
 	sp = getservbyname(shell = "mshell", "tcp");
-	if (sp == NULL) {
-		(void)fprintf(stderr, "mrcp: %s/tcp: unknown service\n", shell);
-		exit(1);
+	if (sp == NULL && service_port == 0) {
+		service_port = htons(21212);
 	}
 	port = (service_port) ? service_port : sp->s_port;
 
diff --git a/mrlogin/mrlogin.c b/mrlogin/mrlogin.c
index ccde09e..3ab0854 100644
--- a/mrlogin/mrlogin.c
+++ b/mrlogin/mrlogin.c
@@ -301,9 +301,8 @@ main(int argc, char **argv)
 	sp = NULL;
 	if (sp == NULL)
 		sp = getservbyname("mlogin", "tcp");
-	if (sp == NULL) {
-		fprintf(stderr, "mrlogin: mlogin/tcp: unknown service.\n");
-		exit(1);
+	if (sp == NULL && service_port == 0) {
+		service_port = htons(541);
 	}
 
 	t = getenv("TERM");
diff --git a/mrsh/mrsh.c b/mrsh/mrsh.c
index d2ce36d..9ed4a01 100644
--- a/mrsh/mrsh.c
+++ b/mrsh/mrsh.c
@@ -206,9 +206,8 @@ main(int argc, char *argv[])
 	sp = NULL;
 	if (sp == NULL)
 		sp = getservbyname("mshell", "tcp");
-	if (sp == NULL) {
-		fprintf(stderr, "mrsh: mshell/tcp: unknown service.\n");
-		exit(1);
+	if (sp == NULL && service_port == 0) {
+		service_port = htons(21212);
 	}
 
 	rem = mcmd(&host, 
openSUSE Build Service is sponsored by