diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 2007-12-05 15:48:04 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 2007-12-05 15:48:04 +0000 |
commit | 2e9c52ae7f968c9e81696f68824b2d27e618a105 (patch) | |
tree | 9e1cbeb3c1c2cd9da61657fb2578fede41585ea2 | |
parent | ad8bcc147f76709838923b5f73e352c06231e91f (diff) |
Notes
22 files changed, 0 insertions, 5256 deletions
diff --git a/contrib/amd/LSM.am-utils b/contrib/amd/LSM.am-utils deleted file mode 100644 index 07b736faf84f..000000000000 --- a/contrib/amd/LSM.am-utils +++ /dev/null @@ -1,20 +0,0 @@ -Begin3 -Title: am-utils -Version: 6.0.1 -Entered-date: 08SEP99 -Description: BSD Automounter Utilities - Replaces the old amd-upl102. Offers NFS V3 support, many - new features, and numerous ports. The home page for - am-utils is in http://www.am-utils.org -Keywords: amd amq hlfsd fsinfo wire-test fixmount mk-amd-map automount -Author: ezk@cs.columbia.edu (Erez Zadok) -Maintained-by: ezk@cs.columbia.edu (Erez Zadok) -Primary-site: shekel.mcl.cs.columbia.edu /pub/am-utils - 1.3MB am-utils-6.0.1.tar.gz - 1.3MB am-utils.tar.gz - 1.3MB am-utils-snapshot.tar.gz -Alternate-site: http://www.am-utils.org/mirrors.html -Original-site: ftp.cs.columbia.edu /pub/amd -Platforms: all modern Unix systems -Copying-policy: BSD -End diff --git a/contrib/amd/TODO b/contrib/amd/TODO deleted file mode 100644 index 07fb5559678c..000000000000 --- a/contrib/amd/TODO +++ /dev/null @@ -1,177 +0,0 @@ -# -*- text -*- - -Make a tasks file that people can pick jobs off of. - -take a look at am_compat.h and fix everything there... - -fix all $Id bla bla bla $ on every file. -add my own copyright 1997 etc. - -NOT NEEDED: convert DEBUG symbol to ENABLE_DEBUG -NOT NEEDED: convert DEBUG_MEM symbol to ENABLE_DEBUG_MEM - -Use these two somewhere: -AC_DEFINE(AM_UTILS_NAME_PACKAGE, "am-utils") -AC_DEFINE(AM_UTILS_VERSION, "6.0a1) - -check all "dnl XXX: in configure.in - -check for: INLINE, Const->const, P_void, VOIDP - -rename DEBUG_MTAB to DEBUG_MNTTAB -rename UPDATE_MTAB to MOUNT_TABLE_ON_FILE -rename HAS_NIS_MAPS to HAVE_MAP_NIS -rename HAS_TFS to HAVE_FS_TFS -rename SIG_HNDL_TYP to RETSIGTYPE - -remove HOST_EXEC #define from everywhere. add to am_ops.c a static flag -initialized_vops, which if not true, should set the host_ops vector field to -0 or host_umounted. This way let the feature be turned on if -h option to -amd is given. - -nuke all code that is ifdef'd SUNOS4_COMPAT - -rename NEED_MNTOPT_PARSER to HAVE_HASMNTOPT and cleanup the code. also take -the supplied code in amd/mount_fs.c and include it as the library function -libamd/hasmntopt.c - -TLI code needs to be fixed. - -a way to include a site-specific configuration file IFF it exists from -directory local/<${target}.h> - -replace #include WAIT with nothing (HAVE_SYS_WAIT_H?) - -replace SYS5_SIGNALS with HAVE_SYS_WAIT_H (which is on only if it sys/wait.h -exists and is using the newer "int" for type, not "union wait". The macro -AC_HEADER_SYS_WAIT turns on HAVE_SYS_WAIT_H iff wait*() functions are -posix.1 compliant. Make sure you don't remove SYS5_SIGNALS ifdef's that are -not related to wait*() syscalls. - -add username, hostname, and date at which time amd was compiled. - -No more need for MOUNT_HELPER_SOURCE. - -any code which is included by NEED_UMOUNT_FS, should be on iff -MOUNT_TABLE_ON_FILE is on. - -replace NFS_FH_FIELD with references fo ".fh" in calls to -NFS_FH_DREF(src, dst) macro - -For *EVERY* M4 Macro with case/esac, check that the $host_os case entries -are correct. - -I'm not using amd's regexp code. Instead, use generic system code. If the -system has posix style regexp functions, then change amd/map.c to use -correct new prototype. - -use HAVE_SVC_GETREQSET instead of RPC_4. - -replace all "jsp" in *.[hc] $Id: TODO,v 1.1.1.1 1998/11/05 02:04:19 ezk Exp $ with ezk. - -use MNTTAB_FILE_NAME instead of MOUNTED - -use MOUNT_TABLE_ON_FILE instead of READ_MTAB_FROM_FILE - -no more HAS_EMPTY_AUTOMOUNTS, which was used if a df(1) divide by zero bug -was invoked. Instead, change nfs_statfs() code to always return non-zero -values. Then nuke HAS_EMPTY_AUTOMOUNTS. - -REGEXP: use whatever regular expressionlibrary you have on the system, -including regexp.h if available, and using regcomp/regexec. Amd was written -with BSD regexps in mind, not Sys V, so if I use any of those, I have to -watch for correct usage. Otherwise, I can include the older include/re.h -and amd/re.c. Replace HAS_REGEXP with HAVE_REGEXEC. - -The regex code in amd/mapc.c has changed a lot. It probably has bugs. Must -test and debug it!!! - -# string name of filesystem in /etc/mnttab file -Use MNTTAB_TYPE_FOO instead of MTAB_TYPE_FOO. -# string name of mount option in /etc/mnttab file -Use MNTTAB_OPT_FOO instead of MNTOPT_FOO. -# string (or integer?) name of filesystem type in mount(2) syscall -Use MOUNT_TYPE_FOO instead of MNTTYPE_FOO or MOUNT_FOO. -# hex/number of FS mount option in nfs_args passed to mount(2) syscall -Use MNT2_NFS_OPT_FOO instead NFSMNT_FOO. -# hex/number of generic FS mount option directly passed to mount(2) syscall -Use MNT2_GEN_OPT_FOO instead of MS_FOO or M_FOO. - - -update AMD_COMPAT to 6.0 in include/am_utils.h - -convert all mem* functions b* functions (memset to bzero, etc.) or vice -verse. - -put my name/copyright on every src file - -change all struct mnttab/mntent to "mntent_t" - -cleanup lib/resvport.c (TLI vs. Sockets). TLI code is #defin'ed -HAVE_T_OPEN. -[ -setting MTAB_LOCK_FILE (mtab_svr4.c) should be an amd run-time configuration -option. - -change all UMOUNT_FS macros to umount_fs() fxn calls. - -remove getnetbyaddr() from lib/getnetbyaddr.c and then link w/ -lsocket - -take care of various (hlfsd et al) scripts in Makefile.am files. - -rename HOSTNAMESZ to MAXHOSTNAMELEN - -turn on all the NEW_TOPLVL_READDIR code (for "ls" to work in an amd point) - -change all NEW_DEFAULTS to ENABLE_DEFAULT_SELECTOTS (which is now on by -default) - -remove refereces to mnt_freq and mnt_passno in mntent_t since it's not in -use any more. - -remove all the (lint?) comments /*ARGSUSED */ - -change HAS_FOOFS to HAVE_AM_FS_FOO (for example HAS_NFSX -> HAVE_AM_FS_FOO), -but change HAS_UNION_FS to HAVE_AM_FS_UNION. - -some code uses #ifdef M_NEWTYPE to tell if mount(2)'s type field is "char *" -or int. Use MTYPE_TYPE declaration instead (not ifdef macro!) - -change DEBUG_MTAB to DEBUG_MNTTAB - -deal with the changes in values of $os, $arch, and $osver! - -replace SYS5_SIGNALS with REINSTATE_SIGNAL_HANDLER - -figure out how to auto-conf HAS_HESIOD_RELOAD (amd/info_hesiod.c). For now -I've used the macro HAVE_HS_ZONE_TRANSFER. - - - - -****************************************************************************** -PERL SCRIPT TO FIX OLD AMD MAPS: -- fix '=' to ':=' -- fix sos5 -> solaris2, etc. - -****************************************************************************** -USE AS IS: - -- SVC_IN_ARG_TYPE (change from SVC_IN_ARGS_TYPE, with an 'S') -- NFS_FH_TYPE -- MTYPE_TYPE -- MOUNT_TYPE_* NO!!! - -****************************************************************************** -NEW FEATURES: - -- autofs -- cachefs -- dbm/gdbm/db file maps -- add amd option -O (override) to override $os, $osver, $arch, $karch, etc. - -****************************************************************************** -DONE: - -HAS_TFS is gone and all of it's code too. -major code cleanup, removed if 0 code and if notdef diff --git a/contrib/amd/amd/amfs_inherit.c b/contrib/amd/amd/amfs_inherit.c deleted file mode 100644 index 3e86c4d18771..000000000000 --- a/contrib/amd/amd/amfs_inherit.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 1997-2004 Erez Zadok - * Copyright (c) 1989 Jan-Simon Pendry - * Copyright (c) 1989 Imperial College of Science, Technology & Medicine - * Copyright (c) 1989 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: amfs_inherit.c,v 1.3.2.4 2004/01/06 03:15:16 ezk Exp $ - * - */ - -/* - * Inheritance file system. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif /* HAVE_CONFIG_H */ -#include <am_defs.h> -#include <amd.h> - -/* - * This implements a filesystem restart. - * - * This is a *gross* hack - it knows far too - * much about the way other parts of the - * system work. See restart.c too. - */ - -static char *amfs_inherit_match(am_opts *fo); -static int amfs_inherit_fmount(mntfs *mf); -static int amfs_inherit_fumount(mntfs *mf); -static int amfs_inherit_init(mntfs *mf); -static int amfs_inherit_mount(am_node *mp); - - -/* - * Ops structure - */ -am_ops amfs_inherit_ops = -{ - "inherit", - amfs_inherit_match, - amfs_inherit_init, - amfs_inherit_mount, - amfs_inherit_fmount, - amfs_auto_fumount, - amfs_inherit_fumount, - amfs_error_lookuppn, - amfs_error_readdir, - 0, /* amfs_inherit_readlink */ - 0, /* amfs_inherit_mounted */ - 0, /* amfs_inherit_umounted */ - find_amfs_auto_srvr, - FS_DISCARD -}; - - -/* - * This should never be called. - */ -static char * -amfs_inherit_match(am_opts *fo) -{ - plog(XLOG_FATAL, "amfs_inherit_match called!"); - return 0; -} - - -static int -amfs_inherit_init(mntfs *mf) -{ - mntfs *mf_link = (mntfs *) mf->mf_private; - - if (mf_link == 0) { - plog(XLOG_ERROR, "Remount collision on %s?", mf->mf_mount); - plog(XLOG_FATAL, "Attempting to init not-a-filesystem"); - return EINVAL; - } - - if (mf_link->mf_ops->fs_init) - return (*mf_link->mf_ops->fs_init) (mf_link); - return 0; -} - - -/* - * Take the linked mount point and - * propagate. - */ -static mntfs * -amfs_inherit_inherit(mntfs *mf) -{ - mntfs *mf_link = (mntfs *) mf->mf_private; - - if (mf_link == 0) { - plog(XLOG_FATAL, "Attempting to inherit not-a-filesystem"); - return 0; /* XXX */ - } - mf_link->mf_fo = mf->mf_fo; - - /* - * Discard the old map. - * Don't call am_unmounted since this - * node was never really mounted in the - * first place. - */ - mf->mf_private = 0; - free_mntfs(mf); - - /* - * Free the dangling reference - * to the mount link. - */ - free_mntfs(mf_link); - - /* - * Get a hold of the other entry - */ - mf_link->mf_flags &= ~MFF_RESTART; - - /* Say what happened */ - plog(XLOG_INFO, "restarting %s on %s", mf_link->mf_info, mf_link->mf_mount); - - return mf_link; -} - - -static int -amfs_inherit_mount(am_node *mp) -{ - mntfs *newmf = amfs_inherit_inherit(mp->am_mnt); - - if (newmf) { - mp->am_mnt = newmf; - /* - * XXX - must do the am_mounted call here - */ - if (newmf->mf_ops->fs_flags & FS_MBACKGROUND) - am_mounted(mp); - - new_ttl(mp); - return 0; - } - return EINVAL; -} - - -static int -amfs_inherit_fmount(mntfs *mf) -{ - am_node *mp = find_mf(mf); - - if (mp) - return amfs_inherit_mount(mp); - return amfs_inherit_inherit(mf) ? 0 : EINVAL; -} - - -static int -amfs_inherit_fumount(mntfs *mf) -{ - /* - * Always succeed - */ - return 0; -} diff --git a/contrib/amd/amd/ops_autofs.c b/contrib/amd/amd/ops_autofs.c deleted file mode 100644 index bd0bb122fe03..000000000000 --- a/contrib/amd/amd/ops_autofs.c +++ /dev/null @@ -1,1279 +0,0 @@ -/* - * Copyright (c) 1997-2001 Erez Zadok - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: ops_autofs.c,v 1.7.2.4 2001/04/24 06:17:40 ib42 Exp $ - * - */ - -/* - * Automounter filesystem - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif /* HAVE_CONFIG_H */ -#include <am_defs.h> -#include <amd.h> - -/* - * KLUDGE: wrap whole file in HAVE_FS_AUTOFS, because - * not all systems with an automounter file system are supported - * by am-utils yet... - */ - -#ifdef HAVE_FS_AUTOFS - -/* - * MACROS: - */ -#ifndef AUTOFS_NULL -# define AUTOFS_NULL ((u_long)0) -#endif /* not AUTOFS_NULL */ - -/* - * VARIABLES: - */ - -/* forward declarations */ -static int mount_autofs(char *dir, char *opts); -static int autofs_mount_1_svc(struct mntrequest *mr, struct mntres *result, struct authunix_parms *cred); -static int autofs_unmount_1_svc(struct umntrequest *ur, struct umntres *result, struct authunix_parms *cred); - -/* external declarations */ -extern bool_t xdr_mntrequest(XDR *, mntrequest *); -extern bool_t xdr_mntres(XDR *, mntres *); -extern bool_t xdr_umntrequest(XDR *, umntrequest *); -extern bool_t xdr_umntres(XDR *, umntres *); - -/* - * STRUCTURES: - */ - -/* Sun's kernel-based automounter-supporting file system */ -am_ops autofs_ops = -{ - "autofs", - amfs_auto_match, - 0, /* amfs_auto_init */ - autofs_mount, - 0, - autofs_umount, - 0, - amfs_auto_lookuppn, - amfs_auto_readdir, /* browsable version of readdir() */ - 0, /* autofs_readlink */ - autofs_mounted, - 0, /* autofs_umounted */ - find_amfs_auto_srvr, - FS_MKMNT | FS_NOTIMEOUT | FS_BACKGROUND | FS_AMQINFO | FS_DIRECTORY -}; - - -/**************************************************************************** - *** FUNCTIONS *** - ****************************************************************************/ - -/* - * Mount the top-level using autofs - */ -int -autofs_mount(am_node *mp) -{ - mntfs *mf = mp->am_mnt; - struct stat stb; - char opts[256], preopts[256]; - int error; - char *mnttype; - - /* - * Mounting the automounter. - * Make sure the mount directory exists, construct - * the mount options and call the mount_autofs routine. - */ - - if (stat(mp->am_path, &stb) < 0) { - return errno; - } else if ((stb.st_mode & S_IFMT) != S_IFDIR) { - plog(XLOG_WARNING, "%s is not a directory", mp->am_path); - return ENOTDIR; - } - if (mf->mf_ops == &autofs_ops) - mnttype = "indirect"; - else if (mf->mf_ops == &amfs_direct_ops) - mnttype = "direct"; -#ifdef HAVE_AMU_FS_UNION - else if (mf->mf_ops == &amfs_union_ops) - mnttype = "union"; -#endif /* HAVE_AMU_FS_UNION */ - else - mnttype = "auto"; - - /* - * Construct some mount options: - * - * Tack on magic map=<mapname> option in mtab to emulate - * SunOS automounter behavior. - */ - preopts[0] = '\0'; -#ifdef MNTTAB_OPT_INTR - strcat(preopts, MNTTAB_OPT_INTR); - strcat(preopts, ","); -#endif /* MNTTAB_OPT_INTR */ -#ifdef MNTTAB_OPT_IGNORE - strcat(preopts, MNTTAB_OPT_IGNORE); - strcat(preopts, ","); -#endif /* MNTTAB_OPT_IGNORE */ - sprintf(opts, "%s%s,%s=%d,%s=%d,%s=%d,%s,map=%s", - preopts, - MNTTAB_OPT_RW, - MNTTAB_OPT_PORT, nfs_port, - MNTTAB_OPT_TIMEO, gopt.amfs_auto_timeo, - MNTTAB_OPT_RETRANS, gopt.amfs_auto_retrans, - mnttype, mf->mf_info); - - /* now do the mount */ - error = mount_autofs(mf->mf_mount, opts); - if (error) { - errno = error; - plog(XLOG_FATAL, "mount_autofs: %m"); - return error; - } - return 0; -} - - -void -autofs_mounted(mntfs *mf) -{ - amfs_auto_mkcacheref(mf); -} - - -/* - * Unmount a top-level automount node - */ -int -autofs_umount(am_node *mp) -{ - int error; - struct stat stb; - - /* - * The lstat is needed if this mount is type=direct. When that happens, - * the kernel cache gets confused between the underlying type (dir) and - * the mounted type (link) and so needs to be re-synced before the - * unmount. This is all because the unmount system call follows links and - * so can't actually unmount a link (stupid!). It was noted that doing an - * ls -ld of the mount point to see why things were not working actually - * fixed the problem - so simulate an ls -ld here. - */ - if (lstat(mp->am_path, &stb) < 0) { -#ifdef DEBUG - dlog("lstat(%s): %m", mp->am_path); -#endif /* DEBUG */ - } - error = UMOUNT_FS(mp->am_path, mnttab_file_name); - if (error == EBUSY && mp->am_flags & AMF_AUTOFS) { - plog(XLOG_WARNING, "autofs_unmount of %s busy (autofs). exit", mp->am_path); - error = 0; /* fake unmount was ok */ - } - return error; -} - - -/* - * Mount an automounter directory. - * The automounter is connected into the system - * as a user-level NFS server. mount_autofs constructs - * the necessary NFS parameters to be given to the - * kernel so that it will talk back to us. - */ -static int -mount_autofs(char *dir, char *opts) -{ - char fs_hostname[MAXHOSTNAMELEN + MAXPATHLEN + 1]; - char *map_opt, buf[MAXHOSTNAMELEN]; - int retry, error, flags; - struct utsname utsname; - mntent_t mnt; - autofs_args_t autofs_args; - MTYPE_TYPE type = MOUNT_TYPE_AUTOFS; - - memset((voidp) &autofs_args, 0, sizeof(autofs_args)); /* Paranoid */ - - memset((voidp) &mnt, 0, sizeof(mnt)); - mnt.mnt_dir = dir; - mnt.mnt_fsname = pid_fsname; - mnt.mnt_opts = opts; - mnt.mnt_type = type; - - retry = hasmntval(&mnt, "retry"); - if (retry <= 0) - retry = 2; /* XXX */ - - /* - * SET MOUNT ARGS - */ - if (uname(&utsname) < 0) { - strcpy(buf, "localhost.autofs"); - } else { - strcpy(buf, utsname.nodename); - strcat(buf, ".autofs"); - } -#ifdef HAVE_FIELD_AUTOFS_ARGS_T_ADDR - autofs_args.addr.buf = buf; - autofs_args.addr.len = strlen(autofs_args.addr.buf); - autofs_args.addr.maxlen = autofs_args.addr.len; -#endif /* HAVE_FIELD_AUTOFS_ARGS_T_ADDR */ - - autofs_args.path = dir; - autofs_args.opts = opts; - - map_opt = hasmntopt(&mnt, "map"); - if (map_opt) { - map_opt += sizeof("map="); /* skip the "map=" */ - if (map_opt == NULL) { - plog(XLOG_WARNING, "map= has a null map name. reset to amd.unknown"); - map_opt = "amd.unknown"; - } - } - autofs_args.map = map_opt; - - /* XXX: these I set arbitrarily... */ - autofs_args.mount_to = 300; - autofs_args.rpc_to = 60; - autofs_args.direct = 0; - - /* - * Make a ``hostname'' string for the kernel - */ - sprintf(fs_hostname, "pid%ld@%s:%s", - (long) (foreground ? am_mypid : getppid()), - am_get_hostname(), dir); - - /* - * Most kernels have a name length restriction. - */ - if (strlen(fs_hostname) >= MAXHOSTNAMELEN) - strcpy(fs_hostname + MAXHOSTNAMELEN - 3, ".."); - - /* - * Finally we can compute the mount flags set above. - */ - flags = compute_mount_flags(&mnt); - - /* - * This is it! Here we try to mount amd on its mount points. - */ - error = mount_fs(&mnt, flags, (caddr_t) &autofs_args, retry, type, 0, NULL, mnttab_file_name); - return error; -} - - -/****************************************************************************/ -/* autofs program dispatcher */ -void -autofs_program_1(struct svc_req *rqstp, SVCXPRT *transp) -{ - int ret; - union { - mntrequest autofs_mount_1_arg; - umntrequest autofs_umount_1_arg; - } argument; - union { - mntres mount_res; - umntres umount_res; - } result; - - bool_t (*xdr_argument)(), (*xdr_result)(); - int (*local)(); - - switch (rqstp->rq_proc) { - - case AUTOFS_NULL: - svc_sendreply(transp, - (XDRPROC_T_TYPE) xdr_void, - (SVC_IN_ARG_TYPE) NULL); - return; - - case AUTOFS_MOUNT: - xdr_argument = xdr_mntrequest; - xdr_result = xdr_mntres; - local = (int (*)()) autofs_mount_1_svc; - break; - - case AUTOFS_UNMOUNT: - xdr_argument = xdr_umntrequest; - xdr_result = xdr_umntres; - local = (int (*)()) autofs_unmount_1_svc; - break; - - default: - svcerr_noproc(transp); - return; - } - - memset((char *) &argument, 0, sizeof(argument)); - if (!svc_getargs(transp, - (XDRPROC_T_TYPE) xdr_argument, - (SVC_IN_ARG_TYPE) &argument)) { - plog(XLOG_ERROR, - "AUTOFS xdr decode failed for %d %d %d", - (int) rqstp->rq_prog, (int) rqstp->rq_vers, (int) rqstp->rq_proc); - svcerr_decode(transp); - return; - } - - ret = (*local) (&argument, &result, rqstp); - if (!svc_sendreply(transp, - (XDRPROC_T_TYPE) xdr_result, - (SVC_IN_ARG_TYPE) &result)) { - svcerr_systemerr(transp); - } - - if (!svc_freeargs(transp, - (XDRPROC_T_TYPE) xdr_argument, - (SVC_IN_ARG_TYPE) &argument)) { - plog(XLOG_FATAL, "unable to free rpc arguments in autofs_program_1"); - going_down(1); - } -} - - -static int -autofs_mount_1_svc(struct mntrequest *mr, struct mntres *result, struct authunix_parms *cred) -{ - int err = 0; - am_node *anp, *anp2; - - plog(XLOG_INFO, "XXX: autofs_mount_1_svc: %s:%s:%s:%s", - mr->map, mr->name, mr->opts, mr->path); - - /* look for map (eg. "/home") */ - anp = find_ap(mr->path); - if (!anp) { - plog(XLOG_ERROR, "map %s not found", mr->path); - err = ENOENT; - goto out; - } - /* turn on autofs in map flags */ - if (!(anp->am_flags & AMF_AUTOFS)) { - plog(XLOG_INFO, "turning on AMF_AUTOFS for node %s", mr->path); - anp->am_flags |= AMF_AUTOFS; - } - - /* - * Look for (and create if needed) the new node. - * - * If an error occurred, return it. If a -1 was returned, that indicates - * that a mount is in progress, so sleep a while (while the backgrounded - * mount is happening), and then signal the autofs to retry the mount. - * - * There's something I don't understand. I was thinking that this code - * here is the one which will succeed eventually and will send an RPC - * reply to the kernel, but apparently that happens somewhere else, not - * here. It works though, just that I don't know how. Arg. -Erez. - * */ - err = 0; - anp2 = autofs_lookuppn(anp, mr->name, &err, VLOOK_CREATE); - if (!anp2) { - if (err == -1) { /* then tell autofs to retry */ - sleep(1); - err = EAGAIN; - } - goto out; - } - -out: - result->status = err; - return err; -} - - -static int -autofs_unmount_1_svc(struct umntrequest *ur, struct umntres *result, struct authunix_parms *cred) -{ - int err = 0; - -#ifdef HAVE_FIELD_UMNTREQUEST_RDEVID - plog(XLOG_INFO, "XXX: autofs_unmount_1_svc: %d:%lu:%lu:0x%lx", - ur->isdirect, (unsigned long) ur->devid, (unsigned long) ur->rdevid, - (unsigned long) ur->next); -#else /* HAVE_FIELD_UMNTREQUEST_RDEVID */ - plog(XLOG_INFO, "XXX: autofs_unmount_1_svc: %d:%lu:0x%lx", - ur->isdirect, (unsigned long) ur->devid, - (unsigned long) ur->next); -#endif /* HAVE_FIELD_UMNTREQUEST_RDEVID */ - - err = EINVAL; /* XXX: not implemented yet */ - goto out; - -out: - result->status = err; - return err; -} - - -/* - * Pick a file system to try mounting and - * do that in the background if necessary - * - For each location: - if it is new -defaults then - extract and process - continue; - fi - if it is a cut then - if a location has been tried then - break; - fi - continue; - fi - parse mount location - discard previous mount location if required - find matching mounted filesystem - if not applicable then - this_error = No such file or directory - continue - fi - if the filesystem failed to be mounted then - this_error = error from filesystem - elif the filesystem is mounting or unmounting then - this_error = -1 - elif the fileserver is down then - this_error = -1 - elif the filesystem is already mounted - this_error = 0 - break - fi - if no error on this mount then - this_error = initialize mount point - fi - if no error on this mount and mount is delayed then - this_error = -1 - fi - if this_error < 0 then - retry = true - fi - if no error on this mount then - make mount point if required - fi - if no error on this mount then - if mount in background then - run mount in background - return -1 - else - this_error = mount in foreground - fi - fi - if an error occurred on this mount then - update stats - save error in mount point - fi - endfor - */ -static int -autofs_bgmount(struct continuation *cp, int mpe) -{ - mntfs *mf = cp->mp->am_mnt; /* Current mntfs */ - mntfs *mf_retry = 0; /* First mntfs which needed retrying */ - int this_error = -1; /* Per-mount error */ - int hard_error = -1; - int mp_error = mpe; - - /* - * Try to mount each location. - * At the end: - * hard_error == 0 indicates something was mounted. - * hard_error > 0 indicates everything failed with a hard error - * hard_error < 0 indicates nothing could be mounted now - */ - for (; this_error && *cp->ivec; cp->ivec++) { - am_ops *p; - am_node *mp = cp->mp; - char *link_dir; - int dont_retry; - - if (hard_error < 0) - hard_error = this_error; - - this_error = -1; - - if (**cp->ivec == '-') { - /* - * Pick up new defaults - */ - if (cp->auto_opts && *cp->auto_opts) - cp->def_opts = str3cat(cp->def_opts, cp->auto_opts, ";", *cp->ivec + 1); - else - cp->def_opts = strealloc(cp->def_opts, *cp->ivec + 1); -#ifdef DEBUG - dlog("Setting def_opts to \"%s\"", cp->def_opts); -#endif /* DEBUG */ - continue; - } - /* - * If a mount has been attempted, and we find - * a cut then don't try any more locations. - */ - if (STREQ(*cp->ivec, "/") || STREQ(*cp->ivec, "||")) { - if (cp->tried) { -#ifdef DEBUG - dlog("Cut: not trying any more locations for %s", - mp->am_path); -#endif /* DEBUG */ - break; - } - continue; - } - - /* match the operators */ - p = ops_match(&cp->fs_opts, *cp->ivec, cp->def_opts, mp->am_path, cp->key, mp->am_parent->am_mnt->mf_info); - - /* - * Find a mounted filesystem for this node. - */ - mp->am_mnt = mf = realloc_mntfs(mf, p, &cp->fs_opts, - cp->fs_opts.opt_fs, - cp->fs_opts.fs_mtab, - cp->auto_opts, - cp->fs_opts.opt_opts, - cp->fs_opts.opt_remopts); - - p = mf->mf_ops; -#ifdef DEBUG - dlog("Got a hit with %s", p->fs_type); -#endif /* DEBUG */ - - /* - * Note whether this is a real mount attempt - */ - if (p == &amfs_error_ops) { - plog(XLOG_MAP, "Map entry %s for %s did not match", *cp->ivec, mp->am_path); - if (this_error <= 0) - this_error = ENOENT; - continue; - } else { - if (cp->fs_opts.fs_mtab) { - plog(XLOG_MAP, "Trying mount of %s on \"%s\" fstype %s", - cp->fs_opts.fs_mtab, mp->am_path, p->fs_type); - } - cp->tried = TRUE; - } - - this_error = 0; - dont_retry = FALSE; - - if (mp->am_link) { - XFREE(mp->am_link); - mp->am_link = 0; - } - link_dir = mf->mf_fo->opt_sublink; - - if (link_dir && *link_dir) { - if (*link_dir == '/') { - mp->am_link = strdup(link_dir); - } else { - /* - * try getting fs option from continuation, not mountpoint! - * Don't try logging the string from mf, since it may be bad! - */ - if (cp->fs_opts.opt_fs != mf->mf_fo->opt_fs) - plog(XLOG_ERROR, "use %s instead of 0x%lx", - cp->fs_opts.opt_fs, (unsigned long) mf->mf_fo->opt_fs); - - mp->am_link = str3cat((char *) 0, - cp->fs_opts.opt_fs, "/", link_dir); - - normalize_slash(mp->am_link); - } - } - - if (mf->mf_error > 0) { - this_error = mf->mf_error; - } else if (mf->mf_flags & (MFF_MOUNTING | MFF_UNMOUNTING)) { - /* - * Still mounting - retry later - */ -#ifdef DEBUG - dlog("Duplicate pending mount fstype %s", p->fs_type); -#endif /* DEBUG */ - this_error = -1; - } else if (FSRV_ISDOWN(mf->mf_server)) { - /* - * Would just mount from the same place - * as a hung mount - so give up - */ -#ifdef DEBUG - dlog("%s is already hung - giving up", mf->mf_mount); -#endif /* DEBUG */ - mp_error = EWOULDBLOCK; - dont_retry = TRUE; - this_error = -1; - } else if (mf->mf_flags & MFF_MOUNTED) { -#ifdef DEBUG - dlog("duplicate mount of \"%s\" ...", mf->mf_info); -#endif /* DEBUG */ - - /* - * Just call mounted() - */ - am_mounted(mp); - - this_error = 0; - break; - } - - /* - * Will usually need to play around with the mount nodes - * file attribute structure. This must be done here. - * Try and get things initialized, even if the fileserver - * is not known to be up. In the common case this will - * progress things faster. - */ - if (!this_error) { - /* - * Fill in attribute fields. - */ - if (mf->mf_ops->fs_flags & FS_DIRECTORY) - mk_fattr(mp, NFDIR); - else - mk_fattr(mp, NFLNK); - - if (p->fs_init) - this_error = (*p->fs_init) (mf); - } - - /* - * Make sure the fileserver is UP before doing any more work - */ - if (!FSRV_ISUP(mf->mf_server)) { -#ifdef DEBUG - dlog("waiting for server %s to become available", mf->mf_server->fs_host); -#endif /* DEBUG */ - this_error = -1; - } - - if (!this_error && mf->mf_fo->opt_delay) { - /* - * If there is a delay timer on the mount - * then don't try to mount if the timer - * has not expired. - */ - int i = atoi(mf->mf_fo->opt_delay); - if (i > 0 && clocktime() < (cp->start + i)) { -#ifdef DEBUG - dlog("Mount of %s delayed by %lds", mf->mf_mount, i - clocktime() + cp->start); -#endif /* DEBUG */ - this_error = -1; - } - } - - if (this_error < 0 && !dont_retry) { - if (!mf_retry) - mf_retry = dup_mntfs(mf); - cp->retry = TRUE; - } - - if (!this_error) { - if (p->fs_flags & FS_MBACKGROUND) { - mf->mf_flags |= MFF_MOUNTING; /* XXX */ -#ifdef DEBUG - dlog("backgrounding mount of \"%s\"", mf->mf_mount); -#endif /* DEBUG */ - if (cp->callout) { - untimeout(cp->callout); - cp->callout = 0; - } - run_task(try_mount, (voidp) mp, amfs_auto_cont, (voidp) cp); - mf->mf_flags |= MFF_MKMNT; /* XXX */ - if (mf_retry) - free_mntfs(mf_retry); - return -1; - } else { -#ifdef DEBUG - dlog("foreground mount of \"%s\" ...", mf->mf_info); -#endif /* DEBUG */ - this_error = try_mount((voidp) mp); - if (this_error < 0) { - if (!mf_retry) - mf_retry = dup_mntfs(mf); - cp->retry = TRUE; - } - } - } - - if (this_error >= 0) { - if (this_error > 0) { - amd_stats.d_merr++; - if (mf != mf_retry) { - mf->mf_error = this_error; - mf->mf_flags |= MFF_ERROR; - } - } - - /* - * Wakeup anything waiting for this mount - */ - wakeup((voidp) mf); - } - } - - if (this_error && cp->retry) { - free_mntfs(mf); - mf = cp->mp->am_mnt = mf_retry; - /* - * Not retrying again (so far) - */ - cp->retry = FALSE; - cp->tried = FALSE; - /* - * Start at the beginning. - * Rewind the location vector and - * reset the default options. - */ - cp->ivec = cp->xivec; - cp->def_opts = strealloc(cp->def_opts, cp->auto_opts); - /* - * Arrange that autofs_bgmount is called - * after anything else happens. - */ -#ifdef DEBUG - dlog("Arranging to retry mount of %s", cp->mp->am_path); -#endif /* DEBUG */ - sched_task(amfs_auto_retry, (voidp) cp, (voidp) mf); - if (cp->callout) - untimeout(cp->callout); - cp->callout = timeout(RETRY_INTERVAL, wakeup, (voidp) mf); - - cp->mp->am_ttl = clocktime() + RETRY_INTERVAL; - - /* - * Not done yet - so don't return anything - */ - return -1; - } - - if (hard_error < 0 || this_error == 0) - hard_error = this_error; - - /* - * Discard handle on duff filesystem. - * This should never happen since it - * should be caught by the case above. - */ - if (mf_retry) { - if (hard_error) - plog(XLOG_ERROR, "discarding a retry mntfs for %s", mf_retry->mf_mount); - free_mntfs(mf_retry); - } - - /* - * If we get here, then either the mount succeeded or - * there is no more mount information available. - */ - if (hard_error < 0 && mp_error) - hard_error = cp->mp->am_error = mp_error; - if (hard_error > 0) { - /* - * Set a small(ish) timeout on an error node if - * the error was not a time out. - */ - switch (hard_error) { - case ETIMEDOUT: - case EWOULDBLOCK: - cp->mp->am_timeo = 17; - break; - default: - cp->mp->am_timeo = 5; - break; - } - new_ttl(cp->mp); - } - - /* - * Make sure that the error value in the mntfs has a - * reasonable value. - */ - if (mf->mf_error < 0) { - mf->mf_error = hard_error; - if (hard_error) - mf->mf_flags |= MFF_ERROR; - } - - /* - * In any case we don't need the continuation any more - */ - free_continuation(cp); - - return hard_error; -} - - -/* - * Automount interface to RPC lookup routine - * Find the corresponding entry and return - * the file handle for it. - */ -am_node * -autofs_lookuppn(am_node *mp, char *fname, int *error_return, int op) -{ - am_node *ap, *new_mp, *ap_hung; - char *info; /* Mount info - where to get the file system */ - char **ivec, **xivec; /* Split version of info */ - char *auto_opts; /* Automount options */ - int error = 0; /* Error so far */ - char path_name[MAXPATHLEN]; /* General path name buffer */ - char apath[MAXPATHLEN]; /* autofs path (added space) */ - char *pfname; /* Path for database lookup */ - struct continuation *cp; /* Continuation structure if need to mount */ - int in_progress = 0; /* # of (un)mount in progress */ - char *dflts; - mntfs *mf; - -#ifdef DEBUG - dlog("in autofs_lookuppn"); -#endif /* DEBUG */ - - /* - * If the server is shutting down - * then don't return information - * about the mount point. - */ - if (amd_state == Finishing) { -#ifdef DEBUG - if ((mf = mp->am_mnt) == 0 || mf->mf_ops == &amfs_direct_ops) { - dlog("%s mount ignored - going down", fname); - } else { - dlog("%s/%s mount ignored - going down", mp->am_path, fname); - } -#endif /* DEBUG */ - ereturn(ENOENT); - } - - /* - * Handle special case of "." and ".." - */ - if (fname[0] == '.') { - if (fname[1] == '\0') - return mp; /* "." is the current node */ - if (fname[1] == '.' && fname[2] == '\0') { - if (mp->am_parent) { -#ifdef DEBUG - dlog(".. in %s gives %s", mp->am_path, mp->am_parent->am_path); -#endif /* DEBUG */ - return mp->am_parent; /* ".." is the parent node */ - } - ereturn(ESTALE); - } - } - - /* - * Check for valid key name. - * If it is invalid then pretend it doesn't exist. - */ - if (!valid_key(fname)) { - plog(XLOG_WARNING, "Key \"%s\" contains a disallowed character", fname); - ereturn(ENOENT); - } - - /* - * Expand key name. - * fname is now a private copy. - */ - fname = expand_key(fname); - - for (ap_hung = 0, ap = mp->am_child; ap; ap = ap->am_osib) { - /* - * Otherwise search children of this node - */ - if (FSTREQ(ap->am_name, fname)) { - mf = ap->am_mnt; - if (ap->am_error) { - error = ap->am_error; - continue; - } - /* - * If the error code is undefined then it must be - * in progress. - */ - if (mf->mf_error < 0) - goto in_progrss; - - /* - * Check for a hung node - */ - if (FSRV_ISDOWN(mf->mf_server)) { -#ifdef DEBUG - dlog("server hung"); -#endif /* DEBUG */ - error = ap->am_error; - ap_hung = ap; - continue; - } - /* - * If there was a previous error with this node - * then return that error code. - */ - if (mf->mf_flags & MFF_ERROR) { - error = mf->mf_error; - continue; - } - if (!(mf->mf_flags & MFF_MOUNTED) || (mf->mf_flags & MFF_UNMOUNTING)) { - in_progrss: - /* - * If the fs is not mounted or it is unmounting then there - * is a background (un)mount in progress. In this case - * we just drop the RPC request (return nil) and - * wait for a retry, by which time the (un)mount may - * have completed. - */ -#ifdef DEBUG - dlog("ignoring mount of %s in %s -- flags (%x) in progress", - fname, mf->mf_mount, mf->mf_flags); -#endif /* DEBUG */ - in_progress++; - continue; - } - - /* - * Otherwise we have a hit: return the current mount point. - */ -#ifdef DEBUG - dlog("matched %s in %s", fname, ap->am_path); -#endif /* DEBUG */ - XFREE(fname); - return ap; - } - } - - if (in_progress) { -#ifdef DEBUG - dlog("Waiting while %d mount(s) in progress", in_progress); -#endif /* DEBUG */ - XFREE(fname); - ereturn(-1); - } - - /* - * If an error occurred then return it. - */ - if (error) { -#ifdef DEBUG - errno = error; /* XXX */ - dlog("Returning error: %m"); -#endif /* DEBUG */ - XFREE(fname); - ereturn(error); - } - - /* - * If doing a delete then don't create again! - */ - switch (op) { - case VLOOK_DELETE: - ereturn(ENOENT); - - case VLOOK_CREATE: - break; - - default: - plog(XLOG_FATAL, "Unknown op to autofs_lookuppn: 0x%x", op); - ereturn(EINVAL); - } - - /* - * If the server is going down then just return, - * don't try to mount any more file systems - */ - if ((int) amd_state >= (int) Finishing) { -#ifdef DEBUG - dlog("not found - server going down anyway"); -#endif /* DEBUG */ - XFREE(fname); - ereturn(ENOENT); - } - - /* - * If we get there then this is a reference to an, - * as yet, unknown name so we need to search the mount - * map for it. - */ - if (mp->am_pref) { - sprintf(path_name, "%s%s", mp->am_pref, fname); - pfname = path_name; - } else { - pfname = fname; - } - - mf = mp->am_mnt; - -#ifdef DEBUG - dlog("will search map info in %s to find %s", mf->mf_info, pfname); -#endif /* DEBUG */ - /* - * Consult the oracle for some mount information. - * info is malloc'ed and belongs to this routine. - * It ends up being free'd in free_continuation(). - * - * Note that this may return -1 indicating that information - * is not yet available. - */ - error = mapc_search((mnt_map *) mf->mf_private, pfname, &info); - if (error) { - if (error > 0) - plog(XLOG_MAP, "No map entry for %s", pfname); - else - plog(XLOG_MAP, "Waiting on map entry for %s", pfname); - XFREE(fname); - ereturn(error); - } -#ifdef DEBUG - dlog("mount info is %s", info); -#endif /* DEBUG */ - - /* - * Split info into an argument vector. - * The vector is malloc'ed and belongs to - * this routine. It is free'd in free_continuation() - */ - xivec = ivec = strsplit(info, ' ', '\"'); - - /* - * Default error code... - */ - if (ap_hung) - error = EWOULDBLOCK; - else - error = ENOENT; - - /* - * Allocate a new map - */ - new_mp = exported_ap_alloc(); - if (new_mp == 0) { - XFREE(xivec); - XFREE(info); - XFREE(fname); - ereturn(ENOSPC); - } - if (mf->mf_auto) - auto_opts = mf->mf_auto; - else - auto_opts = ""; - - auto_opts = strdup(auto_opts); - -#ifdef DEBUG - dlog("searching for /defaults entry"); -#endif /* DEBUG */ - if (mapc_search((mnt_map *) mf->mf_private, "/defaults", &dflts) == 0) { - char *dfl; - char **rvec; -#ifdef DEBUG - dlog("/defaults gave %s", dflts); -#endif /* DEBUG */ - if (*dflts == '-') - dfl = dflts + 1; - else - dfl = dflts; - - /* - * Chop the defaults up - */ - rvec = strsplit(dfl, ' ', '\"'); - - if (gopt.flags & CFM_SELECTORS_IN_DEFAULTS) { - /* - * Pick whichever first entry matched the list of selectors. - * Strip the selectors from the string, and assign to dfl the - * rest of the string. - */ - if (rvec) { - am_opts ap; - am_ops *pt; - char **sp = rvec; - while (*sp) { /* loop until you find something, if any */ - memset((char *) &ap, 0, sizeof(am_opts)); - pt = ops_match(&ap, *sp, "", mp->am_path, "/defaults", - mp->am_parent->am_mnt->mf_info); - free_opts(&ap); /* don't leak */ - if (pt == &amfs_error_ops) { - plog(XLOG_MAP, "did not match defaults for \"%s\"", *sp); - } else { - dfl = strip_selectors(*sp, "/defaults"); - plog(XLOG_MAP, "matched default selectors \"%s\"", dfl); - break; - } - ++sp; - } - } - } else { /* not selectors_in_defaults */ - /* - * Extract first value - */ - dfl = rvec[0]; - } - - /* - * If there were any values at all... - */ - if (dfl) { - /* - * Log error if there were other values - */ - if (!(gopt.flags & CFM_SELECTORS_IN_DEFAULTS) && rvec[1]) { -# ifdef DEBUG - dlog("/defaults chopped into %s", dfl); -# endif /* DEBUG */ - plog(XLOG_USER, "More than a single value for /defaults in %s", mf->mf_info); - } - - /* - * Prepend to existing defaults if they exist, - * otherwise just use these defaults. - */ - if (*auto_opts && *dfl) { - char *nopts = (char *) xmalloc(strlen(auto_opts) + strlen(dfl) + 2); - sprintf(nopts, "%s;%s", dfl, auto_opts); - XFREE(auto_opts); - auto_opts = nopts; - } else if (*dfl) { - auto_opts = strealloc(auto_opts, dfl); - } - } - XFREE(dflts); - /* - * Don't need info vector any more - */ - XFREE(rvec); - } - - /* - * Fill it in - */ - init_map(new_mp, fname); - - /* - * Turn on autofs flag if needed. - */ - if (mp->am_flags & AMF_AUTOFS) { - new_mp->am_flags |= AMF_AUTOFS; - } - - /* - * Put it in the table - */ - insert_am(new_mp, mp); - - /* - * Fill in some other fields, - * path and mount point. - * - * bugfix: do not prepend old am_path if direct map - * <wls@astro.umd.edu> William Sebok - */ - - strcpy(apath, fname); - strcat(apath, " "); - new_mp->am_path = str3cat(new_mp->am_path, - mf->mf_ops == &amfs_direct_ops ? "" : mp->am_path, - *fname == '/' ? "" : "/", - apath); - -#ifdef DEBUG - dlog("setting path to \"%s\"", new_mp->am_path); -#endif /* DEBUG */ - - /* - * Take private copy of pfname - */ - pfname = strdup(pfname); - - /* - * Construct a continuation - */ - cp = ALLOC(struct continuation); - cp->callout = 0; - cp->mp = new_mp; - cp->xivec = xivec; - cp->ivec = ivec; - cp->info = info; - cp->key = pfname; - cp->auto_opts = auto_opts; - cp->retry = FALSE; - cp->tried = FALSE; - cp->start = clocktime(); - cp->def_opts = strdup(auto_opts); - memset((voidp) &cp->fs_opts, 0, sizeof(cp->fs_opts)); - - /* - * Try and mount the file system. If this succeeds immediately (possible - * for a ufs file system) then return the attributes, otherwise just - * return an error. - */ - error = autofs_bgmount(cp, error); - reschedule_timeout_mp(); - if (!error) { - XFREE(fname); - return new_mp; - } - - /* - * Code for quick reply. If nfs_program_2_transp is set, then - * its the transp that's been passed down from nfs_program_2(). - * If new_mp->am_transp is not already set, set it by copying in - * nfs_program_2_transp. Once am_transp is set, quick_reply() can - * use it to send a reply to the client that requested this mount. - */ - if (nfs_program_2_transp && !new_mp->am_transp) { - new_mp->am_transp = (SVCXPRT *) xmalloc(sizeof(SVCXPRT)); - *(new_mp->am_transp) = *nfs_program_2_transp; - } - if (error && (new_mp->am_mnt->mf_ops == &amfs_error_ops)) - new_mp->am_error = error; - - assign_error_mntfs(new_mp); - - XFREE(fname); - - ereturn(error); -} -#endif /* HAVE_FS_AUTOFS */ diff --git a/contrib/amd/conf/hn_dref/hn_dref_default.h b/contrib/amd/conf/hn_dref/hn_dref_default.h deleted file mode 100644 index d495ea8ca943..000000000000 --- a/contrib/amd/conf/hn_dref/hn_dref_default.h +++ /dev/null @@ -1,2 +0,0 @@ -/* $srcdir/conf/hn_dref/hn_dref_default.h */ -#define NFS_HN_DREF(dst, src) (dst) = (src) diff --git a/contrib/amd/conf/mount/mount_default.c b/contrib/amd/conf/mount/mount_default.c deleted file mode 100644 index 1bdf52293cfe..000000000000 --- a/contrib/amd/conf/mount/mount_default.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997-2003 Erez Zadok - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: mount_default.c,v 1.1.2.3 2002/12/27 22:44:48 ezk Exp $ - */ - -/* - * Default mount helper (currently empty) - */ diff --git a/contrib/amd/conf/mount/mount_freebsd3.c b/contrib/amd/conf/mount/mount_freebsd3.c deleted file mode 100644 index 5888ed949d30..000000000000 --- a/contrib/amd/conf/mount/mount_freebsd3.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 1997-1998 Erez Zadok - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: mount_freebsd3.c,v 5.2.2.1 1992/02/09 15:10:08 jsp beta $ - * - */ - -/* - * FreeBSD 3.x (as of snapshot 3.0-980311-SNAP) Mount helper - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif /* HAVE_CONFIG_H */ -#include <am_defs.h> -#include <amu.h> - -/* - * Map from conventional mount arguments - * to FreeBSD 3.0 style arguments. - */ -int -mount_freebsd3(MTYPE_TYPE type, const char *dir, int flags, voidp data) -{ - char const *namelist[] = INITMOUNTNAMES; - - return mount(namelist[type], - dir, - flags, - data); -} diff --git a/contrib/amd/conf/nfs_prot/nfs_prot_aix5_1.h b/contrib/amd/conf/nfs_prot/nfs_prot_aix5_1.h deleted file mode 100644 index e7fb47861c77..000000000000 --- a/contrib/amd/conf/nfs_prot/nfs_prot_aix5_1.h +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (c) 1997-2003 Erez Zadok - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: nfs_prot_aix5_1.h,v 1.1.2.3 2002/12/27 22:44:53 ezk Exp $ - * - */ - -#ifndef _AMU_NFS_PROT_H -#define _AMU_NFS_PROT_H - - -/* - * AIX 5.1 has a different aix51_nfs_args structure, hence the separate header. - */ - -#ifdef HAVE_RPCSVC_NFS_PROT_H -# include <rpcsvc/nfs_prot.h> -#endif /* HAVE_RPCSVC_NFS_PROT_H */ -#ifdef HAVE_NFS_NFSV2_H -# include <nfs/nfsv2.h> -#endif /* HAVE_NFS_NFSV2_H */ -#ifdef HAVE_NFS_RPCV2_H -# include <nfs/rpcv2.h> -#endif /* HAVE_NFS_RPCV2_H */ -#ifdef HAVE_SYS_FS_NFS_H -# include <sys/fs/nfs.h> -#endif /* HAVE_SYS_FS_NFS_H */ -#ifdef HAVE_RPCSVC_MOUNT_H -# include <rpcsvc/mount.h> -#endif /* HAVE_RPCSVC_MOUNT_H */ - - -/* - * MACROS - */ - -#ifndef MNTPATHLEN -# define MNTPATHLEN 1024 -#endif /* not MNTPATHLEN */ -#ifndef MNTNAMLEN -# define MNTNAMLEN 255 -#endif /* not MNTNAMLEN */ - -/* map field names */ -#define ex_dir ex_name -#define gr_name g_name -#define gr_next g_next -#define ml_directory ml_path -#define ml_hostname ml_name -#define ml_next ml_nxt - -#define dr_drok_u diropres -#define ca_attributes attributes -#define ca_where where -#define da_fhandle dir -#define da_name name -#define dl_entries entries -#define dl_eof eof -#define dr_status status -#define dr_u diropres_u -#define drok_attributes attributes -#define drok_fhandle file -#define fh_data data -#define la_fhandle from -#define la_to to -#define na_atime atime -#define na_blocks blocks -#define na_blocksize blocksize -#define na_ctime ctime -#define na_fileid fileid -#define na_fsid fsid -#define na_gid gid -#define na_mode mode -#define na_mtime mtime -#define na_nlink nlink -#define na_rdev rdev -#define na_size size -#define na_type type -#define na_uid uid -#define ne_cookie cookie -#define ne_fileid fileid -#define ne_name name -#define ne_nextentry nextentry -#define ns_attr_u attributes -#define ns_status status -#define ns_u attrstat_u -#define nt_seconds seconds -#define nt_useconds useconds -#define ra_count count -#define ra_fhandle file -#define ra_offset offset -#define ra_totalcount totalcount -#define raok_attributes attributes -#define raok_len_u data_len -#define raok_u data -#define raok_val_u data_val -#define rda_cookie cookie -#define rda_count count -#define rda_fhandle dir -#define rdr_reply_u reply -#define rdr_status status -#define rdr_u readdirres_u -#define rlr_data_u data -#define rlr_status status -#define rlr_u readlinkres_u -#define rna_from from -#define rna_to to -#define rr_reply_u reply -#define rr_status status -#define rr_u readres_u -#define sa_atime atime -#define sa_gid gid -#define sa_mode mode -#define sa_mtime mtime -#define sa_size size -#define sa_uid uid -#define sag_attributes attributes -#define sag_fhandle file -#define sfr_reply_u reply -#define sfr_status status -#define sfr_u statfsres_u -#define sfrok_bavail bavail -#define sfrok_bfree bfree -#define sfrok_blocks blocks -#define sfrok_bsize bsize -#define sfrok_tsize tsize -#define sla_attributes attributes -#define sla_from from -#define sla_to to -#define wra_beginoffset beginoffset -#define wra_fhandle file -#define wra_len_u data_len -#define wra_offset offset -#define wra_totalcount totalcount -#define wra_u data -#define wra_val_u data_val - - -/* - * TYPEDEFS: - */ -typedef char *dirpath; -typedef char *name; -typedef struct exports *exports; -typedef struct exports exportnode; -typedef struct groups *groups; -typedef struct groups groupnode; -typedef struct mountlist *mountlist; - -typedef attrstat nfsattrstat; -typedef createargs nfscreateargs; -typedef dirlist nfsdirlist; -typedef diropargs nfsdiropargs; -typedef diropokres nfsdiropokres; -typedef diropres nfsdiropres; -typedef entry nfsentry; -typedef fattr nfsfattr; -typedef ftype nfsftype; -typedef linkargs nfslinkargs; -typedef readargs nfsreadargs; -typedef readdirargs nfsreaddirargs; -typedef readdirres nfsreaddirres; -typedef readlinkres nfsreadlinkres; -typedef readokres nfsreadokres; -typedef readres nfsreadres; -typedef renameargs nfsrenameargs; -typedef sattr nfssattr; -typedef sattrargs nfssattrargs; -typedef statfsokres nfsstatfsokres; -typedef statfsres nfsstatfsres; -typedef symlinkargs nfssymlinkargs; -typedef writeargs nfswriteargs; - - -/* - * EXTERNALS: - */ - - -/* - * STRUCTURES: - */ - -/* - * AIX 5.1 has NFS V3, but it is undefined in the header files. - * so I define everything that's needed for NFS V3 here. - */ -#ifdef MNT_NFS3 - -#define FHSIZE3 64 /* size in bytes of a file handle (v3) */ -#define NFS3_FHSIZE 64 -#define MOUNTVERS3 ((unsigned long)(3)) -#define NFS_V3 ((unsigned long)(3)) - -#if 0 -struct nfs_fh3 { - u_int len; - char val[64]; /* !!! */ -}; -#endif - -struct aix51_nfs_args { - struct sockaddr_in addr; /* server address and port */ - caddr_t u0; /* ??? UNKNOWN ??? */ - unsigned long proto; /* IPPROTO_TCP/IPPROTO_UDP */ - char *hostname; /* pointer to hostname? */ - char *netname; /* pointer to netname? */ - caddr_t fh; /* pointer to NFS v3 fh? */ - unsigned long u5; /* IBM sux, IBM sux, IBM sux... */ - unsigned long flags; /* flags */ - unsigned long wsize; /* wsize */ - unsigned long rsize; /* rsize */ - unsigned long timeo; /* timeo */ - unsigned long retrans; /* retrans */ - unsigned long acregmin; /* acregmin */ - unsigned long acregmax; /* acregmax */ - unsigned long acdirmin; /* acdirmin */ - unsigned long acdirmax; /* acdirmax */ - unsigned long u15; /* ??? UNKNOWN ??? */ - struct pathcnf *pathconf; /* pathconf */ -}; - -typedef struct { - u_int fhandle3_len; - char *fhandle3_val; -} fhandle3; - -enum mountstat3 { - MNT3_OK = 0, - MNT3ERR_PERM = 1, - MNT3ERR_NOENT = 2, - MNT3ERR_IO = 5, - MNT3ERR_ACCES = 13, - MNT3ERR_NOTDIR = 20, - MNT3ERR_INVAL = 22, - MNT3ERR_NAMETOOLONG = 63, - MNT3ERR_NOTSUPP = 10004, - MNT3ERR_SERVERFAULT = 10006 -}; -typedef enum mountstat3 mountstat3; - -struct mountres3_ok { - fhandle3 fhandle; - struct { - u_int auth_flavors_len; - int *auth_flavors_val; - } auth_flavors; -}; -typedef struct mountres3_ok mountres3_ok; - -struct mountres3 { - mountstat3 fhs_status; - union { - mountres3_ok mountinfo; - } mountres3_u; -}; -typedef struct mountres3 mountres3; - -struct nfs_fh3 { - u_int fh3_length; - union nfs_fh3_u { - struct nfs_fh3_i { - fhandle_t fh3_i; - } nfs_fh3_i; - char data[NFS3_FHSIZE]; - } fh3_u; -}; -typedef struct nfs_fh3 nfs_fh3; - -#endif /* MNT_NFS3 */ - -/* - * EXTERNALS: - */ -extern bool_t xdr_groups(XDR *xdrs, groups *objp); -extern char *yperr_string (int incode); - -#endif /* not _AMU_NFS_PROT_H */ diff --git a/contrib/amd/conf/nfs_prot/nfs_prot_darwin.h b/contrib/amd/conf/nfs_prot/nfs_prot_darwin.h deleted file mode 100644 index 9ef1e721e60d..000000000000 --- a/contrib/amd/conf/nfs_prot/nfs_prot_darwin.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 1997-2003 Erez Zadok - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: nfs_prot_darwin.h,v 1.1.2.4 2002/12/27 22:44:54 ezk Exp $ - * - */ - -#ifndef _AMU_NFS_PROT_H -#define _AMU_NFS_PROT_H - -#ifdef HAVE_RPCSVC_NFS_PROT_H -# include <rpcsvc/nfs_prot.h> -#endif /* HAVE_RPCSVC_NFS_PROT_H */ -#ifdef HAVE_NFS_RPCV2_H -# include <nfs/rpcv2.h> -#endif /* HAVE_NFS_RPCV2_H */ -#ifdef HAVE_NFS_NFS_H -# include <nfs/nfs.h> -#endif /* HAVE_NFS_NFS_H */ -#ifdef HAVE_UFS_UFS_UFSMOUNT_H -# include <ufs/ufs/ufsmount.h> -#endif /* HAVE_UFS_UFS_UFSMOUNT_H */ - -#define MOUNTVERS3 ((unsigned long)(3)) - -typedef struct { - u_int fhandle3_len; - char *fhandle3_val; -} fhandle3; - - -enum mountstat3 { - MNT3_OK = 0, - MNT3ERR_PERM = 1, - MNT3ERR_NOENT = 2, - MNT3ERR_IO = 5, - MNT3ERR_ACCES = 13, - MNT3ERR_NOTDIR = 20, - MNT3ERR_INVAL = 22, - MNT3ERR_NAMETOOLONG = 63, - MNT3ERR_NOTSUPP = 10004, - MNT3ERR_SERVERFAULT = 10006 -}; -typedef enum mountstat3 mountstat3; - -struct mountres3_ok { - fhandle3 fhandle; - struct { - u_int auth_flavors_len; - int *auth_flavors_val; - } auth_flavors; -}; -typedef struct mountres3_ok mountres3_ok; - -struct mountres3 { - mountstat3 fhs_status; - union { - mountres3_ok mountinfo; - } mountres3_u; -}; -typedef struct mountres3 mountres3; - - -/* - * MACROS: - */ -#define dr_drok_u diropres -#define ca_attributes attributes -#define ca_where where -#define da_fhandle dir -#define da_name name -#define dl_entries entries -#define dl_eof eof -#define dr_status status -#define dr_u diropres_u -#define drok_attributes attributes -#define drok_fhandle file -#define fh_data data -#define la_fhandle from -#define la_to to -#define na_atime atime -#define na_ctime ctime -#define na_fileid fileid -#define na_fsid fsid -#define na_gid gid -#define na_mode mode -#define na_mtime mtime -#define na_nlink nlink -#define na_size size -#define na_type type -#define na_uid uid -#define na_blocks blocks -#define na_blocksize blocksize -#define na_rdev rdev -#define ne_cookie cookie -#define ne_fileid fileid -#define ne_name name -#define ne_nextentry nextentry -#define ns_attr_u attributes -#define ns_status status -#define ns_u attrstat_u -#define nt_seconds seconds -#define nt_useconds useconds -#define ra_count count -#define ra_fhandle file -#define ra_offset offset -#define ra_totalcount totalcount -#define raok_attributes attributes -#define raok_len_u data_len -#define raok_u data -#define raok_val_u data_val -#define rda_cookie cookie -#define rda_count count -#define rda_fhandle dir -#define rdr_reply_u reply -#define rdr_status status -#define rdr_u readdirres_u -#define rlr_data_u data -#define rlr_status status -#define rlr_u readlinkres_u -#define rna_from from -#define rna_to to -#define rr_reply_u reply -#define rr_status status -#define rr_u readres_u -#define sa_atime atime -#define sa_gid gid -#define sa_mode mode -#define sa_mtime mtime -#define sa_size size -#define sa_uid uid -#define sag_attributes attributes -#define sag_fhandle file -#define sfr_reply_u reply -#define sfr_status status -#define sfr_u statfsres_u -#define sfrok_bavail bavail -#define sfrok_bfree bfree -#define sfrok_blocks blocks -#define sfrok_bsize bsize -#define sfrok_tsize tsize -#define sla_attributes attributes -#define sla_from from -#define sla_to to -#define wra_beginoffset beginoffset -#define wra_fhandle file -#define wra_len_u data_len -#define wra_offset offset -#define wra_totalcount totalcount -#define wra_u data -#define wra_val_u data_val - -/* - * TYPEDEFS: - */ -typedef attrstat nfsattrstat; -typedef createargs nfscreateargs; -typedef dirlist nfsdirlist; -typedef diropargs nfsdiropargs; -typedef diropokres nfsdiropokres; -typedef diropres nfsdiropres; -typedef entry nfsentry; -typedef fattr nfsfattr; -typedef ftype nfsftype; -typedef linkargs nfslinkargs; -typedef readargs nfsreadargs; -typedef readdirargs nfsreaddirargs; -typedef readdirres nfsreaddirres; -typedef readlinkres nfsreadlinkres; -typedef readokres nfsreadokres; -typedef readres nfsreadres; -typedef renameargs nfsrenameargs; -typedef sattr nfssattr; -typedef sattrargs nfssattrargs; -typedef statfsokres nfsstatfsokres; -typedef statfsres nfsstatfsres; -typedef symlinkargs nfssymlinkargs; -typedef writeargs nfswriteargs; - - -/* - * - * FreeBSD-3.0-RELEASE has NFS V3. Older versions had it only defined - * in the rpcgen source file. If you are on an older system, and you - * want NFSv3 support, you need to regenerate the rpcsvc header files as - * follows: - * cd /usr/include/rpcsvc - * rpcgen -h -C -DWANT_NFS3 mount.x - * rpcgen -h -C -DWANT_NFS3 nfs_prot.x - * If you don't want NFSv3, then you will have to turn off the NFSMNT_NFSV3 - * macro below. If the code doesn't compile, upgrade to the latest 3.0 - * version... - */ -#ifdef NFSMNT_NFSV3 - -# define MOUNT_NFS3 "nfs" /* is this right? */ -# define MNTOPT_NFS3 "nfs" - -/* - * as of 3.0-RELEASE the nfs_fh3 that is defined in the system headers - * (or the one generated by rpcgen) lacks the proper full definition, - * listed below. A special macro (m4/macros/struct_nfs_fh3.m4) searches - * for this special name before other names. - */ - -#define NFS3_FHSIZE 64 -#define FHSIZE3 64 - -struct nfs_fh3_freebsd3 { - u_int fh3_length; - union nfs_fh3_u { - struct nfs_fh3_i { - fhandle_t fh3_i; - } nfs_fh3_i; - char data[NFS3_FHSIZE]; - } fh3_u; -}; -typedef struct nfs_fh3_freebsd3 nfs_fh3; - -#endif /* NFSMNT_NFSV3 */ - -#endif /* not _AMU_NFS_PROT_H */ diff --git a/contrib/amd/conf/nfs_prot/nfs_prot_osf5.h b/contrib/amd/conf/nfs_prot/nfs_prot_osf5.h deleted file mode 100644 index 655e98d03902..000000000000 --- a/contrib/amd/conf/nfs_prot/nfs_prot_osf5.h +++ /dev/null @@ -1,431 +0,0 @@ -/* - * Copyright (c) 1997-2003 Erez Zadok - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: nfs_prot_osf5.h,v 1.1.2.4 2002/12/27 22:44:57 ezk Exp $ - * - */ - -#ifndef _AMU_NFS_PROT_H -#define _AMU_NFS_PROT_H - -#ifdef HAVE_RPCSVC_NFS_PROT_H -# include <rpcsvc/nfs_prot.h> -#endif /* HAVE_RPCSVC_NFS_PROT_H */ -#ifdef HAVE_NFS_NFS_H -# include <nfs/nfs.h> -#endif /* HAVE_NFS_NFS_H */ -#ifdef HAVE_RPCSVC_MOUNTV3_H -# include <rpcsvc/mountv3.h> -#endif /* HAVE_RPCSVC_MOUNTV3_H */ -#ifdef HAVE_RPC_RPC_H -# include <rpc/rpc.h> -#endif /* HAVE_RPC_RPC_H */ - -/* avoid conflicts with Irix's EFS */ -#undef MOUNT_EFS /* DCE Episode FS */ - -/* - * The NFSMNT_AUTO flag in Tru64 UNIX V5 has two effects: it causes df and - * mount not to display this mount point without the -e switch, as it did in - * previous releases. Unfortunately it also ignores the timeo mount option, - * disables the usual timeout backof and enforces a timeout of NFS_MAXTIMO - * (20 seconds) instead. This breaks amd which can sometimes take longer to - * respond to an NFS request, causing `nfs server not responding still trying' - * messages. - * - * To avoid this, we need to completely disable this flag on automount points, - * with the unfortunate side effect that they are no longer hidden in df and - * mount output. - */ -#undef MNT2_NFS_OPT_AUTO - -/* - * MACROS - */ - -#define NFS_PORT 2049 -#define NFS_MAXDATA 8192 -#define NFS_MAXPATHLEN 1024 -#define NFS_MAXNAMLEN 255 -#define NFS_FHSIZE 32 -#define NFS_COOKIESIZE 4 -#define MNTPATHLEN 1024 -#define MNTNAMLEN 255 - -#define NFSMODE_FMT 0170000 -#define NFSMODE_DIR 0040000 -#define NFSMODE_CHR 0020000 -#define NFSMODE_BLK 0060000 -#define NFSMODE_REG 0100000 -#define NFSMODE_LNK 0120000 -#define NFSMODE_SOCK 0140000 -#define NFSMODE_FIFO 0010000 - -#ifndef NFS_PROGRAM -# define NFS_PROGRAM ((u_long)100003) -#endif /* not NFS_PROGRAM */ -#ifndef NFS_VERSION -# define NFS_VERSION ((u_long)2) -#endif /* not NFS_VERSION */ - -#define NFSPROC_NULL ((u_long)0) -#define NFSPROC_GETATTR ((u_long)1) -#define NFSPROC_SETATTR ((u_long)2) -#define NFSPROC_ROOT ((u_long)3) -#define NFSPROC_LOOKUP ((u_long)4) -#define NFSPROC_READLINK ((u_long)5) -#define NFSPROC_READ ((u_long)6) -#define NFSPROC_WRITECACHE ((u_long)7) -#define NFSPROC_WRITE ((u_long)8) -#define NFSPROC_CREATE ((u_long)9) -#define NFSPROC_REMOVE ((u_long)10) -#define NFSPROC_RENAME ((u_long)11) -#define NFSPROC_LINK ((u_long)12) -#define NFSPROC_SYMLINK ((u_long)13) -#define NFSPROC_MKDIR ((u_long)14) -#define NFSPROC_RMDIR ((u_long)15) -#define NFSPROC_READDIR ((u_long)16) -#define NFSPROC_STATFS ((u_long)17) - -/* map field names */ -#define ml_hostname ml_name -#define ml_directory ml_path -#define ml_next ml_nxt -#define gr_next g_next -#define gr_name g_name -#define ex_dir ex_name - -#define drok_attributes drok_attr -#define na_fileid na_nodeid -#define la_fhandle la_from -#define nt_seconds tv_sec -#define nt_useconds tv_usec -#define ra_totalcount ra_totcount -#define sla_to sla_tnm -#define sla_attributes sla_sa -#define sag_fhandle saa_fh -#define sag_attributes saa_sa -#define sfrok_tsize fsok_tsize -#define sfrok_bsize fsok_bsize -#define sfrok_blocks fsok_blocks -#define sfrok_bfree fsok_bfree -#define sfrok_bavail fsok_bavail -#define sfr_status fs_status -#define sfr_u fs_u -#define sfr_reply_u fs_fsok_u -#define wra_fhandle wa_fhandle -#define wra_beginoffset wa_begoff -#define wra_offset wa_offset -#define wra_totalcount wa_totcount -#define wra_u wa_mbuf->m_hdr -#define wra_val_u mh_data -#define wra_len_u mh_len - - -/* - * TYPEDEFS: - */ -typedef char *dirpath; -typedef char *filename; -typedef char *name; -typedef char *nfspath; -typedef char nfscookie[NFS_COOKIESIZE]; -typedef enum nfsftype nfsftype; -typedef enum nfsstat nfsstat; -typedef struct nfssvcfh fhandle; -typedef struct nfsattrstat nfsattrstat; -typedef struct nfscreateargs nfscreateargs; -typedef struct nfsdirlist nfsdirlist; -typedef struct nfsdiropargs nfsdiropargs; -typedef struct nfsdrok nfsdiropokres; -typedef struct nfsdiropres nfsdiropres; -typedef struct nfsentry nfsentry; -typedef struct exports *exports; -typedef struct exports exportnode; -typedef struct nfsfattr nfsfattr; -typedef struct fhstatus fhstatus; -typedef struct groups *groups; -typedef struct groups groupnode; -typedef struct nfslinkargs nfslinkargs; -typedef struct mountlist *mountlist; -typedef struct mountlist mountbody; -typedef struct _nfs_fh _nfs_fh; -typedef struct timeval nfstime; -typedef struct nfsreadargs nfsreadargs; -typedef struct nfsreaddirargs nfsreaddirargs; -typedef struct nfsreaddirres nfsreaddirres; -typedef struct nfsreadlinkres nfsreadlinkres; -typedef struct nfsreadokres nfsreadokres; -typedef struct nfsreadres nfsreadres; -typedef struct nfsrenameargs nfsrenameargs; -typedef struct nfssattr nfssattr; -typedef struct nfssaargs nfssattrargs; -typedef struct nfsstatfsok nfsstatfsokres; -typedef struct nfsstatfs nfsstatfsres; -typedef struct nfsslargs nfssymlinkargs; -typedef struct nfswriteargs nfswriteargs; - - -/* - * EXTERNALS: - */ - -extern void *nfsproc_null_2_svc(void *, struct svc_req *); -extern nfsattrstat *nfsproc_getattr_2_svc(struct nfssvcfh *, struct svc_req *); -extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); -extern void *nfsproc_root_2_svc(void *, struct svc_req *); -extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); -extern nfsreadlinkres *nfsproc_readlink_2_svc(struct nfssvcfh *, struct svc_req *); -extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); -extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); -extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); -extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); -extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); -extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); -extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); -extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); -extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); -extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); -extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); -extern nfsstatfsres *nfsproc_statfs_2_svc(struct nfssvcfh *, struct svc_req *); - -extern bool_t xdr_nfsstat(XDR *, nfsstat*); -extern bool_t xdr_ftype(XDR *, nfsftype*); -extern bool_t xdr_nfs_fh(XDR *, struct nfssvcfh*); -extern bool_t xdr_nfstime(XDR *, nfstime*); -extern bool_t xdr_fattr(XDR *, nfsfattr*); -extern bool_t xdr_sattr(XDR *, nfssattr*); -extern bool_t xdr_filename(XDR *, filename*); -extern bool_t xdr_nfspath(XDR *, nfspath*); -extern bool_t xdr_attrstat(XDR *, nfsattrstat*); -extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); -extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); -extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); -extern bool_t xdr_diropres(XDR *, nfsdiropres*); -extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); -extern bool_t xdr_readargs(XDR *, nfsreadargs*); -extern bool_t xdr_readokres(XDR *, nfsreadokres*); -extern bool_t xdr_readres(XDR *, nfsreadres*); -extern bool_t xdr_writeargs(XDR *, nfswriteargs*); -extern bool_t xdr_createargs(XDR *, nfscreateargs*); -extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); -extern bool_t xdr_linkargs(XDR *, nfslinkargs*); -extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); -extern bool_t xdr_nfscookie(XDR *, nfscookie); -extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); -extern bool_t xdr_entry(XDR *, nfsentry*); -extern bool_t xdr_dirlist(XDR *, nfsdirlist*); -extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); -extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); -extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); - - -/* - * STRUCTURES: - */ - -struct _nfs_fh { - char data[NFS_FHSIZE]; -}; - -struct nfstime { - u_int nt_seconds; - u_int nt_useconds; -}; - -struct _fattr { - nfsftype na_type; - u_int na_mode; - u_int na_nlink; - u_int na_uid; - u_int na_gid; - u_int na_size; - u_int na_blocksize; - u_int na_rdev; - u_int na_blocks; - u_int na_fsid; - u_int na_fileid; - nfstime na_atime; - nfstime na_mtime; - nfstime na_ctime; -}; - -struct _sattr { - u_int sa_mode; - u_int sa_uid; - u_int sa_gid; - u_int sa_size; - nfstime sa_atime; - nfstime sa_mtime; -}; - -struct _attrstat { - nfsstat ns_status; - union { - nfsfattr ns_attr_u; - } ns_u; -}; - -struct _sattrargs { - struct nfssvcfh sag_fhandle; - nfssattr sag_attributes; -}; - -struct _diropargs { - struct nfssvcfh da_fhandle; /* was dir */ - filename da_name; -}; - -struct _diropokres { - struct nfssvcfh drok_fhandle; - nfsfattr drok_attributes; -}; - -struct _diropres { - nfsstat dr_status; /* was status */ - union { - nfsdiropokres dr_drok_u; /* was diropres */ - } dr_u; /* was diropres_u */ -}; - -struct nfsreadlinkres { - nfsstat rlr_status; - union { - nfspath rlr_data_u; - } rlr_u; -}; - -struct _readargs { - struct nfssvcfh ra_fhandle; - u_int ra_offset; - u_int ra_count; - u_int ra_totalcount; -}; - -struct nfsreadokres { - nfsfattr raok_attributes; - struct { - u_int raok_len_u; - char *raok_val_u; - } raok_u; -}; - -struct nfsreadres { - nfsstat rr_status; - union { - nfsreadokres rr_reply_u; - } rr_u; -}; - -#if 0 -struct _writeargs { - struct nfssvcfh wra_fhandle; - u_int wra_beginoffset; - u_int wra_offset; - u_int wra_totalcount; - struct { - u_int wra_len_u; - char *wra_val_u; - } wra_u; -}; -#endif - -struct nfscreateargs { - nfsdiropargs ca_where; - nfssattr ca_attributes; -}; - -struct nfsrenameargs { - nfsdiropargs rna_from; - nfsdiropargs rna_to; -}; - -struct _linkargs { - struct nfssvcfh la_fhandle; - nfsdiropargs la_to; -}; - -struct _symlinkargs { - nfsdiropargs sla_from; - nfspath sla_to; - nfssattr sla_attributes; -}; - -struct nfsreaddirargs { - struct nfssvcfh rda_fhandle; - nfscookie rda_cookie; - u_int rda_count; -}; - -struct nfsentry { - u_int ne_fileid; - filename ne_name; - nfscookie ne_cookie; - nfsentry *ne_nextentry; -}; - -struct nfsdirlist { - nfsentry *dl_entries; - bool_t dl_eof; -}; - -struct nfsreaddirres { - nfsstat rdr_status; - union { - nfsdirlist rdr_reply_u; - } rdr_u; -}; - -struct _statfsokres { - u_int sfrok_tsize; - u_int sfrok_bsize; - u_int sfrok_blocks; - u_int sfrok_bfree; - u_int sfrok_bavail; -}; - -struct _statfsres { - nfsstat sfr_status; - union { - nfsstatfsokres sfr_reply_u; - } sfr_u; -}; - -#endif /* not _AMU_NFS_PROT_H */ diff --git a/contrib/amd/conf/nfs_prot/nfs_prot_sunos5_8.h b/contrib/amd/conf/nfs_prot/nfs_prot_sunos5_8.h deleted file mode 100644 index 639262229608..000000000000 --- a/contrib/amd/conf/nfs_prot/nfs_prot_sunos5_8.h +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 1997-2003 Erez Zadok - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: nfs_prot_sunos5_8.h,v 1.2.2.4 2002/12/27 22:44:59 ezk Exp $ - * - */ - -#ifndef _AMU_NFS_PROT_H -#define _AMU_NFS_PROT_H - -/* - * Do NOT include <rpcsvc/nfs_prot.h> to get NFS V2 specs, because - * it will result in conflicts with <nfs/nfs.h>. The latter is a must - * for NFS V3 specs. - */ - -#ifdef HAVE_NFS_NFS_H -# include <nfs/nfs.h> -#endif /* HAVE_NFS_NFS_H */ - -#ifdef HAVE_RPCSVC_MOUNT_H -# include <rpcsvc/mount.h> -#endif /* HAVE_RPCSVC_MOUNT_H */ - -#ifdef HAVE_RPC_RPC_H -# include <rpc/rpc.h> -#endif /* HAVE_RPC_RPC_H */ - - -/* - * MACROS - */ - -#define NFS_PORT 2049 -#define NFS_MAXDATA 8192 -#define NFS_MAXPATHLEN 1024 -#define NFS_MAXNAMLEN 255 -#define NFS_FHSIZE 32 -#define NFS_COOKIESIZE 4 - -#define NFSMODE_FMT 0170000 -#define NFSMODE_DIR 0040000 -#define NFSMODE_CHR 0020000 -#define NFSMODE_BLK 0060000 -#define NFSMODE_REG 0100000 -#define NFSMODE_LNK 0120000 -#define NFSMODE_SOCK 0140000 -#define NFSMODE_FIFO 0010000 - -#define NFSPROC_NULL ((unsigned long)(0)) -#define NFSPROC_GETATTR ((unsigned long)(1)) -#define NFSPROC_SETATTR ((unsigned long)(2)) -#define NFSPROC_ROOT ((unsigned long)(3)) -#define NFSPROC_LOOKUP ((unsigned long)(4)) -#define NFSPROC_READLINK ((unsigned long)(5)) -#define NFSPROC_READ ((unsigned long)(6)) -#define NFSPROC_WRITECACHE ((unsigned long)(7)) -#define NFSPROC_WRITE ((unsigned long)(8)) -#define NFSPROC_CREATE ((unsigned long)(9)) -#define NFSPROC_REMOVE ((unsigned long)(10)) -#define NFSPROC_RENAME ((unsigned long)(11)) -#define NFSPROC_LINK ((unsigned long)(12)) -#define NFSPROC_SYMLINK ((unsigned long)(13)) -#define NFSPROC_MKDIR ((unsigned long)(14)) -#define NFSPROC_RMDIR ((unsigned long)(15)) -#define NFSPROC_READDIR ((unsigned long)(16)) -#define NFSPROC_STATFS ((unsigned long)(17)) - - -/* - * TYPEDEFS: - */ - -typedef char *filename; -typedef char *nfspath; -typedef char nfscookie[NFS_COOKIESIZE]; -typedef enum nfsftype nfsftype; -typedef struct attrstat nfsattrstat; -typedef struct createargs nfscreateargs; -typedef struct dirlist nfsdirlist; -typedef struct diropargs nfsdiropargs; -typedef struct diropokres nfsdiropokres; -typedef struct diropres nfsdiropres; -typedef struct entry nfsentry; -typedef struct fattr nfsfattr; -typedef struct linkargs nfslinkargs; -typedef struct nfs_fh nfs_fh; -typedef struct nfstime nfstime; -typedef struct readargs nfsreadargs; -typedef struct readdirargs nfsreaddirargs; -typedef struct readdirres nfsreaddirres; -typedef struct readlinkres nfsreadlinkres; -typedef struct readokres nfsreadokres; -typedef struct readres nfsreadres; -typedef struct renameargs nfsrenameargs; -typedef struct sattr nfssattr; -typedef struct sattrargs nfssattrargs; -typedef struct statfsokres nfsstatfsokres; -typedef struct statfsres nfsstatfsres; -typedef struct symlinkargs nfssymlinkargs; -typedef struct writeargs nfswriteargs; - - -/* - * EXTERNALS: - */ - -extern bool_t xdr_nfsstat(XDR *, nfsstat *); -extern bool_t xdr_ftype(XDR *, nfsftype *); -extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); -extern bool_t xdr_nfstime(XDR *, nfstime *); -extern bool_t xdr_fattr(XDR *, nfsfattr *); -extern bool_t xdr_sattr(XDR *, nfssattr *); -extern bool_t xdr_filename(XDR *, filename *); -extern bool_t xdr_nfspath(XDR *, nfspath *); -extern bool_t xdr_attrstat(XDR *, nfsattrstat *); -extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); -extern bool_t xdr_diropargs(XDR *, nfsdiropargs *); -extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); -extern bool_t xdr_diropres(XDR *, nfsdiropres *); -extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); -extern bool_t xdr_readargs(XDR *, nfsreadargs *); -extern bool_t xdr_readokres(XDR *, nfsreadokres *); -extern bool_t xdr_readres(XDR *, nfsreadres *); -extern bool_t xdr_writeargs(XDR *, nfswriteargs *); -extern bool_t xdr_createargs(XDR *, nfscreateargs *); -extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); -extern bool_t xdr_linkargs(XDR *, nfslinkargs *); -extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); -extern bool_t xdr_nfscookie(XDR *, nfscookie); -extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); -extern bool_t xdr_entry(XDR *, nfsentry *); -extern bool_t xdr_dirlist(XDR *, nfsdirlist *); -extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); -extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); -extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); - -extern nfsattrstat *nfsproc_getattr_2(nfs_fh *, CLIENT *); -extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); -extern nfsattrstat *nfsproc_setattr_2(nfssattrargs *, CLIENT *); -extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); -extern nfsattrstat *nfsproc_write_2(nfswriteargs *, CLIENT *); -extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); -extern nfsdiropres *nfsproc_create_2(nfscreateargs *, CLIENT *); -extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); -extern nfsdiropres *nfsproc_lookup_2(nfsdiropargs *, CLIENT *); -extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); -extern nfsdiropres *nfsproc_mkdir_2(nfscreateargs *, CLIENT *); -extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); -extern nfsstat *nfsproc_link_2(nfslinkargs *, CLIENT *); -extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); -extern nfsstat *nfsproc_remove_2(nfsdiropargs *, CLIENT *); -extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); -extern nfsstat *nfsproc_rename_2(nfsrenameargs *, CLIENT *); -extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); -extern nfsstat *nfsproc_rmdir_2(nfsdiropargs *, CLIENT *); -extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); -extern nfsstat *nfsproc_symlink_2(nfssymlinkargs *, CLIENT *); -extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); -extern nfsreaddirres *nfsproc_readdir_2(nfsreaddirargs *, CLIENT *); -extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); -extern nfsreadlinkres *nfsproc_readlink_2(nfs_fh *, CLIENT *); -extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); -extern nfsreadres *nfsproc_read_2(nfsreadargs *, CLIENT *); -extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); -extern nfsstatfsres *nfsproc_statfs_2(nfs_fh *, CLIENT *); -extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); -extern void *nfsproc_null_2(void *, CLIENT *); -extern void *nfsproc_null_2_svc(void *, struct svc_req *); -extern void *nfsproc_root_2(void *, CLIENT *); -extern void *nfsproc_root_2_svc(void *, struct svc_req *); -extern void *nfsproc_writecache_2(void *, CLIENT *); -extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); -extern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); - - -/* - * ENUMS: - */ - - -/* - * STRUCTURES: - */ - -struct nfs_fh { - char fh_data[NFS_FHSIZE]; -}; - -struct nfstime { - u_int nt_seconds; - u_int nt_useconds; -}; - -struct fattr { - nfsftype na_type; - u_int na_mode; - u_int na_nlink; - u_int na_uid; - u_int na_gid; - u_int na_size; - u_int na_blocksize; - u_int na_rdev; - u_int na_blocks; - u_int na_fsid; - u_int na_fileid; - nfstime na_atime; - nfstime na_mtime; - nfstime na_ctime; -}; - -struct sattr { - u_int sa_mode; - u_int sa_uid; - u_int sa_gid; - u_int sa_size; - nfstime sa_atime; - nfstime sa_mtime; -}; - -struct attrstat { - nfsstat ns_status; - union { - nfsfattr ns_attr_u; - } ns_u; -}; - -struct sattrargs { - nfs_fh sag_fhandle; - nfssattr sag_attributes; -}; - -struct diropargs { - nfs_fh da_fhandle; /* was dir */ - filename da_name; -}; - -struct diropokres { - nfs_fh drok_fhandle; - nfsfattr drok_attributes; -}; - -struct diropres { - nfsstat dr_status; /* was status */ - union { - nfsdiropokres dr_drok_u; /* was diropres */ - } dr_u; /* was diropres_u */ -}; - -struct readlinkres { - nfsstat rlr_status; - union { - nfspath rlr_data_u; - } rlr_u; -}; - -struct readargs { - nfs_fh ra_fhandle; - u_int ra_offset; - u_int ra_count; - u_int ra_totalcount; -}; - -struct readokres { - nfsfattr raok_attributes; - struct { - u_int raok_len_u; - char *raok_val_u; - } raok_u; -}; - -struct readres { - nfsstat rr_status; - union { - nfsreadokres rr_reply_u; - } rr_u; -}; - -struct writeargs { - nfs_fh wra_fhandle; - u_int wra_beginoffset; - u_int wra_offset; - u_int wra_totalcount; - struct { - u_int wra_len_u; - char *wra_val_u; - } wra_u; -}; - -struct createargs { - nfsdiropargs ca_where; - nfssattr ca_attributes; -}; - -struct renameargs { - nfsdiropargs rna_from; - nfsdiropargs rna_to; -}; - -struct linkargs { - nfs_fh la_fhandle; - nfsdiropargs la_to; -}; - -struct symlinkargs { - nfsdiropargs sla_from; - nfspath sla_to; - nfssattr sla_attributes; -}; - -struct readdirargs { - nfs_fh rda_fhandle; - nfscookie rda_cookie; - u_int rda_count; -}; - -struct entry { - u_int ne_fileid; - filename ne_name; - nfscookie ne_cookie; - nfsentry *ne_nextentry; -}; - -struct dirlist { - nfsentry *dl_entries; - bool_t dl_eof; -}; - -struct readdirres { - nfsstat rdr_status; - union { - nfsdirlist rdr_reply_u; - } rdr_u; -}; - -struct statfsokres { - u_int sfrok_tsize; - u_int sfrok_bsize; - u_int sfrok_blocks; - u_int sfrok_bfree; - u_int sfrok_bavail; -}; - -struct statfsres { - nfsstat sfr_status; - union { - nfsstatfsokres sfr_reply_u; - } sfr_u; -}; - -#endif /* not _AMU_NFS_PROT_H */ diff --git a/contrib/amd/conf/trap/trap_default.h b/contrib/amd/conf/trap/trap_default.h deleted file mode 100644 index a132b0ec4931..000000000000 --- a/contrib/amd/conf/trap/trap_default.h +++ /dev/null @@ -1,2 +0,0 @@ -/* $srcdir/conf/trap/trap_default.h */ -#define MOUNT_TRAP(type, mnt, flags, mnt_data) mount(type, mnt->mnt_dir, flags, mnt_data) diff --git a/contrib/amd/conf/trap/trap_freebsd3.h b/contrib/amd/conf/trap/trap_freebsd3.h deleted file mode 100644 index 95c664254c05..000000000000 --- a/contrib/amd/conf/trap/trap_freebsd3.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $srcdir/conf/trap/trap_freebsd3.h */ -extern int mount_freebsd3(MTYPE_TYPE type, const char *dir, int flags, voidp data); -#define MOUNT_TRAP(type, mnt, flags, mnt_data) mount_freebsd3(type, mnt->mnt_dir, flags, mnt_data) diff --git a/contrib/amd/cvs-server.txt b/contrib/amd/cvs-server.txt deleted file mode 100644 index 0943963082cb..000000000000 --- a/contrib/amd/cvs-server.txt +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################## -Here are generic CVS server instructions: - -(1) Login to the cvs server. Not needed more than once b/c the cvs login - will record your cvs password in $HOME/.cvspass. Change "ezk" for your - CVS user id. - -$ cvs -d :pserver:ezk@shekel.mcl.cs.columbia.edu:/proj/bank/cvsroot login -CVS password: - -Type in your password, crypt(3)'ed in /proj/bank/cvsroot/CVSROOT/passwd. - -(2) Then, check out a fresh copy of 6.1 (experimental) - -$ cvs -d :pserver:ezk@shekel.mcl.cs.columbia.edu:/proj/bank/cvsroot checkout am-utils - -Or, to checkout the stable branch: - -$ cvs -d :pserver:ezk@shekel.mcl.cs.columbia.edu:/proj/bank/cvsroot checkout -r amd-6-0-stable am-utils - -(3) Then you can do normal edit, commit, update, etc. w/o having to worry - about your $CVSROOT or the -d option. - -############################################################################## -To merge changes from the stable branch into the main (experimental) branch: - -$ cvs update -j amd-6-0-stable -kk - -- don't worry about all the files that change; it's probably because of cvs - keywords in the sources -- after the merge, do a 'cvs update -d' and resolve any conflicts - -############################################################################## - -There are two new mailing lists: - -amd-maintainers@shekel.mcl.cs.columbia.edu: for Amd maintainers to - communicate internally w/o exposure to the greater user community. - -amd-cvslog@shekel.mcl.cs.columbia.edu: to get cvs log messages. I've used a - better (I hope) script for loginfo. It provides different output - and can be tweaked as well. -############################################################################## diff --git a/contrib/amd/libamu/alloca.c b/contrib/amd/libamu/alloca.c deleted file mode 100644 index 31fb4e0d4e06..000000000000 --- a/contrib/amd/libamu/alloca.c +++ /dev/null @@ -1,504 +0,0 @@ -/* alloca.c -- allocate automatically reclaimed memory - (Mostly) portable public-domain implementation -- D A Gwyn - - This implementation of the PWB library alloca function, - which is used to allocate space off the run-time stack so - that it is automatically reclaimed upon procedure exit, - was inspired by discussions with J. Q. Johnson of Cornell. - J.Otto Tennant <jot@cray.com> contributed the Cray support. - - There are some preprocessor constants that can - be defined when compiling for your specific system, for - improved efficiency; however, the defaults should be okay. - - The general concept of this implementation is to keep - track of all alloca-allocated blocks, and reclaim any - that are found to be deeper in the stack than the current - invocation. This heuristic does not reclaim storage as - soon as it becomes invalid, but it will do so eventually. - - As a special case, alloca(0) reclaims storage without - allocating any. It is a good idea to use alloca(0) in - your main control loop, etc. to force garbage collection. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#ifdef emacs -#include "blockinput.h" -#endif - -/* If compiling with GCC 2, this file's not needed. */ -#if !defined (__GNUC__) || __GNUC__ < 2 - -/* If someone has defined alloca as a macro, - there must be some other way alloca is supposed to work. */ -#ifndef alloca - -#ifdef emacs -#ifdef static -/* actually, only want this if static is defined as "" - -- this is for usg, in which emacs must undefine static - in order to make unexec workable - */ -#ifndef STACK_DIRECTION -you -lose --- must know STACK_DIRECTION at compile-time -#endif /* STACK_DIRECTION undefined */ -#endif /* static */ -#endif /* emacs */ - -/* If your stack is a linked list of frames, you have to - provide an "address metric" ADDRESS_FUNCTION macro. */ - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) -long i00afunc (); -#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) -#else -#define ADDRESS_FUNCTION(arg) &(arg) -#endif - -#if __STDC__ -typedef void *pointer; -#else -typedef char *pointer; -#endif - -#ifndef NULL -#define NULL 0 -#endif - -/* Different portions of Emacs need to call different versions of - malloc. The Emacs executable needs alloca to call xmalloc, because - ordinary malloc isn't protected from input signals. On the other - hand, the utilities in lib-src need alloca to call malloc; some of - them are very simple, and don't have an xmalloc routine. - - Non-Emacs programs expect this to call use xmalloc. - - Callers below should use malloc. */ - -#ifndef emacs -#define malloc xmalloc -#endif -extern pointer malloc (); - -/* Define STACK_DIRECTION if you know the direction of stack - growth for your system; otherwise it will be automatically - deduced at run-time. - - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ - -#ifndef STACK_DIRECTION -#define STACK_DIRECTION 0 /* Direction unknown. */ -#endif - -#if STACK_DIRECTION != 0 - -#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ - -#else /* STACK_DIRECTION == 0; need run-time code. */ - -static int stack_dir; /* 1 or -1 once known. */ -#define STACK_DIR stack_dir - -static void -find_stack_direction () -{ - static char *addr = NULL; /* Address of first `dummy', once known. */ - auto char dummy; /* To get stack address. */ - - if (addr == NULL) - { /* Initial entry. */ - addr = ADDRESS_FUNCTION (dummy); - - find_stack_direction (); /* Recurse once. */ - } - else - { - /* Second entry. */ - if (ADDRESS_FUNCTION (dummy) > addr) - stack_dir = 1; /* Stack grew upward. */ - else - stack_dir = -1; /* Stack grew downward. */ - } -} - -#endif /* STACK_DIRECTION == 0 */ - -/* An "alloca header" is used to: - (a) chain together all alloca'ed blocks; - (b) keep track of stack depth. - - It is very important that sizeof(header) agree with malloc - alignment chunk size. The following default should work okay. */ - -#ifndef ALIGN_SIZE -#define ALIGN_SIZE sizeof(double) -#endif - -typedef union hdr -{ - char align[ALIGN_SIZE]; /* To force sizeof(header). */ - struct - { - union hdr *next; /* For chaining headers. */ - char *deep; /* For stack depth measure. */ - } h; -} header; - -static header *last_alloca_header = NULL; /* -> last alloca header. */ - -/* Return a pointer to at least SIZE bytes of storage, - which will be automatically reclaimed upon exit from - the procedure that called alloca. Originally, this space - was supposed to be taken from the current stack frame of the - caller, but that method cannot be made to work for some - implementations of C, for example under Gould's UTX/32. */ - -pointer -alloca (size) - unsigned size; -{ - auto char probe; /* Probes stack depth: */ - register char *depth = ADDRESS_FUNCTION (probe); - -#if STACK_DIRECTION == 0 - if (STACK_DIR == 0) /* Unknown growth direction. */ - find_stack_direction (); -#endif - - /* Reclaim garbage, defined as all alloca'd storage that - was allocated from deeper in the stack than currently. */ - - { - register header *hp; /* Traverses linked list. */ - -#ifdef emacs - BLOCK_INPUT; -#endif - - for (hp = last_alloca_header; hp != NULL;) - if ((STACK_DIR > 0 && hp->h.deep > depth) - || (STACK_DIR < 0 && hp->h.deep < depth)) - { - register header *np = hp->h.next; - - free ((pointer) hp); /* Collect garbage. */ - - hp = np; /* -> next header. */ - } - else - break; /* Rest are not deeper. */ - - last_alloca_header = hp; /* -> last valid storage. */ - -#ifdef emacs - UNBLOCK_INPUT; -#endif - } - - if (size == 0) - return NULL; /* No allocation required. */ - - /* Allocate combined header + user data storage. */ - - { - register pointer new = malloc (sizeof (header) + size); - /* Address of header. */ - - if (new == 0) - abort(); - - ((header *) new)->h.next = last_alloca_header; - ((header *) new)->h.deep = depth; - - last_alloca_header = (header *) new; - - /* User storage begins just after header. */ - - return (pointer) ((char *) new + sizeof (header)); - } -} - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) - -#ifdef DEBUG_I00AFUNC -#include <stdio.h> -#endif - -#ifndef CRAY_STACK -#define CRAY_STACK -#ifndef CRAY2 -/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ -struct stack_control_header - { - long shgrow:32; /* Number of times stack has grown. */ - long shaseg:32; /* Size of increments to stack. */ - long shhwm:32; /* High water mark of stack. */ - long shsize:32; /* Current size of stack (all segments). */ - }; - -/* The stack segment linkage control information occurs at - the high-address end of a stack segment. (The stack - grows from low addresses to high addresses.) The initial - part of the stack segment linkage control information is - 0200 (octal) words. This provides for register storage - for the routine which overflows the stack. */ - -struct stack_segment_linkage - { - long ss[0200]; /* 0200 overflow words. */ - long sssize:32; /* Number of words in this segment. */ - long ssbase:32; /* Offset to stack base. */ - long:32; - long sspseg:32; /* Offset to linkage control of previous - segment of stack. */ - long:32; - long sstcpt:32; /* Pointer to task common address block. */ - long sscsnm; /* Private control structure number for - microtasking. */ - long ssusr1; /* Reserved for user. */ - long ssusr2; /* Reserved for user. */ - long sstpid; /* Process ID for pid based multi-tasking. */ - long ssgvup; /* Pointer to multitasking thread giveup. */ - long sscray[7]; /* Reserved for Cray Research. */ - long ssa0; - long ssa1; - long ssa2; - long ssa3; - long ssa4; - long ssa5; - long ssa6; - long ssa7; - long sss0; - long sss1; - long sss2; - long sss3; - long sss4; - long sss5; - long sss6; - long sss7; - }; - -#else /* CRAY2 */ -/* The following structure defines the vector of words - returned by the STKSTAT library routine. */ -struct stk_stat - { - long now; /* Current total stack size. */ - long maxc; /* Amount of contiguous space which would - be required to satisfy the maximum - stack demand to date. */ - long high_water; /* Stack high-water mark. */ - long overflows; /* Number of stack overflow ($STKOFEN) calls. */ - long hits; /* Number of internal buffer hits. */ - long extends; /* Number of block extensions. */ - long stko_mallocs; /* Block allocations by $STKOFEN. */ - long underflows; /* Number of stack underflow calls ($STKRETN). */ - long stko_free; /* Number of deallocations by $STKRETN. */ - long stkm_free; /* Number of deallocations by $STKMRET. */ - long segments; /* Current number of stack segments. */ - long maxs; /* Maximum number of stack segments so far. */ - long pad_size; /* Stack pad size. */ - long current_address; /* Current stack segment address. */ - long current_size; /* Current stack segment size. This - number is actually corrupted by STKSTAT to - include the fifteen word trailer area. */ - long initial_address; /* Address of initial segment. */ - long initial_size; /* Size of initial segment. */ - }; - -/* The following structure describes the data structure which trails - any stack segment. I think that the description in 'asdef' is - out of date. I only describe the parts that I am sure about. */ - -struct stk_trailer - { - long this_address; /* Address of this block. */ - long this_size; /* Size of this block (does not include - this trailer). */ - long unknown2; - long unknown3; - long link; /* Address of trailer block of previous - segment. */ - long unknown5; - long unknown6; - long unknown7; - long unknown8; - long unknown9; - long unknown10; - long unknown11; - long unknown12; - long unknown13; - long unknown14; - }; - -#endif /* CRAY2 */ -#endif /* not CRAY_STACK */ - -#ifdef CRAY2 -/* Determine a "stack measure" for an arbitrary ADDRESS. - I doubt that "lint" will like this much. */ - -static long -i00afunc (long *address) -{ - struct stk_stat status; - struct stk_trailer *trailer; - long *block, size; - long result = 0; - - /* We want to iterate through all of the segments. The first - step is to get the stack status structure. We could do this - more quickly and more directly, perhaps, by referencing the - $LM00 common block, but I know that this works. */ - - STKSTAT (&status); - - /* Set up the iteration. */ - - trailer = (struct stk_trailer *) (status.current_address - + status.current_size - - 15); - - /* There must be at least one stack segment. Therefore it is - a fatal error if "trailer" is null. */ - - if (trailer == 0) - abort (); - - /* Discard segments that do not contain our argument address. */ - - while (trailer != 0) - { - block = (long *) trailer->this_address; - size = trailer->this_size; - if (block == 0 || size == 0) - abort (); - trailer = (struct stk_trailer *) trailer->link; - if ((block <= address) && (address < (block + size))) - break; - } - - /* Set the result to the offset in this segment and add the sizes - of all predecessor segments. */ - - result = address - block; - - if (trailer == 0) - { - return result; - } - - do - { - if (trailer->this_size <= 0) - abort (); - result += trailer->this_size; - trailer = (struct stk_trailer *) trailer->link; - } - while (trailer != 0); - - /* We are done. Note that if you present a bogus address (one - not in any segment), you will get a different number back, formed - from subtracting the address of the first block. This is probably - not what you want. */ - - return (result); -} - -#else /* not CRAY2 */ -/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. - Determine the number of the cell within the stack, - given the address of the cell. The purpose of this - routine is to linearize, in some sense, stack addresses - for alloca. */ - -static long -i00afunc (long address) -{ - long stkl = 0; - - long size, pseg, this_segment, stack; - long result = 0; - - struct stack_segment_linkage *ssptr; - - /* Register B67 contains the address of the end of the - current stack segment. If you (as a subprogram) store - your registers on the stack and find that you are past - the contents of B67, you have overflowed the segment. - - B67 also points to the stack segment linkage control - area, which is what we are really interested in. */ - - stkl = CRAY_STACKSEG_END (); - ssptr = (struct stack_segment_linkage *) stkl; - - /* If one subtracts 'size' from the end of the segment, - one has the address of the first word of the segment. - - If this is not the first segment, 'pseg' will be - nonzero. */ - - pseg = ssptr->sspseg; - size = ssptr->sssize; - - this_segment = stkl - size; - - /* It is possible that calling this routine itself caused - a stack overflow. Discard stack segments which do not - contain the target address. */ - - while (!(this_segment <= address && address <= stkl)) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); -#endif - if (pseg == 0) - break; - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - this_segment = stkl - size; - } - - result = address - this_segment; - - /* If you subtract pseg from the current end of the stack, - you get the address of the previous stack segment's end. - This seems a little convoluted to me, but I'll bet you save - a cycle somewhere. */ - - while (pseg != 0) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o\n", pseg, size); -#endif - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - result += size; - } - return (result); -} - -#endif /* not CRAY2 */ -#endif /* CRAY */ - -#endif /* no alloca */ -#endif /* not GCC version 2 */ diff --git a/contrib/amd/libamu/clnt_sperrno.c b/contrib/amd/libamu/clnt_sperrno.c deleted file mode 100644 index d3b48d1cd405..000000000000 --- a/contrib/amd/libamu/clnt_sperrno.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 1997-1998 Erez Zadok - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: clnt_sperrno.c,v 5.2.2.1 1992/02/09 15:08:40 jsp beta $ - * - */ - -/* - * Early RPC seems to be missing these.. - * Extracted from the RPC 3.9 sources as indicated - */ - -/* @(#)clnt_perror.c 1.1 87/11/04 3.9 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif /* HAVE_CONFIG_H */ -#include <am_defs.h> -#include <amu.h> - - -struct rpc_errtab { - enum clnt_stat status; - char *message; -}; - -static struct rpc_errtab rpc_errlist[] = -{ - {RPC_SUCCESS, - "RPC: Success"}, - {RPC_CANTENCODEARGS, - "RPC: Can't encode arguments"}, - {RPC_CANTDECODERES, - "RPC: Can't decode result"}, - {RPC_CANTSEND, - "RPC: Unable to send"}, - {RPC_CANTRECV, - "RPC: Unable to receive"}, - {RPC_TIMEDOUT, - "RPC: Timed out"}, - {RPC_VERSMISMATCH, - "RPC: Incompatible versions of RPC"}, - {RPC_AUTHERROR, - "RPC: Authentication error"}, - {RPC_PROGUNAVAIL, - "RPC: Program unavailable"}, - {RPC_PROGVERSMISMATCH, - "RPC: Program/version mismatch"}, - {RPC_PROCUNAVAIL, - "RPC: Procedure unavailable"}, - {RPC_CANTDECODEARGS, - "RPC: Server can't decode arguments"}, - {RPC_SYSTEMERROR, - "RPC: Remote system error"}, - {RPC_UNKNOWNHOST, - "RPC: Unknown host"}, -/* { RPC_UNKNOWNPROTO, - * "RPC: Unknown protocol" }, */ - {RPC_PMAPFAILURE, - "RPC: Port mapper failure"}, - {RPC_PROGNOTREGISTERED, - "RPC: Program not registered"}, - {RPC_FAILED, - "RPC: Failed (unspecified error)"} -}; - - -/* - * This interface for use by clntrpc - */ -char * -clnt_sperrno(enum clnt_stat stat) -{ - int i; - - for (i = 0; i < sizeof(rpc_errlist) / sizeof(struct rpc_errtab); i++) { - if (rpc_errlist[i].status == stat) { - return (rpc_errlist[i].message); - } - } - return ("RPC: (unknown error code)"); -} diff --git a/contrib/amd/libamu/util.c b/contrib/amd/libamu/util.c deleted file mode 100644 index ad16b15eb9df..000000000000 --- a/contrib/amd/libamu/util.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 1997-2004 Erez Zadok - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * %W% (Berkeley) %G% - * - * $Id: util.c,v 1.3.2.4 2004/01/06 03:15:24 ezk Exp $ - * - */ - -/* - * General Utilities. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif /* HAVE_CONFIG_H */ -#include <am_defs.h> -#include <amu.h> - - -char * -strnsave(const char *str, int len) -{ - char *sp = (char *) xmalloc(len + 1); - memmove(sp, str, len); - sp[len] = 0; - - return sp; -} - - -/* - * Concatenate three strings and store in buffer pointed to - * by p, making p large enough to hold the strings - */ -char * -str3cat(char *p, char *s1, char *s2, char *s3) -{ - int l1 = strlen(s1); - int l2 = strlen(s2); - int l3 = strlen(s3); - - p = (char *) xrealloc(p, l1 + l2 + l3 + 1); - memmove(p, s1, l1); - memmove(p + l1, s2, l2); - memmove(p + l1 + l2, s3, l3 + 1); - return p; -} - - -/* - * Make all the directories in the path. - */ -int -mkdirs(char *path, int mode) -{ - /* - * take a copy in case path is in readonly store - */ - char *p2 = strdup(path); - char *sp = p2; - struct stat stb; - int error_so_far = 0; - - /* - * Skip through the string make the directories. - * Mostly ignore errors - the result is tested at the end. - * - * This assumes we are root so that we can do mkdir in a - * mode 555 directory... - */ - while ((sp = strchr(sp + 1, '/'))) { - *sp = '\0'; - if (mkdir(p2, mode) < 0) { - error_so_far = errno; - } else { -#ifdef DEBUG - dlog("mkdir(%s)", p2); -#endif /* DEBUG */ - } - *sp = '/'; - } - - if (mkdir(p2, mode) < 0) { - error_so_far = errno; - } else { -#ifdef DEBUG - dlog("mkdir(%s)", p2); -#endif /* DEBUG */ - } - - XFREE(p2); - - return stat(path, &stb) == 0 && - (stb.st_mode & S_IFMT) == S_IFDIR ? 0 : error_so_far; -} - - -/* - * Remove as many directories in the path as possible. - * Give up if the directory doesn't appear to have - * been created by Amd (not mode dr-x) or an rmdir - * fails for any reason. - */ -void -rmdirs(char *dir) -{ - char *xdp = strdup(dir); - char *dp; - - do { - struct stat stb; - /* - * Try to find out whether this was - * created by amd. Do this by checking - * for owner write permission. - */ - if (stat(xdp, &stb) == 0 && (stb.st_mode & 0200) == 0) { - if (rmdir(xdp) < 0) { - if (errno != ENOTEMPTY && - errno != EBUSY && - errno != EEXIST && - errno != EINVAL) - plog(XLOG_ERROR, "rmdir(%s): %m", xdp); - break; - } else { -#ifdef DEBUG - dlog("rmdir(%s)", xdp); -#endif /* DEBUG */ - } - } else { - break; - } - - dp = strrchr(xdp, '/'); - if (dp) - *dp = '\0'; - } while (dp && dp > xdp); - - XFREE(xdp); -} diff --git a/contrib/amd/scripts/Makefile.am b/contrib/amd/scripts/Makefile.am deleted file mode 100644 index c4380584ec0e..000000000000 --- a/contrib/amd/scripts/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -## Process this file with automake to produce Makefile.in - -# Package: am-utils -# Level: Makefile for scripts/ directory -# Author: Erez Zadok - -sbin_SCRIPTS = \ - am-eject \ - amd2ldif \ - amd2sun \ - ctl-amd \ - ctl-hlfsd \ - fixrmtab \ - fix-amd-map \ - lostaltmail \ - wait4amd \ - wait4amd2die - -bin_SCRIPTS = \ - expn - -sysconf_DATA = \ - amd.conf-sample \ - lostaltmail.conf-sample - -# man pages -man_MANS = \ - amd.conf.5 \ - expn.1 - -EXTRA_DIST = \ - am-eject.in \ - amd2ldif.in \ - amd2sun.in \ - ctl-amd.in \ - ctl-hlfsd.in \ - fixrmtab.in \ - fix-amd-map.in \ - lostaltmail.in \ - wait4amd.in \ - wait4amd2die.in \ - \ - expn.in \ - \ - amd.conf-sample \ - lostaltmail.conf-sample \ - $(man_MANS) - -CLEANFILES = $(sbin_SCRIPTS) $(bin_SCRIPTS) diff --git a/contrib/amd/scripts/Makefile.in b/contrib/amd/scripts/Makefile.in deleted file mode 100644 index a20d84627136..000000000000 --- a/contrib/amd/scripts/Makefile.in +++ /dev/null @@ -1,381 +0,0 @@ -# Makefile.in generated automatically by automake 1.3.2 from Makefile.am - -# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Package: am-utils -# Level: Makefile for scripts/ directory -# Author: Erez Zadok - - -SHELL = /bin/sh - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DISTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AR = @AR@ -CC = @CC@ -CPP = @CPP@ -LEX = @LEX@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ -LTALLOCA = @LTALLOCA@ -LTLIBOBJS = @LTLIBOBJS@ -PACKAGE = @PACKAGE@ -PERL = @PERL@ -RANLIB = @RANLIB@ -VERSION = @VERSION@ - -sbin_SCRIPTS = \ - am-eject \ - amd2ldif \ - amd2sun \ - ctl-amd \ - ctl-hlfsd \ - fixrmtab \ - fix-amd-map \ - lostaltmail \ - wait4amd \ - wait4amd2die - -bin_SCRIPTS = \ - expn - -sysconf_DATA = \ - amd.conf-sample \ - lostaltmail.conf-sample - -# man pages -man_MANS = \ - amd.conf.5 \ - expn.1 - -EXTRA_DIST = \ - am-eject.in \ - amd2ldif.in \ - amd2sun.in \ - ctl-amd.in \ - ctl-hlfsd.in \ - fixrmtab.in \ - fix-amd-map.in \ - lostaltmail.in \ - wait4amd.in \ - wait4amd2die.in \ - \ - expn.in \ - \ - amd.conf-sample \ - lostaltmail.conf-sample \ - $(man_MANS) - -CLEANFILES = $(sbin_SCRIPTS) $(bin_SCRIPTS) -mkinstalldirs = $(SHELL) $(top_srcdir)/aux/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = am-eject amd2ldif amd2sun ctl-amd ctl-hlfsd expn \ -fixrmtab fix-amd-map lostaltmail wait4amd wait4amd2die -SCRIPTS = $(bin_SCRIPTS) $(sbin_SCRIPTS) - -man1dir = $(mandir)/man1 -man5dir = $(mandir)/man5 -MANS = $(man_MANS) - -NROFF = nroff -DATA = $(sysconf_DATA) - -DIST_COMMON = Makefile.am Makefile.in am-eject.in amd2ldif.in \ -amd2sun.in ctl-amd.in ctl-hlfsd.in expn.in fix-amd-map.in fixrmtab.in \ -lostaltmail.in wait4amd.in wait4amd2die.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP = --best -all: Makefile $(SCRIPTS) $(MANS) $(DATA) - -.SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/./aux/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --localdir=./aux --gnu --include-deps scripts/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - -am-eject: $(top_builddir)/config.status am-eject.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -amd2ldif: $(top_builddir)/config.status amd2ldif.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -amd2sun: $(top_builddir)/config.status amd2sun.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -ctl-amd: $(top_builddir)/config.status ctl-amd.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -ctl-hlfsd: $(top_builddir)/config.status ctl-hlfsd.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -expn: $(top_builddir)/config.status expn.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -fixrmtab: $(top_builddir)/config.status fixrmtab.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -fix-amd-map: $(top_builddir)/config.status fix-amd-map.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -lostaltmail: $(top_builddir)/config.status lostaltmail.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -wait4amd: $(top_builddir)/config.status wait4amd.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status -wait4amd2die: $(top_builddir)/config.status wait4amd2die.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status - -install-binSCRIPTS: $(bin_SCRIPTS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_SCRIPTS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ - else if test -f $(srcdir)/$$p; then \ - echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ - else :; fi; fi; \ - done - -uninstall-binSCRIPTS: - @$(NORMAL_UNINSTALL) - list='$(bin_SCRIPTS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ - done - -install-sbinSCRIPTS: $(sbin_SCRIPTS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(sbindir) - @list='$(sbin_SCRIPTS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \ - else if test -f $(srcdir)/$$p; then \ - echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \ - else :; fi; fi; \ - done - -uninstall-sbinSCRIPTS: - @$(NORMAL_UNINSTALL) - list='$(sbin_SCRIPTS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \ - done - -install-man1: - $(mkinstalldirs) $(DESTDIR)$(man1dir) - @list='$(man1_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ - case "$$i" in \ - *.1*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ - else file=$$i; fi; \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ - done - -uninstall-man1: - @list='$(man1_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ - case "$$i" in \ - *.1*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ - rm -f $(DESTDIR)$(man1dir)/$$inst; \ - done - -install-man5: - $(mkinstalldirs) $(DESTDIR)$(man5dir) - @list='$(man5_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ - case "$$i" in \ - *.5*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ - else file=$$i; fi; \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \ - done - -uninstall-man5: - @list='$(man5_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ - case "$$i" in \ - *.5*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \ - rm -f $(DESTDIR)$(man5dir)/$$inst; \ - done -install-man: $(MANS) - @$(NORMAL_INSTALL) - $(MAKE) install-man1 install-man5 -uninstall-man: - @$(NORMAL_UNINSTALL) - $(MAKE) uninstall-man1 uninstall-man5 - -install-sysconfDATA: $(sysconf_DATA) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(sysconfdir) - @list='$(sysconf_DATA)'; for p in $$list; do \ - if test -f $(srcdir)/$$p; then \ - echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \ - $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \ - else if test -f $$p; then \ - echo " $(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \ - $(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \ - fi; fi; \ - done - -uninstall-sysconfDATA: - @$(NORMAL_UNINSTALL) - list='$(sysconf_DATA)'; for p in $$list; do \ - rm -f $(DESTDIR)$(sysconfdir)/$$p; \ - done -tags: TAGS -TAGS: - - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = scripts - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file; \ - done -info: -dvi: -check: all - $(MAKE) -installcheck: -install-exec: install-binSCRIPTS install-sbinSCRIPTS install-sysconfDATA - @$(NORMAL_INSTALL) - -install-data: install-man - @$(NORMAL_INSTALL) - -install: install-exec install-data all - @: - -uninstall: uninstall-binSCRIPTS uninstall-sbinSCRIPTS uninstall-man uninstall-sysconfDATA - -install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install -installdirs: - $(mkinstalldirs) $(DATADIR)$(bindir) $(DATADIR)$(sbindir) \ - $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 \ - $(DATADIR)$(sysconfdir) - - -mostlyclean-generic: - -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(DISTCLEANFILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -mostlyclean: mostlyclean-generic - -clean: clean-generic mostlyclean - -distclean: distclean-generic clean - -rm -f config.status - -rm -f libtool - -maintainer-clean: maintainer-clean-generic distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -.PHONY: uninstall-binSCRIPTS install-binSCRIPTS uninstall-sbinSCRIPTS \ -install-sbinSCRIPTS install-man1 uninstall-man1 install-man5 \ -uninstall-man5 install-man uninstall-man uninstall-sysconfDATA \ -install-sysconfDATA tags distdir info dvi installcheck install-exec \ -install-data install uninstall all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/amd/scripts/fixrmtab b/contrib/amd/scripts/fixrmtab deleted file mode 100755 index 33b7bcfdb6ce..000000000000 --- a/contrib/amd/scripts/fixrmtab +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# Invalidate /etc/rmtab entries for hosts named. -# Restart mountd for changes to take effect. -# -# usage: fixrmtab host1 host2 ... -# -# Package: am-utils-6.0 -# Author: Andreas Stolcke <stolcke@icsi.berkeley.edu> - -#set -x - -RMTAB=/etc/rmtab -TMP=/tmp/rmtab.$$ - -if [ ! -f /etc/rmtab ]; then - exit 0 -fi - -for host in $* -do - sed -e '/^'$host':/s/^./#/' $RMTAB > $TMP && cp $TMP $RMTAB -done -rm -f $TMP diff --git a/contrib/amd/scripts/lostaltmail.conf-sample b/contrib/amd/scripts/lostaltmail.conf-sample deleted file mode 100644 index a20158c14f83..000000000000 --- a/contrib/amd/scripts/lostaltmail.conf-sample +++ /dev/null @@ -1,84 +0,0 @@ -# -*- perl -*- -############################################################################## -# # -# CONFIGURABLE VALUES # -# # -############################################################################## - -$MAILGRUNT="postmaster"; # To whom to send log mail if mail is prefered. - -$TMPDIR="/tmp/"; # Place lostmail can do its dirty work. - -$LOCAL_LOCK_EXT=".lock"; # Name of file local mailer uses to lock - # spool file. This the correct setting for - # /bin/mail - -$SYSTEM_FROM_ADDRESS="Mailer-Daemon"; - -$MAILDIR="/var/alt_mail"; # What directory should I run out of. -$MAILER='/usr/lib/sendmail -t'; # Which mailer should I use. - -$LOCALMAILJUNK='.*~|\#.*|core'; # Files name patterns that might appear in - # alt_mail and should be ignored. This REGEXP - # gets or'ed with $MAILJUNK below. - -$SMTPHOST='localhost'; # The name of a local host which speaks SMTP - # and knows *all* your aliases. You probably - # don't want to change this. If the machine - # running lost_alt mail doesn't run an SMTP, - # daemon then something is either wrong or you - # should be setting `noverify' to prevent - # SMTP verification. - -$HOSTNAME='localhost'; # Hostname to use for SMTP HELO - -# Subject of lost log mail message. Must define $MAILGRUNT. -# I overwrite this variable in the subroutine Clean_up. Please make sure I -# haven't noodle-headdly forgotten to remove that hack in the distribution! -# No newline here please. The script will insert it for you. -$LOG_SUBJECT="Log of lostmail resends"; - -############################################################################## -# # -# DEFAULTED CONFIGURATIONS # -# # -############################################################################## - -$LOGFILE="$TMPDIR" . "lostlog"; - - -# MAILJUNK is a pattern of ignorable alt_mail files which are either common -# to most platforms or actually produced by this script. You should customize -# this REGEXP by hacking at $LOCALMAILJUNK above. -$MAILJUNK='[a-z]\.[0-9]*|\.\.?|lost\+found'; - -$LOCKEXT=".lostlock"; # our lock file extension. Should not need to - # modify - -$MESSAGE_DELIM="^From[^:]"; # /bin/mail message delimiter. Your milage - # may differ - -$HEADER_BODY_DELIM="\n"; # RFC 822 header-body delimiter. - -$RESENT_TO="Resent-To: "; # -$RESENT_FROM="Resent-From: "; # Resent headers (RFC 822). -$RESENT_DATE="Resent-Date: "; # You probably don't want to muck with these. -$RESENT_INFO="X-Resent-Info: "; # (special one to alert folks about mail). - - -############################################################################## -# # -# LOSTMAIL DEFINITIONS (DON'T TOUCH) # -# # -############################################################################## - -$FALSE=0; -$TRUE=(! $FALSE); - -$OK=$TRUE; -$ABORT_RESEND=2; -$LOCK_RETRIES=10; # The number of seconds/retries lost mail - # should wait before requeing or aborting a - # resend. - -TRUE; # Ansures true return from include file. diff --git a/contrib/amd/scripts/lostaltmail.in b/contrib/amd/scripts/lostaltmail.in deleted file mode 100755 index 467dedd24e5a..000000000000 --- a/contrib/amd/scripts/lostaltmail.in +++ /dev/null @@ -1,658 +0,0 @@ -#!@PERL@ -sw -# -# Package: am-utils-6.0 -# Author: James Tanis <jtt@cs.columbia.edu> -# - -############################################################################ -# -# lostaltmail -- remail files files found alt_mail (or -a argument to hlfsd) to -# whomever should receive it. This version is for SMTP varient which -# support VRFY as a non-expanding verifier!!! (sendmail V8 is a an -# example). -# -# Usage: lostaltmail [-debug] [-nomail] [-noverify] -# -# GLOBAL VARIABLES (as if you care :-) ) -# Probably a very incomplete list. -# -# Everything in the config file for this program *and* ... -# -# $debug: set it from the command line with -debug. Does the obvious -# $nomail: set it from the command line with -nomail. *Not* implied by -# $debug -# $currentTO: The addresss we are currently checking on. Actually this is -# left over from an earlier version of lostaltmail and will hopefully -# go away. -# $noverify: set it from the address line. Avoid verification of $currentTO. -# This should be relatively safe as long as you are willing to -# endure bounces from mail that cannot be redelivered as opposed to -# just getting a warning. UNTESTED (but should work). -# -# $logopen: state variable indicating weather the log file (should there be -# one) is in fact open. -# -# @allentries: Array of all the directory entries in $MAILDIR -# @allnames: Array of all *likely* recipients. It is created from @allentries -# sans junk files (see $MAILJUNK and $LOCALMAILJUNK) -# @wanderers: Array of all the files associated with a *single* address -# which might need remailing. Should lostaltmail die unexpectedly, -# it might leave a temporary file containing messages it was -# currently trying to deliver. These will get picked and resent -# later. -# -# VRFY: Handle onto SMTP verification channel. Not to be confused with mail -# delivery; only verification occurs accross this handle. -# -############################################################################ - -############################################################################## -# # -# SMTP_SEND # -# # -############################################################################## -# -# Send a message to the smtp channel. Inserts the necessary NEWLINE if it -# does not exist; -# I stole this from myself. It shouldn nott be printing errors to STDERR, but -# this is a quick hack. -# -sub smtp_send { - local ($msg) = @_; - local ($length); - - $length=length($msg); - - if ( $msg !~ /^.*\n$/ ) { - $msg = $msg . "\n"; - $length++; - } - - - if ( ! syswrite (VRFY, $msg, $length)) { - print STDERR "Failing SMTP write: $msg"; - return 0; - } - - return 1; -} - -############################################################################## -# # -# SMTP_RECV # -# # -############################################################################## -# -# Read in lines from SMTP connection and return the final -# Really hideous -- please excuse. -# -sub smtp_recv { - local ($line,$rin, $win, $ein, $readbuf, $ret); - $readbuf = ""; - - $rin = $win = $ein = ''; # Null fd sets, - vec ($rin, fileno(VRFY), 1) = 1; # Stolen straight from the example; - $ein = $rin | $win; # This is probably useless - - -LINE_OF_INPUT: - while (1) { # Read in all the input - - if ((select ( $rin, $win, $ein, 600.0))[0] == 0 ) { - print "select returned -1" if ($debug); - return -1; # timeout - } - sysread (VRFY, $readbuf, 1024); - chop ($readbuf); - - foreach $line ( split('\n', $readbuf)) { - - # This loop is actually needed since V8 has a multi-line greet. - - ( $line =~ /^(\d\d\d).*/ && ($SMTP_retval=$1)) || - warn "Badly formed reply from SMTP peer: $line\n"; - - # Space after return code indicates EOT - - if ($line =~ /^\d\d\d /) { - $ret = $line; # Oddly $line is in a different context here; - # and thus we need to export it out of the - # while loop via $ret. - last LINE_OF_INPUT; - } - } # End of read. - } # End of input. - - return $ret; -} - - - - -############################################################################## -# # -# LOG_INFO # -# # -############################################################################## -# -# -# Opens appropriate logging file -- STDOUT (cron) or temp file (mail). -# -sub Log_info { - local($message) = @_; - - if ( !$logopened ) { - if ( $MAILGRUNT eq "" || $debug) { - open (LOGFILE, ">-") || die "Unable to open stdout"; - } - else { - # Snarf the log into a tmp file for final mailing to MAILGRUNT - $logfile = $LOGFILE . ".$$"; - open (LOGFILE, (">". "$logfile")) || die "Unable to create log file"; - } - } - - $logopened=1; # Note that the log is now open - - # Heart of the function. - print LOGFILE "$message"; - - print LOGFILE "\n" if ( index($message,"\n") == -1 ); -} - -############################################################################## -# # -# LOCK_FILE # -# # -############################################################################## - -# -# Tries to grab a lock on the supplied file name. -# Spins for a bit if it can't on the assumption that the lock will be released -# quickly. If it times out and it's allowed to requeue, it will defer -# until later, other wise write a message to loginfo. - -# If a recurring error or really unexpected situation arrises, return -# ABORT_RESEND -# -# PARAMETERS -# mailfile: path to the file to resend. -# should_requeue: BOOLEAN - TRUE if the mailfile should be put on the -# queue for a later retry if we can not finish -# now. - -sub Lock_file { - - local($mailfile,$should_requeue,$i,$new_lost_file) = @_; - -# We need to rename the current mailbox so that mail can loop back into it if -# the resent mail just gets looped right back to us. - $new_lost_file = $mailfile . ".$$"; - -# make a tmpfile name based on mailfile; - $lostlockfile = "$mailfile" . "$LOCKEXT"; - - if ( ! open(LOCKFILE, (">" . $lostlockfile)) ) { - printf(STDERR "Could not create lostlockfile for %s: %s\n", $mailfile,$!); - return $ABORT_RESEND; - } - close(LOCKFILE); - - $maillockfile = "$mailfile" . "$LOCAL_LOCK_EXT"; - - for ($i=0; $i < $LOCK_RETRIES && ! link ($lostlockfile, $maillockfile); - $i++) { - sleep(1); - } - - unlink($lostlockfile); # No matter what eliminate our cruft - - if ( $i == $LOCK_RETRIES ) { - &Log_info("Could not grab lock on: " . "$mailfile" . " :timed out"); - if ( $should_requeue ) { - &Log_info("Requeing " . "$mailfile" . " for later retry"); - $retry_list .= " $mailfile"; - } - else { - &Log_info("Giving up on: " . "$mailfile"); - } - - return $ABORT_RESEND; - } - - # We created the link and therefore have the lock - - if (rename ($mailfile, $new_lost_file) == 0 ){ - # Failed to rename file -- this is serious. - unlink($maillockfile); - return $ABORT_RESEND; - } - - unlink($maillockfile); - return $new_lost_file; - -} - -############################################################################## -# # -# PARSE NEXT MAIL MESSAGE # -# # -############################################################################## -# -# Parameters: -# mailfile: handle of mailfile to use. -# -# Parses the next message in the mail file and inserts it in $current_msg -# -sub Get_next_msg { - local($mailfile,$found_body_delimiter) = @_; - - # If this is the first message in the spool file, read the first line - # otherwise use the MESSAGE_DELIM line from the previous message (which we - # were forced to overread). - - $done=$FALSE; - $found_body_delimiter=$FALSE; - - # This if eats the very first "From " line and should never fire again. - if ( ! defined $current_msg ) {<$mailfile>}; - undef ($current_msg); # Erase the old message. - - - # Read the mailfile and pass through all the lines up until the next - # message delimiter. Kill any previous resend headers. - while ( <$mailfile> ) { - last if (/$MESSAGE_DELIM/); - next if ( !$found_body_delimiter && /[Rr][Ee][Ss][Ee][Nn][Tt]-.+:/); - if ( !$found_body_delimiter && /^$HEADER_BODY_DELIM/) { - &Splice_in_resent_headers(); - $found_body_delimiter=$TRUE; - } - if (defined($current_msg)) { - $current_msg .= $_; - } else { - $current_msg = $_; - } - } - - # Return TRUE when we have hit the end of the file. - if (!defined($_) || $_ eq "" ) { - return $TRUE; - } else { - return $FALSE; - } -} - -############################################################################## -# # -# SPLICE IN RESENT_HEADERS # -# # -############################################################################## -# -# Insert the Resent- headers at the *current location* of the message stream -# (In Engish, print out a few Resent-X: lines and return :-) ) -# In addition splice in the X-resent-info: header. - -# -# Paremters: None. -# Return: None -# -sub Splice_in_resent_headers { - local($date,$utctime,$weekday,$time,$month,$hostname); - - $current_msg .= "$RESENT_TO" . "$currentTO" . "\n"; - $current_msg .= "$RESENT_FROM" . "$SYSTEM_FROM_ADDRESS" . "\n"; - - # Calculate date and time. It is a bit of a shame to do this each time - # the time needs to be acurate. - - @utctime=gmtime(time); - - $weekday=(Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$utctime[6]]; - - - # If the minutes or second do not take two columns each, patch em up. - if ( $utctime[1] < 10 ) { - if ( $utctime[0] < 10 ) { - $time=sprintf("%d:0%d:0%d",$utctime[2],$utctime[1],$utctime[0]); - } - else { - $time=sprintf("%d:0%d:%d",$utctime[2],$utctime[1],$utctime[0]); - } - } - else { - if ( $utctime[0] < 10 ) { - $time=sprintf("%d:%d:0%d",$utctime[2],$utctime[1],$utctime[0]); - } - else { - $time=sprintf("%d:%2d:%2d",$utctime[2],$utctime[1],$utctime[0]); - } - } - - $month=(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$utctime[4]]; - - # Ensure Y2K format - $date=sprintf("%s, %d %s %d %s UTC", $weekday, $utctime[3], $month, $utctime[5]+1900, $time); - - $current_msg .= "$RESENT_DATE" . $date . "\n"; - - if ( defined $RESENT_INFO && $RESENT_INFO ne "") { - $hostname=`uname -n`; - $current_msg .= "$RESENT_INFO" . "Lost mail resent from ". $hostname; - } - - return; -} - -############################################################################## -# # -# DO_REMAIL # -# # -############################################################################## -# -# Actually resends the mail. Talks to the process configured as $MAILER -# We need better handling. -# -sub Do_remail { - open (MAILER, "| $MAILER $currentTO") || return $ABORT_RESEND; - print MAILER $current_msg; - close (MAILER); -} - -############################################################################## -# # -# CLEAN_UP # -# # -############################################################################## -# -# Clean up my messes. -# -sub Clean_up { - local ($hostname); - - # Ugly local hack that you should never have seen, but I forgot to - # remove. Hopefully it did not kill you (I tried as you see), but you - # should eiter remove or update it for yourself. I find the message - # subject needs to have the hostname to be useful. - # - chop ($hostname=`uname -n`); - $LOG_SUBJECT="$LOG_SUBJECT from $hostname" if ( $hostname =~ /.*\.cs\.columbia\.edu/ ); - # - # End of ugly local hack - - # Mail any log info to MAILGRUNT. - if (defined($logfile) && $logfile ne "" ) { - close (LOGFILE); # Flush logfile output. - if ( -s $logfile ) { - open (MAILER, "| $MAILER $MAILGRUNT"); - - print MAILER "To: $MAILGRUNT\n"; - print MAILER "Subject: $LOG_SUBJECT\n"; - print MAILER "$HEADER_BODY_DELIM"; - - open (LOGFILE, "< $logfile"); - - while (<LOGFILE>) { - print MAILER $_; - } - close (MAILER); - close (LOGFILE); - } - - unlink($logfile); - } - exit(0); -} - - -############################################################################## -# # -# COLLECT_WANDERERS # -# # -############################################################################## - -# -# Collects other files that appear to be mail file for the $currentTO -# but were not remailed successfully. -# -# Parameters: none (but uses $currentTO) -# Return: True if a old mail directory is found. False otherwise. -# Side effects: $wanderers set. -# -sub Collect_wanderers { - - undef (@wanderers); - - # Slurp in the directory and close. - - return ($found); -} - -############################################################################# -# # -# REMAIL ALL # -# # -############################################################################# - -# -# Takes an array of files that all seem to share a common repcipient and -# remails them if possible. -# -# Parameters: None (uses @wanderers). -# -sub Remail_all { - local($file,$i); - - $i=0; - foreach $file (@wanderers) { - if ( !open (LOSTFILE, "< $file")) { - &Log_info("Could not open " . "$file" . " for remailing"); - next; - } - - do { # Power loop! - $done = &Get_next_msg(LOSTFILE); # Retrieve the next message... - &Do_remail; # and remail it. - } until $done; - undef ($current_msg); # Erase the final remailed message. - - close(LOSTFILE); # Tidy up. - - unlink ($file); # Remove the remailed file - $i++; - } - -} - -############################################################################# -# # -# CHECK_USER # -# # -############################################################################# - -# -# Checks the password tables for the uid of $currentTO. If the user is -# uid 0 (ie *supposed* to get mail in altmail) or unknown the resend is -# aborted. -# -# -sub Check_user { - local (@passwdinfo); - undef (@passwdinfo); - - if (!$noverify && !&vrfy_user($currentTO) ) { - &Log_info("Possible non user mail file: $currentTO"); - return $ABORT_RESEND; - } - - @passwdinfo = getpwnam($currentTO); - - print "Non user mailable mail: Name: $currentTO\n" - if ( $debug && ! defined @passwdinfo ); - - return !$ABORT_RESEND if ( ! defined @passwdinfo ); # A non user but evidently mailable - - print "Check User(): Name: $currentTO -- UID: $passwdinfo[2]\n" if ($debug); - - return $ABORT_RESEND if ( $passwdinfo[2] == 0 ); - - - return !$ABORT_RESEND; -} - -############################################################################# -# # -# VRFY USER # -# # -############################################################################# -# -# Use SMTP VRFY to insure that argument is in fact a legal mail id. -# Boolean: TRUE if mailable account, FALSE if not. - -sub vrfy_user { - - local ($mailname,$repl) = @_; - - if ( !&smtp_send("vrfy $mailname") ) { - &Log_info("Failed sending to vrfy smtp command for: $mailname"); - return 0; - } - - $repl = &smtp_recv; - - print "VRFY REPLY: $repl\n" if ($debug); - - return ( $repl =~ /^2\d\d/ ); - - -} - - -############################################################################# -# # -# MAIN PROC # -# # -############################################################################# - -# dummy code to shut up perl -w -$debug = 0 if !defined($debug); -print $nomail if $debug > 1; -print $RESENT_FROM if $debug > 1; -print $logopen if $debug > 1; -print $LOCAL_LOCK_EXT if $debug > 1; -print $RESENT_TO if $debug > 1; -print $LOCKEXT if $debug > 1; -print $RESENT_DATE if $debug > 1; -print $MESSAGE_DELIM if $debug > 1; -print $SMTP_retval if $debug > 1; -print $found if $debug > 1; -print $retry_list if $debug > 1; -print $MAILJUNK if $debug > 1; -print $noverify if $debug > 1; -print $SYSTEM_FROM_ADDRESS if $debug > 1; - -# BEGIN: stuff -$prefix="@prefix@"; -$CONFIGDIR="@sysconfdir@"; # Directory where global config lives -require "$CONFIGDIR/lostaltmail.conf" if (-f "$CONFIGDIR/lostaltmail.conf"); -require "/etc/global/lostaltmail.conf" if (-f "/etc/global/lostaltmail.conf"); -require "/etc/os/lostaltmail.conf" if (-f "/etc/os/lostaltmail.conf"); -require "/etc/local/lostaltmail.conf" if (-f "/etc/local/lostaltmail.conf"); - - -require "ctime.pl"; -use Socket; -#require "sys/socket.ph"; - -# SET some initial state variales -$logopen = 0; - -# -# Change to alt_dir -# -# Important!! This directory should be local. Folks will be responsible -# for finding this out for themselves. -# -if (!defined($MAILDIR) || $MAILDIR eq "") { - die "MAILDIR must be defined\n"; -} -chdir ( $MAILDIR ) || die "Cannot change to $MAILDIR (`x' bit not set?)"; - -# -# slurp in directory -# -opendir (MAIL, ".") || die "Cannot open $MAILDIR (`r' bit not set?)"; -@allentries= readdir (MAIL); -closedir (MAIL); -@allnames = grep (!/$LOCALMAILJUNK|$MAILJUNK/, @allentries); - -# Open chanel to SMTP for verification -- unless this option is -# configured off. - -if ( ! $noverify ) { - local($addr, $port,$sockaddr); - - socket (VRFY, &AF_INET, &SOCK_STREAM, 0) || - die "Could not create TCP socket (SMTP channel)"; - - $addr = (gethostbyname($SMTPHOST))[4]; # Just use the first addr - - die "Could not obtain STMP host ($SMTPHOST) address" - if ( $addr eq "" ); - - $port = (getservbyname('smtp','tcp'))[2]; # Get smtp port. - die "Could not obtain SMTP port number" if (!defined($port)); - - printf("SMTP: address: %s port: $port\n", - join ('.',unpack('C4',$addr))) if ($debug); - - $sockaddr = sockaddr_in($port, $addr); - - printf("Sockaddr: %s\n", join (' ',unpack('C14',$sockaddr))) if ($debug); - - connect (VRFY, $sockaddr) || - die "Could not connect to SMTP daemon on $SMTPHOST"; - - print "Establshed SMTP channel\n" if ($debug); - - &smtp_recv; # Greet wait - &smtp_send("helo $SMTPHOST"); # Helo message for picky SMTPs - &smtp_recv; # Helo reply - - # Connection is up and ready to VRFY -} - -# main stuff starts here -foreach $currentTO (@allnames) { - next if ( &Check_user == $ABORT_RESEND); - - # just delete the file if too small to be real mail - if ((stat($currentTO))[7] < 5) { - print "Too small to be real mail, unlinking $currentTO" if $debug; - unlink $currentTO; - } - - undef (@wanderers); # Just reset this at each pass. - @wanderers=grep (/$currentTO\.\d+/, @allentries); - - $remail_file = &Lock_file($currentTO,$FALSE); # Need to lock the spool. - - next if ( $remail_file eq $ABORT_RESEND); # Could not get that lock - - push (@wanderers, $remail_file); # Try to resend "old" files. - print "List to remail: @wanderers\n" if ($debug); - # check if there is something to remail - &Remail_all if ( defined @wanderers && !$nomail); -} - -# this stuff should run at the end -foreach $file (grep (/$LOCALMAILJUNK/,@allentries)) { - - if ($debug) { - print "Would unlink $file\n" if ($debug); - } else { - unlink $file if (-f $file); - } - -} -&Clean_up; # Do a clean exit. |