Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/amd Resolve corn-flakes



details:   https://anonhg.NetBSD.org/src/rev/4ae757f90518
branches:  trunk
changeset: 476055:4ae757f90518
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Sep 04 22:38:15 1999 +0000

description:
Resolve corn-flakes

diffstat:

 usr.sbin/amd/Makefile                |   5 +-
 usr.sbin/amd/amd/am_ops.c            |  37 ++++++++++---
 usr.sbin/amd/amd/amd.c               |  15 +----
 usr.sbin/amd/amd/amq_subr.c          |  41 +++++++-------
 usr.sbin/amd/amd/amq_svc.c           |   8 ++-
 usr.sbin/amd/amd/conf.c              |   6 +-
 usr.sbin/amd/amd/conf_parse.y        |  20 ++++++-
 usr.sbin/amd/amd/info_nis.c          |  77 +++++++++++++++++++++++-----
 usr.sbin/amd/amd/map.c               |   6 +-
 usr.sbin/amd/amd/mapc.c              |  11 +--
 usr.sbin/amd/amd/nfs_prot_svc.c      |  25 ++++++++-
 usr.sbin/amd/amd/nfs_start.c         |  24 +++++---
 usr.sbin/amd/amd/ops_cdfs.c          |  17 +++++-
 usr.sbin/amd/amd/ops_nfs.c           |  15 +++-
 usr.sbin/amd/amd/opts.c              |  24 +++++++-
 usr.sbin/amd/amd2netbsd              |  96 ++++++++++++++++++++++++++++-------
 usr.sbin/amd/amq/amq.c               |  39 +++++++------
 usr.sbin/amd/doc/Makefile            |   6 +-
 usr.sbin/amd/fixmount/fixmount.c     |  13 +----
 usr.sbin/amd/fsinfo/fsi_gram.y       |  20 ++++++-
 usr.sbin/amd/fsinfo/fsinfo.c         |  12 +---
 usr.sbin/amd/hlfsd/hlfsd.c           |  18 +------
 usr.sbin/amd/include/am_defs.h       |  81 +++++++++++++++++++++---------
 usr.sbin/amd/include/am_utils.h      |   6 +-
 usr.sbin/amd/include/amd.h           |   5 +-
 usr.sbin/amd/include/amu_nfs_prot.h  |   4 +-
 usr.sbin/amd/include/config.h        |  56 +++++++++++++++++---
 usr.sbin/amd/libamu/xutil.c          |  49 +++++++++++++-----
 usr.sbin/amd/mk-amd-map/mk-amd-map.c |  14 +----
 usr.sbin/amd/wire-test/wire-test.c   |  17 +-----
 30 files changed, 506 insertions(+), 261 deletions(-)

diffs (truncated from 1920 to 300 lines):

diff -r c59f7f98834a -r 4ae757f90518 usr.sbin/amd/Makefile
--- a/usr.sbin/amd/Makefile     Sat Sep 04 22:26:21 1999 +0000
+++ b/usr.sbin/amd/Makefile     Sat Sep 04 22:38:15 1999 +0000
@@ -1,6 +1,5 @@
-#      $NetBSD: Makefile,v 1.9 1999/07/22 01:16:59 hubertf Exp $
-SUBDIR= libamu amd amq hlfsd fixmount fsinfo mk-amd-map pawd wire-test \
-       doc
+#      $NetBSD: Makefile,v 1.10 1999/09/04 22:38:15 christos Exp $
+SUBDIR= libamu amd amq hlfsd fixmount fsinfo mk-amd-map pawd wire-test doc
 
 all-amd all-amq all-hlfsd all-fixmount all-fsinfo all-mk-amd-map all-pawd \
     all-wire-test: all-libamu
diff -r c59f7f98834a -r 4ae757f90518 usr.sbin/amd/amd/am_ops.c
--- a/usr.sbin/amd/amd/am_ops.c Sat Sep 04 22:26:21 1999 +0000
+++ b/usr.sbin/amd/amd/am_ops.c Sat Sep 04 22:38:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: am_ops.c,v 1.8 1999/02/01 19:05:09 christos Exp $      */
+/*     $NetBSD: am_ops.c,v 1.9 1999/09/04 22:38:17 christos Exp $      */
 
 /*
  * Copyright (c) 1997-1999 Erez Zadok
@@ -40,7 +40,7 @@
  *
  *      %W% (Berkeley) %G%
  *
- * Id: am_ops.c,v 1.3 1999/01/10 21:53:39 ezk Exp 
+ * Id: am_ops.c,v 1.4 1999/03/13 17:03:26 ezk Exp 
  *
  */
 
