summaryrefslogtreecommitdiffstats
path: root/sbin/mount_portal
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/mount_portal')
-rw-r--r--sbin/mount_portal/mount_portal.c20
-rw-r--r--sbin/mount_portal/pt_file.c6
-rw-r--r--sbin/mount_portal/pt_tcp.c16
3 files changed, 33 insertions, 9 deletions
diff --git a/sbin/mount_portal/mount_portal.c b/sbin/mount_portal/mount_portal.c
index 862027f..23098d2 100644
--- a/sbin/mount_portal/mount_portal.c
+++ b/sbin/mount_portal/mount_portal.c
@@ -46,6 +46,7 @@ static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
#include <sys/param.h>
#include <sys/wait.h>
+#include <sys/time.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/syslog.h>
@@ -72,6 +73,12 @@ static void usage __P((void));
static sig_atomic_t readcf; /* Set when SIGHUP received */
+static void sighup(sig)
+int sig;
+{
+ readcf ++;
+}
+
static void sigchld(sig)
int sig;
{
@@ -79,8 +86,11 @@ int sig;
while ((pid = waitpid((pid_t) -1, (int *) 0, WNOHANG)) > 0)
;
+ /* wrtp - waitpid _doesn't_ return 0 when no children! */
+#ifdef notdef
if (pid < 0)
syslog(LOG_WARNING, "waitpid: %s", strerror(errno));
+#endif
}
int
@@ -149,6 +159,7 @@ main(argc, argv)
(void) unlink(un.sun_path);
if (bind(so, (struct sockaddr *) &un, sizeof(un)) < 0)
err(1, NULL);
+
(void) unlink(un.sun_path);
(void) listen(so, 5);
@@ -185,6 +196,7 @@ main(argc, argv)
readcf = 1;
signal(SIGCHLD, sigchld);
+ signal(SIGHUP, sighup);
/*
* Just loop waiting for new connections and activating them
@@ -201,6 +213,9 @@ main(argc, argv)
* Check whether we need to re-read the configuration file
*/
if (readcf) {
+#ifdef DEBUG
+ printf ("re-reading configuration file\n");
+#endif
readcf = 0;
conf_read(&q, conf);
continue;
@@ -211,8 +226,9 @@ main(argc, argv)
* Will get EINTR if a signal has arrived, so just
* ignore that error code
*/
+ FD_ZERO(&fdset);
FD_SET(so, &fdset);
- rc = select(so+1, &fdset, (void *) 0, (void *) 0, (void *) 0);
+ rc = select(so+1, &fdset, (fd_set *) 0, (fd_set *) 0, (struct timeval *) 0);
if (rc < 0) {
if (errno == EINTR)
continue;
@@ -251,7 +267,7 @@ main(argc, argv)
case 0:
(void) close(so);
activate(&q, so2);
- break;
+ exit(0); /* stupid errors.... tidied up... wrtp*/
default:
(void) close(so2);
break;
diff --git a/sbin/mount_portal/pt_file.c b/sbin/mount_portal/pt_file.c
index 929f261..a9cd2ca3 100644
--- a/sbin/mount_portal/pt_file.c
+++ b/sbin/mount_portal/pt_file.c
@@ -36,7 +36,7 @@
*
* @(#)pt_file.c 8.2 (Berkeley) 3/27/94
*
- * $Id: pt_file.c,v 1.1.1.1 1994/05/26 06:34:34 rgrimes Exp $
+ * $Id: pt_file.c,v 1.2 1994/09/19 13:52:38 ache Exp $
*/
#include <stdio.h>
@@ -69,6 +69,7 @@ int *fdp;
#ifdef DEBUG
printf("path = %s, uid = %d, gid = %d\n", pbuf, pcr->pcr_uid, pcr->pcr_groups[0]);
+ printf ("fflag = %x, oflag = %x\n", pcr->pcr_flag, (pcr->pcr_flag)-1);
#endif
for (i = 0; i < pcr->pcr_ngroups; i++)
@@ -80,7 +81,8 @@ int *fdp;
if (seteuid(pcr->pcr_uid) < 0)
return (errno);
- fd = open(pbuf, O_RDWR|O_CREAT, 0666);
+ /* dmb convert kernel flags to oflags, see <fcntl.h> */
+ fd = open(pbuf, (pcr->pcr_flag)-1, 0777);
if (fd < 0)
error = errno;
else
diff --git a/sbin/mount_portal/pt_tcp.c b/sbin/mount_portal/pt_tcp.c
index 18a53ce..11f1453 100644
--- a/sbin/mount_portal/pt_tcp.c
+++ b/sbin/mount_portal/pt_tcp.c
@@ -36,7 +36,7 @@
*
* @(#)pt_tcp.c 8.3 (Berkeley) 3/27/94
*
- * $Id: pt_tcp.c,v 1.1 1992/05/25 21:43:09 jsp Exp jsp $
+ * $Id: pt_tcp.c,v 1.1.1.1 1994/05/26 06:34:34 rgrimes Exp $
*/
#include <stdio.h>
@@ -77,7 +77,7 @@ int *fdp;
struct in_addr **ipp;
struct in_addr *ip[2];
struct in_addr ina;
- int s_port;
+ u_short s_port;
int priv = 0;
struct sockaddr_in sain;
@@ -117,15 +117,21 @@ int *fdp;
ip[1] = 0;
ipp = ip;
}
+#ifdef DEBUG
+ printf ("inet address for %s is %s\n", host, inet_ntoa(*ipp[0]));
+#endif
sp = getservbyname(port, "tcp");
- if (sp != 0)
- s_port = sp->s_port;
+ if (sp != NULL)
+ s_port = (u_short)sp->s_port;
else {
- s_port = atoi(port);
+ s_port = htons ((u_short)strtol (port, (char**)NULL, 10));
if (s_port == 0)
return (EINVAL);
}
+#ifdef DEBUG
+ printf ("port number for %s is %d\n", port, s_port);
+#endif
bzero(&sain, sizeof(sain));
sain.sin_len = sizeof(sain);
OpenPOWER on IntegriCloud