From 5d8bee0f9f885937b3a49659579dd41bd1c7fe8f Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 26 Oct 1997 00:02:11 +0000 Subject: [PATCH] New version from Erez --- usr.sbin/amd/AUTHORS | 8 + usr.sbin/amd/COPYING | 1 + usr.sbin/amd/doc/am-utils.info | 778 +++++++++-------------------- usr.sbin/amd/doc/am-utils.info-1 | 21 +- usr.sbin/amd/doc/am-utils.info-2 | 17 +- usr.sbin/amd/doc/am-utils.info-3 | 1 + usr.sbin/amd/doc/am-utils.info-4 | 30 +- usr.sbin/amd/doc/am-utils.info-5 | 19 + usr.sbin/amd/doc/am-utils.info-6 | 32 +- usr.sbin/amd/doc/am-utils.texi | 70 ++- usr.sbin/amd/doc/hlfsd.ps | 1 + usr.sbin/amd/doc/version.texi | 7 +- usr.sbin/amd/fixmount/fixmount.8 | 4 +- usr.sbin/amd/hlfsd/hlfsd.8 | 26 +- usr.sbin/amd/hlfsd/hlfsd.h | 5 +- usr.sbin/amd/hlfsd/nfs_prot_svc.c | 4 +- usr.sbin/amd/hlfsd/stubs.c | 13 +- usr.sbin/amd/include/am_compat.h | 2 + usr.sbin/amd/include/am_xdr_func.h | 4 +- usr.sbin/amd/libamu/amu.h | 4 +- usr.sbin/amd/libamu/hasmntopt.c | 4 +- usr.sbin/amd/libamu/misc_rpc.c | 4 +- usr.sbin/amd/libamu/mount_fs.c | 4 +- usr.sbin/amd/libamu/mtab.c | 4 +- usr.sbin/amd/libamu/mtabutil.c | 4 +- usr.sbin/amd/libamu/nfs_prot_xdr.c | 4 +- usr.sbin/amd/libamu/tranputil.c | 4 +- usr.sbin/amd/libamu/umount_fs.c | 4 +- usr.sbin/amd/libamu/util.c | 4 +- usr.sbin/amd/libamu/wire.c | 125 +++-- usr.sbin/amd/libamu/xdr_func.c | 4 +- usr.sbin/amd/libamu/xutil.c | 50 +- usr.sbin/amd/wire-test/wire-test.8 | 4 +- usr.sbin/amd/wire-test/wire-test.c | 37 +- 34 files changed, 575 insertions(+), 728 deletions(-) diff --git a/usr.sbin/amd/AUTHORS b/usr.sbin/amd/AUTHORS index 9ba7b83c0061..65e64e6ef444 100644 --- a/usr.sbin/amd/AUTHORS +++ b/usr.sbin/amd/AUTHORS @@ -1,3 +1,4 @@ +$NetBSD: AUTHORS,v 1.1.1.4 1997/10/26 00:02:12 christos Exp $ # -*- text -*- PRIMARY AUTHORS AND MAJOR CONTRIBUTORS TO AM_UTILS: @@ -54,6 +55,9 @@ July 4, 1997: patches to get NFS V.3 working under irix5. September 9, 1997: initialize all fields of mntent_t structures to 0. +October 2, 1997: don't log an RPC timeout as an error but only as an info +message. + * Danny Braniss July, 6 1997: contributed patches to hesiod on bsdi3. @@ -119,3 +123,7 @@ pcfs_args (msdos mount). September 25, 1997: fix to initialize uid/gid fields of pcfs_args_t on netbsd. + +October 10, 1997: compile time cleanups of printf()s in hlfsd code. If nfs +server is down or does not support a portmapper call, then mark it down as +version 2, and try again later. diff --git a/usr.sbin/amd/COPYING b/usr.sbin/amd/COPYING index d360a43e70a3..d6880c49b425 100644 --- a/usr.sbin/amd/COPYING +++ b/usr.sbin/amd/COPYING @@ -1,3 +1,4 @@ +$NetBSD: COPYING,v 1.1.1.3 1997/10/26 00:02:11 christos Exp $ Copyright (c) 1997 Erez Zadok Copyright (c) 1989 Jan-Simon Pendry Copyright (c) 1989 Imperial College of Science, Technology & Medicine diff --git a/usr.sbin/amd/doc/am-utils.info b/usr.sbin/amd/doc/am-utils.info index 33249bb8469e..f81994e49609 100644 --- a/usr.sbin/amd/doc/am-utils.info +++ b/usr.sbin/amd/doc/am-utils.info @@ -1,545 +1,243 @@ -This is Info file am-utils.info, produced by Makeinfo-1.63 from the -input file am-utils.texi. +$NetBSD: am-utils.info,v 1.1.1.3 1997/10/26 00:03:39 christos Exp $ +This is Info file am-utils.info, produced by Makeinfo version 1.68 from +the input file am-utils.texi. - * Am-utils: (am-utils). The Amd automounter suite of -utilities direntry +START-INFO-DIR-ENTRY +* Am-utils: (am-utils). The Amd automounter suite of utilities +END-INFO-DIR-ENTRY  -File: am-utils.info, Node: Top, Next: License, Up: (DIR) - - Am-utils - The 4.4 BSD Automounter Tool Suite -********************************************* - - Am-utils is the 4.4 BSD Automounter Tool Suite, which includes the -Amd automounter, the Amq query and control program, the Hlfsd daemon, -and other tools. This Info file describes how to use and understand the -tools within Am-utils. - -* Menu: - -* License:: Explains the terms and conditions for using - and distributing Am-utils. -* Distrib:: How to get the latest Am-utils distribution. -* Intro:: An introduction to Automounting concepts. -* History:: History of am-utils' development. -* Overview:: An overview of Amd. -* Supported Platforms:: Machines and Systems supported by Amd. -* Mount Maps:: Details of mount maps -* Amd Command Line Options:: All the Amd command line options explained. -* Filesystem Types:: The different mount types supported by Amd. -* Amd Configuration File:: The amd.conf file syntax and meaning. -* Run-time Administration:: How to start, stop and control Amd. -* FSinfo:: The FSinfo filesystem management tool. -* Hlfsd:: The Home-Link Filesystem server. -* Assorted Tools:: Other tools which come with am-utils. -* Examples:: Some examples showing how Amd might be used. -* Internals:: Implementation details. -* Acknowledgments & Trademarks:: Legal Notes - -Indexes -* Index:: An item for each concept. - +Indirect: +am-utils.info-1: 216 +am-utils.info-2: 49850 +am-utils.info-3: 99207 +am-utils.info-4: 149122 +am-utils.info-5: 198972 +am-utils.info-6: 231195  -File: am-utils.info, Node: License, Next: Distrib, Prev: Top, Up: Top - -License -******* - - Am-utils is not in the public domain; it is copyrighted and there are -restrictions on its distribution. - - 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, as well as the Trustees - of Columbia University." - - 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. - +Tag Table: +(Indirect) +Node: Top216 +Node: License1838 +Node: Distrib3783 +Node: Intro6265 +Node: History7402 +Node: Overview9456 +Node: Fundamentals10428 +Node: Filesystems and Volumes11204 +Node: Volume Naming12026 +Node: Volume Binding13286 +Node: Operational Principles14494 +Node: Mounting a Volume15835 +Node: Automatic Unmounting17573 +Node: Keep-alives18559 +Node: Non-blocking Operation20870 +Node: Supported Platforms21992 +Node: Mount Maps25779 +Node: Map Types26612 +Node: File maps28266 +Node: ndbm maps29794 +Node: NIS maps30471 +Node: NIS+ maps31940 +Node: Hesiod maps32201 +Node: Password maps33084 +Node: Union maps34015 +Node: LDAP maps34614 +Node: Key Lookup35988 +Node: Location Format37298 +Node: Map Defaults39695 +Node: Variable Expansion40314 +Node: Selectors43258 +Node: Map Options49133 +Node: delay Option49850 +Node: fs Option50381 +Node: opts Option52239 +Node: remopts Option56989 +Node: sublink Option57862 +Node: type Option58211 +Node: Amd Command Line Options58420 +Node: -a Option61118 +Node: -c Option61466 +Node: -d Option62105 +Node: -k Option62643 +Node: -l Option63182 +Node: -n Option64660 +Node: -o Option65071 +Node: -p Option65529 +Node: -r Option65955 +Node: -t Option66150 +Node: -v Option66712 +Node: -w Option68620 +Node: -x Option68918 +Node: -y Option70735 +Node: -C-Option71067 +Node: -D-Option71711 +Node: -F Option72847 +Node: -H Option73378 +Node: -S Option73534 +Node: -T-Option74133 +Node: Filesystem Types74465 +Node: Network Filesystem76774 +Node: Network Host Filesystem78466 +Node: Network Filesystem Group80593 +Node: Unix Filesystem82198 +Node: Caching Filesystem82712 +Node: CD-ROM Filesystem83061 +Node: Loopback Filesystem83557 +Node: Memory/RAM Filesystem84472 +Node: Null Filesystem84895 +Node: Floppy Filesystem85231 +Node: Translucent Filesystem85726 +Node: Shared Memory+Swap Filesystem86048 +Node: User ID Mapping Filesystem86583 +Node: Program Filesystem86942 +Node: Symbolic Link Filesystem88939 +Node: Symbolic Link Filesystem II90222 +Node: Automount Filesystem90825 +Node: Direct Automount Filesystem94491 +Node: Union Filesystem95539 +Node: Error Filesystem97040 +Node: Top-level Filesystem97550 +Node: Root Filesystem98129 +Node: Autofs Filesystem98612 +Node: Inheritance Filesystem99207 +Node: Amd Configuration File100213 +Node: File Format100725 +Node: The Global Section102173 +Node: Regular Map Sections102776 +Node: Common Parameters103176 +Node: browsable_dirs Parameter103809 +Node: map_options Parameter104542 +Node: map_type Parameter104864 +Node: mount_type Parameter105672 +Node: search_path Parameter106089 +Node: Global Parameters106484 +Node: arch Parameter107511 +Node: auto_dir Parameter107774 +Node: cache_duration Parameter108105 +Node: cluster Parameter108433 +Node: debug_options Parameter108726 +Node: dismount_interval Parameter109731 +Node: fully_qualified_hosts Parameter110119 +Node: karch Parameter110639 +Node: ldap_base Parameter111279 +Node: ldap_cache_maxmem Parameter111537 +Node: ldap_cache_seconds Parameter111844 +Node: ldap_hostports Parameter112148 +Node: local_domain Parameter112471 +Node: log_file Parameter112907 +Node: log_options Parameter113393 +Node: nfs_retransmit_counter Parameter114285 +Node: nfs_retry_interval Parameter114676 +Node: nis_domain Parameter115068 +Node: normalize_hostnames Parameter115514 +Node: os Parameter115948 +Node: osver Parameter116481 +Node: plock Parameter116752 +Node: portmap_program Parameter117408 +Node: print_pid Parameter118189 +Node: print_version Parameter118492 +Node: restart_mounts Parameter118911 +Node: selectors_on_default Parameter119343 +Node: show_statfs_entries Parameter120062 +Node: Regular Map Parameters120477 +Node: map_name Parameter120784 +Node: tag Parameter121038 +Node: amd.conf Examples121504 +Node: Run-time Administration122950 +Node: Starting Amd123193 +Node: Stopping Amd124039 +Node: Restarting Amd124840 +Node: Controlling Amd126069 +Node: Amq default127346 +Node: Amq -f option129307 +Node: Amq -l option129746 +Node: Amq -h option130172 +Node: Amq -m option130529 +Node: Amq -M-option131680 +Node: Amq -p option133092 +Node: Amq -P-option133470 +Node: Amq -s option134135 +Node: Amq -u option135211 +Node: Amq -v option135637 +Node: Other Amq options135868 +Node: FSinfo136544 +Node: FSinfo Overview137280 +Node: Using FSinfo138461 +Node: FSinfo Grammar140166 +Node: FSinfo host definitions141532 +Node: FSinfo host attributes142644 +Node: FSinfo host netif143788 +Node: FSinfo host config144617 +Node: FSinfo host arch145046 +Node: FSinfo host os145408 +Node: FSinfo host cluster145790 +Node: FSinfo filesystems146145 +Node: FSinfo filesystems fstype149122 +Node: FSinfo filesystems opts149903 +Node: FSinfo filesystems passno150202 +Node: FSinfo filesystems freq150532 +Node: FSinfo filesystems mount150837 +Node: FSinfo filesystems dumpset152957 +Node: FSinfo filesystems log153244 +Node: FSinfo static mounts153505 +Node: FSinfo automount definitions155184 +Node: FSinfo Command Line Options158420 +Node: -a FSinfo Option160056 +Node: -b FSinfo Option160435 +Node: -d FSinfo Option161127 +Node: -e FSinfo Option161732 +Node: -f FSinfo Option162508 +Node: -h FSinfo Option163108 +Node: -m FSinfo Option163486 +Node: -q FSinfo Option164056 +Node: -v FSinfo Option164322 +Node: -D-FSinfo Option164729 +Node: -I FSinfo Option165019 +Node: -U FSinfo Option165316 +Node: FSinfo errors165530 +Node: Hlfsd172124 +Node: Introduction to Hlfsd173591 +Node: Background to Mail Delivery178503 +Node: Single-Host Mail Spool Directory178998 +Node: Centralized Mail Spool Directory180079 +Node: Distributed Mail Spool Service183346 +Node: Why Deliver Into the Home Directory?186618 +Node: Using Hlfsd189341 +Node: Controlling Hlfsd189523 +Node: Hlfsd Options191060 +Node: Hlfsd Files195925 +Node: Assorted Tools196582 +Node: am-eject197046 +Node: amd.conf-sample197290 +Node: amd2ldif197495 +Node: amd2sun197745 +Node: ctl-amd197975 +Node: ctl-hlfsd198453 +Node: expn198972 +Node: fix-amd-map199547 +Node: fixmount200044 +Node: fixrmtab200454 +Node: lostaltmail200737 +Node: lostaltmail.conf-sample201490 +Node: mk-amd-map201899 +Node: wait4amd202189 +Node: wait4amd2die203287 +Node: wire-test203838 +Node: Examples204918 +Node: User Filesystems205219 +Node: Home Directories208379 +Node: Architecture Sharing211376 +Node: Wildcard Names212966 +Node: rwho servers214265 +Node: /vol215003 +Node: /default with selectors217585 +Node: /tftpboot in a chroot-ed environment218443 +Node: Internals222713 +Node: Log Messages223049 +Node: Fatal errors223800 +Node: Info messages227297 +Node: Acknowledgments & Trademarks229917 +Node: Index231195  -File: am-utils.info, Node: Distrib, Next: Intro, Prev: License, Up: Top - -Source Distribution -******************* - - You can get the latest distribution version of Am-utils from - ftp://ftp.cs.columbia.edu/pub/am-utils/am-utils.tar.gz - - Alpha and beta distributions are available in - ftp://shekel.mcl.cs.columbia.edu/private/am-utils/. - - Revision 5.2 was part of the 4.3 BSD Reno distribution. - - Revision 5.3bsdnet, a late alpha version of 5.3, was part of the BSD -network version 2 distribution - - Revision 6.0 was made independently by Erez Zadok at Columbia -University, as part of his PhD thesis work. *Note History:: for more -details. - -Bug Reports -=========== - - Send all bug reports to `amd-dev@majordomo.cs.columbia.edu' quoting -the details of the release and your configuration. These can be -obtained by running the command `amd -v'. It would greatly help if you -could provide a reproducible procedure for detecting the bug you are -reporting. - -Mailing List -============ - - There are two mailing lists for people interested in keeping -up-to-date with developments. - - 1. The older list, `amd-workers' is for general "how to" questions and - announcements. To subscribe, send a note to - `amd-workers-request@majordomo.glue.umd.edu'.(1) To post a - message to this list, send mail to - `amd-workers@majordomo.glue.umd.edu'. - - 2. The developers only list, `amd-dev' is for - - - announcements of alpha and beta releases of am-utils - - - reporting of bugs and patches - - - discussions of new features for am-utils - - - implementation and porting issues - - To subscribe, send a note to `amd-dev@majordomo.cs.columbia.edu'. - To post a message to this list, send mail to - `amd-dev@majordomo.cs.columbia.edu'. To avoid as much spam as - possible, only subscribers to this list may post to it. - - Subscribers of `amd-dev' are most suitable if they have the time - and resources to test new and buggy versions of amd, on as many - different platforms as possible. They should also be prepared to - learn and use the GNU Autoconf, Automake, and Libtool packages, - and of course, be very familiar with the complex code in the - am-utils package. In other words, subscribers on this list should - be able to contribute meaningfully to the development of amd. - - - ---------- Footnotes ---------- - - (1) Note that the older address, -`amd-workers-request@acl.lanl.gov', is defunct. - - -File: am-utils.info, Node: Intro, Next: History, Prev: Distrib, Up: Top - -Introduction -************ - - An "automounter" maintains a cache of mounted filesystems. -Filesystems are mounted on demand when they are first referenced, and -unmounted after a period of inactivity. - - Amd may be used as a replacement for Sun's automounter. The choice -of which filesystem to mount can be controlled dynamically with -"selectors". Selectors allow decisions of the form "hostname is THIS," -or "architecture is not THAT." Selectors may be combined arbitrarily. -Amd also supports a variety of filesystem types, including NFS, UFS and -the novel "program" filesystem. The combination of selectors and -multiple filesystem types allows identical configuration files to be -used on all machines thus reducing the administrative overhead. - - Amd ensures that it will not hang if a remote server goes down. -Moreover, Amd can determine when a remote server has become -inaccessible and then mount replacement filesystems as and when they -become available. - - Amd contains no proprietary source code and has been ported to -numerous flavors of Unix. - - -File: am-utils.info, Node: History, Next: Overview, Prev: Intro, Up: Top - -History -******* - - The Amd package has been without an official maintainer since 1992. -Several people have stepped in to maintain it unofficially. Most -notable were the `upl' (Unofficial Patch Level) releases of Amd, -created by me (Erez Zadok), and available from -ftp://ftp.cs.columbia.edu/pub/amd/. The last such unofficial release -was `upl102'. - - Through the process of patching and aging, it was becoming more and -more apparent that Amd was in much need of revitalizing. Maintaining -Amd had become a difficult task. I took it upon myself to cleanup the -code, so that it would be easier to port to new platforms, add new -features, keep up with the many new feature requests, and deal with the -never ending stream of bug reports. - - I have been working on such a release of Amd on and off since -January of 1996. The new suite of tools is currently named "am-utils" -(AutoMounter Utilities), in line with GNU naming conventions, befitting -the contents of the package. In October of 1996 I had received enough -offers to help me with this task that I decided to make a mailing list -for these group of people. Around the same time, Amd had become a -necessary part of my PhD thesis work, resulting in more work performed -on am-utils. - - Am-utils version 6.0 was numbered with a major new release number to -distinguish it from the last official release of Amd (5.x). Many new -features have been added such as a GNU `configure' system, NFS Version -3, Autofs support, a run-time configuration file (`amd.conf'), many new -ports, more scripts and programs, as well as numerous bug fixes. -Another reason for the new major release number was to alert users of -am-utils that user-visible interfaces may have changed. In order to -make Amd work well for the next 10 years, and be easier to maintain, it -was necessary to remove old or unused features, change various syntax -files, etc. However, great care was taken to ensure the maximum -possible backwards compatibility. - - -File: am-utils.info, Node: Overview, Next: Supported Platforms, Prev: History, Up: Top - -Overview -******** - - Amd maintains a cache of mounted filesystems. Filesystems are -"demand-mounted" when they are first referenced, and unmounted after a -period of inactivity. Amd may be used as a replacement for Sun's -automount(8) program. It contains no proprietary source code and has -been ported to numerous flavors of Unix. *Note Supported Platforms::. - - Amd was designed as the basis for experimenting with filesystem -layout and management. Although Amd has many direct applications it is -loaded with additional features which have little practical use. At -some point the infrequently used components may be removed to streamline -the production system. - -* Menu: - -* Fundamentals:: -* Filesystems and Volumes:: -* Volume Naming:: -* Volume Binding:: -* Operational Principles:: -* Mounting a Volume:: -* Automatic Unmounting:: -* Keep-alives:: -* Non-blocking Operation:: - - -File: am-utils.info, Node: Fundamentals, Next: Filesystems and Volumes, Prev: Overview, Up: Overview - -Fundamentals -============ - - The fundamental concept behind Amd is the ability to separate the -name used to refer to a file from the name used to refer to its physical -storage location. This allows the same files to be accessed with the -same name regardless of where in the network the name is used. This is -very different from placing `/n/hostname' in front of the pathname -since that includes location dependent information which may change if -files are moved to another machine. - - By placing the required mappings in a centrally administered -database, filesystems can be re-organized without requiring changes to -configuration files, shell scripts and so on. - - -File: am-utils.info, Node: Filesystems and Volumes, Next: Volume Naming, Prev: Fundamentals, Up: Overview - -Filesystems and Volumes -======================= - - Amd views the world as a set of fileservers, each containing one or -more filesystems where each filesystem contains one or more "volumes". -Here the term "volume" is used to refer to a coherent set of files such -as a user's home directory or a TeX distribution. - - In order to access the contents of a volume, Amd must be told in -which filesystem the volume resides and which host owns the filesystem. -By default the host is assumed to be local and the volume is assumed to -be the entire filesystem. If a filesystem contains more than one -volume, then a "sublink" is used to refer to the sub-directory within -the filesystem where the volume can be found. - - -File: am-utils.info, Node: Volume Naming, Next: Volume Binding, Prev: Filesystems and Volumes, Up: Overview - -Volume Naming -============= - - Volume names are defined to be unique across the entire network. A -volume name is the pathname to the volume's root as known by the users -of that volume. Since this name uniquely identifies the volume -contents, all volumes can be named and accessed from each host, subject -to administrative controls. - - Volumes may be replicated or duplicated. Replicated volumes contain -identical copies of the same data and reside at two or more locations in -the network. Each of the replicated volumes can be used -interchangeably. Duplicated volumes each have the same name but contain -different, though functionally identical, data. For example, -`/vol/tex' might be the name of a TeX distribution which varied for -each machine architecture. - - Amd provides facilities to take advantage of both replicated and -duplicated volumes. Configuration options allow a single set of -configuration data to be shared across an entire network by taking -advantage of replicated and duplicated volumes. - - Amd can take advantage of replacement volumes by mounting them as -required should an active fileserver become unavailable. - - -File: am-utils.info, Node: Volume Binding, Next: Operational Principles, Prev: Volume Naming, Up: Overview - -Volume Binding -============== - - Unix implements a namespace of hierarchically mounted filesystems. -Two forms of binding between names and files are provided. A "hard -link" completes the binding when the name is added to the filesystem. A -"soft link" delays the binding until the name is accessed. An -"automounter" adds a further form in which the binding of name to -filesystem is delayed until the name is accessed. - - The target volume, in its general form, is a tuple (host, filesystem, -sublink) which can be used to name the physical location of any volume -in the network. - - When a target is referenced, Amd ignores the sublink element and -determines whether the required filesystem is already mounted. This is -done by computing the local mount point for the filesystem and checking -for an existing filesystem mounted at the same place. If such a -filesystem already exists then it is assumed to be functionally -identical to the target filesystem. By default there is a one-to-one -mapping between the pair (host, filesystem) and the local mount point so -this assumption is valid. - - -File: am-utils.info, Node: Operational Principles, Next: Mounting a Volume, Prev: Volume Binding, Up: Overview - -Operational Principles -====================== - - Amd operates by introducing new mount points into the namespace. -These are called "automount" points. The kernel sees these automount -points as NFS filesystems being served by Amd. Having attached itself -to the namespace, Amd is now able to control the view the rest of the -system has of those mount points. RPC calls are received from the -kernel one at a time. - - When a "lookup" call is received Amd checks whether the name is -already known. If it is not, the required volume is mounted. A -symbolic link pointing to the volume root is then returned. Once the -symbolic link is returned, the kernel will send all other requests -direct to the mounted filesystem. - - If a volume is not yet mounted, Amd consults a configuration -"mount-map" corresponding to the automount point. Amd then makes a -runtime decision on what and where to mount a filesystem based on the -information obtained from the map. - - Amd does not implement all the NFS requests; only those relevant to -name binding such as "lookup", "readlink" and "readdir". Some other -calls are also implemented but most simply return an error code; for -example "mkdir" always returns "read-only filesystem". - - -File: am-utils.info, Node: Mounting a Volume, Next: Automatic Unmounting, Prev: Operational Principles, Up: Overview - -Mounting a Volume -================= - - Each automount point has a corresponding mount map. The mount map -contains a list of key-value pairs. The key is the name of the volume -to be mounted. The value is a list of locations describing where the -filesystem is stored in the network. In the source for the map the -value would look like - - location1 location2 ... locationN - - Amd examines each location in turn. Each location may contain -"selectors" which control whether Amd can use that location. For -example, the location may be restricted to use by certain hosts. Those -locations which cannot be used are ignored. - - Amd attempts to mount the filesystem described by each remaining -location until a mount succeeds or Amd can no longer proceed. The -latter can occur in three ways: - - * If none of the locations could be used, or if all of the locations - caused an error, then the last error is returned. - - * If a location could be used but was being mounted in the - background then Amd marks that mount as being "in progress" and - continues with the next request; no reply is sent to the kernel. - - * Lastly, one or more of the mounts may have been "deferred". A - mount is deferred if extra information is required before the - mount can proceed. When the information becomes available the - mount will take place, but in the mean time no reply is sent to - the kernel. If the mount is deferred, Amd continues to try any - remaining locations. - - Once a volume has been mounted, Amd establishes a "volume mapping" -which is used to satisfy subsequent requests. - - -File: am-utils.info, Node: Automatic Unmounting, Next: Keep-alives, Prev: Mounting a Volume, Up: Overview - -Automatic Unmounting -==================== - - To avoid an ever increasing number of filesystem mounts, Amd removes -volume mappings which have not been used recently. A time-to-live -interval is associated with each mapping and when that expires the -mapping is removed. When the last reference to a filesystem is removed, -that filesystem is unmounted. If the unmount fails, for example the -filesystem is still busy, the mapping is re-instated and its -time-to-live interval is extended. The global default for this grace -period is controlled by the "-w" command-line option (*note -w: -w -Option.) or the amd.conf parameter `dismount_interval' (*note -dismount_interval Parameter::.). It is also possible to set this value -on a per-mount basis (*note opts: opts Option.). - - Filesystems can be forcefully timed out using the Amq command. -*Note Run-time Administration::. - - -File: am-utils.info, Node: Keep-alives, Next: Non-blocking Operation, Prev: Automatic Unmounting, Up: Overview - -Keep-alives -=========== - - Use of some filesystem types requires the presence of a server on -another machine. If a machine crashes then it is of no concern to -processes on that machine that the filesystem is unavailable. However, -to processes on a remote host using that machine as a fileserver this -event is important. This situation is most widely recognized when an -NFS server crashes and the behavior observed on client machines is that -more and more processes hang. In order to provide the possibility of -recovery, Amd implements a "keep-alive" interval timer for some -filesystem types. Currently only NFS makes use of this service. - - The basis of the NFS keep-alive implementation is the observation -that most sites maintain replicated copies of common system data such as -manual pages, most or all programs, system source code and so on. If -one of those servers goes down it would be reasonable to mount one of -the others as a replacement. - - The first part of the process is to keep track of which fileservers -are up and which are down. Amd does this by sending RPC requests to the -servers' NFS `NullProc' and checking whether a reply is returned. -While the server state is uncertain the requests are re-transmitted at -three second intervals and if no reply is received after four attempts -the server is marked down. If a reply is received the fileserver is -marked up and stays in that state for 30 seconds at which time another -NFS ping is sent. - - Once a fileserver is marked down, requests continue to be sent every -30 seconds in order to determine when the fileserver comes back up. -During this time any reference through Amd to the filesystems on that -server fail with the error "Operation would block". If a replacement -volume is available then it will be mounted, otherwise the error is -returned to the user. - - Although this action does not protect user files, which are unique on -the network, or processes which do not access files via Amd or already -have open files on the hung filesystem, it can prevent most new -processes from hanging. - - By default, fileserver state is not maintained for NFS/TCP mounts. -The remote fileserver is always assumed to be up. - - -File: am-utils.info, Node: Non-blocking Operation, Prev: Keep-alives, Up: Overview - -Non-blocking Operation -====================== - - Since there is only one instance of Amd for each automount point, -and usually only one instance on each machine, it is important that it -is always available to service kernel calls. Amd goes to great lengths -to ensure that it does not block in a system call. As a last resort -Amd will fork before it attempts a system call that may block -indefinitely, such as mounting an NFS filesystem. Other tasks such as -obtaining filehandle information for an NFS filesystem, are done using a -purpose built non-blocking RPC library which is integrated with Amd's -task scheduler. This library is also used to implement NFS keep-alives -(*note Keep-alives::.). - - Whenever a mount is deferred or backgrounded, Amd must wait for it -to complete before replying to the kernel. However, this would cause -Amd to block waiting for a reply to be constructed. Rather than do -this, Amd simply "drops" the call under the assumption that the kernel -RPC mechanism will automatically retry the request. - - -File: am-utils.info, Node: Supported Platforms, Next: Mount Maps, Prev: Overview, Up: Top - -Supported Platforms -******************* - - Am-utils has been ported to a wide variety of machines and operating -systems. Am-utils's code works for little-endian and big-endian -machines, as well as 32 bit and 64 bit architectures. Furthermore, when -am-utils to an Operating System on one architecture, it is generally -readily portable to the same Operating System on all platforms on which -it is available. - - The table below lists those platforms supported by the latest -release. The listing is based on the standard output from GNU's -`config.guess' script. Since significant changes have been made to -am-utils, not all systems listed here have been verified working for all -features. - - Auto-Configured System Name Config Compile Amd NFS3 Shlib Hlfsd - - Auto-Configured System Name Config Compile Amd NFS3 Shlib Hlfsd - - alpha-dec-osf4.0 yes yes yes yes - - hppa1.1-hp-hpux10.10 yes yes yes n/a no - - hppa1.1-hp-hpux10.20 yes yes yes n/a no - - hppa1.1-hp-hpux9.01 yes yes yes n/a - - hppa1.1-hp-hpux9.05 yes yes yes n/a - - hppa1.1-hp-hpux9.07 yes yes yes n/a - - i386-pc-bsdi2.1 yes yes yes n/a - - i386-pc-bsdi3.0 yes yes yes n/a - - i386-pc-solaris2.5.1 yes yes yes yes yes yes - +End Tag Table diff --git a/usr.sbin/amd/doc/am-utils.info-1 b/usr.sbin/amd/doc/am-utils.info-1 index 73902dc087a3..f89103e7cd34 100644 --- a/usr.sbin/amd/doc/am-utils.info-1 +++ b/usr.sbin/amd/doc/am-utils.info-1 @@ -1,3 +1,4 @@ +$NetBSD: am-utils.info-1,v 1.1.1.3 1997/10/26 00:03:40 christos Exp $ This is Info file am-utils.info, produced by Makeinfo version 1.68 from the input file am-utils.texi. @@ -1144,12 +1145,10 @@ defined as empty strings. the name of the mount map being used. `netnumber' -`primnetnum' the number of the network to which the primary network interface is attached. This value is also output by the "-v" option. `network' -`primnetname' `wire' the name of the network to which the primary network interface is attached. If a symbolic name cannot be found in the networks or @@ -1160,18 +1159,6 @@ defined as empty strings. the full pathname of the name being resolved. For example `/home/foo' in the example above. -`subsnetname' - the name of the network to which the subsidiary (second) network - interface is attached. If a symbolic name cannot be found in the - networks or hosts database then dotted IP address format is used. - This value is also output by the "-v" option. - -`subsnetnum' - the number of the network to which the subsidiary (second) network - interface is attached. If a symbolic name cannot be found in the - networks or hosts database then dotted IP address format is used. - This value is also output by the "-v" option. - Selectors can be negated by using `!=' instead of `=='. For example to select a location on all non-Vax machines the selector `arch!=vax' would be used. @@ -1192,6 +1179,12 @@ compared with a value. member of the netgroup ARG, this selector evaluates to true. Otherwise it evaluates to false. +`in_network(ARG)' + If the current host has any network interface that is locally + attached to the network specified in ARG (either via name or + number), this selector evaluates to true. Otherwise it evaluates + to false. + `true(ARG)' Always evaluates to true. ARG is ignored. diff --git a/usr.sbin/amd/doc/am-utils.info-2 b/usr.sbin/amd/doc/am-utils.info-2 index 58ceceef9f92..6cccdb7366a7 100644 --- a/usr.sbin/amd/doc/am-utils.info-2 +++ b/usr.sbin/amd/doc/am-utils.info-2 @@ -1,3 +1,4 @@ +$NetBSD: am-utils.info-2,v 1.1.1.2 1997/10/26 00:03:41 christos Exp $ This is Info file am-utils.info, produced by Makeinfo version 1.68 from the input file am-utils.texi. @@ -528,16 +529,17 @@ output is of the form: 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. - am-utils version 6.0a10 (build 18). - Built by ezk@cs.columbia.edu on date Fri Aug 22 15:21:03 EDT 1997. + am-utils version 6.0a13 (build 18). + Built by ezk@cs.columbia.edu on date Wed Oct 22 15:21:03 EDT 1997. cpu=sparc (big-endian), arch=sun4, karch=sun4u. full_os=solaris2.5.1, os=sos5, osver=5.5.1, vendor=sun. Map support for: root, passwd, union, nisplus, nis, ndbm, file, error. AMFS: nfs, link, nfsx, host, linkx, program, union, inherit, ufs, lofs, cdfs, pcfs, auto, direct, toplvl, autofs, error. FS: autofs, cachefs, cdfs, lofs, nfs, nfs3, pcfs, tfs, tmpfs, ufs. - Primary network: primnetname="cucs-net" (primnetnum=128.59.16). - No Subsidiary network. + Network 1: wire="mcl-lab-net.cs.columbia.edu" (netnumber=128.59.13). + Network 2: wire="14-net.cs.columbia.edu" (netnumber=128.59.14). + Network 3: wire="old-net.cs.columbia.edu" (netnumber=128.59.16). The information includes the version number, number of times Amd was compiled on the local system, release date and name of the release. @@ -548,10 +550,9 @@ next line lists the full name of the system, the variables `${os}' and Then come a list of map types supported, filesystems internally supported by Amd (AMFS), and generic filesystems available (FS). -Finally the first two networks (if any) of this host are listed by name -and number. The latter are available via the variables -`${primnetname}', `${primnetnum}', `${subsnetname}', and -`${subsnetnum}'. *Note Selectors::. +Finally all known networks (if any) of this host are listed by name and +number. The primary (first) listed are available via the variables +`${wire}' or `${network}', and `${netnumber}'. *Note Selectors::.  File: am-utils.info, Node: -w Option, Next: -x Option, Prev: -v Option, Up: Amd Command Line Options diff --git a/usr.sbin/amd/doc/am-utils.info-3 b/usr.sbin/amd/doc/am-utils.info-3 index 187ad49c4ba9..fc909ba374fc 100644 --- a/usr.sbin/amd/doc/am-utils.info-3 +++ b/usr.sbin/amd/doc/am-utils.info-3 @@ -1,3 +1,4 @@ +$NetBSD: am-utils.info-3,v 1.1.1.2 1997/10/26 00:03:42 christos Exp $ This is Info file am-utils.info, produced by Makeinfo version 1.68 from the input file am-utils.texi. diff --git a/usr.sbin/amd/doc/am-utils.info-4 b/usr.sbin/amd/doc/am-utils.info-4 index 774676205d22..ea8c0fc12afc 100644 --- a/usr.sbin/amd/doc/am-utils.info-4 +++ b/usr.sbin/amd/doc/am-utils.info-4 @@ -1,3 +1,4 @@ +$NetBSD: am-utils.info-4,v 1.1.1.2 1997/10/26 00:03:44 christos Exp $ This is Info file am-utils.info, produced by Makeinfo version 1.68 from the input file am-utils.texi. @@ -1142,6 +1143,17 @@ Hlfsd Options SIGUSR1 sent to Hlfsd will cause it to dump its internal password map to the file `/tmp/hlfsdump'. +-P PASSWORD-FILE + Read the user-name, user-id, and home directory information from + the file PASSWORD-FILE. Normally, Hlfsd will use getpwent(3) to + read the password database. This option allows you to override the + default database, and is useful if you want to map users' mail + files to a directory other than their home directory. Only the + username, uid, and home-directory fields of the file PASSWORD-FILE + are read and checked. All other fields are ignored. The file + PASSWORD-FILE must otherwise be compliant with Unix System 7 + colon-delimited format passwd(4). +  File: am-utils.info, Node: Hlfsd Files, Prev: Hlfsd Options, Up: Using Hlfsd @@ -1274,21 +1286,3 @@ ctl-hlfsd restart *Note Hlfsd:: for more details. - -File: am-utils.info, Node: expn, Next: fix-amd-map, Prev: ctl-hlfsd, Up: Assorted Tools - -expn -==== - - A script to expand email addresses into their full name. It is -generally useful when using with the `lostaltmail' script, but is a -useful tools otherwise. - - $ expn -v ezk@cs.columbia.edu - ezk@cs.columbia.edu -> - ezk@shekel.mcl.cs.columbia.edu - ezk@shekel.mcl.cs.columbia.edu -> - Erez Zadok <"| /usr/local/mh/lib/slocal -user ezk || exit 75> - Erez Zadok <\ezk> - Erez Zadok - diff --git a/usr.sbin/amd/doc/am-utils.info-5 b/usr.sbin/amd/doc/am-utils.info-5 index 8f6c52f8d3dd..f21649dc9f52 100644 --- a/usr.sbin/amd/doc/am-utils.info-5 +++ b/usr.sbin/amd/doc/am-utils.info-5 @@ -1,3 +1,4 @@ +$NetBSD: am-utils.info-5,v 1.1.1.3 1997/10/26 00:03:45 christos Exp $ This is Info file am-utils.info, produced by Makeinfo version 1.68 from the input file am-utils.texi. @@ -5,6 +6,24 @@ START-INFO-DIR-ENTRY * Am-utils: (am-utils). The Amd automounter suite of utilities END-INFO-DIR-ENTRY + +File: am-utils.info, Node: expn, Next: fix-amd-map, Prev: ctl-hlfsd, Up: Assorted Tools + +expn +==== + + A script to expand email addresses into their full name. It is +generally useful when using with the `lostaltmail' script, but is a +useful tools otherwise. + + $ expn -v ezk@cs.columbia.edu + ezk@cs.columbia.edu -> + ezk@shekel.mcl.cs.columbia.edu + ezk@shekel.mcl.cs.columbia.edu -> + Erez Zadok <"| /usr/local/mh/lib/slocal -user ezk || exit 75> + Erez Zadok <\ezk> + Erez Zadok +  File: am-utils.info, Node: fix-amd-map, Next: fixmount, Prev: expn, Up: Assorted Tools diff --git a/usr.sbin/amd/doc/am-utils.info-6 b/usr.sbin/amd/doc/am-utils.info-6 index 17f48bda72d8..ac8cfd11a313 100644 --- a/usr.sbin/amd/doc/am-utils.info-6 +++ b/usr.sbin/amd/doc/am-utils.info-6 @@ -1,3 +1,4 @@ +$NetBSD: am-utils.info-6,v 1.1.1.2 1997/10/26 00:03:46 christos Exp $ This is Info file am-utils.info, produced by Makeinfo version 1.68 from the input file am-utils.texi. @@ -23,8 +24,8 @@ Index * Alternate locations: Mounting a Volume. * am-eject: am-eject. * Amd command line options: Amd Command Line Options. -* Amd Configuration File: Amd Configuration File. * Amd configuration file: -F Option. +* Amd Configuration File: Amd Configuration File. * Amd configuration file; specifying name: -F Option. * Amd's PID: Amq -p option. * Amd's process ID: Amq -p option. @@ -89,8 +90,8 @@ Index * Controlling Amd: Controlling Amd. * Controlling Hlfsd: Controlling Hlfsd. * Creating a pid file: -p Option. -* ctl-amd <1>: ctl-amd. -* ctl-amd: Starting Amd. +* ctl-amd <1>: Starting Amd. +* ctl-amd: ctl-amd. * ctl-hlfsd <1>: Controlling Hlfsd. * ctl-hlfsd: ctl-hlfsd. * Debug options: -D-Option. @@ -103,9 +104,9 @@ Index * delay, mount option: delay Option. * Delaying mounts from specific locations: delay Option. * Determining the map type: Map Types. -* dev, mount option <1>: Unix Filesystem. -* dev, mount option <2>: CD-ROM Filesystem. -* dev, mount option: Floppy Filesystem. +* dev, mount option <1>: Floppy Filesystem. +* dev, mount option <2>: Unix Filesystem. +* dev, mount option: CD-ROM Filesystem. * Direct automount filesystem: Direct Automount Filesystem. * direct, filesystem type: Direct Automount Filesystem. * Discovering version information: -v Option. @@ -236,6 +237,7 @@ Index * How to start a direct automount point: Direct Automount Filesystem. * How to start an indirect automount point: Automount Filesystem. * How variables are expanded: Variable Expansion. +* in_network, nomadic mount selector: Selectors. * inherit, filesystem type: Inheritance Filesystem. * Inheritance filesystem: Inheritance Filesystem. * Interval before a filesystem times out: -c Option. @@ -374,6 +376,7 @@ Index * Mount selector; false: Selectors. * Mount selector; host: Selectors. * Mount selector; hostd: Selectors. +* Mount selector; in_network: Selectors. * Mount selector; karch: Selectors. * Mount selector; key: Selectors. * Mount selector; map: Selectors. @@ -383,10 +386,6 @@ Index * Mount selector; os: Selectors. * Mount selector; osver: Selectors. * Mount selector; path: Selectors. -* Mount selector; primnetname: Selectors. -* Mount selector; primnetnum: Selectors. -* Mount selector; subsnetname: Selectors. -* Mount selector; subsnetnum: Selectors. * Mount selector; true: Selectors. * Mount selector; wire: Selectors. * mount system call: opts Option. @@ -458,8 +457,6 @@ Index * plock; using: -S Option. * portmap_program Parameter: portmap_program Parameter. * Primary server: delay Option. -* primnetname, mount selector: Selectors. -* primnetnum, mount selector: Selectors. * print_pid Parameter: print_pid Parameter. * print_version Parameter: print_version Parameter. * Process id: -p Option. @@ -480,8 +477,8 @@ Index * restart_mounts Parameter: restart_mounts Parameter. * Restarting Amd: Restarting Amd. * Restarting existing mounts: -r Option. -* rfs, mount option <1>: Loopback Filesystem. -* rfs, mount option: Network Filesystem. +* rfs, mount option <1>: Network Filesystem. +* rfs, mount option: Loopback Filesystem. * rhost, mount option: Network Filesystem. * Root filesystem: Root Filesystem. * root, filesystem type: Root Filesystem. @@ -503,6 +500,7 @@ Index * Selector; false: Selectors. * Selector; host: Selectors. * Selector; hostd: Selectors. +* Selector; in_network: Selectors. * Selector; karch: Selectors. * Selector; key: Selectors. * Selector; map: Selectors. @@ -512,10 +510,6 @@ Index * Selector; os: Selectors. * Selector; osver: Selectors. * Selector; path: Selectors. -* Selector; primnetname: Selectors. -* Selector; primnetnum: Selectors. -* Selector; subsnetname: Selectors. -* Selector; subsnetnum: Selectors. * Selector; true: Selectors. * Selector; wire: Selectors. * Selectors: Selectors. @@ -559,8 +553,6 @@ Index * Stripping the local domain name: Variable Expansion. * sublink: Filesystems and Volumes. * sublink, mount option: sublink Option. -* subsnetname, mount selector: Selectors. -* subsnetnum, mount selector: Selectors. * Supported Platforms: Supported Platforms. * Symbolic link filesystem: Symbolic Link Filesystem. * Symbolic link filesystem II: Symbolic Link Filesystem II. diff --git a/usr.sbin/amd/doc/am-utils.texi b/usr.sbin/amd/doc/am-utils.texi index eb7bec6dd07b..356bfd1edf4c 100644 --- a/usr.sbin/amd/doc/am-utils.texi +++ b/usr.sbin/amd/doc/am-utils.texi @@ -1,3 +1,4 @@ +$NetBSD: am-utils.texi,v 1.1.1.3 1997/10/26 00:03:47 christos Exp $ \input texinfo @c -*-texinfo-*- @c @c Copyright (c) 1997 Erez Zadok @@ -38,7 +39,7 @@ @c @c %W% (Berkeley) %G% @c -@c $Id: am-utils.texi,v 1.1.1.2 1997/09/26 16:08:28 christos Exp $ +@c Id: am-utils.texi,v 6.0 1997/02/09 15:11:50 ezk beta @c @setfilename am-utils.info @@ -1522,25 +1523,17 @@ prefix was @file{blah/} then @code{$@{key@}} would be set to the name of the mount map being used. @item netnumber -@itemx primnetnum @cindex netnumber, mount selector @cindex Mount selector; netnumber @cindex Selector; netnumber -@cindex primnetnum, mount selector -@cindex Mount selector; primnetnum -@cindex Selector; primnetnum the number of the network to which the primary network interface is attached. This value is also output by the ``-v'' option. @item network -@itemx primnetname @itemx wire @cindex network, mount selector @cindex Mount selector; network @cindex Selector; network -@cindex primnetname, mount selector -@cindex Mount selector; primnetname -@cindex Selector; primnetname @cindex wire, mount selector @cindex Mount selector; wire @cindex Selector; wire @@ -1556,24 +1549,6 @@ output by the ``-v'' option. the full pathname of the name being resolved. For example @file{/home/foo} in the example above. -@item subsnetname -@cindex subsnetname, mount selector -@cindex Mount selector; subsnetname -@cindex Selector; subsnetname -the name of the network to which the subsidiary (second) network -interface is attached. If a symbolic name cannot be found in the -networks or hosts database then dotted IP address format is used. This -value is also output by the ``-v'' option. - -@item subsnetnum -@cindex subsnetnum, mount selector -@cindex Mount selector; subsnetnum -@cindex Selector; subsnetnum -the number of the network to which the subsidiary (second) network -interface is attached. If a symbolic name cannot be found in the -networks or hosts database then dotted IP address format is used. This -value is also output by the ``-v'' option. - @end table Selectors can be negated by using @samp{!=} instead of @samp{==}. For @@ -1607,6 +1582,14 @@ If the current host as determined by the value of @code{$@{host@}} is a member of the netgroup @i{ARG}, this selector evaluates to true. Otherwise it evaluates to false. +@item in_network(ARG) +@cindex in_network, nomadic mount selector +@cindex Mount selector; in_network +@cindex Selector; in_network +If the current host has any network interface that is locally attached +to the network specified in @i{ARG} (either via name or number), this +selector evaluates to true. Otherwise it evaluates to false. + @item true(ARG) @cindex true, nomadic mount selector @cindex Mount selector; true @@ -2284,16 +2267,17 @@ Copyright (c) 1997 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. -am-utils version 6.0a10 (build 18). -Built by ezk@@cs.columbia.edu on date Fri Aug 22 15:21:03 EDT 1997. +am-utils version 6.0a13 (build 18). +Built by ezk@@cs.columbia.edu on date Wed Oct 22 15:21:03 EDT 1997. cpu=sparc (big-endian), arch=sun4, karch=sun4u. full_os=solaris2.5.1, os=sos5, osver=5.5.1, vendor=sun. Map support for: root, passwd, union, nisplus, nis, ndbm, file, error. AMFS: nfs, link, nfsx, host, linkx, program, union, inherit, ufs, lofs, cdfs, pcfs, auto, direct, toplvl, autofs, error. FS: autofs, cachefs, cdfs, lofs, nfs, nfs3, pcfs, tfs, tmpfs, ufs. -Primary network: primnetname="cucs-net" (primnetnum=128.59.16). -No Subsidiary network. +Network 1: wire="mcl-lab-net.cs.columbia.edu" (netnumber=128.59.13). +Network 2: wire="14-net.cs.columbia.edu" (netnumber=128.59.14). +Network 3: wire="old-net.cs.columbia.edu" (netnumber=128.59.16). @end example The information includes the version number, number of times @i{Amd} was @@ -2306,10 +2290,10 @@ name. @xref{Supported Platforms}. Then come a list of map types supported, filesystems internally supported by @i{Amd} (AMFS), and generic filesystems available (FS). -Finally the first two networks (if any) of this host are listed by name -and number. The latter are available via the variables -@code{$@{primnetname@}}, @code{$@{primnetnum@}}, -@code{$@{subsnetname@}}, and @code{$@{subsnetnum@}}. @xref{Selectors}. +Finally all known networks (if any) of this host are listed by name +and number. The primary (first) listed are available via the variables +@code{$@{wire@}} or @code{$@{network@}}, and +@code{$@{netnumber@}}. @xref{Selectors}. @c ---------------------------------------------------------------- @node -w Option, -x Option, -v Option, Amd Command Line Options @@ -6146,6 +6130,17 @@ description is available in the program source. A SIGUSR1 sent to @i{Hlfsd} will cause it to dump its internal password map to the file @file{/tmp/hlfsdump}. +@item -P @var{password-file} +Read the user-name, user-id, and home directory information from the +file @var{password-file}. Normally, @i{Hlfsd} will use @b{getpwent}(3) +to read the password database. This option allows you to override the +default database, and is useful if you want to map users' mail files to +a directory other than their home directory. Only the username, uid, +and home-directory fields of the file @var{password-file} are read and +checked. All other fields are ignored. The file @var{password-file} +must otherwise be compliant with Unix System 7 colon-delimited format +@b{passwd}(4). + @end table @c ---------------------------------------------------------------- @@ -7250,4 +7245,7 @@ All other registered trademarks are owned by their respective owners. @c LocalWords: lrwxrwxrwx adminpr hplj adminpr cfg tekxp xterms tekxp Dupuy tp @c LocalWords: linkname hlfsddump dirname rmtab pluto rlogin direntry pg vr dn @c LocalWords: maxmem hlfsdir xmailbox hlfsdump showmount cn amdmap amdmapName -@c LocalWords: objectClass amdmapKey amdmapValue ln +@c LocalWords: objectClass amdmapKey amdmapValue ln powerpc amdmapTimestamp +@c LocalWords: moisil FSinfo Libtool Unmounting sublink fileservers NullProc +@c LocalWords: gethostname mount's unmounts linkx remounts unmounting UAs SA's +@c LocalWords: mountpoint mountpoints unescaped UIDs util's overlayed diff --git a/usr.sbin/amd/doc/hlfsd.ps b/usr.sbin/amd/doc/hlfsd.ps index 18c257d993a1..e48922a0e3af 100644 --- a/usr.sbin/amd/doc/hlfsd.ps +++ b/usr.sbin/amd/doc/hlfsd.ps @@ -1,3 +1,4 @@ +$NetBSD: hlfsd.ps,v 1.1.1.2 1997/10/26 00:03:50 christos Exp $ %!PS-Adobe-2.0 %%Creator: dvips 5.47 Copyright 1986-91 Radical Eye Software %%Title: hlfsd.dvi diff --git a/usr.sbin/amd/doc/version.texi b/usr.sbin/amd/doc/version.texi index 703d65ee8387..3494dd3fe73f 100644 --- a/usr.sbin/amd/doc/version.texi +++ b/usr.sbin/amd/doc/version.texi @@ -1,3 +1,4 @@ -@set UPDATED 26 September 1997 -@set EDITION 6.0a12 -@set VERSION 6.0a12 +$NetBSD: version.texi,v 1.1.1.3 1997/10/26 00:03:55 christos Exp $ +@set UPDATED 24 October 1997 +@set EDITION 6.0a13 +@set VERSION 6.0a13 diff --git a/usr.sbin/amd/fixmount/fixmount.8 b/usr.sbin/amd/fixmount/fixmount.8 index 49fd1bd5a2eb..9c2a0cbd3ac7 100644 --- a/usr.sbin/amd/fixmount/fixmount.8 +++ b/usr.sbin/amd/fixmount/fixmount.8 @@ -1,3 +1,5 @@ +.\" $NetBSD: fixmount.8,v 1.1.1.3 1997/10/26 00:03:33 christos Exp $ +.\" .\" .\" Copyright (c) 1997 Erez Zadok .\" Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ .\" .\" %W% (Berkeley) %G% .\" -.\" $Id: fixmount.8,v 1.1.1.2 1997/09/22 21:13:12 christos Exp $ +.\" Id: fixmount.8,v 5.2.2.1 1992/02/09 15:11:15 jsp beta .\" .TH FIXMOUNT 8L "26 Feb 1993" .SH NAME diff --git a/usr.sbin/amd/hlfsd/hlfsd.8 b/usr.sbin/amd/hlfsd/hlfsd.8 index 49823f6258b5..072cc4e53440 100644 --- a/usr.sbin/amd/hlfsd/hlfsd.8 +++ b/usr.sbin/amd/hlfsd/hlfsd.8 @@ -1,3 +1,5 @@ +.\" $NetBSD: hlfsd.8,v 1.1.1.3 1997/10/26 00:03:15 christos Exp $ +.\" .\" .\" Copyright (c) 1997 Erez Zadok .\" Copyright (c) 1989 Jan-Simon Pendry @@ -36,7 +38,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: hlfsd.8,v 1.1.1.2 1997/09/22 21:12:41 christos Exp $ +.\" Id: hlfsd.8,v 1.2 1993/09/14 22:29:10 ezk Exp ezk .\" .\" HLFSD was written at Columbia University Computer Science Department, by .\" Erez Zadok and Alexander Dupuy @@ -65,6 +67,8 @@ hlfsd \- home-link file system daemon .BI \-x " log-options" ] [ .BI \-D " debug-options" +] [ +.BI \-P " password-file" ] [ .I linkname @@ -243,6 +247,23 @@ source. A SIGUSR1 sent to .B hlfsd will cause it to dump its internal password map to the file .BR /tmp/hlfsdump . +.TP +.BI \-P " password-file" +Read the user-name, user-id, and home directory information from the file +.I password-file. +Normally, +.B hlfsd +will use +.IR getpwent (3) +to read the password database. This option allows you to override the +default database, and is useful if you want to map users' mail files to a +directory other than their home directory. Only the username, uid, and +home-directory fields of the file +.I password-file +are read and checked. All other fields are ignored. The file +.I password-file +must otherwise be compliant with Unix System 7 colon-delimited format +.IR passwd (4). .SH FILES .PD 0 .TP 5 @@ -273,9 +294,10 @@ user's home directory is accessible. .BR getgrent (3), .BR getpwent (3), .BR mail(1), +.BR mnttab (4), .BR mount (8), .BR mtab (5), -.BR passwd (5), +.BR passwd (4), .BR sendmail (8), .BR umount (8). .LP diff --git a/usr.sbin/amd/hlfsd/hlfsd.h b/usr.sbin/amd/hlfsd/hlfsd.h index b53dba2586e2..9f00ac63a5b8 100644 --- a/usr.sbin/amd/hlfsd/hlfsd.h +++ b/usr.sbin/amd/hlfsd/hlfsd.h @@ -1,3 +1,5 @@ +/* $NetBSD: hlfsd.h,v 1.1.1.3 1997/10/26 00:03:14 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: hlfsd.h,v 1.1.1.2 1997/09/22 21:12:39 christos Exp $ + * Id: hlfs.h,v 1.9 1993/09/13 15:11:00 ezk Exp * * HLFSD was written at Columbia University Computer Science Department, by * Erez Zadok and Alexander Dupuy @@ -133,6 +135,7 @@ extern char *alt_spooldir; extern char *home_subdir; extern char *homedir(int); extern char *mailbox(int, char *); +extern char *passwdfile; extern char *slinkname; extern char mboxfile[]; extern int cache_interval; diff --git a/usr.sbin/amd/hlfsd/nfs_prot_svc.c b/usr.sbin/amd/hlfsd/nfs_prot_svc.c index 71af29056a58..7746a88988a6 100644 --- a/usr.sbin/amd/hlfsd/nfs_prot_svc.c +++ b/usr.sbin/amd/hlfsd/nfs_prot_svc.c @@ -1,3 +1,5 @@ +/* $NetBSD: nfs_prot_svc.c,v 1.1.1.3 1997/10/26 00:03:12 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: nfs_prot_svc.c,v 1.1.1.2 1997/09/26 16:07:45 christos Exp $ + * Id: nfs_prot_svc.c,v 5.2.2.1 1992/02/09 15:09:30 jsp beta * */ diff --git a/usr.sbin/amd/hlfsd/stubs.c b/usr.sbin/amd/hlfsd/stubs.c index 2eafd2f7a61c..14d28cc802de 100644 --- a/usr.sbin/amd/hlfsd/stubs.c +++ b/usr.sbin/amd/hlfsd/stubs.c @@ -1,3 +1,5 @@ +/* $NetBSD: stubs.c,v 1.1.1.3 1997/10/26 00:03:13 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: stubs.c,v 1.1.1.2 1997/09/22 21:12:37 christos Exp $ + * Id: stubs.c,v 1.10 1993/09/13 15:11:00 ezk Exp * * HLFSD was written at Columbia University Computer Science Department, by * Erez Zadok and Alexander Dupuy @@ -303,6 +305,7 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp) int retval = 0; char *path_val = (char *) NULL; char *username; + static uid_t last_uid = INVALIDID; if (eq_fh(argp, &root)) { res.rlr_status = NFSERR_ISDIR; @@ -341,8 +344,12 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp) } } - plog(XLOG_USER, "mailbox for uid=%d, gid=%d is %s", - userid, groupid, (char *) res.rlr_u.rlr_data_u); + /* print info, but try to avoid repetitions */ + if (userid != last_uid) { + plog(XLOG_USER, "mailbox for uid=%d, gid=%d is %s", + userid, groupid, (char *) res.rlr_u.rlr_data_u); + last_uid = userid; + } /* I don't think will pass this if -D nofork */ if (serverpid == getpid()) diff --git a/usr.sbin/amd/include/am_compat.h b/usr.sbin/amd/include/am_compat.h index 590b2c283a37..9e9c25d27e1a 100644 --- a/usr.sbin/amd/include/am_compat.h +++ b/usr.sbin/amd/include/am_compat.h @@ -1,3 +1,5 @@ +/* $NetBSD: am_compat.h,v 1.1.1.3 1997/10/26 00:02:25 christos Exp $ */ + /* * am_compat.h: * diff --git a/usr.sbin/amd/include/am_xdr_func.h b/usr.sbin/amd/include/am_xdr_func.h index a18644c0bb2a..a2e440bf78b4 100644 --- a/usr.sbin/amd/include/am_xdr_func.h +++ b/usr.sbin/amd/include/am_xdr_func.h @@ -1,3 +1,5 @@ +/* $NetBSD: am_xdr_func.h,v 1.1.1.2 1997/10/26 00:02:28 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: am_xdr_func.h,v 1.1.1.1 1997/09/26 16:06:24 christos Exp $ + * Id: am_xdr_func.c,v 5.2.2.1 1992/02/09 15:08:40 ezk beta * */ diff --git a/usr.sbin/amd/libamu/amu.h b/usr.sbin/amd/libamu/amu.h index 271639b161da..c1f307e3238f 100644 --- a/usr.sbin/amd/libamu/amu.h +++ b/usr.sbin/amd/libamu/amu.h @@ -1,3 +1,5 @@ +/* $NetBSD: amu.h,v 1.1.1.2 1997/10/26 00:02:21 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: amu.h,v 1.1.1.1 1997/07/24 21:20:10 christos Exp $ + * Id: amu.h,v 1.1 1996/01/13 23:23:39 ezk Exp ezk * */ diff --git a/usr.sbin/amd/libamu/hasmntopt.c b/usr.sbin/amd/libamu/hasmntopt.c index 6199c63dec20..90f21b13cf7b 100644 --- a/usr.sbin/amd/libamu/hasmntopt.c +++ b/usr.sbin/amd/libamu/hasmntopt.c @@ -1,3 +1,5 @@ +/* $NetBSD: hasmntopt.c,v 1.1.1.2 1997/10/26 00:02:15 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ n * modification, are permitted provided that the following conditions * * %W% (Berkeley) %G% * - * $Id: hasmntopt.c,v 1.1.1.1 1997/07/24 21:20:07 christos Exp $ + * Id: hasmntopt.c,v 5.2.2.2 1992/05/31 16:35:45 jsp Exp * */ diff --git a/usr.sbin/amd/libamu/misc_rpc.c b/usr.sbin/amd/libamu/misc_rpc.c index 944260157afa..1092e78607fc 100644 --- a/usr.sbin/amd/libamu/misc_rpc.c +++ b/usr.sbin/amd/libamu/misc_rpc.c @@ -1,3 +1,5 @@ +/* $NetBSD: misc_rpc.c,v 1.1.1.2 1997/10/26 00:02:16 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: misc_rpc.c,v 1.1.1.1 1997/07/24 21:20:07 christos Exp $ + * Id: misc_rpc.c,v 5.2.2.1 1992/02/09 15:08:40 jsp beta * */ diff --git a/usr.sbin/amd/libamu/mount_fs.c b/usr.sbin/amd/libamu/mount_fs.c index 001983c76728..7c55fe0c725e 100644 --- a/usr.sbin/amd/libamu/mount_fs.c +++ b/usr.sbin/amd/libamu/mount_fs.c @@ -1,3 +1,5 @@ +/* $NetBSD: mount_fs.c,v 1.1.1.4 1997/10/26 00:02:16 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: mount_fs.c,v 1.1.1.3 1997/09/26 16:05:59 christos Exp $ + * Id: mount_fs.c,v 5.2.2.2 1992/05/31 16:35:45 jsp Exp * */ diff --git a/usr.sbin/amd/libamu/mtab.c b/usr.sbin/amd/libamu/mtab.c index f4119e71743c..d42ff95fd1fc 100644 --- a/usr.sbin/amd/libamu/mtab.c +++ b/usr.sbin/amd/libamu/mtab.c @@ -1,3 +1,5 @@ +/* $NetBSD: mtab.c,v 1.1.1.3 1997/10/26 00:02:17 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: mtab.c,v 1.1.1.2 1997/09/26 16:06:00 christos Exp $ + * Id: mtab.c,v 5.2.2.1 1992/02/09 15:08:45 jsp beta * */ diff --git a/usr.sbin/amd/libamu/mtabutil.c b/usr.sbin/amd/libamu/mtabutil.c index 0a2d574fee20..22e99df266c6 100644 --- a/usr.sbin/amd/libamu/mtabutil.c +++ b/usr.sbin/amd/libamu/mtabutil.c @@ -1,3 +1,5 @@ +/* $NetBSD: mtabutil.c,v 1.1.1.3 1997/10/26 00:02:24 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: mtabutil.c,v 1.1.1.2 1997/09/22 21:11:24 christos Exp $ + * Id: mtab_bsd.c,v 5.2.2.2 1992/11/12 23:29:14 jsp Exp * */ diff --git a/usr.sbin/amd/libamu/nfs_prot_xdr.c b/usr.sbin/amd/libamu/nfs_prot_xdr.c index ad2871d0ef51..81a9240e3a01 100644 --- a/usr.sbin/amd/libamu/nfs_prot_xdr.c +++ b/usr.sbin/amd/libamu/nfs_prot_xdr.c @@ -1,3 +1,5 @@ +/* $NetBSD: nfs_prot_xdr.c,v 1.1.1.2 1997/10/26 00:02:18 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: nfs_prot_xdr.c,v 1.1.1.1 1997/07/24 21:20:08 christos Exp $ + * Id: nfs_prot_xdr.c,v 5.2.2.1 1992/02/09 15:09:32 jsp beta * */ diff --git a/usr.sbin/amd/libamu/tranputil.c b/usr.sbin/amd/libamu/tranputil.c index 4291e64c1ac0..9b26d6dff3c3 100644 --- a/usr.sbin/amd/libamu/tranputil.c +++ b/usr.sbin/amd/libamu/tranputil.c @@ -1,3 +1,5 @@ +/* $NetBSD: tranputil.c,v 1.1.1.4 1997/10/26 00:02:23 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: tranputil.c,v 1.1.1.3 1997/09/26 16:06:09 christos Exp $ + * Id: transp_sockets.c,v 5.2.2.2 1992/07/18 18:57:03 jsp Exp jsp * * Socket specific utilities. * -Erez Zadok diff --git a/usr.sbin/amd/libamu/umount_fs.c b/usr.sbin/amd/libamu/umount_fs.c index aa8f28bc4f9b..4c29274a33f1 100644 --- a/usr.sbin/amd/libamu/umount_fs.c +++ b/usr.sbin/amd/libamu/umount_fs.c @@ -1,3 +1,5 @@ +/* $NetBSD: umount_fs.c,v 1.1.1.3 1997/10/26 00:02:22 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: umount_fs.c,v 1.1.1.2 1997/09/22 21:11:22 christos Exp $ + * Id: umount_bsd44.c,v 5.2.2.2 1993/01/27 07:32:45 jsp Exp * */ diff --git a/usr.sbin/amd/libamu/util.c b/usr.sbin/amd/libamu/util.c index 5b15247e7ff2..4e7b08ffbe38 100644 --- a/usr.sbin/amd/libamu/util.c +++ b/usr.sbin/amd/libamu/util.c @@ -1,3 +1,5 @@ +/* $NetBSD: util.c,v 1.1.1.2 1997/10/26 00:02:18 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: util.c,v 1.1.1.1 1997/07/24 21:20:08 christos Exp $ + * Id: util.c,v 5.2.2.2 1992/03/07 17:52:06 jsp Exp * */ diff --git a/usr.sbin/amd/libamu/wire.c b/usr.sbin/amd/libamu/wire.c index 1cb37e9138ea..bc5e47d101e8 100644 --- a/usr.sbin/amd/libamu/wire.c +++ b/usr.sbin/amd/libamu/wire.c @@ -1,3 +1,5 @@ +/* $NetBSD: wire.c,v 1.1.1.2 1997/10/26 00:02:19 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: wire.c,v 1.1.1.1 1997/07/24 21:20:09 christos Exp $ + * Id: wire.c,v 5.2.2.2 1992/06/07 18:06:46 jsp Exp jsp * */ @@ -67,10 +69,12 @@ typedef struct addrlist addrlist; struct addrlist { addrlist *ip_next; - u_long ip_addr; + u_long ip_addr; /* address of network */ u_long ip_mask; + char *ip_net_num; /* number of network */ + char *ip_net_name; /* name of network */ }; -static addrlist *localnets = 0; +static addrlist *localnets = NULL; #if defined(IFF_LOCAL_LOOPBACK) && !defined(IFF_LOOPBACK) # define IFF_LOOPBACK IFF_LOCAL_LOOPBACK @@ -89,7 +93,39 @@ static addrlist *localnets = 0; void -getwire(char **name1, char **number1, char **name2, char **number2) +print_wires(char *buf) +{ + addrlist *al; + char s[256]; + int i; + + if (!buf) + return; + + if (!localnets) { + sprintf(buf, "No networks.\n"); + return; + } + /* check if there's more than one network */ + if (!localnets->ip_next) { + sprintf(buf, + "Network: wire=\"%s\" (netnumber=%s).\n", + localnets->ip_net_name, localnets->ip_net_num); + return; + } + i = 1; + for (al = localnets; al; al=al->ip_next) { + sprintf(s, + "Network %d: wire=\"%s\" (netnumber=%s).\n", + i, al->ip_net_name, al->ip_net_num); + strcat(buf, s); + i++; + } +} + + +void +getwire(char **name1, char **number1) { struct hostent *hp; struct netent *np; @@ -103,21 +139,15 @@ getwire(char **name1, char **number1, char **name2, char **number2) u_long mask; u_long subnetshift; char netNumberBuf[64]; + addrlist *al = NULL, *tail = NULL; #ifndef SIOCGIFFLAGS /* if cannot get interface flags, return nothing */ - *name1 = strdup("no_subnet_known"); - *number1 = "0.0.0.0"; - *name2 = 0; - *number2 = 0; + plog(XLOG_ERROR, "getwire unable to get interface flags"); + localnets = NULL; return; #endif /* not SIOCGIFFLAGS */ - *name1 = 0; - *number1 = 0; - *name2 = 0; - *number2 = 0; - /* * Get suitable socket */ @@ -153,7 +183,6 @@ getwire(char **name1, char **number1, char **name2, char **number2) * Scan the list looking for a suitable interface */ for (cp = buf; cp < cplim; cp += SIZE(ifr)) { - addrlist *al; ifr = (struct ifreq *) cp; if (ifr->ifr_addr.sa_family != AF_INET) @@ -190,13 +219,22 @@ getwire(char **name1, char **number1, char **name2, char **number2) netmask = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr.s_addr; /* - * Add interface to local network list + * Add interface to local network singly linked list */ al = ALLOC(struct addrlist); al->ip_addr = address; al->ip_mask = netmask; - al->ip_next = localnets; - localnets = al; + al->ip_net_name = NO_SUBNET; /* fill in a bit later */ + al->ip_net_num = "0.0.0.0"; /* fill in a bit later */ + al->ip_next = NULL; + /* append to the end of the list */ + if (!localnets) { + localnets = tail = al; + tail->ip_next = NULL; + } else { + tail->ip_next = al; + tail = al; + } /* * Figure out the subnet's network address @@ -255,13 +293,10 @@ getwire(char **name1, char **number1, char **name2, char **number2) C(subnet >> 24), C(subnet >> 16), C(subnet >> 8), C(subnet)); } - if (!*number1) { - *number1 = strdup(netNumberBuf); - } else if (!*number2) { - *number2 = strdup(netNumberBuf); - } else { - plog(XLOG_INFO, "Another unused interface discovered: netnumber %s", netNumberBuf); - } + + /* fill in network number (string) */ + al->ip_net_num = strdup(netNumberBuf); + #else /* not IN_CLASSA */ /* This is probably very wrong. */ np = getnetbyaddr(subnet, AF_INET); @@ -277,26 +312,21 @@ getwire(char **name1, char **number1, char **name2, char **number2) else s = inet_dquad(buf, subnet); } - if (!*name1) { - *name1 = strdup(s); - } else if (!*name2) { - *name2 = strdup(s); - } else { - plog(XLOG_INFO, "Another unused interface discovered: netname %s", s); - } + + /* fill in network name (string) */ + al->ip_net_name = strdup(s); } out: if (fd >= 0) - (void) close(fd); - if (!*name1) - *name1 = strdup(NO_SUBNET); - if (!*number1) + close(fd); + if (localnets) { + *name1 = localnets->ip_net_name; + *number1 = localnets->ip_net_num; + } else { + *name1 = NO_SUBNET; *number1 = "0.0.0.0"; - if (!*name2) - *name2 = strdup(NO_SUBNET); - if (!*number2) - *number2 = "0.0.0.0"; + } } @@ -340,3 +370,20 @@ islocalnet(u_long addr) return FALSE; } + + +/* + * Determine whether a network name is one of the local networks + * of a host. + */ +int +is_network_member(const char *net) +{ + addrlist *al; + + for (al = localnets; al; al = al->ip_next) + if (STREQ(net, al->ip_net_name) || STREQ(net, al->ip_net_num)) + return TRUE; + + return FALSE; +} diff --git a/usr.sbin/amd/libamu/xdr_func.c b/usr.sbin/amd/libamu/xdr_func.c index 6d0f9c037685..99d3f6358f6a 100644 --- a/usr.sbin/amd/libamu/xdr_func.c +++ b/usr.sbin/amd/libamu/xdr_func.c @@ -1,3 +1,5 @@ +/* $NetBSD: xdr_func.c,v 1.1.1.3 1997/10/26 00:02:20 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: xdr_func.c,v 1.1.1.2 1997/09/26 16:06:04 christos Exp $ + * Id: xdr_func.c,v 5.2.2.1 1992/02/09 15:08:40 jsp beta * */ diff --git a/usr.sbin/amd/libamu/xutil.c b/usr.sbin/amd/libamu/xutil.c index 7c72f8d8d0a8..6d50739410b3 100644 --- a/usr.sbin/amd/libamu/xutil.c +++ b/usr.sbin/amd/libamu/xutil.c @@ -1,3 +1,5 @@ +/* $NetBSD: xutil.c,v 1.1.1.4 1997/10/26 00:02:21 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: xutil.c,v 1.1.1.3 1997/09/26 16:06:06 christos Exp $ + * Id: xutil.c,v 1.1 1997/01/11 21:06:22 ezk Exp ezk * */ @@ -601,3 +603,49 @@ set_amd_program_number(int program) { amd_program_number = program; } + + +/* + * Release the controlling tty of the process pid. + * + * Algorithm: try these in order, if available, until one of them + * succeeds: setsid(), ioctl(fd, TIOCNOTTY, 0). + * Do not use setpgid(): on some OSs it may release the controlling tty, + * even if the man page does not mention it, but on other OSs it does not. + * Also avoid setpgrp(): it works on some systems, and on others it is + * identical to setpgid(). + */ +void +amu_release_controlling_tty(void) +{ +#ifdef TIOCNOTTY + int fd; +#endif /* TIOCNOTTY */ + +#ifdef HAVE_SETSID + if (setsid() < 0) { + plog(XLOG_WARNING, "Could not release controlling tty using setsid(): %m"); + } else { + plog(XLOG_INFO, "released controlling tty using setsid()"); + return; + } +#endif /* HAVE_SETSID */ + +#ifdef TIOCNOTTY + fd = open("/dev/tty", O_RDWR); + if (fd < 0) { + /* not an error if already no controlling tty */ + if (errno != ENXIO) + plog(XLOG_WARNING, "Could not open controlling tty: %m"); + } else { + if (ioctl(fd, TIOCNOTTY, 0) < 0 && errno != ENOTTY) + plog(XLOG_WARNING, "Could not disassociate tty (TIOCNOTTY): %m"); + else + plog(XLOG_INFO, "released controlling tty using ioctl(TIOCNOTTY)"); + close(fd); + } + return; +#endif /* not TIOCNOTTY */ + + plog(XLOG_ERROR, "unable to release controlling tty"); +} diff --git a/usr.sbin/amd/wire-test/wire-test.8 b/usr.sbin/amd/wire-test/wire-test.8 index 39a6967c8a92..b3455b6ff3b6 100644 --- a/usr.sbin/amd/wire-test/wire-test.8 +++ b/usr.sbin/amd/wire-test/wire-test.8 @@ -1,3 +1,5 @@ +.\" $NetBSD: wire-test.8,v 1.1.1.2 1997/10/26 00:03:37 christos Exp $ +.\" .\" .\" Copyright (c) 1997 Erez Zadok .\" Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ .\" .\" %W% (Berkeley) %G% .\" -.\" $Id: wire-test.8,v 1.1.1.1 1997/09/26 16:08:41 christos Exp $ +.\" Id: fixmount.8,v 5.2.2.1 1992/02/09 15:11:15 jsp beta .\" .TH WIRE-TEST 8L "26 Feb 1993" .SH NAME diff --git a/usr.sbin/amd/wire-test/wire-test.c b/usr.sbin/amd/wire-test/wire-test.c index 0daa53eddcd3..d786ea6f35a1 100644 --- a/usr.sbin/amd/wire-test/wire-test.c +++ b/usr.sbin/amd/wire-test/wire-test.c @@ -1,3 +1,5 @@ +/* $NetBSD: wire-test.c,v 1.1.1.2 1997/10/26 00:03:37 christos Exp $ */ + /* * Copyright (c) 1997 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry @@ -38,7 +40,7 @@ * * %W% (Berkeley) %G% * - * $Id: wire-test.c,v 1.1.1.1 1997/09/26 16:08:40 christos Exp $ + * Id: wire-test.c,v 5.2.2.2 1992/06/07 18:06:46 jsp Exp jsp * */ @@ -59,9 +61,8 @@ int main(int argc, char **argv) { char *networkName1, *networkNumber1; - char *networkName2, *networkNumber2; struct in_addr myipaddr; /* (An) IP address of this host */ - char *testhost, *proto; + char *testhost, *proto, tmpbuf[1024]; int nv, ret; struct sockaddr_in *ip; struct hostent *hp = 0; @@ -74,31 +75,11 @@ main(int argc, char **argv) perror(argv[0]); exit(1); } - if ((networkName1 = (char *) calloc(STRMAX, sizeof(char))) - == (char *) NULL) { - perror(argv[0]); - exit(1); - } - if ((networkNumber1 = (char *) calloc(STRMAX, sizeof(char))) - == (char *) NULL) { - perror(argv[0]); - exit(1); - } - if ((networkName2 = (char *) calloc(STRMAX, sizeof(char))) - == (char *) NULL) { - perror(argv[0]); - exit(1); - } - if ((networkNumber2 = (char *) calloc(STRMAX, sizeof(char))) - == (char *) NULL) { - perror(argv[0]); - exit(1); - } - getwire(&networkName1, &networkNumber1, &networkName2, &networkNumber2); - fprintf(stderr, "Network name is \"%s\"\n", networkName1); - fprintf(stderr, "Network number is \"%s\"\n", networkNumber1); - fprintf(stderr, "Network name is \"%s\"\n", networkName2); - fprintf(stderr, "Network number is \"%s\"\n", networkNumber2); + + /* get list of networks */ + getwire(&networkName1, &networkNumber1); + print_wires(tmpbuf); + fprintf(stderr, "%s", tmpbuf); /* also print my IP address */ amu_get_myaddress(&myipaddr);