@@ -166,7 +166,7 @@
     if (ap[1])
       strcat(buf, ", ");
     l += strlen((*ap)->fs_type) + 2;
-    if (l > 60) {
+    if (l > 62) {
       l = 0;
       strcat(buf, "\n      ");
     }
@@ -415,15 +415,32 @@
 
   /*
    * If addopts option was used, then append it to the
-   * current options.
+   * current options and remote mount options.
    */
   if (fo->opt_addopts) {
-    char *mergedstr;
-    mergedstr = merge_opts(fo->opt_opts, fo->opt_addopts);
-    plog(XLOG_USER, "merge opts \"%s\" add \"%s\" => \"%s\"",
-        fo->opt_opts, fo->opt_addopts, mergedstr);
-    XFREE(fo->opt_opts);
-    fo->opt_opts = mergedstr;
+    if (STREQ(fo->opt_opts, fo->opt_remopts)) {
+      /* optimize things for the common case where opts==remopts */
+      char *mergedstr;
+      mergedstr = merge_opts(fo->opt_opts, fo->opt_addopts);
+      plog(XLOG_USER, "merge rem/opts \"%s\" add \"%s\" => \"%s\"",
+          fo->opt_opts, fo->opt_addopts, mergedstr);
+      XFREE(fo->opt_opts);
+      XFREE(fo->opt_remopts);
+      fo->opt_opts = mergedstr;
+      fo->opt_remopts = strdup(mergedstr);
+    } else {
+      char *mergedstr, *remmergedstr;
+      mergedstr = merge_opts(fo->opt_opts, fo->opt_addopts);
+      plog(XLOG_USER, "merge opts \"%s\" add \"%s\" => \"%s\"",
+          fo->opt_opts, fo->opt_addopts, mergedstr);
+      XFREE(fo->opt_opts);
+      fo->opt_opts = mergedstr;
+      remmergedstr = merge_opts(fo->opt_remopts, fo->opt_addopts);
+      plog(XLOG_USER, "merge remopts \"%s\" add \"%s\" => \"%s\"",
+          fo->opt_remopts, fo->opt_addopts, remmergedstr);
+      XFREE(fo->opt_remopts);
+      fo->opt_remopts = remmergedstr;
+    }
   }
 
   /*
diff -r c59f7f98834a -r 4ae757f90518 usr.sbin/amd/amd/amd.c
--- a/usr.sbin/amd/amd/amd.c    Sat Sep 04 22:26:21 1999 +0000
+++ b/usr.sbin/amd/amd/amd.c    Sat Sep 04 22:38:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amd.c,v 1.11 1999/02/01 19:05:09 christos Exp $        */
+/*     $NetBSD: amd.c,v 1.12 1999/09/04 22:38:17 christos Exp $        */
 
 /*
  * Copyright (c) 1997-1999 Erez Zadok
@@ -40,7 +40,7 @@
  *
  *      %W% (Berkeley) %G%
  *
- * Id: amd.c,v 1.4 1999/01/13 23:30:57 ezk Exp 
+ * Id: amd.c,v 1.5 1999/02/04 07:24:14 ezk Exp 
  *
  */
 
@@ -57,13 +57,7 @@
 struct amu_global_options gopt;        /* where global options are stored */
 
 char pid_fsname[16 + MAXHOSTNAMELEN];  /* "kiska.southseas.nz:(pid%d)" */
-#if 0
-char *progname;                        /* "amd" */
-#endif
 char *hostdomain = "unknown.domain";
-#if 0
-char hostname[MAXHOSTNAMELEN + 1] = "localhost"; /* Hostname */
-#endif
 char hostd[2 * MAXHOSTNAMELEN + 1]; /* Host+domain */
 char *endian = ARCH_ENDIAN;    /* Big or Little endian */
 char *cpu = HOST_CPU;          /* CPU type */
@@ -75,11 +69,6 @@
 int select_intr_valid;
 
 jmp_buf select_intr;
-#if 0
-pid_t mypid;                   /* Current process id */
-serv_state amd_state;
-int foreground = 1;            /* This is the top-level server */
-#endif
 struct amd_stats amd_stats;    /* Server statistics */
 struct in_addr myipaddr;       /* (An) IP address of this host */
 time_t do_mapc_reload = 0;     /* mapc_reload() call required? */
diff -r c59f7f98834a -r 4ae757f90518 usr.sbin/amd/amd/amq_subr.c
--- a/usr.sbin/amd/amd/amq_subr.c       Sat Sep 04 22:26:21 1999 +0000
+++ b/usr.sbin/amd/amd/amq_subr.c       Sat Sep 04 22:38:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amq_subr.c,v 1.10 1999/02/01 19:05:09 christos Exp $   */
+/*     $NetBSD: amq_subr.c,v 1.11 1999/09/04 22:38:17 christos Exp $   */
 
 /*
  * Copyright (c) 1997-1999 Erez Zadok
@@ -40,7 +40,7 @@
  *
  *      %W% (Berkeley) %G%
  *
- * Id: amq_subr.c,v 1.3 1999/01/10 21:53:43 ezk Exp 
+ * Id: amq_subr.c,v 1.5 1999/08/24 21:31:06 ezk Exp 
  *
  */
 /*
@@ -189,7 +189,7 @@
     return(0);                 /* assume security is therefore not OK */
   }
 
