From 17fd16762bdc1a9de3ee0a11984b0481407c5cd1 Mon Sep 17 00:00:00 2001 From: dogcow Date: Fri, 16 Jun 2000 02:10:12 +0000 Subject: [PATCH] pull up christos's amd patches that didn't make it into 6.0.3 (derived from diff'ing am-utils 6.0.1s10 and basesrc/usr.sbin/amd) --- dist/am-utils/amd/amq_subr.c | 25 +++++++++++++++++++++++-- dist/am-utils/amd/srvr_nfs.c | 12 ++++++++++-- dist/am-utils/fsinfo/fsinfo.c | 6 +++--- dist/am-utils/include/amq_defs.h | 4 ++-- dist/am-utils/libamu/wire.c | 7 ++++--- 5 files changed, 42 insertions(+), 12 deletions(-) diff --git a/dist/am-utils/amd/amq_subr.c b/dist/am-utils/amd/amq_subr.c index 0da594e245b9..985def702691 100644 --- a/dist/am-utils/amd/amq_subr.c +++ b/dist/am-utils/amd/amq_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: amq_subr.c,v 1.1.1.1 2000/06/07 00:52:22 dogcow Exp $ */ +/* $NetBSD: amq_subr.c,v 1.2 2000/06/16 02:10:12 dogcow Exp $ */ /* * Copyright (c) 1997-2000 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -254,7 +254,28 @@ amqproc_mount_1_svc(voidp argp, struct svc_req *rqstp) return 0; return &rc; } -#endif /* ENABLE_AMQ_MOUNT */ +#else /* not ENABLE_AMQ_MOUNT */ + +int * +amqproc_mount_1_svc(voidp argp, struct svc_req *rqstp) +{ + static int rc = EINVAL; + char *s = *(amq_string *) argp; + char dq[20]; + struct sockaddr_in *sin; + + if ((sin = amu_svc_getcaller(rqstp->rq_xprt)) == NULL) { + plog(XLOG_ERROR, "amu_svc_getcaller returned NULL"); + return &rc; + } + plog(XLOG_ERROR, + "amq requested mount of %s from %s.%d, but code is disabled", + s, inet_dquad(dq, sin->sin_addr.s_addr), + ntohs(sin->sin_port)); + + return &rc; +} +#endif /* not ENABLE_AMQ_MOUNT */ amq_string * diff --git a/dist/am-utils/amd/srvr_nfs.c b/dist/am-utils/amd/srvr_nfs.c index 687ff98d1948..405ae7726a35 100644 --- a/dist/am-utils/amd/srvr_nfs.c +++ b/dist/am-utils/amd/srvr_nfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: srvr_nfs.c,v 1.1.1.1 2000/06/07 00:52:22 dogcow Exp $ */ +/* $NetBSD: srvr_nfs.c,v 1.2 2000/06/16 02:10:12 dogcow Exp $ */ /* * Copyright (c) 1997-2000 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -95,7 +95,7 @@ static char ping_buf[sizeof(struct rpc_msg) + 32]; #if defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3) /* protocols we know about, in order of preference */ -static char *protocols[] = { "tcp", "udp", NULL }; +static char *protocols[] = { "udp", "tcp", NULL }; #endif /* defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3) */ /* forward definitions */ @@ -756,6 +756,14 @@ find_nfs_srvr(mntfs *mf) if (!nfs_proto) nfs_proto = "udp"; + if (ip) { + /* + * XXX RPC or SunOS 4.1.4 bug ? the last call to nfs_get_version() must + * be done with the used version and proto + */ + (void)get_nfs_version(host, ip, nfs_version, nfs_proto); + } + plog(XLOG_INFO, "Using NFS version %d, protocol %s on host %s", (int) nfs_version, nfs_proto, host); diff --git a/dist/am-utils/fsinfo/fsinfo.c b/dist/am-utils/fsinfo/fsinfo.c index 7fa330b0510b..55ed5e119a8e 100644 --- a/dist/am-utils/fsinfo/fsinfo.c +++ b/dist/am-utils/fsinfo/fsinfo.c @@ -1,4 +1,4 @@ -/* $NetBSD: fsinfo.c,v 1.1.1.1 2000/06/07 00:52:23 dogcow Exp $ */ +/* $NetBSD: fsinfo.c,v 1.2 2000/06/16 02:10:13 dogcow Exp $ */ /* * Copyright (c) 1997-2000 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry @@ -197,7 +197,7 @@ Usage: %s [-v] [-a autodir] [-h hostname] [-b bootparams] [-d dumpsets]\n\ static char * find_username(void) { - char *u = getlogin(); + const char *u = getlogin(); if (!u) { struct passwd *pw = getpwuid(getuid()); @@ -234,7 +234,7 @@ main(int argc, char *argv[]) perror("gethostname"); exit(1); } - + hostname[sizeof(hostname) - 1] = '\0'; /* * Get the username */ diff --git a/dist/am-utils/include/amq_defs.h b/dist/am-utils/include/amq_defs.h index 5398a3b72e66..048b761e2903 100644 --- a/dist/am-utils/include/amq_defs.h +++ b/dist/am-utils/include/amq_defs.h @@ -1,4 +1,4 @@ -/* $NetBSD: amq_defs.h,v 1.1.1.1 2000/06/07 00:52:21 dogcow Exp $ */ +/* $NetBSD: amq_defs.h,v 1.2 2000/06/16 02:10:13 dogcow Exp $ */ /* * Copyright (c) 1997-2000 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -52,7 +52,7 @@ #ifndef AMQ_SIZE # define AMQ_SIZE 16384 #endif /* not AMQ_SIZE */ -#define AMQ_STRLEN 2048 +#define AMQ_STRLEN 10240 #define AMQ_PROGRAM ((u_long)300019) #define AMQ_VERSION ((u_long)1) #define AMQPROC_NULL ((u_long)0) diff --git a/dist/am-utils/libamu/wire.c b/dist/am-utils/libamu/wire.c index 0e07de45de01..446e143984af 100644 --- a/dist/am-utils/libamu/wire.c +++ b/dist/am-utils/libamu/wire.c @@ -1,4 +1,4 @@ -/* $NetBSD: wire.c,v 1.1.1.1 2000/06/07 00:52:22 dogcow Exp $ */ +/* $NetBSD: wire.c,v 1.2 2000/06/16 02:10:13 dogcow Exp $ */ /* * Copyright (c) 1997-2000 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -377,7 +377,7 @@ void getwire(char **name1, char **number1) { struct ifconf ifc; - struct ifreq *ifr; + struct ifreq *ifr, ifrpool; caddr_t cp, cplim; int fd = -1; u_long address; @@ -432,7 +432,8 @@ getwire(char **name1, char **number1) * Scan the list looking for a suitable interface */ for (cp = buf; cp < cplim; /* increment in the loop body */) { - ifr = (struct ifreq *) cp; + memcpy(&ifrpool, cp, sizeof(ifrpool)); + ifr = &ifrpool; cp += SIZE(ifr); if (ifr->ifr_addr.sa_family != AF_INET)