ypserv/ypserv-2.25-systemd.patch

264 lines
9.0 KiB
Diff
Raw Normal View History

diff -up ypserv-2.25/rpc.yppasswdd/rpc.yppasswdd.8.systemd ypserv-2.25/rpc.yppasswdd/rpc.yppasswdd.8
--- ypserv-2.25/rpc.yppasswdd/rpc.yppasswdd.8.systemd 2011-05-10 14:11:56.272577424 +0200
+++ ypserv-2.25/rpc.yppasswdd/rpc.yppasswdd.8 2011-05-10 14:15:28.822920180 +0200
@@ -14,11 +14,11 @@
rpc.yppasswdd - NIS password update daemon
.SH "SYNOPSIS"
.HP 14
-\fBrpc\.yppasswdd\fR [\-D\ \fIdirectory\fR] \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR]
+\fBrpc\.yppasswdd\fR [\-D\ \fIdirectory\fR] \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR] [\-f|\-\-foreground]
.HP 14
-\fBrpc\.yppasswdd\fR [\-s\ \fIshadow\fR] [\-p\ \fIpasswd\fR] \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR]
+\fBrpc\.yppasswdd\fR [\-s\ \fIshadow\fR] [\-p\ \fIpasswd\fR] \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR] [\-f|\-\-foreground]
.HP 14
-\fBrpc\.yppasswdd\fR \-x\ \fIprogram\fR | \-E\ \fIprogram\fR \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR]
+\fBrpc\.yppasswdd\fR \-x\ \fIprogram\fR | \-E\ \fIprogram\fR \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR] [\-f|\-\-foreground]
.SH "DESCRIPTION"
.PP
@@ -135,6 +135,11 @@ rpc\.yppasswdd will try to register itse
.RS 4
Prints the version number and if this package is compiled with the CHECKROOT option\.
.RE
+.PP
+\fB\-f\fR, \fB\-\-foreground\fR
+.RS 4
+will not put itself into background\&.
+.RE
.SH "MISCELLANEOUS"
.SS "Shadow Passwords"
.PP
diff -up ypserv-2.25/rpc.yppasswdd/yppasswdd.c.systemd ypserv-2.25/rpc.yppasswdd/yppasswdd.c
--- ypserv-2.25/rpc.yppasswdd/yppasswdd.c.systemd 2011-05-10 14:11:56.258577599 +0200
+++ ypserv-2.25/rpc.yppasswdd/yppasswdd.c 2011-05-10 14:16:40.327026256 +0200
@@ -58,6 +58,8 @@ int allow_chfn = 0;
int solaris_mode = -1;
int x_flag = -1;
+static int foreground_flag = 0;
+
#define xprt_addr(xprt) (svc_getcaller(xprt)->sin_addr)
#define xprt_port(xprt) ntohs(svc_getcaller(xprt)->sin_port)
void yppasswdprog_1 (struct svc_req *rqstp, SVCXPRT * transp);
@@ -110,9 +112,9 @@ yppasswdprog_1 (struct svc_req *rqstp, S
static void
usage (FILE * fp, int n)
{
- fputs ("Usage: rpc.yppasswdd [--debug] [-s shadowfile] [-p passwdfile] [-e chsh|chfn]\n", fp);
- fputs (" rpc.yppasswdd [--debug] [-D directory] [-e chsh|chfn]\n", fp);
- fputs (" rpc.yppasswdd [--debug] [-x program |-E program] [-e chsh|chfn]\n", fp);
+ fputs ("Usage: rpc.yppasswdd [--debug] [-s shadowfile] [-p passwdfile] [-e chsh|chfn] [-f|--foreground]\n", fp);
+ fputs (" rpc.yppasswdd [--debug] [-D directory] [-e chsh|chfn] [-f|--foreground]\n", fp);
+ fputs (" rpc.yppasswdd [--debug] [-x program |-E program] [-e chsh|chfn] [-f|--foreground]\n", fp);
fputs (" rpc.yppasswdd --port number\n", fp);
fputs (" rpc.yppasswdd --version\n", fp);
exit (n);
@@ -200,12 +202,13 @@ main (int argc, char **argv)
{"usage", no_argument, NULL, 'h'},
{"help", no_argument, NULL, 'h'},
{"execute", required_argument, NULL, 'x'},
+ {"foreground", no_argument, NULL, 'f'},
{"debug", no_argument, NULL, '\254'},
{"port", required_argument, NULL, '\253'},
{NULL, 0, NULL, '\0'}
};
- c=getopt_long (argc, argv, "e:p:s:uhvD:E:x:m", long_options,
+ c=getopt_long (argc, argv, "e:p:s:fuhvD:E:x:m", long_options,
&option_index);
if (c == EOF)
break;
@@ -225,6 +228,9 @@ main (int argc, char **argv)
solaris_mode = 0;
path_passwd = optarg;
break;
+ case 'f':
+ foreground_flag = 1;
+ break;
case 's':
if (solaris_mode == 1)
usage (stderr, 1);
@@ -336,7 +342,7 @@ main (int argc, char **argv)
log_msg ("rpc.yppasswdd - NYS YP server version %s\n", VERSION);
#endif /* CHECKROOT */
}
- else
+ else if (!foreground_flag)
{
int i;
diff -up ypserv-2.25/rpc.ypxfrd/rpc.ypxfrd.8.systemd ypserv-2.25/rpc.ypxfrd/rpc.ypxfrd.8
--- ypserv-2.25/rpc.ypxfrd/rpc.ypxfrd.8.systemd 2011-05-10 14:11:56.286577250 +0200
+++ ypserv-2.25/rpc.ypxfrd/rpc.ypxfrd.8 2011-05-10 14:15:19.875032043 +0200
@@ -14,7 +14,7 @@
rpc.ypxfrd - NIS map transfer server
.SH "SYNOPSIS"
.HP 21
-\fB/usr/sbin/rpc\.ypxfrd\fR [\-d\ \fIpath\fR] [\-p\ \fIport\fR] [\-\-debug]
+\fB/usr/sbin/rpc\.ypxfrd\fR [\-d\ \fIpath\fR] [\-p\ \fIport\fR] [\-\-debug] [\-f|\-\-foreground]
.HP 21
\fB/usr/sbin/rpc\.ypxfrd\fR \-\-version
.SH "DESCRIPTION"
@@ -83,6 +83,11 @@ will bind itself to this port, which mak
.RS 4
Prints the version number
.RE
+.PP
+\fB\-f\fR, \fB\-\-foreground\fR
+.RS 4
+will not put itself into background\&.
+.RE
.SH "SECURITY"
.PP
diff -up ypserv-2.25/rpc.ypxfrd/ypxfrd.c.systemd ypserv-2.25/rpc.ypxfrd/ypxfrd.c
--- ypserv-2.25/rpc.ypxfrd/ypxfrd.c.systemd 2011-05-10 14:11:56.258577599 +0200
+++ ypserv-2.25/rpc.ypxfrd/ypxfrd.c 2011-05-10 14:16:26.193202954 +0200
@@ -79,6 +79,8 @@ char *path_ypdb = YPMAPDIR;
char *progname;
+static int foreground_flag = 0;
+
/*
** Needed, if we start rpc.ypxfrd from inetd
*/
@@ -140,7 +142,7 @@ sig_hup (int sig UNUSED)
static void
usage (int exitcode)
{
- fputs ("usage: rpc.ypxfrd [--debug] [-d path] [-p port]\n", stderr);
+ fputs ("usage: rpc.ypxfrd [--debug] [-d path] [-p port] [-f|--foreground]\n", stderr);
fputs (" rpc.ypxfrd --version\n", stderr);
exit (exitcode);
@@ -180,12 +182,13 @@ main (int argc, char **argv)
{"port", required_argument, NULL, 'p'},
{"path", required_argument, NULL, 'd'},
{"dir", required_argument, NULL, 'd'},
+ {"foreground", no_argument, NULL, 'f'},
{"usage", no_argument, NULL, 'u'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, '\0'}
};
- c=getopt_long(argc, argv, "p:d:uh",long_options, &option_index);
+ c=getopt_long(argc, argv, "p:d:fuh",long_options, &option_index);
if (c==EOF) break;
switch (c)
{
@@ -212,6 +215,9 @@ main (int argc, char **argv)
if (debug_flag)
log_msg("Using port %d\n", my_port);
break;
+ case 'f':
+ foreground_flag = 1;
+ break;
case 'u':
case 'h':
usage(0);
@@ -227,8 +233,8 @@ main (int argc, char **argv)
if (debug_flag)
log_msg("[Welcome to the rpc.ypxfrd Daemon, version %s]\n", VERSION);
- else
- if(!_rpcpmstart)
+ else
+ if (!_rpcpmstart && !foreground_flag)
{
int i;
diff -up ypserv-2.25/ypserv/ypserv.8.systemd ypserv-2.25/ypserv/ypserv.8
--- ypserv-2.25/ypserv/ypserv.8.systemd 2011-05-10 14:11:56.295577137 +0200
+++ ypserv-2.25/ypserv/ypserv.8 2011-05-10 14:15:01.646259934 +0200
@@ -22,7 +22,7 @@
ypserv \- NIS Server
.SH "SYNOPSIS"
.HP \w'\fB/usr/sbin/ypserv\fR\ 'u
-\fB/usr/sbin/ypserv\fR [\-d\ [\fIpath\fR]] [\-p\ \fIport\fR]
+\fB/usr/sbin/ypserv\fR [\-d\] [\-p\ \fIport\fR] [\-f|\-\-foreground]
.SH "DESCRIPTION"
.PP
.\" ypserv: ypserv \(em NIS server process
@@ -66,15 +66,11 @@ and this variable can be set in
\fB/etc/sysconfig/network\&.\fR
.SH "OPTIONS"
.PP
-\fB\-d\fR, \fB\-\-debug \fR[\fIpath\fR]
+\fB\-d\fR, \fB\-\-debug
.RS 4
Causes the server to run in debugging mode\&. Normally,
\fBypserv\fR
reports only errors (access violations, dbm failures) using the syslog(3) facility\&. In debug mode, the server does not background itself and prints extra status messages to stderr for each request that it revceives\&.
-\fBpath\fR
-is an optionally parameter\&.
-\fBypserv\fR
-is using this directory instead of /var/yp
.RE
.PP
\fB\-p\fR, \fB\-\-port\fR \fIport\fR
@@ -87,6 +83,11 @@ will bind itself to this port\&. This ma
.RS 4
Prints the version number
.RE
+.PP
+\fB\-f\fR, \fB\-\-foreground\fR
+.RS 4
+will not put itself into background\&.
+.RE
.SH "SECURITY"
.PP
In general, any remote user can issue an RPC to
diff -up ypserv-2.25/ypserv/ypserv.c.systemd ypserv-2.25/ypserv/ypserv.c
--- ypserv-2.25/ypserv/ypserv.c.systemd 2011-05-10 14:11:56.261577563 +0200
+++ ypserv-2.25/ypserv/ypserv.c 2011-05-10 14:16:19.745283563 +0200
@@ -60,6 +60,7 @@
#endif
static char *path_ypdb = YPMAPDIR;
+static int foreground_flag = 0;
static void
ypprog_2 (struct svc_req *rqstp, register SVCXPRT * transp)
@@ -317,7 +318,7 @@ sig_child (int sig UNUSED)
static void
Usage (int exitcode)
{
- fputs ("usage: ypserv [-d [path]] [-p port]\n", stderr);
+ fputs ("usage: ypserv [-d] [-p port] [-f|--foreground]\n", stderr);
fputs (" ypserv --version\n", stderr);
exit (exitcode);
@@ -342,10 +343,11 @@ main (int argc, char **argv)
{"port", required_argument, NULL, 'p'},
{"usage", no_argument, NULL, 'u'},
{"help", no_argument, NULL, 'h'},
+ {"foreground", no_argument, NULL, 'f'},
{NULL, 0, NULL, '\0'}
};
- c = getopt_long (argc, argv, "vdp:buh", long_options, &option_index);
+ c = getopt_long (argc, argv, "vdp:fbuh", long_options, &option_index);
if (c == -1)
break;
switch (c)
@@ -368,6 +370,9 @@ main (int argc, char **argv)
if (debug_flag)
log_msg ("Using port %d\n", my_port);
break;
+ case 'f':
+ foreground_flag = 1;
+ break;
case 'u':
case 'h':
Usage (0);
@@ -383,7 +388,7 @@ main (int argc, char **argv)
if (debug_flag)
log_msg ("[ypserv (%s) %s]\n", PACKAGE, VERSION);
- else
+ else if (! foreground_flag)
{
int i;