-  if (ntohs(sin->sin_port) >= 1024 ||
+  if (ntohs(sin->sin_port) >= IPPORT_RESERVED ||
       !(sin->sin_addr.s_addr == htonl(0x7f000001) ||
        sin->sin_addr.s_addr == myipaddr.s_addr)) {
     char dq[20];
@@ -206,11 +206,24 @@
 int *
 amqproc_mount_1_svc(voidp argp, struct svc_req *rqstp)
 {
-  static int rc;
-  char *s = *(amq_string *) argp;
+  static int rc = EINVAL;
+  char s[AMQ_STRLEN];
   char *cp;
+  char dq[20];
+  struct sockaddr_in *sin;
 
-  plog(XLOG_INFO, "amq requested mount of %s", s);
+  if ((sin = amu_svc_getcaller(rqstp->rq_xprt)) == NULL) {
+    plog(XLOG_ERROR, "amu_svc_getcaller returned NULL");
+    return &rc;
+  }
+
+  strncpy(s, *(amq_string *) argp, AMQ_STRLEN-1);
+  s[AMQ_STRLEN-1] = '\0';      /* null terminate, to be sure */
+  plog(XLOG_ERROR,
+       "amq requested mount of %s from %s.%d",
+       s, inet_dquad(dq, sin->sin_addr.s_addr),
+       ntohs(sin->sin_port));
+
   /*
    * Minimalist security check.
    */
@@ -242,21 +255,7 @@
     return 0;
   return &rc;
 }
-
-#else /* not ENABLE_AMQ_MOUNT */
-
-int *
-amqproc_mount_1_svc(voidp argp, struct svc_req *rqstp)
-{
-  static int rc;
-  char *s = *(amq_string *) argp;
-
-  plog(XLOG_ERROR, "amq requested mount of %s, but code is disabled", s);
-
-  rc = EINVAL;
-  return &rc;
-}
-#endif /* not ENABLE_AMQ_MOUNT */
+#endif /* ENABLE_AMQ_MOUNT */
 
 
 amq_string *
diff -r c59f7f98834a -r 4ae757f90518 usr.sbin/amd/amd/amq_svc.c
--- a/usr.sbin/amd/amd/amq_svc.c        Sat Sep 04 22:26:21 1999 +0000
+++ b/usr.sbin/amd/amd/amq_svc.c        Sat Sep 04 22:38:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amq_svc.c,v 1.7 1999/02/01 19:05:09 christos Exp $     */
+/*     $NetBSD: amq_svc.c,v 1.8 1999/09/04 22:38:17 christos Exp $     */
 
 /*
  * Copyright (c) 1997-1999 Erez Zadok
@@ -40,7 +40,7 @@
  *
  *      %W% (Berkeley) %G%
  *
- * Id: amq_svc.c,v 1.2 1999/01/10 21:53:44 ezk Exp 
+ * Id: amq_svc.c,v 1.3 1999/08/24 21:31:06 ezk Exp 
  *
  */
 
@@ -61,7 +61,9 @@
     amq_string amqproc_mnttree_1_arg;
     amq_string amqproc_umnt_1_arg;
     amq_setopt amqproc_setopt_1_arg;
+#ifdef ENABLE_AMQ_MOUNT
     amq_string amqproc_mount_1_arg;
+#endif /* ENABLE_AMQ_MOUNT */
   } argument;
   char *result;
   xdrproc_t xdr_argument, xdr_result;
@@ -111,11 +113,13 @@
     local = (amqsvcproc_t) amqproc_getmntfs_1_svc;
     break;
 
+#ifdef ENABLE_AMQ_MOUNT
   case AMQPROC_MOUNT:
     xdr_argument = (xdrproc_t) xdr_amq_string;
     xdr_result = (xdrproc_t) xdr_int;
     local = (amqsvcproc_t) amqproc_mount_1_svc;
     break;
+#endif /* ENABLE_AMQ_MOUNT */
 
   case AMQPROC_GETVERS:
     xdr_argument = (xdrproc_t) xdr_void;
diff -r c59f7f98834a -r 4ae757f90518 usr.sbin/amd/amd/conf.c
--- a/usr.sbin/amd/amd/conf.c   Sat Sep 04 22:26:21 1999 +0000
+++ b/usr.sbin/amd/amd/conf.c   Sat Sep 04 22:38:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.c,v 1.6 1999/02/01 19:05:09 christos Exp $        */
+/*     $NetBSD: conf.c,v 1.7 1999/09/04 22:38:17 christos Exp $        */
 
 /*
  * Copyright (c) 1997-1999 Erez Zadok
@@ -40,7 +40,7 @@
  *
  *      %W% (Berkeley) %G%
  *
- * Id: conf.c,v 1.3 1999/01/10 21:53:44 ezk Exp 
+ * Id: conf.c,v 1.4 1999/02/04 07:24:15 ezk Exp 
  *
  */
 
@@ -552,6 +552,7 @@
   if (STREQ(val, "autofs")) {
 #ifdef HAVE_FS_AUTOFS
     gopt.flags |= CFM_MOUNT_TYPE_AUTOFS;
+    amd_use_autofs++;
     return 0;
 #else /* not HAVE_FS_AUTOFS */
     fprintf(stderr, "conf: no autofs support available\n");
@@ -869,6 +870,7 @@
   if (STREQ(val, "autofs")) {
 #ifdef HAVE_FS_AUTOFS
     cfm->cfm_flags |= CFM_MOUNT_TYPE_AUTOFS;
+    amd_use_autofs++;
     return 0;
 #else /* not HAVE_FS_AUTOFS */
     fprintf(stderr, "conf: no autofs support available\n");
diff -r c59f7f98834a -r 4ae757f90518 usr.sbin/amd/amd/conf_parse.y
--- a/usr.sbin/amd/amd/conf_parse.y     Sat Sep 04 22:26:21 1999 +0000
+++ b/usr.sbin/amd/amd/conf_parse.y     Sat Sep 04 22:38:15 1999 +0000
@@ -38,12 +38,12 @@
  *
  *     %W% (Berkeley) %G%
  *
- * Id: conf_parse.y,v 1.2 1999/01/10 21:53:44 ezk Exp 
+ * Id: conf_parse.y,v 1.3 1999/04/16 14:20:59 ezk Exp 
  *
  */
 
 %{
-/*     $NetBSD: conf_parse.y,v 1.5 1999/02/01 19:05:10 christos Exp $  */
+/*     $NetBSD: conf_parse.y,v 1.6 1999/09/04 22:38:17 christos Exp $  */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -51,6 +51,22 @@
 #include <am_defs.h>
 #include <amd.h>
 
+/* AIX requires this to be the first thing in the file. */



Home | Main Index | Thread Index | Old Index