Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/usr.sbin/amd/libamu pull up rev 1.1.1.7 from trunk (req...



details:   https://anonhg.NetBSD.org/src/rev/b67c3082f5b6
branches:  netbsd-1-4
changeset: 469452:b67c3082f5b6
user:      cgd <cgd%NetBSD.org@localhost>
date:      Tue Sep 21 04:58:16 1999 +0000

description:
pull up rev 1.1.1.7 from trunk (requested by christos):
  Upgrade amd(8) and related software to fix expoitable stack overflows
  in amq(8), as reported in BUGTRAQ and elsewhere.

diffstat:

 usr.sbin/amd/libamu/mount_fs.c  |  32 +++++++++++++++++++++++++-------
 usr.sbin/amd/libamu/tranputil.c |  25 +++++++------------------
 2 files changed, 32 insertions(+), 25 deletions(-)

diffs (143 lines):

diff -r f6d7fa9a3962 -r b67c3082f5b6 usr.sbin/amd/libamu/mount_fs.c
--- a/usr.sbin/amd/libamu/mount_fs.c    Tue Sep 21 04:58:10 1999 +0000
+++ b/usr.sbin/amd/libamu/mount_fs.c    Tue Sep 21 04:58:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mount_fs.c,v 1.1.1.6 1999/02/01 18:45:43 christos Exp $        */
+/*     $NetBSD: mount_fs.c,v 1.1.1.6.2.1 1999/09/21 04:58:16 cgd Exp $ */
 
 /*
  * Copyright (c) 1997-1999 Erez Zadok
@@ -40,7 +40,7 @@
  *
  *      %W% (Berkeley) %G%
  *
- * Id: mount_fs.c,v 1.3 1999/01/13 23:31:21 ezk Exp 
+ * Id: mount_fs.c,v 1.7 1999/08/22 21:12:33 ezk Exp 
  *
  */
 
@@ -545,12 +545,16 @@
      * conf/nfs_prot/nfs_prot_*.h files.
      */
 # ifdef USE_UNCONNECTED_NFS_SOCKETS
-    nap->flags |= MNT2_NFS_OPT_NOCONN;
-    plog(XLOG_WARNING, "noconn option exists, and was turned ON! (May cause NFS hangs on some systems...)");
+    if (!(nap->flags & MNT2_NFS_OPT_NOCONN)) {
+      nap->flags |= MNT2_NFS_OPT_NOCONN;
+      plog(XLOG_WARNING, "noconn option not specified, and was just turned ON (OS override)! (May cause NFS hangs on some systems...)");
+    }
 # endif /* USE_UNCONNECTED_NFS_SOCKETS */
 # ifdef USE_CONNECTED_NFS_SOCKETS
-    nap->flags &= ~MNT2_NFS_OPT_NOCONN;
-    plog(XLOG_WARNING, "noconn option exists, and was turned OFF! (May cause NFS hangs on some systems...)");
+    if (nap->flags & MNT2_NFS_OPT_NOCONN) {
+      nap->flags &= ~MNT2_NFS_OPT_NOCONN;
+      plog(XLOG_WARNING, "noconn option specified, and was just turned OFF (OS override)! (May cause NFS hangs on some systems...)");
+    }
 # endif /* USE_CONNECTED_NFS_SOCKETS */
   }
 #endif /* MNT2_NFS_OPT_NOCONN */
@@ -767,6 +771,13 @@
   nap->flags |= MNT2_NFS_OPT_ACDIRMIN | MNT2_NFS_OPT_ACDIRMAX;
 # endif /* defined(MNT2_NFS_OPT_ACDIRMIN) && defined(MNT2_NFS_OPT_ACDIRMAX) */
 #endif /* not MNT2_NFS_OPT_NOAC */
+  /*
+   * Provide a slight bit more security by requiring the kernel to use
+   * reserved ports.
+   */
+#ifdef MNT2_NFS_OPT_RESVPORT
+  nap->flags |= MNT2_NFS_OPT_RESVPORT;
+#endif /* MNT2_NFS_OPT_RESVPORT */
 }
 
 
@@ -839,7 +850,7 @@
   plog(XLOG_DEBUG, "NA->addr {sockaddr_in} (len=%d) = \"%s\"",
        (int) sizeof(struct sockaddr_in),
        get_hex_string(sizeof(struct sockaddr_in), (const char *)sap));
