use SS_PRIV instead of suser; fix includes (rm user.h)
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Sun, 21 Apr 1991 08:02:18 +0000 (00:02 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Sun, 21 Apr 1991 08:02:18 +0000 (00:02 -0800)
SCCS-vsn: sys/netinet/in_pcb.c 7.14
SCCS-vsn: sys/netinet/in.c 7.17

usr/src/sys/netinet/in.c
usr/src/sys/netinet/in_pcb.c

index cb531d6..92ee85c 100644 (file)
@@ -1,23 +1,21 @@
 /*
 /*
- * Copyright (c) 1982, 1986 Regents of the University of California.
+ * Copyright (c) 1982, 1986, 1991 Regents of the University of California.
  * All rights reserved.
  *
  * %sccs.include.redist.c%
  *
  * All rights reserved.
  *
  * %sccs.include.redist.c%
  *
- *     @(#)in.c        7.16 (Berkeley) %G%
+ *     @(#)in.c        7.17 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "ioctl.h"
 #include "mbuf.h"
  */
 
 #include "param.h"
 #include "ioctl.h"
 #include "mbuf.h"
-#include "protosw.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "socket.h"
 #include "socketvar.h"
-#include "user.h"
 #include "in_systm.h"
 #include "in_systm.h"
-#include "../net/if.h"
-#include "../net/route.h"
-#include "../net/af.h"
+#include "net/if.h"
+#include "net/route.h"
+#include "net/af.h"
 #include "in.h"
 #include "in_var.h"
 
 #include "in.h"
 #include "in_var.h"
 
@@ -256,8 +254,8 @@ in_control(so, cmd, data, ifp)
        case SIOCSIFADDR:
        case SIOCSIFNETMASK:
        case SIOCSIFDSTADDR:
        case SIOCSIFADDR:
        case SIOCSIFNETMASK:
        case SIOCSIFDSTADDR:
-               if (error = suser(u.u_cred, &u.u_acflag))
-                       return (error);
+               if ((so->so_state & SS_PRIV) == 0)
+                       return (EPERM);
 
                if (ifp == 0)
                        panic("in_control");
 
                if (ifp == 0)
                        panic("in_control");
@@ -295,8 +293,8 @@ in_control(so, cmd, data, ifp)
                break;
 
        case SIOCSIFBRDADDR:
                break;
 
        case SIOCSIFBRDADDR:
-               if (error = suser(u.u_cred, &u.u_acflag))
-                       return (error);
+               if ((so->so_state & SS_PRIV) == 0)
+                       return (EPERM);
                /* FALLTHROUGH */
 
        case SIOCGIFADDR:
                /* FALLTHROUGH */
 
        case SIOCGIFADDR:
index 7827c63..14f07fd 100644 (file)
@@ -1,28 +1,29 @@
 /*
 /*
- * Copyright (c) 1982, 1986 Regents of the University of California.
+ * Copyright (c) 1982, 1986, 1991 Regents of the University of California.
  * All rights reserved.
  *
  * %sccs.include.redist.c%
  *
  * All rights reserved.
  *
  * %sccs.include.redist.c%
  *
- *     @(#)in_pcb.c    7.13 (Berkeley) %G%
+ *     @(#)in_pcb.c    7.14 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "systm.h"
  */
 
 #include "param.h"
 #include "systm.h"
-#include "user.h"
 #include "malloc.h"
 #include "mbuf.h"
 #include "malloc.h"
 #include "mbuf.h"
+#include "protosw.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "ioctl.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "ioctl.h"
+
 #include "../net/if.h"
 #include "../net/route.h"
 #include "../net/if.h"
 #include "../net/route.h"
+
 #include "in.h"
 #include "in_systm.h"
 #include "ip.h"
 #include "in_pcb.h"
 #include "in_var.h"
 #include "in.h"
 #include "in_systm.h"
 #include "ip.h"
 #include "in_pcb.h"
 #include "in_var.h"
-#include "protosw.h"
 
 struct in_addr zeroin_addr;
 
 
 struct in_addr zeroin_addr;
 
@@ -76,7 +77,7 @@ in_pcbbind(inp, nam)
                int wild = 0;
 
                /* GROSS */
                int wild = 0;
 
                /* GROSS */
-               if (aport < IPPORT_RESERVED && u.u_uid != 0)
+               if (aport < IPPORT_RESERVED && (so->so_state & SS_PRIV) == 0)
                        return (EACCES);
                /* even GROSSER, but this is the Internet */
                if ((so->so_options & SO_REUSEADDR) == 0 &&
                        return (EACCES);
                /* even GROSSER, but this is the Internet */
                if ((so->so_options & SO_REUSEADDR) == 0 &&