projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
missing #includes
[unix-history]
/
usr
/
src
/
sbin
/
mount_portal
/
pt_tcp.c
diff --git
a/usr/src/sbin/mount_portal/pt_tcp.c
b/usr/src/sbin/mount_portal/pt_tcp.c
index
dbc61bd
..
bc2cd66
100644
(file)
--- a/
usr/src/sbin/mount_portal/pt_tcp.c
+++ b/
usr/src/sbin/mount_portal/pt_tcp.c
@@
-8,7
+8,7
@@
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)pt_tcp.c 8.
1
(Berkeley) %G%
+ * @(#)pt_tcp.c 8.
3
(Berkeley) %G%
*
* $Id: pt_tcp.c,v 1.1 1992/05/25 21:43:09 jsp Exp jsp $
*/
*
* $Id: pt_tcp.c,v 1.1 1992/05/25 21:43:09 jsp Exp jsp $
*/
@@
-23,6
+23,7
@@
#include <sys/syslog.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/syslog.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <netdb.h>
#include "portald.h"
#include <netdb.h>
#include "portald.h"
@@
-51,6
+52,7
@@
int *fdp;
struct in_addr *ip[2];
struct in_addr ina;
int s_port;
struct in_addr *ip[2];
struct in_addr ina;
int s_port;
+ int priv = 0;
struct sockaddr_in sain;
q = strchr(p, '/');
struct sockaddr_in sain;
q = strchr(p, '/');
@@
-58,14
+60,25
@@
int *fdp;
return (EINVAL);
*q = '\0';
strcpy(host, p);
return (EINVAL);
*q = '\0';
strcpy(host, p);
- p = q
++
;
+ p = q
+ 1
;
q = strchr(p, '/');
q = strchr(p, '/');
- if (q == 0 || q - p >= sizeof(port))
+ if (q)
+ *q = '\0';
+ if (strlen(p) >= sizeof(port))
return (EINVAL);
return (EINVAL);
- *q = '\0';
strcpy(port, p);
strcpy(port, p);
- p = q++;
+ if (q) {
+ p = q + 1;
+ if (strcmp(p, "priv") == 0) {
+ if (pcr->pcr_uid == 0)
+ priv = 1;
+ else
+ return (EPERM);
+ } else {
+ return (EINVAL);
+ }
+ }
hp = gethostbyname(host);
if (hp != 0) {
hp = gethostbyname(host);
if (hp != 0) {
@@
-96,7
+109,10
@@
int *fdp;
while (ipp[0]) {
int so;
while (ipp[0]) {
int so;
- so = socket(AF_INET, SOCK_STREAM, 0);
+ if (priv)
+ so = rresvport((int *) 0);
+ else
+ so = socket(AF_INET, SOCK_STREAM, 0);
if (so < 0) {
syslog(LOG_ERR, "socket: %m");
return (errno);
if (so < 0) {
syslog(LOG_ERR, "socket: %m");
return (errno);