summaryrefslogtreecommitdiffstats
path: root/libexec/rexecd
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>2000-11-28 18:15:25 +0000
committercharnier <charnier@FreeBSD.org>2000-11-28 18:15:25 +0000
commitf1a89df3316a1b8c0a7ee15461f3ff8470fad0f6 (patch)
treefd857288354aae40f0851473612e4b1d875c62a4 /libexec/rexecd
parent963cc312d0ec623f0651f4334eddeb71ffc0ca3c (diff)
downloadFreeBSD-src-f1a89df3316a1b8c0a7ee15461f3ff8470fad0f6.zip
FreeBSD-src-f1a89df3316a1b8c0a7ee15461f3ff8470fad0f6.tar.gz
Remove unused #include. Use getopt(3). Add usage() with syslog(3) cap.
Diffstat (limited to 'libexec/rexecd')
-rw-r--r--libexec/rexecd/rexecd.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c
index bd8876c..3404803 100644
--- a/libexec/rexecd/rexecd.c
+++ b/libexec/rexecd/rexecd.c
@@ -48,20 +48,18 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <sys/time.h>
#include <netinet/in.h>
-#include <arpa/inet.h>
#include <err.h>
-#include <netdb.h>
+#ifdef DEBUG
+#include <fcntl.h>
+#endif
#include <libutil.h>
#include <paths.h>
-#include <pwd.h>
#include <signal.h>
#include <stdio.h>
#include <skey.h>
-#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
@@ -84,6 +82,13 @@ void error __P(());
int no_uid_0 = 1;
+void
+usage(void)
+{
+ syslog(LOG_ERR, "usage: rexecd [-i]");
+ exit(1);
+}
+
/*
* remote execute server:
* username\0
@@ -99,12 +104,21 @@ main(argc, argv)
{
struct sockaddr_in from;
int fromlen;
- struct hostent *hp;
+ int ch;
- if (argc == 2 && !strcmp(argv[1], "-i"))
+ openlog("rexecd", LOG_PID, LOG_AUTH);
+
+ while ((ch = getopt(argc, argv, "i")) != -1)
+ switch (ch) {
+ case 'i':
no_uid_0 = 0;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
- openlog(argv[0], LOG_PID, LOG_AUTH);
fromlen = sizeof (from);
if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0)
err(1, "getpeername");
OpenPOWER on IntegriCloud