-#ifdef HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN_off
+#ifdef HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN
   plog(XLOG_DEBUG, "NA->addr.sin_len = \"%d\"", sap->sin_len);
 #endif /* HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN */
   plog(XLOG_DEBUG, "NA->addr.sin_family = \"%d\"", sap->sin_family);
@@ -849,6 +860,10 @@
 #endif /* not HAVE_TRANSPORT_TYPE_TLI */
 
   plog(XLOG_DEBUG, "NA->hostname = \"%s\"", nap->hostname ? nap->hostname : "null");
+#ifdef HAVE_FIELD_NFS_ARGS_T_NAMLEN
+  plog(XLOG_DEBUG, "NA->namlen = %d", nap->namlen);
+#endif /* HAVE_FIELD_NFS_ARGS_T_NAMLEN */
+
 #ifdef MNT2_NFS_OPT_FSNAME
   plog(XLOG_DEBUG, "NA->fsname = \"%s\"", nap->fsname ? nap->fsname : "null");
 #endif /* MNT2_NFS_OPT_FSNAME */
@@ -885,6 +900,9 @@
 
   plog(XLOG_DEBUG, "NA->rsize = %d", nap->rsize);
   plog(XLOG_DEBUG, "NA->wsize = %d", nap->wsize);
+#ifdef HAVE_FIELD_NFS_ARGS_T_BSIZE
+  plog(XLOG_DEBUG, "NA->bsize = %d", nap->bsize);
+#endif /* HAVE_FIELD_NFS_ARGS_T_BSIZE */
   plog(XLOG_DEBUG, "NA->timeo = %d", nap->timeo);
   plog(XLOG_DEBUG, "NA->retrans = %d", nap->retrans);
 
diff -r f6d7fa9a3962 -r b67c3082f5b6 usr.sbin/amd/libamu/tranputil.c
--- a/usr.sbin/amd/libamu/tranputil.c   Tue Sep 21 04:58:10 1999 +0000
+++ b/usr.sbin/amd/libamu/tranputil.c   Tue Sep 21 04:58:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tranputil.c,v 1.1.1.6 1999/02/01 18:45:49 christos Exp $       */
+/*     $NetBSD: tranputil.c,v 1.1.1.6.2.1 1999/09/21 04:58:22 cgd Exp $        */
 
 /*
  * Copyright (c) 1997-1999 Erez Zadok
@@ -40,7 +40,7 @@
  *
  *      %W% (Berkeley) %G%
  *
- * Id: transp_sockets.c,v 1.4 1999/01/13 23:31:14 ezk Exp 
+ * Id: transp_sockets.c,v 1.5 1999/08/22 21:12:31 ezk Exp 
  *
  * Socket specific utilities.
  *      -Erez Zadok <ezk%cs.columbia.edu@localhost>
@@ -181,21 +181,6 @@
 
 
 /*
- * Bind NFS to a reserved port.
- */
-static int
-bindnfs_port(int so, u_short *nfs_portp)
-{
-  u_short port;
-  int error = bind_resv_port(so, &port);
-
-  if (error == 0)
-    *nfs_portp = port;
-  return error;
-}
-
-
-/*
  * Create the nfs service for amd
  */
 int
@@ -204,7 +189,7 @@
 
   *soNFSp = socket(AF_INET, SOCK_DGRAM, 0);
 
-  if (*soNFSp < 0 || bindnfs_port(*soNFSp, nfs_portp) < 0) {
+  if (*soNFSp < 0 || bind_resv_port(*soNFSp, NULL) < 0) {
     plog(XLOG_FATAL, "Can't create privileged nfs port");
     return 1;
   }
@@ -212,6 +197,10 @@
     plog(XLOG_FATAL, "cannot create rpc/udp service");
     return 2;
   }
+  if ((*nfs_portp = (*nfs_xprtp)->xp_port) >= IPPORT_RESERVED) {
+    plog(XLOG_FATAL, "Can't create privileged nfs port");
+    return 1;
+  }
   if (!svc_register(*nfs_xprtp, NFS_PROGRAM, NFS_VERSION, dispatch_fxn, 0)) {
     plog(XLOG_FATAL, "unable to register (NFS_PROGRAM, NFS_VERSION, 0)");
     return 3;



Home | Main Index | Thread Index | Old Index