summaryrefslogtreecommitdiff
path: root/usr.sbin/amd
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-10-20 06:56:00 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-10-20 06:56:00 +0000
commit6c64990bce02698d460b3cfc5c02c279a0cd2c7b (patch)
treea83281aa42835e9213766e3a98c23d651bbb3f8f /usr.sbin/amd
parent5b0ea22ec23a09546632ef762e4b678f12d4449c (diff)
Change MTAB_TYPE_UFS from "ufs" to "ffs", fixing mount-restarting for them.
Perform one level of expansion on the various "portability" macros from os-*.h Delete support for Hesiod and the pre-4.4 versions of the NFS API Delete the no-op unlock_mntlist() unifdef -UFASCIST_DF_COMMAND -UMOUNT_HELPER_SOURCE Move the struct mntent and MNTMAXSTR definitions into include/am.h Move the commented-out -DHAS_NDBM_MAPS into amd/Makefile Expand OS_REP to "bsd44". With config/* empty, delete them. "lot of stuff...but I know your process on this" deraadt@
Diffstat (limited to 'usr.sbin/amd')
-rw-r--r--usr.sbin/amd/amd/Makefile14
-rw-r--r--usr.sbin/amd/amd/afs_ops.c36
-rw-r--r--usr.sbin/amd/amd/amd.c4
-rw-r--r--usr.sbin/amd/amd/host_ops.c14
-rw-r--r--usr.sbin/amd/amd/info_hes.c681
-rw-r--r--usr.sbin/amd/amd/mapc.c17
-rw-r--r--usr.sbin/amd/amd/mount_fs.c65
-rw-r--r--usr.sbin/amd/amd/mtab.c7
-rw-r--r--usr.sbin/amd/amd/nfs_ops.c43
-rw-r--r--usr.sbin/amd/amd/opts.c4
-rw-r--r--usr.sbin/amd/amd/restart.c8
-rw-r--r--usr.sbin/amd/amd/ufs_ops.c15
-rw-r--r--usr.sbin/amd/amq/Makefile5
-rw-r--r--usr.sbin/amd/config/Makefile.config59
-rw-r--r--usr.sbin/amd/config/RELEASE1
-rw-r--r--usr.sbin/amd/config/os-bsd44.h106
-rw-r--r--usr.sbin/amd/config/os-defaults.h77
-rw-r--r--usr.sbin/amd/include/am.h28
-rw-r--r--usr.sbin/amd/include/config.h9
19 files changed, 76 insertions, 1117 deletions
diff --git a/usr.sbin/amd/amd/Makefile b/usr.sbin/amd/amd/Makefile
index 311f13caf90..df67837d557 100644
--- a/usr.sbin/amd/amd/Makefile
+++ b/usr.sbin/amd/amd/Makefile
@@ -1,12 +1,10 @@
-# $OpenBSD: Makefile,v 1.5 2014/10/20 00:20:04 guenther Exp $
+# $OpenBSD: Makefile,v 1.6 2014/10/20 06:55:59 guenther Exp $
# from: @(#)Makefile 8.2 (Berkeley) 4/22/94
-.include "../config/Makefile.config"
-
PROG= amd
MAN= amd.8
SRCS= afs_ops.c am_ops.c clock.c util.c xutil.c \
- efs_ops.c mapc.c info_file.c info_hes.c \
+ efs_ops.c mapc.c info_file.c \
info_ndbm.c info_passwd.c info_nis.c \
info_union.c map.c srvr_afs.c srvr_nfs.c \
mntfs.c misc_rpc.c mount_fs.c mount_xdr.c \
@@ -16,12 +14,12 @@ SRCS= afs_ops.c am_ops.c clock.c util.c xutil.c \
amq_subr.c umount_fs.c host_ops.c nfsx_ops.c \
ufs_ops.c ifs_ops.c amd.c get_args.c restart.c wire.c
CFLAGS+=-I${.CURDIR}/../rpcx
-CFLAGS+=-I${.CURDIR}/../config
CFLAGS+=-I${.CURDIR}/../include
CFLAGS+=-DARCH_REP=\"${MACHINE}\"
-CFLAGS+=-DOS_REP=\"${OS}\"
-CFLAGS+=${CONFIG}
-.PATH: ${.CURDIR}/../rpcx ${.CURDIR}/../config
+# Include support for ndbm.
+#CFLAGS+=-DHAS_NDBM_MAPS
+
+.PATH: ${.CURDIR}/../rpcx
.include "../../Makefile.inc"
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/amd/afs_ops.c b/usr.sbin/amd/amd/afs_ops.c
index 1e45685c040..fc54997ebd6 100644
--- a/usr.sbin/amd/amd/afs_ops.c
+++ b/usr.sbin/amd/amd/afs_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: afs_ops.c,v 1.13 2014/10/20 02:33:42 guenther Exp $ */
+/* $OpenBSD: afs_ops.c,v 1.14 2014/10/20 06:55:59 guenther Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -42,14 +42,8 @@
#define NFSCLIENT
#include <unistd.h>
-
#include <sys/stat.h>
-#ifdef NFS_3
-typedef nfs_fh fhandle_t;
-#endif /* NFS_3 */
-#ifdef NFS_HDR
-#include NFS_HDR
-#endif /* NFS_HDR */
+
#include "mount.h"
/*
@@ -112,13 +106,13 @@ mount_toplvl(char *dir, char *opts)
nfs_fh *fhp;
char fs_hostname[MAXHOSTNAMELEN+MAXPATHLEN+1];
- MTYPE_TYPE type = MOUNT_TYPE_NFS;
+ const char *type = MOUNT_NFS;
bzero((void *)&nfs_args, sizeof(nfs_args)); /* Paranoid */
mnt.mnt_dir = dir;
mnt.mnt_fsname = pid_fsname;
- mnt.mnt_type = MNTTYPE_AUTO;
+ mnt.mnt_type = "auto"; /* fake type */
mnt.mnt_opts = opts;
mnt.mnt_freq = 0;
mnt.mnt_passno = 0;
@@ -136,9 +130,9 @@ mount_toplvl(char *dir, char *opts)
return EINVAL;
}
+ nfs_args.fh = (void *)fhp;
nfs_args.fhsize = NFSX_V2FH;
nfs_args.version = NFS_ARGSVERSION;
- NFS_FH_DREF(nfs_args.fh, (NFS_FH_TYPE) fhp);
/*
* Create sockaddr to point to the local machine. 127.0.0.1
@@ -158,7 +152,10 @@ mount_toplvl(char *dir, char *opts)
/*
* set mount args
*/
- NFS_SA_DREF(nfs_args, &sin);
+ nfs_args.addr = (struct sockaddr *)&sin;
+ nfs_args.addrlen = sizeof sin;
+ nfs_args.sotype = SOCK_DGRAM;
+ nfs_args.proto = 0;
/*
* Make a ``hostname'' string for the kernel
@@ -169,7 +166,6 @@ mount_toplvl(char *dir, char *opts)
snprintf(fs_hostname, sizeof(fs_hostname), "amd:%ld",
foreground ? (long)mypid : (long)getppid());
nfs_args.hostname = fs_hostname;
- nfs_args.flags |= NFSMNT_HOSTNAME;
#ifdef HOSTNAMESZ
/*
* Most kernels have a name length restriction.
@@ -210,13 +206,11 @@ mount_toplvl(char *dir, char *opts)
/*
* These two are constructed internally by the calling routine
*/
- if (hasmntopt(&mnt, MNTOPT_SOFT) != NULL)
+ if (hasmntopt(&mnt, "soft") != NULL)
nfs_args.flags |= NFSMNT_SOFT;
-#ifdef MNTOPT_INTR
- if (hasmntopt(&mnt, MNTOPT_INTR) != NULL)
+ if (hasmntopt(&mnt, "intr") != NULL)
nfs_args.flags |= NFSMNT_INT;
-#endif /* MNTOPT_INTR */
flags = compute_mount_flags(&mnt);
return mount_fs(&mnt, flags, (caddr_t) &nfs_args, retry, type);
@@ -347,12 +341,8 @@ toplvl_mount(am_node *mp)
* Construct some mount options
*/
snprintf(opts, sizeof(opts),
-#ifdef MNTOPT_INTR
"%s,%s,%s=%d,%s=%d,%s=%d,%s",
- MNTOPT_INTR,
-#else
- "%s,%s=%d,%s=%d,%s=%d,%s",
-#endif /* MNTOPT_INTR */
+ "intr",
"rw",
"port", nfs_port,
"timeo", afs_timeo,
@@ -463,7 +453,7 @@ again:
dlog("lstat(%s): %m", mp->am_path);
#endif /* DEBUG */
}
- error = UMOUNT_FS(mp->am_path);
+ error = umount_fs(mp->am_path);
if (error == EBUSY) {
plog(XLOG_WARNING, "afs_unmount retrying %s in 1s", mp->am_path);
sleep(1); /* XXX */
diff --git a/usr.sbin/amd/amd/amd.c b/usr.sbin/amd/amd/amd.c
index 3e990cd7c18..8e77b3063c8 100644
--- a/usr.sbin/amd/amd/amd.c
+++ b/usr.sbin/amd/amd/amd.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)amd.c 8.1 (Berkeley) 6/6/93
- * $Id: amd.c,v 1.19 2014/10/20 02:33:42 guenther Exp $
+ * $Id: amd.c,v 1.20 2014/10/20 06:55:59 guenther Exp $
*/
/*
@@ -70,7 +70,7 @@ char *auto_dir = "/tmp_mnt";
char *hostdomain = "unknown.domain";
char hostname[MAXHOSTNAMELEN] = "localhost"; /* Hostname */
char hostd[2*MAXHOSTNAMELEN]; /* Host+domain */
-char *op_sys = OS_REP; /* Name of current op_sys */
+char *op_sys = "bsd44"; /* Name of current op_sys */
char *arch = ARCH_REP; /* Name of current architecture */
char *endian = ARCH_ENDIAN; /* Big or Little endian */
char *wire;
diff --git a/usr.sbin/amd/amd/host_ops.c b/usr.sbin/amd/amd/host_ops.c
index e797ddc919f..4d8385bf2ba 100644
--- a/usr.sbin/amd/amd/host_ops.c
+++ b/usr.sbin/amd/amd/host_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: host_ops.c,v 1.14 2014/10/20 02:33:42 guenther Exp $ */
+/* $OpenBSD: host_ops.c,v 1.15 2014/10/20 06:55:59 guenther Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -238,11 +238,6 @@ host_fmount(mntfs *mf)
mlist = read_mtab(mf->mf_mount);
/*
- * Unlock the mount list
- */
- unlock_mntlist();
-
- /*
* Take a copy of the server address
*/
sin = *mf->mf_server->fs_ip;
@@ -414,11 +409,6 @@ host_fumount(mntfs *mf)
mntlist *mlist = read_mtab(mf->mf_mount);
/*
- * Unlock the mount list
- */
- unlock_mntlist();
-
- /*
* Reverse list...
*/
ml = mlist;
@@ -444,7 +434,7 @@ host_fumount(mntfs *mf)
/*
* Unmount "dir"
*/
- error = UMOUNT_FS(dir);
+ error = umount_fs(dir);
/*
* Keep track of errors
*/
diff --git a/usr.sbin/amd/amd/info_hes.c b/usr.sbin/amd/amd/info_hes.c
deleted file mode 100644
index 5561614866a..00000000000
--- a/usr.sbin/amd/amd/info_hes.c
+++ /dev/null
@@ -1,681 +0,0 @@
-/*
- * Copyright (c) 1989 Jan-Simon Pendry
- * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry at Imperial College, London.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)info_hes.c 8.1 (Berkeley) 6/6/93
- * $Id: info_hes.c,v 1.13 2012/02/24 06:19:00 guenther Exp $
- */
-
-/*
- * Get info from Hesiod
- *
- * Zone transfer code from Bruce Cole <cole@cs.wisc.edu>
- */
-
-#include "am.h"
-
-#ifdef HAS_HESIOD_MAPS
-#include <hesiod.h>
-
-#define HES_PREFIX "hesiod."
-#define HES_PREFLEN 7
-
-#ifdef HAS_HESIOD_RELOAD
-#include <arpa/nameser.h>
-#include <resolv.h>
-#include <sys/uio.h>
-#include <netdb.h>
-
-/*
- * Patch up broken system include files
- */
-#ifndef C_HS
-#define C_HS 4
-#endif
-#ifndef T_TXT
-#define T_TXT 16
-#endif
-
-static int soacnt;
-static struct timeval hs_timeout;
-static int servernum;
-#endif /* HAS_HESIOD_RELOAD */
-
-/*
- * No easy way to probe the server - check the map name begins with "hesiod."
- */
-int
-hesiod_init(char *map, time_t *tp)
-{
-#ifdef DEBUG
- dlog("hesiod_init(%s)", map);
-#endif
- *tp = 0;
- return strncmp(map, HES_PREFIX, HES_PREFLEN) == 0 ? 0 : ENOENT;
-}
-
-
-/*
- * Make Hesiod name. Skip past the "hesiod."
- * at the start of the map name and append
- * ".automount". The net effect is that a lookup
- * of /defaults in hesiod.home will result in a
- * call to hes_resolve("/defaults", "home.automount");
- */
-#ifdef notdef
-#define MAKE_HES_NAME(dest, src) snprintf(dest, sizeof(dest), \
- "%s%s", src + HES_PREFLEN, ".automount")
-#endif
-
-/*
- * Do a Hesiod nameserver call.
- * Modify time is ignored by Hesiod - XXX
- */
-int
-hesiod_search(mnt_map *m, char *map, char **pval, time_t *tp)
-{
- int error;
- char hes_key[MAXPATHLEN];
- char **rvec;
-
-#ifdef DEBUG
- dlog("hesiod_search(m=%x, map=%s, key=%s, pval=%x tp=%x)",
- m, map, key, pval, tp);
-#endif
- /*MAKE_HES_NAME(hes_map, map);*/
- snprintf(hes_key, sizeof(hes_key), "%s.%s", key, map+HES_PREFLEN);
-
- /*
- * Call the resolver
- */
-#ifdef DEBUG
- dlog("hesiod_search: hes_resolve(%s, %s)", hes_key, "automount");
-#ifdef HAS_HESIOD_RELOAD
- if (debug_flags & D_FULL)
- _res.options |= RES_DEBUG;
-#endif
-#endif
- rvec = hes_resolve(hes_key, "automount");
- /*
- * If a reply was forthcoming then return
- * it (and free subsequent replies)
- */
- if (rvec && *rvec) {
- *pval = *rvec;
- while (*++rvec)
- free(*rvec);
- return 0;
- }
-
- /*
- * Otherwise reflect the hesiod error into a Un*x error
- */
-#ifdef DEBUG
- dlog("hesiod_search: Error: %d", hes_error());
-#endif
- switch (hes_error()) {
- case HES_ER_NOTFOUND: error = ENOENT; break;
- case HES_ER_CONFIG: error = EIO; break;
- case HES_ER_NET: error = ETIMEDOUT; break;
- default: error = EINVAL; break;
- }
-#ifdef DEBUG
- dlog("hesiod_search: Returning: %d", error);
-#endif
- return error;
-}
-
-#ifdef HAS_HESIOD_RELOAD
-/*
- * Zone transfer...
- */
-
-#define MAXHSNS 8
-#define MAX_NSADDR 16
-
-static char *hs_domain;
-static mnt_map *hs_map;
-static int hs_nscount;
-static char nsaddr_list[MAX_NSADDR][sizeof(struct in_addr)];
-
-int
-hesiod_reload(mnt_map *m, char *map, void (*fn)())
-{
- char *zone_name, *cp;
- short domainlen;
- int status;
-
-#ifdef DEBUG
- dlog("hesiod_reload (%x %s %x)", m, map, fn);
-#endif /* DEBUG */
- if (status = res_init()) {
-#ifdef DEBUG
- dlog("hesiod_reload: res_init failed with %d", status);
-#endif
- return(status);
- }
- _res.retrans = 90;
- hs_map = m;
- domainlen = strlen(hostdomain);
- zone_name = hes_to_bind(map+HES_PREFLEN, "automount");
- if (*zone_name == '.')
- zone_name++;
- hs_domain = zone_name;
- /* Traverse the DNS tree until we find an SOA we can transfer from.
- (Our initial zone_name is likely to just be a subtree of a
- real zone). */
- do {
- /* If we can't find any NS records, go up a level in the
- DNS tree */
- if (hs_get_ns_list(zone_name) == 0 &&
- hs_zone_transfer(zone_name) == 0)
- return(0);
- /* Move up DNS tree by one component */
- if (cp = strchr(zone_name, '.'))
- zone_name = ++cp;
- else
- break;
- } while (strlen(zone_name) >= domainlen);
-#ifdef DEBUG
- dlog("hesiod_reload: Giving up on %s", hs_domain);
-#endif
- return(-1);
-}
-
-int
-hs_zone_transfer(char *domain)
-{
- int status, len;
- char buf[PACKETSZ];
- /* Want to make sure ansbuf is well alligned */
- u_int32_t ansbuf[PACKETSZ/sizeof(u_int32_t)];
-
-#ifdef DEBUG
- dlog("hs_zone_transfer (%s)", domain);
-#endif
- if ((len = res_mkquery(QUERY, domain, C_HS, T_AXFR,
- (char *)NULL, 0, NULL, buf, PACKETSZ)) == -1) {
-#ifdef DEBUG
- dlog("hs_zone_transfer: res_mkquery failed");
-#endif
- errno = 0;
- return(-1);
- }
- if ((status = hs_res_send(buf, len, (char *)ansbuf, PACKETSZ)) == -1) {
-#ifdef DEBUG
- dlog("hs_zone_transfer: hs_res_send failed. status %d errno %d",
- status, errno);
-#endif
- errno = 0;
- return(-1);
- }
- return(0);
-}
-
-#define hs_server_addr(ns) ((struct in_addr *) nsaddr_list[ns])
-
-int
-hs_res_send(char *buf, int buflen, char *answer, int anslen)
-{
- int retry, ns;
- u_short id, len;
- HEADER *hp = (HEADER *) buf;
- struct iovec iov[2];
- static int s = -1;
- int status;
- struct sockaddr_in server;
-
- soacnt = 0;
- id = hp->id;
- /*
- * Send request, RETRY times, or until successful
- */
- for (retry = _res.retry; retry > 0; retry--) {
- for (ns = 0; ns < hs_nscount; ns++) {
- hs_timeout.tv_sec =
- (_res.retrans << (_res.retry - retry))
- / hs_nscount;
- if (hs_timeout.tv_sec <= 0)
- hs_timeout.tv_sec = 1;
- hs_timeout.tv_usec = 0;
- if (s < 0) {
- s = socket(AF_INET, SOCK_STREAM, 0);
- if (s < 0) {
- continue;
- }
- servernum = ns;
- bcopy(hs_server_addr(ns), &server.sin_addr,
- sizeof(struct in_addr));
- server.sin_family = AF_INET;
- server.sin_port = htons(NAMESERVER_PORT);
-
- if (connect(s, &server,
- sizeof(struct sockaddr)) < 0) {
- (void) close(s);
- s = -1;
- continue;
- }
- }
- /*
- * Send length & message
- */
- len = htons((u_short)buflen);
- iov[0].iov_base = (caddr_t)&len;
- iov[0].iov_len = sizeof(len);
- iov[1].iov_base = buf;
- iov[1].iov_len = buflen;
- if (writev(s, iov, 2) != sizeof(len) + buflen) {
- (void) close(s);
- s = -1;
- continue;
- }
- status = 0;
- while (s != -1 && soacnt < 2 && status != -2) {
- if ((status =
- hs_readresp(s, answer, anslen)) == -1) {
- (void) close(s);
- s = -1;
- continue;
- }
- }
- if (status == -2) {
- /* There was a permanent error transferring
- * this zone. Give up. */
- if (s != -1) {
- (void) close(s);
- s = -1;
- }
- return(-1);
- }
- if (s == -1)
- continue;
- return (0);
- }
- }
- if (errno == 0)
- errno = ETIMEDOUT;
- return (-1);
-}
-
-/* Returns:
- 0: Success
- -1: Error
- -2: Permanent failure
-*/
-int
-hs_readresp(int s, char *answer, int anslen)
-{
- int len, n;
- char *cp;
-
- cp = answer;
- len = sizeof(short);
- while (len != 0 &&
- (n = hs_res_vcread(s, (char *)cp, (int)len, &hs_timeout)) > 0) {
- cp += n;
- len -= n;
- }
- if (n <= 0)
- return(-1);
- cp = answer;
- if ((len = _getshort(cp)) > anslen) {
-#ifdef DEBUG
- dlog("hs_readresp: response too long: %d", len);
-#endif
- return(-1);
- }
- while (len != 0 &&
- (n = hs_res_vcread(s, (char *)cp, (int)len, &hs_timeout)) > 0) {
- cp += n;
- len -= n;
- }
- if (n <= 0)
- return(-1);
- return(hs_parse(answer, answer+PACKETSZ));
-}
-
-int
-hs_res_vcread(int sock, char *buf, int buflen, struct timeval *timeout)
-{
- int n;
-
- if ((n = hs_res_selwait(sock, timeout)) > 0)
- return(read(sock, buf, buflen));
- else
- return(n);
-}
-
-int
-hs_res_selwait(int sock, struct timeval timeout)
-{
- fd_set *fdsp;
- int fdsn;
- int n;
-
- /*
- * Wait for reply
- */
- fdsn = howmany(sock+1, NFDBITS) * sizeof(fd_mask);
- if ((fdsp = (fd_set *)malloc(fdsn)) == NULL)
- return(0);
- memset(fdsp, 0, fdsn);
-
- FD_SET(sock, fdsp);
- n = select(sock+1, fdsp, NULL, NULL, timeout);
- free(fdsp);
- return(n);
-}
-
-/* Returns:
- 0: Success
- -1: Error
- -2: Permanent failure
-*/
-int
-hs_parse(char *msg, char *eom)
-{
- char *cp;
- HEADER *hp;
- int n, len;
- int qdcount, ancount;
- char key[PACKETSZ];
- char *key_cpy, *value, *hs_make_value();
- int16_t type;
-
- hp = (HEADER *)msg;
- if (hp->rcode != NOERROR || hp->opcode != QUERY) {
- char dq[20];
-#ifdef DEBUG
- dlog("Bad response (%d) from nameserver %s",
- hp->rcode, inet_dquad(dq, sizeof(dq),
- hs_server_addr(servernum)->s_addr));
-#endif /* DEBUG */
- return(-1);
- }
- cp = msg + sizeof(HEADER);
- ancount = ntohs(hp->ancount);
- qdcount = ntohs(hp->qdcount);
- while (qdcount-- > 0)
- cp += dn_skipname(cp, eom) + QFIXEDSZ;
- if (soacnt == 0 && ancount == 0) {
- /* XXX We should look for NS records to find SOA */
-#ifdef DEBUG
- dlog("No SOA found");
-#endif
- return(-2);
- }
- while (ancount-- > 0 && cp < eom) {
- if ((n = dn_expand(msg, eom, cp, key, PACKETSZ)) < 0)
- break;
- cp += n;
- if ((type = _getshort(cp)) == T_SOA) {
- soacnt++;
- }
- cp += 2*sizeof(u_int16_t) + sizeof(u_int32_t);
- len = _getshort(cp);
- cp += sizeof(u_int16_t);
- /* Check to see if key is in our domain */
- if (type == T_TXT && hs_strip_our_domain(key)) {
- value = hs_make_value(cp, len);
- if (value == NULL)
- return(-1);
- key_cpy = strdup(key);
-#ifdef DEBUG
- dlog("hs_parse: Parsed key: %s, value: %s", key,
- value);
-#endif
- mapc_add_kv(hs_map, key_cpy, value);
- }
- cp += len;
- errno = 0;
- }
- return(0);
-}
-
-/* Check to see if the domain name in the supplied argument matches
- hs_domain. Strip hs_domain from supplied argument if so. */
-int
-hs_strip_our_domain(char *name)
-{
- char *end_pos;
- short targ_len, cur_len;
-
- targ_len = strlen(hs_domain);
- cur_len = strlen(name);
- if (cur_len <= targ_len)
- return(0);
- end_pos = &name[cur_len - targ_len];
- if (strcmp(end_pos, hs_domain) != 0)
- return(0);
- if (*--end_pos != '.')
- return(0);
- *end_pos = '\0';
- return(1);
-}
-
-#define MAXDATA 8*1024
-
-char *
-hs_make_value(chr *cp, int len)
-{
- char *value, *cpcpy, *valuep;
- int cnt, nextcnt, totalcnt, lencpy;
-#ifdef DEBUG
- char *dbgname;
-
- dbgname = &cp[1];
-#endif /* DEBUG */
-
- lencpy = len;
- cpcpy = cp;
- totalcnt = 0;
- cnt = *cpcpy++;
- while (cnt) {
- totalcnt += cnt;
- lencpy -= cnt+1;
- if (lencpy == 0)
- break;
- nextcnt = cpcpy[cnt];
- cpcpy = &cpcpy[cnt+1];
- cnt = nextcnt;
- }
- if (totalcnt < 1 || totalcnt > MAXDATA || totalcnt > len) {
-#ifdef DEBUG
- dlog("TXT RR not of expected length (%d %d): %s", totalcnt,
- len, dbgname);
-#endif /* DEBUG */
- return(NULL);
- }
- /* Allocate null terminated string */
- value = (char *) xmalloc(totalcnt+1);
- value[totalcnt] = '\0';
- cnt = *cp++;
- valuep = value;
- while (cnt) {
- bcopy(cp, valuep, cnt);
- len -= cnt+1;
- if (len == 0)
- break;
- valuep = &valuep[cnt];
- nextcnt = cp[cnt];
- cp = &cp[cnt+1];
- cnt = nextcnt;
- }
- return(value);
-}
-
-int
-hs_make_ns_query(char *domain, char *ansbuf)
-{
- int status, len;
- char buf[PACKETSZ];
-
- if ((len = res_mkquery(QUERY, domain, C_HS, T_NS,
- (char *)NULL, 0, NULL, buf, PACKETSZ)) == -1) {
-#ifdef DEBUG
- dlog("hs_get_ns_list: res_mkquery failed");
-#endif
- errno = 0;
- return(-1);
- }
- if ((status = res_send(buf, len, (char *)ansbuf, PACKETSZ)) == -1) {
-#ifdef DEBUG
- dlog("hs_get_ns_list: res_send failed. status %d errno %d",
- status, errno);
-#endif
- errno = 0;
- return(-1);
- }
- return(0);
-}
-
-static void
-add_address(struct in_addr *addr)
-{
- char dq[20];
-
- bcopy((char *)addr, nsaddr_list[hs_nscount++], sizeof(struct in_addr));
-#ifdef DEBUG
- dlog("Adding NS address %s", inet_dquad(dq, sizeof(dq), addr->s_addr));
-#endif /* DEBUG */
-}
-
-int
-hs_get_ns_list(char *domain)
-{
- HEADER *hp;
- int qdcount, nscount;
- char *cp;
- int n, len;
- char key[PACKETSZ], name[PACKETSZ], msg[PACKETSZ], *eom;
- u_int32_t **hptr;
- struct hostent *ghp;
- int numns;
- char nsname[MAXHSNS][MAXDATA];
- int nshaveaddr[MAXHSNS], i;
- short type;
-
- if (hs_make_ns_query(domain, msg) == -1)
- return(-1);
- numns = hs_nscount = 0;
- eom = &msg[PACKETSZ];
- bzero(nsname, sizeof(nsname));
- hp = (HEADER *)msg;
- if (hp->rcode != NOERROR || hp->opcode != QUERY) {
-#ifdef DEBUG
- dlog("Bad response (%d) from nameserver %#x", hp->rcode,
- hs_server_addr(servernum)->s_addr);
-#endif /* DEBUG */
- return(-1);
- }
- cp = msg + sizeof(HEADER);
- qdcount = ntohs(hp->qdcount);
- while (qdcount-- > 0)
- cp += dn_skipname(cp, eom) + QFIXEDSZ;
- nscount = ntohs(hp->ancount) + ntohs(hp->nscount) + ntohs(hp->arcount);
-#ifdef DEBUG
- dlog("hs_get_ns_list: Processing %d response records", nscount);
-#endif
- for (;nscount; nscount--) {
- if ((n = dn_expand(msg, eom, cp, key, PACKETSZ)) < 0)
- break;
- cp += n;
- type = _getshort(cp);
- cp += 2*sizeof(u_short) + sizeof(u_int32_t);
- len = _getshort(cp);
- cp += sizeof(u_short);
-#ifdef DEBUG
- dlog("hs_get_ns_list: Record type: %d", type);
-#endif
- switch (type) {
- case T_NS:
- if (numns >= MAXHSNS || strcasecmp(domain, key) != 0)
- break;
- if ((n = dn_expand(msg, eom, cp, name, PACKETSZ)) < 0)
- break;
-#ifdef DEBUG
- dlog("hs_get_ns_list: NS name: %s", name);
-#endif
- for (i = 0; i < numns; i++)
- if (strcasecmp(nsname[i], name) == 0)
- break;
- if (i == numns) {
-#ifdef DEBUG
- dlog("hs_get_ns_list: Saving name %s", name);
-#endif
- strlcpy(nsname[numns], name,
- sizeof(nsname[numns]));
- nshaveaddr[numns] = 0;
- numns++;
- }
- break;
- case T_A:
- if (hs_nscount == MAX_NSADDR)
- break;
- for (i = 0; i < numns; i++) {
- if (strcasecmp(nsname[i], domain) == 0) {
- nshaveaddr[i]++;
- add_address((struct in_addr *) cp);
- break;
- }
- }
- break;
- default:
- break;
- }
- if (hs_nscount == MAX_NSADDR)
- break;
- cp += len;
- errno = 0;
- }
-#ifdef DEBUG
- dlog("hs_get_ns_list: Found %d NS records", numns);
-#endif
- for (i = 0; i < numns; i++) {
- if (nshaveaddr[i])
- continue;
- if ((ghp = gethostbyname(nsname[i])) == 0)
- continue;
- for (hptr = (in_addr_t **)ghp->h_addr_list;
- *hptr && hs_nscount < MAX_NSADDR; hptr++) {
- add_address((struct in_addr *) *hptr);
- }
- }
- if (hs_nscount)
- return(0);
-#ifdef DEBUG
- dlog("No NS records found for %s", domain);
- return(-1);
-#endif /* DEBUG */
-}
-#endif /* HAS_HESIOD_RELOAD */
-#endif /* HAS_HESIOD_MAPS */
diff --git a/usr.sbin/amd/amd/mapc.c b/usr.sbin/amd/amd/mapc.c
index 869616381f2..671e7d49101 100644
--- a/usr.sbin/amd/amd/mapc.c
+++ b/usr.sbin/amd/amd/mapc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mapc.c,v 1.16 2014/10/20 02:33:42 guenther Exp $ */
+/* $OpenBSD: mapc.c,v 1.17 2014/10/20 06:55:59 guenther Exp $ */
/*-
* Copyright (c) 1989 Jan-Simon Pendry
@@ -175,17 +175,6 @@ extern int ndbm_search(mnt_map *, char *, charo *, char **, time_t *);
extern int passwd_init(char *, time_t *);
extern int passwd_search(mnt_map *, char *, char *, char **, time_t *);
-/* HESIOD MAPS */
-#ifdef HAS_HESIOD_MAPS
-extern int hesiod_init(char *, time_t *);
-#ifdef HAS_HESIOD_RELOAD
-extern int hesiod_reload(mnt_map *, char *, add_fn *);
-#else
-#define hesiod_reload error_reload
-#endif
-extern int hesiod_search(mnt_map *, char *, char *, char **, time_t *);
-#endif /* HAS_HESIOD_MAPS */
-
/* UNION MAPS */
extern int union_init(char *, time_t *);
extern int union_search(mnt_map *, char *, char *, char **, time_t *);
@@ -202,10 +191,6 @@ static map_type maptypes[] = {
{ "passwd", passwd_init, error_reload, passwd_search, error_mtime, MAPC_INC },
-#ifdef HAS_HESIOD_MAPS
- { "hesiod", hesiod_init, hesiod_reload, hesiod_search, error_mtime, MAPC_ALL },
-#endif
-
{ "union", union_init, union_reload, union_search, error_mtime, MAPC_ALL },
{ "nis", nis_init, nis_reload, nis_search, nis_mtime, MAPC_INC },
diff --git a/usr.sbin/amd/amd/mount_fs.c b/usr.sbin/amd/amd/mount_fs.c
index 7a83fb1c7e1..814e7c8d538 100644
--- a/usr.sbin/amd/amd/mount_fs.c
+++ b/usr.sbin/amd/amd/mount_fs.c
@@ -32,13 +32,10 @@
* SUCH DAMAGE.
*
* from: @(#)mount_fs.c 8.1 (Berkeley) 6/6/93
- * $Id: mount_fs.c,v 1.13 2014/10/20 02:33:42 guenther Exp $
+ * $Id: mount_fs.c,v 1.14 2014/10/20 06:55:59 guenther Exp $
*/
#include "am.h"
-#ifdef NFS_3
-typedef nfs_fh fhandle_t;
-#endif /* NFS_3 */
#include <unistd.h>
#include <sys/stat.h>
@@ -48,31 +45,11 @@ typedef nfs_fh fhandle_t;
*/
struct opt_tab mnt_flags[] = {
- { "ro", M_RDONLY },
-#ifdef M_CACHE
- { "nocache", M_NOCACHE },
-#endif /* M_CACHE */
-#ifdef M_GRPID
- { "grpid", M_GRPID },
-#endif /* M_GRPID */
-#ifdef M_MULTI
- { "multi", M_MULTI },
-#endif /* M_MULTI */
-#ifdef M_NODEV
- { "nodev", M_NODEV },
-#endif /* M_NODEV */
-#ifdef M_NOEXEC
- { "noexec", M_NOEXEC },
-#endif /* M_NOEXEC */
-#ifdef M_NOSUB
- { "nosub", M_NOSUB },
-#endif /* M_NOSUB */
-#ifdef M_NOSUID
- { "nosuid", M_NOSUID },
-#endif /* M_NOSUID */
-#ifdef M_SYNC
- { "sync", M_SYNC },
-#endif /* M_SYNC */
+ { "ro", MNT_RDONLY },
+ { "nodev", MNT_NODEV },
+ { "noexec", MNT_NOEXEC },
+ { "nosuid", MNT_NOSUID },
+ { "sync", MNT_SYNCHRONOUS },
{ 0, 0 }
};
@@ -81,11 +58,7 @@ compute_mount_flags(struct mntent *mnt)
{
struct opt_tab *opt;
int flags;
-#ifdef NFS_4
- flags = M_NEWTYPE;
-#else
flags = 0;
-#endif /* NFS_4 */
/*
* Crack basic mount options
@@ -98,39 +71,23 @@ compute_mount_flags(struct mntent *mnt)
int
mount_fs(struct mntent *mnt, int flags, caddr_t mnt_data, int retry,
- MTYPE_TYPE type)
+ const char *type)
{
int error = 0;
#ifdef DEBUG
-#ifdef NFS_4
dlog("%s fstype %s (%s) flags %#x (%s)",
mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts);
-#else
- dlog("%s fstype %d (%s) flags %#x (%s)",
- mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts);
-#endif /* NFS_4 */
#endif /* DEBUG */
/*
* Fake some mount table entries for the automounter
*/
-#ifdef FASCIST_DF_COMMAND
- /*
- * Some systems have a df command which blows up when
- * presented with an unknown mount type.
- */
- if (STREQ(mnt->mnt_type, MNTTYPE_AUTO)) {
- /*
- * Try it with the normal name
- */
- mnt->mnt_type = FASCIST_DF_COMMAND;
- }
-#endif /* FASCIST_DF_COMMAND */
again:
clock_valid = 0;
- error = MOUNT_TRAP(type, mnt, flags, mnt_data);
+ error = mount(type, mnt->mnt_dir, flags, mnt_data);
+
if (error < 0)
plog(XLOG_ERROR, "%s: mount: %m", mnt->mnt_dir);
if (error < 0 && --retry > 0) {
@@ -207,7 +164,3 @@ hasmntopt(struct mntent *mnt, char *opt)
return 0;
}
-
-#ifdef MOUNT_HELPER_SOURCE
-#include MOUNT_HELPER_SOURCE
-#endif /* MOUNT_HELPER_SOURCE */
diff --git a/usr.sbin/amd/amd/mtab.c b/usr.sbin/amd/amd/mtab.c
index 79e9678a948..d9ee081cfb3 100644
--- a/usr.sbin/amd/amd/mtab.c
+++ b/usr.sbin/amd/amd/mtab.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)mtab.c 8.1 (Berkeley) 6/6/93
- * $Id: mtab.c,v 1.6 2014/10/20 00:20:04 guenther Exp $
+ * $Id: mtab.c,v 1.7 2014/10/20 06:55:59 guenther Exp $
*/
#include "am.h"
@@ -73,7 +73,6 @@ void
free_mntlist(mntlist *mp)
{
discard_mntlist(mp);
- unlock_mntlist();
}
/*
@@ -100,12 +99,10 @@ static struct mntent *
mnt_dup(struct statfs *mp)
{
struct mntent *new_mp = ALLOC(mntent);
- char *ty;
new_mp->mnt_fsname = strdup(mp->f_mntfromname);
new_mp->mnt_dir = strdup(mp->f_mntonname);
- ty = mp->f_fstypename;
- new_mp->mnt_type = strdup(ty);
+ new_mp->mnt_type = strdup(mp->f_fstypename);
new_mp->mnt_opts = strdup("unset");
new_mp->mnt_freq = 0;
new_mp->mnt_passno = 0;
diff --git a/usr.sbin/amd/amd/nfs_ops.c b/usr.sbin/amd/amd/nfs_ops.c
index e45266d044a..d155c3d3f8f 100644
--- a/usr.sbin/amd/amd/nfs_ops.c
+++ b/usr.sbin/amd/amd/nfs_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_ops.c,v 1.20 2014/10/20 02:33:42 guenther Exp $ */
+/* $OpenBSD: nfs_ops.c,v 1.21 2014/10/20 06:55:59 guenther Exp $ */
/*-
* Copyright (c) 1990 Jan-Simon Pendry
@@ -41,12 +41,7 @@
#define NFS
#define NFSCLIENT
-#ifdef NFS_3
-typedef nfs_fh fhandle_t;
-#endif /* NFS_3 */
-#ifdef NFS_HDR
-#include NFS_HDR
-#endif /* NFS_HDR */
+
#include "mount.h"
/*
@@ -461,7 +456,7 @@ mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts,
unsigned short port;
#endif /* notdef */
- MTYPE_TYPE type = MOUNT_TYPE_NFS;
+ const char *type = MOUNT_NFS;
bzero((void *)&nfs_args, sizeof(nfs_args)); /* Paranoid */
@@ -482,7 +477,7 @@ mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts,
mnt.mnt_dir = dir;
mnt.mnt_fsname = fs_name;
- mnt.mnt_type = MTAB_TYPE_NFS;
+ mnt.mnt_type = "nfs";
mnt.mnt_opts = xopts;
mnt.mnt_freq = 0;
mnt.mnt_passno = 0;
@@ -496,13 +491,11 @@ mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts,
/*
* set mount args
*/
- NFS_FH_DREF(nfs_args.fh, (NFS_FH_TYPE) fhp->fhs_fhandle);
-
+ nfs_args.fh = (void *)fhp->fhs_fhandle;
nfs_args.fhsize = fhp->fhs_size;
nfs_args.version = NFS_ARGSVERSION;
nfs_args.hostname = host;
- nfs_args.flags |= NFSMNT_HOSTNAME;
#ifdef HOSTNAMESZ
/*
* Most kernels have a name length restriction.
@@ -559,7 +552,7 @@ mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts,
sin.sin_port = htons(NFS_PORT); /* XXX should use portmapper */
#endif /* notdef */
- if (hasmntopt(&mnt, MNTOPT_SOFT) != NULL)
+ if (hasmntopt(&mnt, "soft") != NULL)
nfs_args.flags |= NFSMNT_SOFT;
#ifdef NFSMNT_SPONGY
@@ -572,10 +565,8 @@ mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts,
}
#endif /* MNTOPT_SPONGY */
-#ifdef MNTOPT_INTR
- if (hasmntopt(&mnt, MNTOPT_INTR) != NULL)
+ if (hasmntopt(&mnt, "intr") != NULL)
nfs_args.flags |= NFSMNT_INT;
-#endif /* MNTOPT_INTR */
#ifdef MNTOPT_NODEVS
if (hasmntopt(&mnt, MNTOPT_NODEVS) != NULL)
@@ -583,23 +574,21 @@ mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts,
#endif /* MNTOPT_NODEVS */
-#ifdef MNTOPT_NOCONN
- if (hasmntopt(&mnt, MNTOPT_NOCONN) != NULL)
+ if (hasmntopt(&mnt, "noconn") != NULL)
nfs_args.flags |= NFSMNT_NOCONN;
-#endif /* MNTOPT_NOCONN */
-#ifdef MNTOPT_RESVPORT
- if (hasmntopt(&mnt, MNTOPT_RESVPORT) != NULL)
+ if (hasmntopt(&mnt, "resvport") != NULL)
nfs_args.flags |= NFSMNT_RESVPORT;
-#endif /* MNTOPT_RESVPORT */
-
#ifdef NFSMNT_PGTHRESH
if (nfs_args.pg_thresh = hasmntval(&mnt, "pgthresh"))
nfs_args.flags |= NFSMNT_PGTHRESH;
#endif /* NFSMNT_PGTHRESH */
- NFS_SA_DREF(nfs_args, fs->fs_ip);
+ nfs_args.addr = (struct sockaddr *)fs->fs_ip;
+ nfs_args.addrlen = sizeof(*fs->fs_ip);
+ nfs_args.sotype = SOCK_DGRAM;
+ nfs_args.proto = 0;
flags = compute_mount_flags(&mnt);
@@ -666,11 +655,7 @@ nfs_fmount(mntfs *mf)
static int
nfs_fumount(mntfs *mf)
{
- int error = UMOUNT_FS(mf->mf_mount);
- if (error)
- return error;
-
- return 0;
+ return (umount_fs(mf->mf_mount));
}
static void
diff --git a/usr.sbin/amd/amd/opts.c b/usr.sbin/amd/amd/opts.c
index 6452d637e4e..78587673771 100644
--- a/usr.sbin/amd/amd/opts.c
+++ b/usr.sbin/amd/amd/opts.c
@@ -268,7 +268,7 @@ eval_opts(char *opts, char *mapkey)
*/
if (FSTREQ(op->name, f)) {
switch (vs_opt) {
-#if AMD_COMPAT <= 5000108
+#if 1 /* XXX ancient compat */
case OldSyn:
plog(XLOG_WARNING, "key %s: Old syntax selector found: %s=%s", mapkey, f, opt);
if (!op->sel_p) {
@@ -276,7 +276,7 @@ eval_opts(char *opts, char *mapkey)
break;
}
/* fall through ... */
-#endif /* 5000108 */
+#endif
case SelEQ:
case SelNE:
if (op->sel_p && (STREQ(*op->sel_p, opt) == (vs_opt == SelNE))) {
diff --git a/usr.sbin/amd/amd/restart.c b/usr.sbin/amd/amd/restart.c
index 2387e362259..5f423340be6 100644
--- a/usr.sbin/amd/amd/restart.c
+++ b/usr.sbin/amd/amd/restart.c
@@ -61,12 +61,12 @@ restart()
for (mlp = ml = read_mtab("restart"); mlp; mlp = mlp->mnext) {
struct mntent *me = mlp->mnt;
am_ops *fs_ops = 0;
- if (STREQ(me->mnt_type, MTAB_TYPE_UFS)) {
+ if (STREQ(me->mnt_type, "ffs")) {
/*
* UFS entry
*/
fs_ops = &ufs_ops;
- } else if (STREQ(me->mnt_type, MTAB_TYPE_NFS)) {
+ } else if (STREQ(me->mnt_type, "nfs")) {
/*
* NFS entry, or possibly an Amd entry...
*/
@@ -78,13 +78,11 @@ restart()
} else {
fs_ops = &nfs_ops;
}
-#ifdef MTAB_TYPE_MFS
- } else if (STREQ(me->mnt_type, MTAB_TYPE_MFS)) {
+ } else if (STREQ(me->mnt_type, "mfs")) {
/*
* MFS entry. Fake with a symlink.
*/
fs_ops = &sfs_ops;
-#endif /* MTAB_TYPE_MFS */
} else {
/*
* Catch everything else with symlinks to
diff --git a/usr.sbin/amd/amd/ufs_ops.c b/usr.sbin/amd/amd/ufs_ops.c
index b105762bed9..e7d9b88bf56 100644
--- a/usr.sbin/amd/amd/ufs_ops.c
+++ b/usr.sbin/amd/amd/ufs_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_ops.c,v 1.7 2014/10/20 02:33:42 guenther Exp $ */
+/* $OpenBSD: ufs_ops.c,v 1.8 2014/10/20 06:55:59 guenther Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -41,13 +41,6 @@
#ifdef HAS_UFS
#include <sys/stat.h>
-#ifdef NFS_3
-typedef nfs_fh fhandle_t;
-#endif /* NFS_3 */
-
-#ifdef UFS_HDR
-#include UFS_HDR
-#endif /* UFS_HDR */
/*
* UN*X file system
@@ -85,7 +78,7 @@ mount_ufs(char *dir, char *fs_name, char *opts)
/*
* Figure out the name of the file system type.
*/
- MTYPE_TYPE type = MOUNT_TYPE_UFS;
+ const char *type = MOUNT_FFS;
bzero((void *)&ufs_args, sizeof(ufs_args)); /* Paranoid */
@@ -94,7 +87,7 @@ mount_ufs(char *dir, char *fs_name, char *opts)
*/
mnt.mnt_dir = dir;
mnt.mnt_fsname = fs_name;
- mnt.mnt_type = MTAB_TYPE_UFS;
+ mnt.mnt_type = "ffs";
mnt.mnt_opts = opts;
mnt.mnt_freq = 1;
mnt.mnt_passno = 2;
@@ -128,7 +121,7 @@ ufs_fmount(mntfs *mf)
static int
ufs_fumount(mntfs *mf)
{
- return UMOUNT_FS(mf->mf_mount);
+ return umount_fs(mf->mf_mount);
}
/*
diff --git a/usr.sbin/amd/amq/Makefile b/usr.sbin/amd/amq/Makefile
index b382e48e7d9..9a57675569c 100644
--- a/usr.sbin/amd/amq/Makefile
+++ b/usr.sbin/amd/amq/Makefile
@@ -1,14 +1,11 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $Id: Makefile,v 1.2 2014/10/20 00:20:04 guenther Exp $
-
-.include "../config/Makefile.config"
+# $Id: Makefile,v 1.3 2014/10/20 06:55:59 guenther Exp $
PROG = amq
SRCS = amq.c amq_clnt.c amq_xdr.c misc_rpc.c
MAN = amq.8
CFLAGS+=-I${.CURDIR}/../include
CFLAGS+=-I${.CURDIR}/../rpcx
-CFLAGS+=-I${.CURDIR}/../config
.PATH: ${.CURDIR}/../rpcx ${.CURDIR}/../amd
.include "../../Makefile.inc"
diff --git a/usr.sbin/amd/config/Makefile.config b/usr.sbin/amd/config/Makefile.config
deleted file mode 100644
index 7855c9fb7ab..00000000000
--- a/usr.sbin/amd/config/Makefile.config
+++ /dev/null
@@ -1,59 +0,0 @@
-# from: @(#)Makefile.config 8.1 (Berkeley) 6/6/93
-# $Id: Makefile.config,v 1.4 2014/10/20 02:33:42 guenther Exp $
-#
-
-.include <bsd.own.mk>
-
-OS = bsd44
-
-#
-# Comment/uncomment the following lines as required
-#
-
-#
-# Where local include files are stored
-#
-#XINCLUDE = -I/usr/local/athena/include
-
-#
-# Define RESOLV if your C library does not include support
-# for Hesiod and/or Named.
-#
-#RESOLV = -lhesiod -lresolv
-
-#
-# Define XLIBDIR if you have libraries not on the standard
-# search path.
-#
-#XLIBDIR = -L/usr/local/athena/lib
-
-#
-# Define DBM if your C library does not include
-# support for gdbm and/or ndbm.
-#
-#DBM = -lgdbm #-lndbm
-
-#
-# Define RPCLIB if your C library does not include
-# support for RPC
-#
-#RPCLIB = -lrpc
-
-#
-# Include support for Hesiod
-# Also define HAS_HESIOD_RELOAD to include zone
-# transfer code implementing "cache:=all"
-#
-#HAS_HESIOD_MAPS = -DHAS_HESIOD_MAPS -DHAS_HESIOD_RELOAD
-
-#
-# Include support for ndbm.
-# This removes support for gdbm and is only supported
-# if your operating system supports ndbm
-#
-#HAS_NDBM_MAPS = -DHAS_NDBM_MAPS
-
-##############################################################
-# Do NOT edit the following lines
-#
-CONFIG = ${XINCLUDE} ${HAS_HESIOD_MAPS} ${HAS_NDBM_MAPS}
diff --git a/usr.sbin/amd/config/RELEASE b/usr.sbin/amd/config/RELEASE
deleted file mode 100644
index 7db687dd0a3..00000000000
--- a/usr.sbin/amd/config/RELEASE
+++ /dev/null
@@ -1 +0,0 @@
-$Revision: 1.1 $ of $Date: 1995/10/18 08:47:13 $ bsd44
diff --git a/usr.sbin/amd/config/os-bsd44.h b/usr.sbin/amd/config/os-bsd44.h
deleted file mode 100644
index 67eb1342b28..00000000000
--- a/usr.sbin/amd/config/os-bsd44.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* $OpenBSD: os-bsd44.h,v 1.11 2014/10/20 02:33:42 guenther Exp $ */
-
-/*
- * Copyright (c) 1990 Jan-Simon Pendry
- * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry at Imperial College, London.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)os-bsd44.h 8.1 (Berkeley) 6/6/93
- *
- * 4.4 BSD definitions for Amd (automounter)
- */
-
-/*
- * Which version of the NFS interface are we using.
- * This is the implementation release number, not
- * the protocol revision number.
- */
-#define NFS_44
-
-/*
- * Name of filesystem types
- */
-#define MOUNT_TYPE_NFS MOUNT_NFS
-#define MOUNT_TYPE_UFS MOUNT_UFS
-#undef MTAB_TYPE_UFS
-#define MTAB_TYPE_UFS "ufs"
-#define MTAB_TYPE_MFS "mfs"
-
-/*
- * How to copy an address into an NFS filehandle
- */
-#undef NFS_SA_DREF
-#define NFS_SA_DREF(dst, src) { \
- (dst).addr = (struct sockaddr *) (src); \
- (dst).addrlen = sizeof(*src); \
- (dst).sotype = SOCK_DGRAM; \
- (dst).proto = 0; \
- }
-
-/*
- * Miscellaneous 4.4 BSD bits
- */
-
-#define MNTMAXSTR 128
-
-#define MNTTYPE_UFS "ufs" /* Un*x file system */
-#define MNTTYPE_NFS "nfs" /* network file system */
-#define MNTTYPE_MFS "mfs" /* memory file system */
-#define MNTTYPE_IGNORE "ignore" /* No type specified, ignore this entry */
-
-#define M_RDONLY MNT_RDONLY
-#define M_SYNC MNT_SYNCHRONOUS
-#define M_NOEXEC MNT_NOEXEC
-#define M_NOSUID MNT_NOSUID
-#define M_NODEV MNT_NODEV
-
-#define MNTOPT_SOFT "soft" /* soft mount */
-#define MNTOPT_INTR "intr" /* interrupts allowed */
-#define MNTOPT_NOCONN "noconn" /* accept any responder */
-#define MNTOPT_RESVPORT "resvport" /* use reserved port */
-#define MNTOPT_NQNFS "nqnfs" /* use reserved port */
-
-#define NFSMNT_HOSTNAME 0 /* hostname on 4.4 is not optional */
-
-struct mntent {
- char *mnt_fsname; /* name of mounted file system */
- char *mnt_dir; /* file system path prefix */
- char *mnt_type; /* MNTTYPE_* */
- char *mnt_opts; /* MNTOPT* */
- int mnt_freq; /* dump frequency, in days */
- int mnt_passno; /* pass number on parallel fsck */
-};
-
-/*
- * Type of a file handle
- */
-#undef NFS_FH_TYPE
-#define NFS_FH_TYPE void *
diff --git a/usr.sbin/amd/config/os-defaults.h b/usr.sbin/amd/config/os-defaults.h
deleted file mode 100644
index 75c972761cf..00000000000
--- a/usr.sbin/amd/config/os-defaults.h
+++ /dev/null
@@ -1,77 +0,0 @@
-
-/*
- * Copyright (c) 1989 Jan-Simon Pendry
- * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry at Imperial College, London.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)os-defaults.h 8.1 (Berkeley) 6/6/93
- * $Id: os-defaults.h,v 1.4 2014/10/20 02:33:42 guenther Exp $
- */
-
-/*
- * What level of AMD are we backward compatible with?
- * This only applies to externally visible characteristics.
- * Rev.Minor.Branch.Patch (2 digits each)
- */
-#define AMD_COMPAT 5000000 /* 5.0 */
-
-/*
- * Name of filesystem types
- */
-#define MTAB_TYPE_NFS "nfs"
-#define MTAB_TYPE_UFS "4.2"
-
-/*
- * Name of mount & unmount system calls
- */
-#define MOUNT_TRAP(type, mnt, flags, mnt_data) \
- mount(type, mnt->mnt_dir, flags, mnt_data)
-
-/*
- * How to unmount filesystems.
- */
-#define UMOUNT_FS(dir) umount_fs(dir)
-
-/*
- * Type of a file handle
- */
-#define NFS_FH_TYPE fhandle_t *
-#define NFS_FH_DREF(dst, src) { (dst) = (src); }
-
-/*
- * How to copy an address into an NFS filehandle
- */
-#define NFS_SA_DREF(dst, src) { (dst).addr = (src); }
-
-/*
- * Type of filesystem type
- */
-#define MTYPE_TYPE char *
diff --git a/usr.sbin/amd/include/am.h b/usr.sbin/amd/include/am.h
index 54fcd5746fe..7742dc3c265 100644
--- a/usr.sbin/amd/include/am.h
+++ b/usr.sbin/amd/include/am.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: am.h,v 1.13 2014/10/20 02:33:42 guenther Exp $ */
+/* $OpenBSD: am.h,v 1.14 2014/10/20 06:55:59 guenther Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -50,17 +50,8 @@
#include "nfs_prot.h"
#include <assert.h>
-#ifdef DEBUG_MEM
-#include <malloc.h>
-#endif /* DEBUG_MEM */
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif /* MAXHOSTNAMELEN */
-
-#ifndef MNTTYPE_AUTO
-#define MNTTYPE_AUTO "auto"
-#endif /* MNTTYPE_AUTO */
+/* max length of mount options */
+#define MNTMAXSTR 128
#ifndef FALSE
#define FALSE 0
@@ -187,6 +178,16 @@ struct qelem {
#define ITER(v, ty, q) \
for ((v) = FIRST(ty,(q)); (v) != HEAD(ty,(q)); (v) = NEXT(ty,(v)))
+
+struct mntent {
+ char *mnt_fsname; /* name of mounted file system */
+ char *mnt_dir; /* file system path prefix */
+ char *mnt_type; /* MNTTYPE_* */
+ char *mnt_opts; /* MNTOPT* */
+ int mnt_freq; /* dump frequency, in days */
+ int mnt_passno; /* pass number on parallel fsck */
+};
+
/*
* List of mount table entries
*/
@@ -269,7 +270,7 @@ extern void mnt_free(struct mntent *);
extern int mount_auto_node(char *, void *);
extern int mount_automounter(pid_t);
extern int mount_exported(void);
-extern int mount_fs(struct mntent *, int, caddr_t, int, MTYPE_TYPE);
+extern int mount_fs(struct mntent *, int, caddr_t, int, const char *);
extern int mount_nfs_fh(struct fhstatus *, char *, char *, char *, mntfs *);
extern int mount_node(am_node *);
extern mntfs *new_mntfs(void);
@@ -315,7 +316,6 @@ extern void wakeup(void *);
extern void wakeup_task(int, int, void *);
extern void wakeup_srvr(fserver *);
extern void write_mntent(struct mntent *);
-#define unlock_mntlist()
#define ALLOC(ty) ((struct ty *) xmalloc(sizeof(struct ty)))
diff --git a/usr.sbin/amd/include/config.h b/usr.sbin/amd/include/config.h
index bb6c6acbd23..86b9190ddd7 100644
--- a/usr.sbin/amd/include/config.h
+++ b/usr.sbin/amd/include/config.h
@@ -32,19 +32,16 @@
* SUCH DAMAGE.
*
* from: @(#)config.h 8.1 (Berkeley) 6/6/93
- * $Id: config.h,v 1.8 2014/10/20 00:20:04 guenther Exp $
+ * $Id: config.h,v 1.9 2014/10/20 06:55:59 guenther Exp $
*/
/*
* Pick up target dependent definitions
*/
-#include "os-defaults.h"
-#include "os-bsd44.h"
-
-#include <errno.h>
-#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
+#include <errno.h>
+#include <stdio.h>
#define clocktime() (clock_valid ? clock_valid : time(&clock_valid))
extern time_t clock_valid; /* Clock needs recalculating */