diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.am | 42 | ||||
-rw-r--r-- | scripts/Makefile.in | 881 | ||||
-rw-r--r-- | scripts/amd.conf-sample | 8 | ||||
-rw-r--r-- | scripts/amd.conf.5 | 30 | ||||
-rw-r--r-- | scripts/automount2amd.8 | 11 | ||||
-rw-r--r-- | scripts/expn.1 | 1369 | ||||
-rwxr-xr-x | scripts/expn.in | 1369 | ||||
-rwxr-xr-x | scripts/fixrmtab | 24 | ||||
-rwxr-xr-x | scripts/fixrmtab.in | 20 | ||||
-rwxr-xr-x | scripts/lostaltmail.in | 2 |
10 files changed, 661 insertions, 3095 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index c4380584ec0e..9432643f0e78 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -8,6 +8,7 @@ sbin_SCRIPTS = \ am-eject \ amd2ldif \ amd2sun \ + automount2amd \ ctl-amd \ ctl-hlfsd \ fixrmtab \ @@ -16,34 +17,31 @@ sbin_SCRIPTS = \ wait4amd \ wait4amd2die -bin_SCRIPTS = \ - expn +noinst_SCRIPTS = \ + redhat-ctl-amd \ + test-attrcache -sysconf_DATA = \ - amd.conf-sample \ - lostaltmail.conf-sample +sysconf_DATA = amd.conf-sample lostaltmail.conf-sample # man pages -man_MANS = \ - amd.conf.5 \ - expn.1 +man_MANS = amd.conf.5 automount2amd.8 -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 \ +EXTRA_DIST = \ + am-eject.in \ + amd2ldif.in \ + amd2sun.in \ + automount2amd.in \ + ctl-amd.in \ + ctl-hlfsd.in \ + fixrmtab.in \ + fix-amd-map.in \ + lostaltmail.in \ + redhat-ctl-amd.in \ + wait4amd.in \ + wait4amd2die.in \ \ amd.conf-sample \ lostaltmail.conf-sample \ $(man_MANS) -CLEANFILES = $(sbin_SCRIPTS) $(bin_SCRIPTS) +CLEANFILES = $(sbin_SCRIPTS) $(bin_SCRIPTS) $(noinst_SCRIPTS) diff --git a/scripts/Makefile.in b/scripts/Makefile.in index a20d84627136..b57b0ff43652 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.3.2 from Makefile.am +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. -# 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. @@ -10,76 +12,290 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +@SET_MAKE@ + # 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 = - +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ +build_triplet = @build@ host_triplet = @host@ +subdir = scripts +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/mkinstalldirs $(srcdir)/am-eject.in \ + $(srcdir)/amd2ldif.in $(srcdir)/amd2sun.in \ + $(srcdir)/automount2amd.in $(srcdir)/ctl-amd.in \ + $(srcdir)/ctl-hlfsd.in $(srcdir)/fix-amd-map.in \ + $(srcdir)/fixrmtab.in $(srcdir)/lostaltmail.in \ + $(srcdir)/redhat-ctl-amd.in $(srcdir)/test-attrcache.in \ + $(srcdir)/wait4amd.in $(srcdir)/wait4amd2die.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 $(top_srcdir)/vers.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = am-eject amd2ldif amd2sun automount2amd ctl-amd \ + ctl-hlfsd fix-amd-map fixrmtab lostaltmail redhat-ctl-amd \ + test-attrcache wait4amd wait4amd2die +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" \ + "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(sysconfdir)" +SCRIPTS = $(noinst_SCRIPTS) $(sbin_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man5dir = $(mandir)/man5 +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(man_MANS) +DATA = $(sysconf_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMD_FS_OBJS = @AMD_FS_OBJS@ +AMD_INFO_OBJS = @AMD_INFO_OBJS@ +AMTAR = @AMTAR@ +AMU_AUTOFS_PROT_HEADER = @AMU_AUTOFS_PROT_HEADER@ +AMU_CFLAGS = @AMU_CFLAGS@ +AMU_LIB_OBJS = @AMU_LIB_OBJS@ +AMU_NFS_PROT_HEADER = @AMU_NFS_PROT_HEADER@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ -LTALLOCA = @LTALLOCA@ +LIPO = @LIPO@ +LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNMOUNT_PROGRAM = @UNMOUNT_PROGRAM@ VERSION = @VERSION@ - -sbin_SCRIPTS = \ +WRAPLIB = @WRAPLIB@ +YACC = @YACC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +am_utils_unmount_args = @am_utils_unmount_args@ +am_utils_unmount_call = @am_utils_unmount_call@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +sbin_SCRIPTS = \ am-eject \ amd2ldif \ amd2sun \ + automount2amd \ ctl-amd \ ctl-hlfsd \ fixrmtab \ @@ -88,292 +304,399 @@ sbin_SCRIPTS = \ wait4amd \ wait4amd2die -bin_SCRIPTS = \ - expn +noinst_SCRIPTS = \ + redhat-ctl-amd \ + test-attrcache -sysconf_DATA = \ - amd.conf-sample \ - lostaltmail.conf-sample +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 \ +man_MANS = amd.conf.5 automount2amd.8 +EXTRA_DIST = \ + am-eject.in \ + amd2ldif.in \ + amd2sun.in \ + automount2amd.in \ + ctl-amd.in \ + ctl-hlfsd.in \ + fixrmtab.in \ + fix-amd-map.in \ + lostaltmail.in \ + redhat-ctl-amd.in \ + wait4amd.in \ + wait4amd2die.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) +CLEANFILES = $(sbin_SCRIPTS) $(bin_SCRIPTS) $(noinst_SCRIPTS) +all: all-am .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 - +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu scripts/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +am-eject: $(top_builddir)/config.status $(srcdir)/am-eject.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +amd2ldif: $(top_builddir)/config.status $(srcdir)/amd2ldif.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +amd2sun: $(top_builddir)/config.status $(srcdir)/amd2sun.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +automount2amd: $(top_builddir)/config.status $(srcdir)/automount2amd.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +ctl-amd: $(top_builddir)/config.status $(srcdir)/ctl-amd.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +ctl-hlfsd: $(top_builddir)/config.status $(srcdir)/ctl-hlfsd.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +fix-amd-map: $(top_builddir)/config.status $(srcdir)/fix-amd-map.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +fixrmtab: $(top_builddir)/config.status $(srcdir)/fixrmtab.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +lostaltmail: $(top_builddir)/config.status $(srcdir)/lostaltmail.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +redhat-ctl-amd: $(top_builddir)/config.status $(srcdir)/redhat-ctl-amd.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test-attrcache: $(top_builddir)/config.status $(srcdir)/test-attrcache.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +wait4amd: $(top_builddir)/config.status $(srcdir)/wait4amd.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +wait4amd2die: $(top_builddir)/config.status $(srcdir)/wait4amd2die.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 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 + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; 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 + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) -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 +mostlyclean-libtool: + -rm -f *.lo -install-man5: - $(mkinstalldirs) $(DESTDIR)$(man5dir) - @list='$(man5_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ - case "$$i" in \ - *.5*) list="$$list $$i" ;; \ - esac; \ +clean-libtool: + -rm -rf .libs _libs +install-man5: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man5dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.5[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ + fi; \ 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 + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ + 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_UNINSTALL) + @list=''; test -n "$(man5dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.5[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) +install-man8: $(man_MANS) @$(NORMAL_INSTALL) - $(MAKE) install-man1 install-man5 -uninstall-man: + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man8dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.8[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ + done; } + +uninstall-man8: @$(NORMAL_UNINSTALL) - $(MAKE) uninstall-man1 uninstall-man5 - + @list=''; test -n "$(man8dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.8[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) 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; \ + @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sysconfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \ done uninstall-sysconfDATA: @$(NORMAL_UNINSTALL) - list='$(sysconf_DATA)'; for p in $$list; do \ - rm -f $(DESTDIR)$(sysconfdir)/$$p; \ - done -tags: TAGS -TAGS: + @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(sysconfdir)'; $(am__uninstall_files_from_dir) +tags TAGS: +ctags CTAGS: -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +cscope cscopelist: -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; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ 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 +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) $(MANS) $(DATA) installdirs: - $(mkinstalldirs) $(DATADIR)$(bindir) $(DATADIR)$(sbindir) \ - $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 \ - $(DATADIR)$(sysconfdir) + for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(sysconfdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi 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) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -mostlyclean: mostlyclean-generic + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am -clean: clean-generic mostlyclean +clean-am: clean-generic clean-libtool mostlyclean-am -distclean: distclean-generic clean - -rm -f config.status - -rm -f libtool +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic -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." +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-sbinSCRIPTS install-sysconfDATA + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man5 install-man8 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man uninstall-sbinSCRIPTS \ + uninstall-sysconfDATA + +uninstall-man: uninstall-man5 uninstall-man8 + +.MAKE: install-am install-strip -.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 +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man5 install-man8 install-pdf install-pdf-am \ + install-ps install-ps-am install-sbinSCRIPTS install-strip \ + install-sysconfDATA installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am uninstall-man uninstall-man5 \ + uninstall-man8 uninstall-sbinSCRIPTS uninstall-sysconfDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/scripts/amd.conf-sample b/scripts/amd.conf-sample index 880a74ba7552..4d965787099a 100644 --- a/scripts/amd.conf-sample +++ b/scripts/amd.conf-sample @@ -64,8 +64,8 @@ nis_domain = nisDom-CS.columbia.edu # (amd -x) log_options = fatal,error,user,warn,info,map,stats,all # (amd -D) -debug_options = all,amq,daemon,fork,full,hrtime,info,mem,mtab,\ - str,readdir,test,trace,xdrtrace +debug_options = all,defaults,test,amq,daemon,fork,\ + full,hrtime,info,mem,mtab,str,readdir,trace,xdrtrace # path for mtab file during mtab debug mode debug_mtab_file = /tmp/mnttab # (amd -S) @@ -108,7 +108,7 @@ exec_map_timeout = 10 normalize_slashes = yes | no ############################################################################## -# these 8 global options can be overridden by each map individually +# these 9 global options can be overridden by each map individually browsable_dirs = no | yes | full map_options = cache:=all map_type = file|hesiod|ndbm|nis|nisplus|passwd|union|ldap @@ -119,6 +119,8 @@ autofs_use_lofs = yes | no search_path = /etc/local:/etc/amdmaps:/misc/yp # selectors are not recognized by default in the /defaults entry selectors_in_defaults = no | yes +# does this map use Sun Automounter map syntax? +sun_map_syntax = no | yes ############################################################################## ############################################################################## diff --git a/scripts/amd.conf.5 b/scripts/amd.conf.5 index 36e08cd9a41b..2fa4334b314a 100644 --- a/scripts/amd.conf.5 +++ b/scripts/amd.conf.5 @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 1997-2006 Erez Zadok +.\" Copyright (c) 1997-2014 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. @@ -16,11 +16,7 @@ .\" 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 +.\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" @@ -36,9 +32,8 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" %W% (Berkeley) %G% .\" -.\" $Id: amd.conf.5,v 1.39.2.5 2006/04/21 01:12:04 ezk Exp $ +.\" File: am-utils/scripts/amd.conf.5 .\" .TH AMD.CONF 5 "7 August 1997" .SH NAME @@ -192,6 +187,10 @@ slow slip-based networks as follows: Deprecated form: selectors_on_default +.TP +.BR sun_map_syntax " (boolean, default=no)" +If "yes," then Amd will parse the map according to the Sun Automount syntax. + .\" ************************************************************************** .SS Parameters applicable to the global section only @@ -254,7 +253,9 @@ meaning. You can get the list of supported debugging options by running Amd \-H. Possible values are: .nf -\fBall\fR all options +\fBall\fR all options (excludes hrtime and mtab) +\fBdefaults\fR "sensible" default options (all--excluding hrtime, mtab, and xdrtrace) +\fBtest\fR full debug options plus mtab,nodaemon,nofork,noamq \fBamq\fR register for amq \fBdaemon\fR enter daemon mode \fBfork\fR fork server @@ -262,10 +263,9 @@ meaning. You can get the list of supported debugging options by running Amd \fBhrtime\fR print high resolution time stamps (only if syslog(3) is not used) \fBinfo\fR info service specific debugging (hesiod, nis, etc.) \fBmem\fR trace memory allocations -\fBmtab\fR use local "./mtab" file +\fBmtab\fR use local "/tmp/mtab" file \fBreaddir\fR show browsable_dirs progress \fBstr\fR debug string munging -\fBtest\fR full debug but no daemon \fBtrace\fR trace protocol and NFS mount arguments \fBxdrtrace\fR trace XDR routines .fi @@ -407,7 +407,7 @@ then Amd will log messages via using the LOG_LOCAL7 facility (if it exists on the system). .TP -.BR log_options " (string, default no logging options)" +.BR log_options " (string, default=defaults)" Same as the .B \-x option to Amd. Specify any logging options for Amd. Options are comma @@ -421,9 +421,10 @@ Possible values are: .nf \fBall\fR all messages +\fBdefaults\fR default messages (fatal,error,user,warning,info) \fBdebug\fR debug messages -\fBerror\fR non-fatal system errors -\fBfatal\fR fatal errors +\fBerror\fR non-fatal system errors (cannot be turned off) +\fBfatal\fR fatal errors (cannot be turned off) \fBinfo\fR information \fBmap\fR map errors \fBstats\fR additional statistical information @@ -763,6 +764,7 @@ map_name = amd.tftpboot .BR amd (8), .BR amq (8), .BR ctl-amd (8), +.BR automount (8), .BR hosts_access (5). .LP ``am-utils'' diff --git a/scripts/automount2amd.8 b/scripts/automount2amd.8 index bd3b61230ab6..f9a04d928cd1 100644 --- a/scripts/automount2amd.8 +++ b/scripts/automount2amd.8 @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 1997-2006 Erez Zadok +.\" Copyright (c) 1997-2014 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. @@ -16,11 +16,7 @@ .\" 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 +.\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" @@ -36,9 +32,8 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" %W% (Berkeley) %G% .\" -.\" $Id: automount2amd.8,v 1.8.2.1 2006/01/02 18:48:26 ezk Exp $ +.\" File: am-utils/scripts/automount2amd.8 .\" .TH AUTOMOUNT2AMD 8L "24 May 1993" .SH NAME diff --git a/scripts/expn.1 b/scripts/expn.1 deleted file mode 100644 index f316247b4a9c..000000000000 --- a/scripts/expn.1 +++ /dev/null @@ -1,1369 +0,0 @@ -#!@PERL@ -'di '; -'ds 00 \\"'; -'ig 00 '; -# -# THIS PROGRAM IS ITS OWN MANUAL PAGE. INSTALL IN man & bin. -# - -# hardcoded constants, should work fine for BSD-based systems -#require 'sys/socket.ph'; # perl 4 -use Socket; # perl 5 -$AF_INET = &AF_INET; -$SOCK_STREAM = &SOCK_STREAM; -$sockaddr = 'S n a4 x8'; - -# system requirements: -# must have 'nslookup' and 'hostname' programs. - -# $Header: /home/cvsroot/am-utils/scripts/expn.1,v 1.4 2003/07/18 15:17:37 ezk Exp $ - -# TODO: -# less magic should apply to command-line addresses -# less magic should apply to local addresses -# add magic to deal with cross-domain cnames - -# Checklist: (hard addresses) -# 250 Kimmo Suominen <"|/usr/local/mh/lib/slocal -user kim"@grendel.tac.nyc.ny.us> -# harry@hofmann.cs.Berkeley.EDU -> harry@tenet (.berkeley.edu) [dead] -# bks@cs.berkeley.edu -> shiva.CS (.berkeley.edu) [dead] -# dan@tc.cornell.edu -> brown@tiberius (.tc.cornell.edu) - -############################################################################# -# -# Copyright (c) 1993 David Muir Sharnoff -# All rights reserved. -# -# 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 David Muir Sharnoff. -# 4. The name of David Sharnoff may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE DAVID MUIR SHARNOFF ``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 DAVID MUIR SHARNOFF 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. -# -# This copyright notice derived from material copyrighted by the Regents -# of the University of California. -# -# Contributions accepted. -# -############################################################################# - -# overall structure: -# in an effort to not trace each address individually, but rather -# ask each server in turn a whole bunch of questions, addresses to -# be expanded are queued up. -# -# This means that all accounting w.r.t. an address must be stored in -# various arrays. Generally these arrays are indexed by the -# string "$addr *** $server" where $addr is the address to be -# expanded "foo" or maybe "foo@bar" and $server is the hostname -# of the SMTP server to contact. -# - -# important global variables: -# -# @hosts : list of servers still to be contacted -# $server : name of the current we are currently looking at -# @users = $users{@hosts[0]} : addresses to expand at this server -# $u = $users[0] : the current address being expanded -# $names{"$users[0] *** $server"} : the 'name' associated with the address -# $mxbacktrace{"$users[0] *** $server"} : record of mx expansion -# $mx_secondary{$server} : other mx relays at the same priority -# $domainify_fallback{"$users[0] *** $server"} : alternative names to try -# instead of $server if $server doesn't work -# $temporary_redirect{"$users[0] *** $server"} : when trying alternates, -# temporarily channel all tries along current path -# $giveup{$server} : do not bother expanding addresses at $server -# $verbose : -v -# $watch : -w -# $vw : -v or -w -# $debug : -d -# $valid : -a -# $levels : -1 -# S : the socket connection to $server - -$have_nslookup = 1; # we have the nslookup program -$port = 'smtp'; -$av0 = $0; -$ENV{'PATH'} .= ":/usr/etc" unless $ENV{'PATH'} =~ m,/usr/etc,; -$ENV{'PATH'} .= ":/usr/ucb" unless $ENV{'PATH'} =~ m,/usr/ucb,; -select(STDERR); - -$0 = "$av0 - running hostname"; -chop($name = `hostname || uname -n`); - -$0 = "$av0 - lookup host FQDN and IP addr"; -($hostname,$aliases,$type,$len,$thisaddr) = gethostbyname($name); - -$0 = "$av0 - parsing args"; -$usage = "Usage: $av0 [-1avwd] user[\@host] [user2[host2] ...]"; -for $a (@ARGV) { - die $usage if $a eq "-"; - while ($a =~ s/^(-.*)([1avwd])/$1/) { - eval '$'."flag_$2 += 1"; - } - next if $a eq "-"; - die $usage if $a =~ /^-/; - &expn(&parse($a,$hostname,undef,1)); -} -$verbose = $flag_v; -$watch = $flag_w; -$vw = $flag_v + $flag_w; -$debug = $flag_d; -$valid = $flag_a; -$levels = $flag_1; - -die $usage unless @hosts; -if ($valid) { - if ($valid == 1) { - $validRequirement = 0.8; - } elsif ($valid == 2) { - $validRequirement = 1.0; - } elsif ($valid == 3) { - $validRequirement = 0.9; - } else { - $validRequirement = (1 - (1/($valid-3))); - print "validRequirement = $validRequirement\n" if $debug; - } -} - -$0 = "$av0 - building local socket"; -($name,$aliases,$proto) = getprotobyname('tcp'); -($name,$aliases,$port) = getservbyname($port,'tcp') - unless $port =~ /^\d+/; -$this = pack($sockaddr, &AF_INET, 0, $thisaddr); - -HOST: -while (@hosts) { - $server = shift(@hosts); - @users = split(' ',$users{$server}); - delete $users{$server}; - - # is this server already known to be bad? - $0 = "$av0 - looking up $server"; - if ($giveup{$server}) { - &giveup('mx domainify',$giveup{$server}); - next; - } - - # do we already have an mx record for this host? - next HOST if &mxredirect($server,*users); - - # look it up, or try for an mx. - $0 = "$av0 - gethostbyname($server)"; - - ($name,$aliases,$type,$len,$thataddr) = gethostbyname($server); - # if we can't get an A record, try for an MX record. - unless($thataddr) { - &mxlookup(1,$server,"$server: could not resolve name",*users); - next HOST; - } - - # get a connection, or look for an mx - $0 = "$av0 - socket to $server"; - $that = pack($sockaddr, &AF_INET, $port, $thataddr); - socket(S, &AF_INET, &SOCK_STREAM, $proto) - || die "socket: $!"; - $0 = "$av0 - bind to $server"; - bind(S, $this) - || die "bind $hostname,0: $!"; - $0 = "$av0 - connect to $server"; - print "debug = $debug server = $server\n" if $debug > 8; - if (! connect(S, $that) || ($debug == 10 && $server =~ /relay\d.UU.NET$/i)) { - $0 = "$av0 - $server: could not connect: $!\n"; - $emsg = $!; - unless (&mxlookup(0,$server,"$server: could not connect: $!",*users)) { - &giveup('mx',"$server: Could not connect: $emsg"); - } - next HOST; - } - select((select(S),$| = 1)[0]); # don't buffer output to S - - # read the greeting - $0 = "$av0 - talking to $server"; - &alarm("greeting with $server",''); - while(<S>) { - alarm(0); - print if $watch; - if (/^(\d+)([- ])/) { - if ($1 != 220) { - $0 = "$av0 - bad numeric response from $server"; - &alarm("giving up after bad response from $server",''); - &read_response($2,$watch); - alarm(0); - print STDERR "$server: NOT 220 greeting: $_" - if ($debug || $vw); - if (&mxlookup(0,$server,"$server: did not respond with a 220 greeting",*users)) { - close(S); - next HOST; - } - } - last if ($2 eq " "); - } else { - $0 = "$av0 - bad response from $server"; - print STDERR "$server: NOT 220 greeting: $_" - if ($debug || $vw); - unless (&mxlookup(0,$server,"$server: did not respond with SMTP codes",*users)) { - &giveup('',"$server: did not talk SMTP"); - } - close(S); - next HOST; - } - &alarm("greeting with $server",''); - } - alarm(0); - - # if this causes problems, remove it - $0 = "$av0 - sending helo to $server"; - &alarm("sending helo to $server",""); - &ps("helo $hostname"); - while(<S>) { - print if $watch; - last if /^\d+ /; - } - alarm(0); - - # try the users, one by one - USER: - while(@users) { - $u = shift(@users); - $0 = "$av0 - expanding $u [\@$server]"; - - # do we already have a name for this user? - $oldname = $names{"$u *** $server"}; - - print &compact($u,$server)." ->\n" if ($verbose && ! $valid); - if ($valid) { - # - # when running with -a, we delay taking any action - # on the results of our query until we have looked - # at the complete output. @toFinal stores expansions - # that will be final if we take them. @toExpn stores - # expansions that are not final. @isValid keeps - # track of our ability to send mail to each of the - # expansions. - # - @isValid = (); - @toFinal = (); - @toExpn = (); - } - -# ($ecode,@expansion) = &expn_vrfy($u,$server); - (@foo) = &expn_vrfy($u,$server); - ($ecode,@expansion) = @foo; - if ($ecode) { - &giveup('',$ecode,$u); - last USER; - } - - for $s (@expansion) { - $s =~ s/[\n\r]//g; - $0 = "$av0 - parsing $server: $s"; - - $skipwatch = $watch; - - if ($s =~ /^[25]51([- ]).*<(.+)>/) { - print "$s" if $watch; - print "(pretending 250$1<$2>)" if ($debug && $watch); - print "\n" if $watch; - $s = "250$1<$2>"; - $skipwatch = 0; - } - - if ($s =~ /^250([- ])(.+)/) { - print "$s\n" if $skipwatch; - ($done,$addr) = ($1,$2); - ($newhost, $newaddr, $newname) = &parse($addr,$server,$oldname, $#expansion == 0); - print "($newhost, $newaddr, $newname) = &parse($addr, $server, $oldname)\n" if $debug; - if (! $newhost) { - # no expansion is possible w/o a new server to call - if ($valid) { - push(@isValid, &validAddr($newaddr)); - push(@toFinal,$newaddr,$server,$newname); - } else { - &verbose(&final($newaddr,$server,$newname)); - } - } else { - $newmxhost = &mx($newhost,$newaddr); - print "$newmxhost = &mx($newhost)\n" - if ($debug && $newhost ne $newmxhost); - $0 = "$av0 - parsing $newaddr [@$newmxhost]"; - print "levels = $levels, level{$u *** $server} = ".$level{"$u *** $server"}."\n" if ($debug > 1); - # If the new server is the current one, - # it would have expanded things for us - # if it could have. Mx records must be - # followed to compare server names. - # We are also done if the recursion - # count has been exceeded. - if (&trhost($newmxhost) eq &trhost($server) || ($levels && $level{"$u *** $server"} >= $levels)) { - if ($valid) { - push(@isValid, &validAddr($newaddr)); - push(@toFinal,$newaddr,$newmxhost,$newname); - } else { - &verbose(&final($newaddr,$newmxhost,$newname)); - } - } else { - # more work to do... - if ($valid) { - push(@isValid, &validAddr($newaddr)); - push(@toExpn,$newmxhost,$newaddr,$newname,$level{"$u *** $server"}); - } else { - &verbose(&expn($newmxhost,$newaddr,$newname,$level{"$u *** $server"})); - } - } - } - last if ($done eq " "); - next; - } - # 550 is a known code... Should the be - # included in -a output? Might be a bug - # here. Does it matter? Can assume that - # there won't be UNKNOWN USER responses - # mixed with valid users? - if ($s =~ /^(550)([- ])/) { - if ($valid) { - print STDERR "\@$server:$u ($oldname) USER UNKNOWN\n"; - } else { - &verbose(&final($u,$server,$oldname,"USER UNKNOWN")); - } - last if ($2 eq " "); - next; - } - # 553 is a known code... - if ($s =~ /^(553)([- ])/) { - if ($valid) { - print STDERR "\@$server:$u ($oldname) USER AMBIGUOUS\n"; - } else { - &verbose(&final($u,$server,$oldname,"USER AMBIGUOUS")); - } - last if ($2 eq " "); - next; - } - # 252 is a known code... - if ($s =~ /^(252)([- ])/) { - if ($valid) { - print STDERR "\@$server:$u ($oldname) REFUSED TO VRFY\n"; - } else { - &verbose(&final($u,$server,$oldname,"REFUSED TO VRFY")); - } - last if ($2 eq " "); - next; - } - &giveup('',"$server: did not grok '$s'",$u); - last USER; - } - - if ($valid) { - # - # now we decide if we are going to take these - # expansions or roll them back. - # - $avgValid = &average(@isValid); - print "avgValid = $avgValid\n" if $debug; - if ($avgValid >= $validRequirement) { - print &compact($u,$server)." ->\n" if $verbose; - while (@toExpn) { - &verbose(&expn(splice(@toExpn,0,4))); - } - while (@toFinal) { - &verbose(&final(splice(@toFinal,0,3))); - } - } else { - print "Tossing some valid to avoid invalid ".&compact($u,$server)."\n" if ($avgValid > 0.0 && ($vw || $debug)); - print &compact($u,$server)." ->\n" if $verbose; - &verbose(&final($u,$server,$newname)); - } - } - } - - &alarm("sending 'quit' to $server",''); - $0 = "$av0 - sending 'quit' to $server"; - &ps("quit"); - while(<S>) { - print if $watch; - last if /^\d+ /; - } - close(S); - alarm(0); -} - -$0 = "$av0 - printing final results"; -print "----------\n" if $vw; -select(STDOUT); -for $f (sort @final) { - print "$f\n"; -} -unlink("/tmp/expn$$"); -exit(0); - - -# abandon all attempts deliver to $server -# register the current addresses as the final ones -sub giveup -{ - local($redirect_okay,$reason,$user) = @_; - local($us,@so,$nh,@remaining_users); - local($pk,$file,$line); - ($pk, $file, $line) = caller; - - $0 = "$av0 - giving up on $server: $reason"; - # - # add back a user if we gave up in the middle - # - push(@users,$user) if $user; - # - # don't bother with this system anymore - # - unless ($giveup{$server}) { - $giveup{$server} = $reason; - print STDERR "$reason\n"; - } - print "Giveup at $file:$line!!! redirect okay = $redirect_okay; $reason\n" if $debug; - # - # Wait! - # Before giving up, see if there is a chance that - # there is another host to redirect to! - # (Kids, don't do this at home! Hacking is a dangerous - # crime and you could end up behind bars.) - # - for $u (@users) { - if ($redirect_okay =~ /\bmx\b/) { - next if &try_fallback('mx',$u,*server, - *mx_secondary, - *already_mx_fellback); - } - if ($redirect_okay =~ /\bdomainify\b/) { - next if &try_fallback('domainify',$u,*server, - *domainify_fallback, - *already_domainify_fellback); - } - push(@remaining_users,$u); - } - @users = @remaining_users; - for $u (@users) { - print &compact($u,$server)." ->\n" if ($verbose && $valid && $u); - &verbose(&final($u,$server,$names{"$u *** $server"},$reason)); - } -} -# -# This routine is used only within &giveup. It checks to -# see if we really have to giveup or if there is a second -# chance because we did something before that can be -# backtracked. -# -# %fallback{"$user *** $host"} tracks what is able to fallback -# %fellback{"$user *** $host"} tracks what has fallen back -# -# If there is a valid backtrack, then queue up the new possibility -# -sub try_fallback -{ - local($method,$user,*host,*fall_table,*fellback) = @_; - local($us,$fallhost,$oldhost,$ft,$i); - - if ($debug > 8) { - print "Fallback table $method:\n"; - for $i (sort keys %fall_table) { - print "\t'$i'\t\t'$fall_table{$i}'\n"; - } - print "Fellback table $method:\n"; - for $i (sort keys %fellback) { - print "\t'$i'\t\t'$fellback{$i}'\n"; - } - print "U: $user H: $host\n"; - } - - $us = "$user *** $host"; - if (defined $fellback{$us}) { - # - # Undo a previous fallback so that we can try again - # Nested fallbacks are avoided because they could - # lead to infinite loops - # - $fallhost = $fellback{$us}; - print "Already $method fell back from $us -> \n" if $debug; - $us = "$user *** $fallhost"; - $oldhost = $fallhost; - } elsif (($method eq 'mx') && (defined $mxbacktrace{$us}) && (defined $mx_secondary{$mxbacktrace{$us}})) { - print "Fallback an MX expansion $us -> \n" if $debug; - $oldhost = $mxbacktrace{$us}; - } else { - print "Oldhost($host, $us) = " if $debug; - $oldhost = $host; - } - print "$oldhost\n" if $debug; - if (((defined $fall_table{$us}) && ($ft = $us)) || ((defined $fall_table{$oldhost}) && ($ft = $oldhost))) { - print "$method Fallback = ".$fall_table{$ft}."\n" if $debug; - local(@so,$newhost); - @so = split(' ',$fall_table{$ft}); - $newhost = shift(@so); - print "Falling back ($method) $us -> $newhost (from $oldhost)\n" if $debug; - if ($method eq 'mx') { - if (! defined ($mxbacktrace{"$user *** $newhost"})) { - if (defined $mxbacktrace{"$user *** $oldhost"}) { - print "resetting oldhost $oldhost to the original: " if $debug; - $oldhost = $mxbacktrace{"$user *** $oldhost"}; - print "$oldhost\n" if $debug; - } - $mxbacktrace{"$user *** $newhost"} = $oldhost; - print "mxbacktrace $user *** $newhost -> $oldhost\n" if $debug; - } - $mx{&trhost($oldhost)} = $newhost; - } else { - $temporary_redirect{$us} = $newhost; - } - if (@so) { - print "Can still $method $us: @so\n" if $debug; - $fall_table{$ft} = join(' ',@so); - } else { - print "No more fallbacks for $us\n" if $debug; - delete $fall_table{$ft}; - } - if (defined $create_host_backtrack{$us}) { - $create_host_backtrack{"$user *** $newhost"} - = $create_host_backtrack{$us}; - } - $fellback{"$user *** $newhost"} = $oldhost; - &expn($newhost,$user,$names{$us},$level{$us}); - return 1; - } - delete $temporary_redirect{$us}; - $host = $oldhost; - return 0; -} -# return 1 if you could send mail to the address as is. -sub validAddr -{ - local($addr) = @_; - $res = &do_validAddr($addr); - print "validAddr($addr) = $res\n" if $debug; - $res; -} -sub do_validAddr -{ - local($addr) = @_; - local($urx) = "[-A-Za-z_.0-9+]+"; - - # \u - return 0 if ($addr =~ /^\\/); - # ?@h - return 1 if ($addr =~ /.\@$urx$/); - # @h:? - return 1 if ($addr =~ /^\@$urx\:./); - # h!u - return 1 if ($addr =~ /^$urx!./); - # u - return 1 if ($addr =~ /^$urx$/); - # ? - print "validAddr($addr) = ???\n" if $debug; - return 0; -} -# Some systems use expn and vrfy interchangeably. Some only -# implement one or the other. Some check expn against mailing -# lists and vrfy against users. It doesn't appear to be -# consistent. -# -# So, what do we do? We try everything! -# -# -# Ranking of result codes: good: 250, 251/551, 252, 550, anything else -# -# Ranking of inputs: best: user@host.domain, okay: user -# -# Return value: $error_string, @responses_from_server -sub expn_vrfy -{ - local($u,$server) = @_; - local(@c) = ('expn', 'vrfy'); - local(@try_u) = $u; - local(@ret,$code); - - if (($u =~ /(.+)@(.+)/) && (&trhost($2) eq &trhost($server))) { - push(@try_u,$1); - } - - TRY: - for $c (@c) { - for $try_u (@try_u) { - &alarm("${c}'ing $try_u on $server",'',$u); - &ps("$c $try_u"); - alarm(0); - $s = <S>; - if ($s eq '') { - return "$server: lost connection"; - } - if ($s !~ /^(\d+)([- ])/) { - return "$server: garbled reply to '$c $try_u'"; - } - if ($1 == 250) { - $code = 250; - @ret = ("",$s); - push(@ret,&read_response($2,$debug)); - return (@ret); - } - if ($1 == 551 || $1 == 251) { - $code = $1; - @ret = ("",$s); - push(@ret,&read_response($2,$debug)); - next; - } - if ($1 == 252 && ($code == 0 || $code == 550)) { - $code = 252; - @ret = ("",$s); - push(@ret,&read_response($2,$watch)); - next; - } - if ($1 == 550 && $code == 0) { - $code = 550; - @ret = ("",$s); - push(@ret,&read_response($2,$watch)); - next; - } - &read_response($2,$watch); - } - } - return "$server: expn/vrfy not implemented" unless @ret; - return @ret; -} -# sometimes the old parse routine (now parse2) didn't -# reject funky addresses. -sub parse -{ - local($oldaddr,$server,$oldname,$one_to_one) = @_; - local($newhost, $newaddr, $newname, $um) = &parse2($oldaddr,$server,$oldname,$one_to_one); - if ($newaddr =~ m,^["/],) { - return (undef, $oldaddr, $newname) if $valid; - return (undef, $um, $newname); - } - return ($newhost, $newaddr, $newname); -} - -# returns ($new_smtp_server,$new_address,$new_name) -# given a response from a SMTP server ($newaddr), the -# current host ($server), the old "name" and a flag that -# indicates if it is being called during the initial -# command line parsing ($parsing_args) -sub parse2 -{ - local($newaddr,$context_host,$old_name,$parsing_args) = @_; - local(@names) = $old_name; - local($urx) = "[-A-Za-z_.0-9+]+"; - local($unmangle); - - # - # first, separate out the address part. - # - - # - # [NAME] <ADDR [(NAME)]> - # [NAME] <[(NAME)] ADDR - # ADDR [(NAME)] - # (NAME) ADDR - # [(NAME)] <ADDR> - # - if ($newaddr =~ /^\<(.*)\>$/) { - print "<A:$1>\n" if $debug; - ($newaddr) = &trim($1); - print "na = $newaddr\n" if $debug; - } - if ($newaddr =~ /^([^\<\>]*)\<([^\<\>]*)\>([^\<\>]*)$/) { - # address has a < > pair in it. - print "N:$1 <A:$2> N:$3\n" if $debug; - ($newaddr) = &trim($2); - unshift(@names, &trim($3,$1)); - print "na = $newaddr\n" if $debug; - } - if ($newaddr =~ /^([^\(\)]*)\(([^\(\)]*)\)([^\(\)]*)$/) { - # address has a ( ) pair in it. - print "A:$1 (N:$2) A:$3\n" if $debug; - unshift(@names,&trim($2)); - local($f,$l) = (&trim($1),&trim($3)); - if (($f && $l) || !($f || $l)) { - # address looks like: - # foo (bar) baz or (bar) - # not allowed! - print STDERR "Could not parse $newaddr\n" if $vw; - return(undef,$newaddr,&firstname(@names)); - } - $newaddr = $f if $f; - $newaddr = $l if $l; - print "newaddr now = $newaddr\n" if $debug; - } - # - # @foo:bar - # j%k@l - # a@b - # b!a - # a - # - $unmangle = $newaddr; - if ($newaddr =~ /^\@($urx)\:(.+)$/) { - print "(\@:)" if $debug; - # this is a bit of a cheat, but it seems necessary - return (&domainify($1,$context_host,$2),$2,&firstname(@names),$unmangle); - } - if ($newaddr =~ /^(.+)\@($urx)$/) { - print "(\@)" if $debug; - return (&domainify($2,$context_host,$newaddr),$newaddr,&firstname(@names),$unmangle); - } - if ($parsing_args) { - if ($newaddr =~ /^($urx)\!(.+)$/) { - return (&domainify($1,$context_host,$newaddr),$newaddr,&firstname(@names),$unmangle); - } - if ($newaddr =~ /^($urx)$/) { - return ($context_host,$newaddr,&firstname(@names),$unmangle); - } - print STDERR "Could not parse $newaddr\n"; - } - print "(?)" if $debug; - return(undef,$newaddr,&firstname(@names),$unmangle); -} -# return $u (@$server) unless $u includes reference to $server -sub compact -{ - local($u, $server) = @_; - local($se) = $server; - local($sp); - $se =~ s/(\W)/\\$1/g; - $sp = " (\@$server)"; - if ($u !~ /$se/i) { - return "$u$sp"; - } - return $u; -} -# remove empty (spaces don't count) members from an array -sub trim -{ - local(@v) = @_; - local($v,@r); - for $v (@v) { - $v =~ s/^\s+//; - $v =~ s/\s+$//; - push(@r,$v) if ($v =~ /\S/); - } - return(@r); -} -# using the host part of an address, and the server name, add the -# servers' domain to the address if it doesn't already have a -# domain. Since this sometimes fails, save a back reference so -# it can be unrolled. -sub domainify -{ - local($host,$domain_host,$u) = @_; - local($domain,$newhost); - - # cut of trailing dots - $host =~ s/\.$//; - $domain_host =~ s/\.$//; - - if ($domain_host !~ /\./) { - # - # domain host isn't, keep $host whatever it is - # - print "domainify($host,$domain_host) = $host\n" if $debug; - return $host; - } - - # - # There are several weird situations that need to be - # accounted for. They have to do with domain relay hosts. - # - # Examples: - # host server "right answer" - # - # shiva.cs cs.berkeley.edu shiva.cs.berkeley.edu - # shiva cs.berkeley.edu shiva.cs.berekley.edu - # cumulus reed.edu @reed.edu:cumulus.uucp - # tiberius tc.cornell.edu tiberius.tc.cornell.edu - # - # The first try must always be to cut the domain part out of - # the server and tack it onto the host. - # - # A reasonable second try is to tack the whole server part onto - # the host and for each possible repeated element, eliminate - # just that part. - # - # These extra "guesses" get put into the %domainify_fallback - # array. They will be used to give addresses a second chance - # in the &giveup routine - # - - local(%fallback); - - local($long); - $long = "$host $domain_host"; - $long =~ tr/A-Z/a-z/; - print "long = $long\n" if $debug; - if ($long =~ s/^([^ ]+\.)([^ ]+) \2(\.[^ ]+\.[^ ]+)/$1$2$3/) { - # matches shiva.cs cs.berkeley.edu and returns shiva.cs.berkeley.edu - print "condensed fallback $host $domain_host -> $long\n" if $debug; - $fallback{$long} = 9; - } - - local($fh); - $fh = $domain_host; - while ($fh =~ /\./) { - print "FALLBACK $host.$fh = 1\n" if $debug > 7; - $fallback{"$host.$fh"} = 1; - $fh =~ s/^[^\.]+\.//; - } - - $fallback{"$host.$domain_host"} = 2; - - ($domain = $domain_host) =~ s/^[^\.]+//; - $fallback{"$host$domain"} = 6 - if ($domain =~ /\./); - - if ($host =~ /\./) { - # - # Host is already okay, but let's look for multiple - # interpretations - # - print "domainify($host,$domain_host) = $host\n" if $debug; - delete $fallback{$host}; - $domainify_fallback{"$u *** $host"} = join(' ',sort {$fallback{$b} <=> $fallback{$a};} keys %fallback) if %fallback; - return $host; - } - - $domain = ".$domain_host" - if ($domain !~ /\..*\./); - $newhost = "$host$domain"; - - $create_host_backtrack{"$u *** $newhost"} = $domain_host; - print "domainify($host,$domain_host) = $newhost\n" if $debug; - delete $fallback{$newhost}; - $domainify_fallback{"$u *** $newhost"} = join(' ',sort {$fallback{$b} <=> $fallback{$a};} keys %fallback) if %fallback; - if ($debug) { - print "fallback = "; - print $domainify_fallback{"$u *** $newhost"} - if defined($domainify_fallback{"$u *** $newhost"}); - print "\n"; - } - return $newhost; -} -# return the first non-empty element of an array -sub firstname -{ - local(@names) = @_; - local($n); - while(@names) { - $n = shift(@names); - return $n if $n =~ /\S/; - } - return undef; -} -# queue up more addresses to expand -sub expn -{ - local($host,$addr,$name,$level) = @_; - if ($host) { - $host = &trhost($host); - - if (($debug > 3) || (defined $giveup{$host})) { - unshift(@hosts,$host) unless $users{$host}; - } else { - push(@hosts,$host) unless $users{$host}; - } - $users{$host} .= " $addr"; - $names{"$addr *** $host"} = $name; - $level{"$addr *** $host"} = $level + 1; - print "expn($host,$addr,$name)\n" if $debug; - return "\t$addr\n"; - } else { - return &final($addr,'NONE',$name); - } -} -# compute the numerical average value of an array -sub average -{ - local(@e) = @_; - return 0 unless @e; - local($e,$sum); - for $e (@e) { - $sum += $e; - } - $sum / @e; -} -# print to the server (also to stdout, if -w) -sub ps -{ - local($p) = @_; - print ">>> $p\n" if $watch; - print S "$p\n"; -} -# return case-adjusted name for a host (for comparison purposes) -sub trhost -{ - # treat foo.bar as an alias for Foo.BAR - local($host) = @_; - local($trhost) = $host; - $trhost =~ tr/A-Z/a-z/; - if ($trhost{$trhost}) { - $host = $trhost{$trhost}; - } else { - $trhost{$trhost} = $host; - } - $trhost{$trhost}; -} -# re-queue users if an mx record dictates a redirect -# don't allow a user to be redirected more than once -sub mxredirect -{ - local($server,*users) = @_; - local($u,$nserver,@still_there); - - $nserver = &mx($server); - - if (&trhost($nserver) ne &trhost($server)) { - $0 = "$av0 - mx redirect $server -> $nserver\n"; - for $u (@users) { - if (defined $mxbacktrace{"$u *** $nserver"}) { - push(@still_there,$u); - } else { - $mxbacktrace{"$u *** $nserver"} = $server; - print "mxbacktrace{$u *** $nserver} = $server\n" - if ($debug > 1); - &expn($nserver,$u,$names{"$u *** $server"}); - } - } - @users = @still_there; - if (! @users) { - return $nserver; - } else { - return undef; - } - } - return undef; -} -# follow mx records, return a hostname -# also follow temporary redirections coming from &domainify and -# &mxlookup -sub mx -{ - local($h,$u) = @_; - - for (;;) { - if (defined $mx{&trhost($h)} && $h ne $mx{&trhost($h)}) { - $0 = "$av0 - mx expand $h"; - $h = $mx{&trhost($h)}; - return $h; - } - if ($u) { - if (defined $temporary_redirect{"$u *** $h"}) { - $0 = "$av0 - internal redirect $h"; - print "Temporary redirect taken $u *** $h -> " if $debug; - $h = $temporary_redirect{"$u *** $h"}; - print "$h\n" if $debug; - next; - } - $htr = &trhost($h); - if (defined $temporary_redirect{"$u *** $htr"}) { - $0 = "$av0 - internal redirect $h"; - print "temporary redirect taken $u *** $h -> " if $debug; - $h = $temporary_redirect{"$u *** $htr"}; - print "$h\n" if $debug; - next; - } - } - return $h; - } -} -# look up mx records with the name server. -# re-queue expansion requests if possible -# optionally give up on this host. -sub mxlookup -{ - local($lastchance,$server,$giveup,*users) = @_; - local(*T); - local(*NSLOOKUP); - local($nh, $pref,$cpref); - local($o0) = $0; - local($nserver); - local($name,$aliases,$type,$len,$thataddr); - local(%fallback); - - return 1 if &mxredirect($server,*users); - - if ((defined $mx{$server}) || (! $have_nslookup)) { - return 0 unless $lastchance; - &giveup('mx domainify',$giveup); - return 0; - } - - $0 = "$av0 - nslookup of $server"; - open(T,">/tmp/expn$$") || die "open > /tmp/expn$$: $!\n"; - print T "set querytype=MX\n"; - print T "$server\n"; - close(T); - $cpref = 1.0E12; - undef $nserver; - open(NSLOOKUP,"nslookup < /tmp/expn$$ 2>&1 |") || die "open nslookup: $!"; - while(<NSLOOKUP>) { - print if ($debug > 2); - if (/mail exchanger = ([-A-Za-z_.0-9+]+)/) { - $nh = $1; - if (/preference = (\d+)/) { - $pref = $1; - if ($pref < $cpref) { - $nserver = $nh; - $cpref = $pref; - } elsif ($pref) { - $fallback{$pref} .= " $nh"; - } - } - } - if (/Non-existent domain/) { - # - # These addresses are hosed. Kaput! Dead! - # However, if we created the address in the - # first place then there is a chance of - # salvation. - # - 1 while(<NSLOOKUP>); - close(NSLOOKUP); - return 0 unless $lastchance; - &giveup('domainify',"$server: Non-existent domain",undef,1); - return 0; - } - - } - close(NSLOOKUP); - unlink("/tmp/expn$$"); - unless ($nserver) { - $0 = "$o0 - finished mxlookup"; - return 0 unless $lastchance; - &giveup('mx domainify',"$server: Could not resolve address"); - return 0; - } - - # provide fallbacks in case $nserver doesn't work out - if (defined $fallback{$cpref}) { - $mx_secondary{$server} = $fallback{$cpref}; - } - - $0 = "$av0 - gethostbyname($nserver)"; - ($name,$aliases,$type,$len,$thataddr) = gethostbyname($nserver); - - unless ($thataddr) { - $0 = $o0; - return 0 unless $lastchance; - &giveup('mx domainify',"$nserver: could not resolve address"); - return 0; - } - print "MX($server) = $nserver\n" if $debug; - print "$server -> $nserver\n" if $vw && !$debug; - $mx{&trhost($server)} = $nserver; - # redeploy the users - unless (&mxredirect($server,*users)) { - return 0 unless $lastchance; - &giveup('mx domainify',"$nserver: only one level of mx redirect allowed"); - return 0; - } - $0 = "$o0 - finished mxlookup"; - return 1; -} -# if mx expansion did not help to resolve an address -# (ie: foo@bar became @baz:foo@bar, then undo the -# expansion). -# this is only used by &final -sub mxunroll -{ - local(*host,*addr) = @_; - local($r) = 0; - print "looking for mxbacktrace{$addr *** $host}\n" - if ($debug > 1); - while (defined $mxbacktrace{"$addr *** $host"}) { - print "Unrolling MX expansion: \@$host:$addr -> " - if ($debug || $verbose); - $host = $mxbacktrace{"$addr *** $host"}; - print "\@$host:$addr\n" - if ($debug || $verbose); - $r = 1; - } - return 1 if $r; - $addr = "\@$host:$addr" - if ($host =~ /\./); - return 0; -} -# register a completed expansion. Make the final address as -# simple as possible. -sub final -{ - local($addr,$host,$name,$error) = @_; - local($he); - local($hb,$hr); - local($au,$ah); - - if ($error =~ /Non-existent domain/) { - # - # If we created the domain, then let's undo the - # damage... - # - if (defined $create_host_backtrack{"$addr *** $host"}) { - while (defined $create_host_backtrack{"$addr *** $host"}) { - print "Un&domainifying($host) = " if $debug; - $host = $create_host_backtrack{"$addr *** $host"}; - print "$host\n" if $debug; - } - $error = "$host: could not locate"; - } else { - # - # If we only want valid addresses, toss out - # bad host names. - # - if ($valid) { - print STDERR "\@$host:$addr ($name) Non-existent domain\n"; - return ""; - } - } - } - - MXUNWIND: { - $0 = "$av0 - final parsing of \@$host:$addr"; - ($he = $host) =~ s/(\W)/\\$1/g; - if ($addr !~ /@/) { - # addr does not contain any host - $addr = "$addr@$host"; - } elsif ($addr !~ /$he/i) { - # if host part really something else, use the something - # else. - if ($addr =~ m/(.*)\@([^\@]+)$/) { - ($au,$ah) = ($1,$2); - print "au = $au ah = $ah\n" if $debug; - if (defined $temporary_redirect{"$addr *** $ah"}) { - $addr = "$au\@".$temporary_redirect{"$addr *** $ah"}; - print "Rewrite! to $addr\n" if $debug; - next MXUNWIND; - } - } - # addr does not contain full host - if ($valid) { - if ($host =~ /^([^\.]+)(\..+)$/) { - # host part has a . in it - foo.bar - ($hb, $hr) = ($1, $2); - if ($addr =~ /\@([^\.\@]+)$/ && ($1 eq $hb)) { - # addr part has not . - # and matches beginning of - # host part -- tack on a - # domain name. - $addr .= $hr; - } else { - &mxunroll(*host,*addr) - && redo MXUNWIND; - } - } else { - &mxunroll(*host,*addr) - && redo MXUNWIND; - } - } else { - $addr = "${addr}[\@$host]" - if ($host =~ /\./); - } - } - } - $name = "$name " if $name; - $error = " $error" if $error; - if ($valid) { - push(@final,"$name<$addr>"); - } else { - push(@final,"$name<$addr>$error"); - } - "\t$name<$addr>$error\n"; -} - -sub alarm -{ - local($alarm_action,$alarm_redirect,$alarm_user) = @_; - alarm(3600); - $SIG{ALRM} = 'handle_alarm'; -} -# this involves one great big ugly hack. -# the "next HOST" unwinds the stack! -sub handle_alarm -{ - &giveup($alarm_redirect,"Timed out during $alarm_action",$alarm_user); - next HOST; -} - -# read the rest of the current smtp daemon's response (and toss it away) -sub read_response -{ - local($done,$watch) = @_; - local(@resp); - print $s if $watch; - while(($done eq "-") && ($s = <S>) && ($s =~ /^\d+([- ])/)) { - print $s if $watch; - $done = $1; - push(@resp,$s); - } - return @resp; -} -# print args if verbose. Return them in any case -sub verbose -{ - local(@tp) = @_; - print "@tp" if $verbose; -} -# to pass perl -w: -@tp; -$flag_a; -$flag_d; -$flag_1; -%already_domainify_fellback; -%already_mx_fellback; -&handle_alarm; -################### BEGIN PERL/TROFF TRANSITION -.00 ; - -'di -.nr nl 0-1 -.nr % 0 -.\\"'; __END__ -.\" ############## END PERL/TROFF TRANSITION -.TH EXPN 1 "March 11, 1993" -.AT 3 -.SH NAME -expn \- recursively expand mail aliases -.SH SYNOPSIS -.B expn -.RI [ -a ] -.RI [ -v ] -.RI [ -w ] -.RI [ -d ] -.RI [ -1 ] -.IR user [@ hostname ] -.RI [ user [@ hostname ]]... -.SH DESCRIPTION -.B expn -will use the SMTP -.B expn -and -.B vrfy -commands to expand mail aliases. -It will first look up the addresses you provide on the command line. -If those expand into addresses on other systems, it will -connect to the other systems and expand again. It will keep -doing this until no further expansion is possible. -.SH OPTIONS -The default output of -.B expn -can contain many lines which are not valid -email addresses. With the -.I -aa -flag, only expansions that result in legal addresses -are used. Since many mailing lists have an illegal -address or two, the single -.IR -a , -address, flag specifies that a few illegal addresses can -be mixed into the results. More -.I -a -flags vary the ratio. Read the source to track down -the formula. With the -.I -a -option, you should be able to construct a new mailing -list out of an existing one. -.LP -If you wish to limit the number of levels deep that -.B expn -will recurse as it traces addresses, use the -.I -1 -option. For each -.I -1 -another level will be traversed. So, -.I -111 -will traverse no more than three levels deep. -.LP -The normal mode of operation for -.B expn -is to do all of its work silently. -The following options make it more verbose. -It is not necessary to make it verbose to see what it is -doing because as it works, it changes its -.BR argv [0] -variable to reflect its current activity. -To see how it is expanding things, the -.IR -v , -verbose, flag will cause -.B expn -to show each address before -and after translation as it works. -The -.IR -w , -watch, flag will cause -.B expn -to show you its conversations with the mail daemons. -Finally, the -.IR -d , -debug, flag will expose many of the inner workings so that -it is possible to eliminate bugs. -.SH ENVIRONMENT -No environment variables are used. -.SH FILES -.B /tmp/expn$$ -.B temporary file used as input to -.BR nslookup . -.SH SEE ALSO -.BR aliases (5), -.BR sendmail (8), -.BR nslookup (8), -RFC 823, and RFC 1123. -.SH BUGS -Not all mail daemons will implement -.B expn -or -.BR vrfy . -It is not possible to verify addresses that are served -by such daemons. -.LP -When attempting to connect to a system to verify an address, -.B expn -only tries one IP address. Most mail daemons -will try harder. -.LP -It is assumed that you are running domain names and that -the -.BR nslookup (8) -program is available. If not, -.B expn -will not be able to verify many addresses. It will also pause -for a long time unless you change the code where it says -.I $have_nslookup = 1 -to read -.I $have_nslookup = -.IR 0 . -.LP -Lastly, -.B expn -does not handle every valid address. If you have an example, -please submit a bug report. -.SH CREDITS -In 1986 or so, Jon Broome wrote a program of the same name -that did about the same thing. It has since suffered bit rot -and Jon Broome has dropped off the face of the earth! -(Jon, if you are out there, drop me a line) -.SH AVAILABILITY -The latest version of -.B expn -is available through anonymous ftp at -.IR ftp://ftp.idiom.com/pub/muir-programs/expn . -.SH AUTHOR -.I David Muir Sharnoff\ \ \ \ <muir@idiom.com> diff --git a/scripts/expn.in b/scripts/expn.in deleted file mode 100755 index 9ae575729366..000000000000 --- a/scripts/expn.in +++ /dev/null @@ -1,1369 +0,0 @@ -#!@PERL@ -'di '; -'ds 00 \\"'; -'ig 00 '; -# -# THIS PROGRAM IS ITS OWN MANUAL PAGE. INSTALL IN man & bin. -# - -# hardcoded constants, should work fine for BSD-based systems -#require 'sys/socket.ph'; # perl 4 -use Socket; # perl 5 -$AF_INET = &AF_INET; -$SOCK_STREAM = &SOCK_STREAM; - -# system requirements: -# must have 'nslookup' and 'hostname' programs. - -# $Header: /home/cvsroot/am-utils/scripts/expn.in,v 1.5 2002/07/11 14:28:20 ezk Exp $ - -# TODO: -# less magic should apply to command-line addresses -# less magic should apply to local addresses -# add magic to deal with cross-domain cnames - -# Checklist: (hard addresses) -# 250 Kimmo Suominen <"|/usr/local/mh/lib/slocal -user kim"@grendel.tac.nyc.ny.us> -# harry@hofmann.cs.Berkeley.EDU -> harry@tenet (.berkeley.edu) [dead] -# bks@cs.berkeley.edu -> shiva.CS (.berkeley.edu) [dead] -# dan@tc.cornell.edu -> brown@tiberius (.tc.cornell.edu) - -############################################################################# -# -# Copyright (c) 1993 David Muir Sharnoff -# All rights reserved. -# -# 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 David Muir Sharnoff. -# 4. The name of David Sharnoff may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE DAVID MUIR SHARNOFF ``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 DAVID MUIR SHARNOFF 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. -# -# This copyright notice derived from material copyrighted by the Regents -# of the University of California. -# -# Contributions accepted. -# -############################################################################# - -# overall structure: -# in an effort to not trace each address individually, but rather -# ask each server in turn a whole bunch of questions, addresses to -# be expanded are queued up. -# -# This means that all accounting w.r.t. an address must be stored in -# various arrays. Generally these arrays are indexed by the -# string "$addr *** $server" where $addr is the address to be -# expanded "foo" or maybe "foo@bar" and $server is the hostname -# of the SMTP server to contact. -# - -# important global variables: -# -# @hosts : list of servers still to be contacted -# $server : name of the current we are currently looking at -# @users = $users{@hosts[0]} : addresses to expand at this server -# $u = $users[0] : the current address being expanded -# $names{"$users[0] *** $server"} : the 'name' associated with the address -# $mxbacktrace{"$users[0] *** $server"} : record of mx expansion -# $mx_secondary{$server} : other mx relays at the same priority -# $domainify_fallback{"$users[0] *** $server"} : alternative names to try -# instead of $server if $server doesn't work -# $temporary_redirect{"$users[0] *** $server"} : when trying alternates, -# temporarily channel all tries along current path -# $giveup{$server} : do not bother expanding addresses at $server -# $verbose : -v -# $watch : -w -# $vw : -v or -w -# $debug : -d -# $valid : -a -# $levels : -1 -# S : the socket connection to $server - -$have_nslookup = 1; # we have the nslookup program -$port = 'smtp'; -$av0 = $0; -$ENV{'PATH'} .= ":/usr/etc" unless $ENV{'PATH'} =~ m,/usr/etc,; -$ENV{'PATH'} .= ":/usr/ucb" unless $ENV{'PATH'} =~ m,/usr/ucb,; -select(STDERR); - -$0 = "$av0 - running hostname"; -chop($name = `hostname || uname -n`); - -$0 = "$av0 - lookup host FQDN and IP addr"; -($hostname,$aliases,$type,$len,$thisaddr) = gethostbyname($name); - -$0 = "$av0 - parsing args"; -$usage = "Usage: $av0 [-1avwd] user[\@host] [user2[\@host2] ...]"; -for $a (@ARGV) { - die $usage if $a eq "-"; - while ($a =~ s/^(-.*)([1avwd])/$1/) { - eval '$'."flag_$2 += 1"; - } - next if $a eq "-"; - die $usage if $a =~ /^-/; - &expn(&parse($a,$hostname,undef,1)); -} -$verbose = $flag_v; -$watch = $flag_w; -$vw = $flag_v + $flag_w; -$debug = $flag_d; -$valid = $flag_a; -$levels = $flag_1; - -die $usage unless @hosts; -if ($valid) { - if ($valid == 1) { - $validRequirement = 0.8; - } elsif ($valid == 2) { - $validRequirement = 1.0; - } elsif ($valid == 3) { - $validRequirement = 0.9; - } else { - $validRequirement = (1 - (1/($valid-3))); - print "validRequirement = $validRequirement\n" if $debug; - } -} - -$0 = "$av0 - building local socket"; -($name,$aliases,$proto) = getprotobyname('tcp'); -($name,$aliases,$port) = getservbyname($port,'tcp') - unless $port =~ /^\d+/; -$this = sockaddr_in(0, $thisaddr); - -HOST: -while (@hosts) { - $server = shift(@hosts); - @users = split(' ',$users{$server}); - delete $users{$server}; - - # is this server already known to be bad? - $0 = "$av0 - looking up $server"; - if ($giveup{$server}) { - &giveup('mx domainify',$giveup{$server}); - next; - } - - # do we already have an mx record for this host? - next HOST if &mxredirect($server,*users); - - # look it up, or try for an mx. - $0 = "$av0 - gethostbyname($server)"; - - ($name,$aliases,$type,$len,$thataddr) = gethostbyname($server); - # if we can't get an A record, try for an MX record. - unless($thataddr) { - &mxlookup(1,$server,"$server: could not resolve name",*users); - next HOST; - } - - # get a connection, or look for an mx - $0 = "$av0 - socket to $server"; - $that = sockaddr_in($port, $thataddr); - socket(S, &AF_INET, &SOCK_STREAM, $proto) - || die "socket: $!"; - $0 = "$av0 - bind to $server"; - bind(S, $this) - || die "bind $hostname,0: $!"; - $0 = "$av0 - connect to $server"; - print "debug = $debug server = $server\n" if $debug > 8; - if (! connect(S, $that) || ($debug == 10 && $server =~ /relay\d.UU.NET$/i)) { - $0 = "$av0 - $server: could not connect: $!\n"; - $emsg = $!; - unless (&mxlookup(0,$server,"$server: could not connect: $!",*users)) { - &giveup('mx',"$server: Could not connect: $emsg"); - } - next HOST; - } - select((select(S),$| = 1)[0]); # don't buffer output to S - - # read the greeting - $0 = "$av0 - talking to $server"; - &alarm("greeting with $server",''); - while(<S>) { - alarm(0); - print if $watch; - if (/^(\d+)([- ])/) { - if ($1 != 220) { - $0 = "$av0 - bad numeric response from $server"; - &alarm("giving up after bad response from $server",''); - &read_response($2,$watch); - alarm(0); - print STDERR "$server: NOT 220 greeting: $_" - if ($debug || $vw); - if (&mxlookup(0,$server,"$server: did not respond with a 220 greeting",*users)) { - close(S); - next HOST; - } - } - last if ($2 eq " "); - } else { - $0 = "$av0 - bad response from $server"; - print STDERR "$server: NOT 220 greeting: $_" - if ($debug || $vw); - unless (&mxlookup(0,$server,"$server: did not respond with SMTP codes",*users)) { - &giveup('',"$server: did not talk SMTP"); - } - close(S); - next HOST; - } - &alarm("greeting with $server",''); - } - alarm(0); - - # if this causes problems, remove it - $0 = "$av0 - sending helo to $server"; - &alarm("sending helo to $server",""); - &ps("helo $hostname"); - while(<S>) { - print if $watch; - last if /^\d+ /; - } - alarm(0); - - # try the users, one by one - USER: - while(@users) { - $u = shift(@users); - $0 = "$av0 - expanding $u [\@$server]"; - - # do we already have a name for this user? - $oldname = $names{"$u *** $server"}; - - print &compact($u,$server)." ->\n" if ($verbose && ! $valid); - if ($valid) { - # - # when running with -a, we delay taking any action - # on the results of our query until we have looked - # at the complete output. @toFinal stores expansions - # that will be final if we take them. @toExpn stores - # expansions that are not final. @isValid keeps - # track of our ability to send mail to each of the - # expansions. - # - @isValid = (); - @toFinal = (); - @toExpn = (); - } - -# ($ecode,@expansion) = &expn_vrfy($u,$server); - (@foo) = &expn_vrfy($u,$server); - ($ecode,@expansion) = @foo; - if ($ecode) { - &giveup('',$ecode,$u); - last USER; - } - - for $s (@expansion) { - $s =~ s/[\n\r]//g; - $0 = "$av0 - parsing $server: $s"; - - $skipwatch = $watch; - - if ($s =~ /^[25]51([- ]).*<(.+)>/) { - print "$s" if $watch; - print "(pretending 250$1<$2>)" if ($debug && $watch); - print "\n" if $watch; - $s = "250$1<$2>"; - $skipwatch = 0; - } - - if ($s =~ /^250([- ])(.+)/) { - print "$s\n" if $skipwatch; - ($done,$addr) = ($1,$2); - ($newhost, $newaddr, $newname) = &parse($addr,$server,$oldname, $#expansion == 0); - print "($newhost, $newaddr, $newname) = &parse($addr, $server, $oldname)\n" if $debug; - if (! $newhost) { - # no expansion is possible w/o a new server to call - if ($valid) { - push(@isValid, &validAddr($newaddr)); - push(@toFinal,$newaddr,$server,$newname); - } else { - &verbose(&final($newaddr,$server,$newname)); - } - } else { - $newmxhost = &mx($newhost,$newaddr); - print "$newmxhost = &mx($newhost)\n" - if ($debug && $newhost ne $newmxhost); - $0 = "$av0 - parsing $newaddr [@$newmxhost]"; - print "levels = $levels, level{$u *** $server} = ".$level{"$u *** $server"}."\n" if ($debug > 1); - # If the new server is the current one, - # it would have expanded things for us - # if it could have. Mx records must be - # followed to compare server names. - # We are also done if the recursion - # count has been exceeded. - if (&trhost($newmxhost) eq &trhost($server) || ($levels && $level{"$u *** $server"} >= $levels)) { - if ($valid) { - push(@isValid, &validAddr($newaddr)); - push(@toFinal,$newaddr,$newmxhost,$newname); - } else { - &verbose(&final($newaddr,$newmxhost,$newname)); - } - } else { - # more work to do... - if ($valid) { - push(@isValid, &validAddr($newaddr)); - push(@toExpn,$newmxhost,$newaddr,$newname,$level{"$u *** $server"}); - } else { - &verbose(&expn($newmxhost,$newaddr,$newname,$level{"$u *** $server"})); - } - } - } - last if ($done eq " "); - next; - } - # 550 is a known code... Should the be - # included in -a output? Might be a bug - # here. Does it matter? Can assume that - # there won't be UNKNOWN USER responses - # mixed with valid users? - if ($s =~ /^(550)([- ])/) { - if ($valid) { - print STDERR "\@$server:$u ($oldname) USER UNKNOWN\n"; - } else { - &verbose(&final($u,$server,$oldname,"USER UNKNOWN")); - } - last if ($2 eq " "); - next; - } - # 553 is a known code... - if ($s =~ /^(553)([- ])/) { - if ($valid) { - print STDERR "\@$server:$u ($oldname) USER AMBIGUOUS\n"; - } else { - &verbose(&final($u,$server,$oldname,"USER AMBIGUOUS")); - } - last if ($2 eq " "); - next; - } - # 252 is a known code... - if ($s =~ /^(252)([- ])/) { - if ($valid) { - print STDERR "\@$server:$u ($oldname) REFUSED TO VRFY\n"; - } else { - &verbose(&final($u,$server,$oldname,"REFUSED TO VRFY")); - } - last if ($2 eq " "); - next; - } - &giveup('',"$server: did not grok '$s'",$u); - last USER; - } - - if ($valid) { - # - # now we decide if we are going to take these - # expansions or roll them back. - # - $avgValid = &average(@isValid); - print "avgValid = $avgValid\n" if $debug; - if ($avgValid >= $validRequirement) { - print &compact($u,$server)." ->\n" if $verbose; - while (@toExpn) { - &verbose(&expn(splice(@toExpn,0,4))); - } - while (@toFinal) { - &verbose(&final(splice(@toFinal,0,3))); - } - } else { - print "Tossing some valid to avoid invalid ".&compact($u,$server)."\n" if ($avgValid > 0.0 && ($vw || $debug)); - print &compact($u,$server)." ->\n" if $verbose; - &verbose(&final($u,$server,$newname)); - } - } - } - - &alarm("sending 'quit' to $server",''); - $0 = "$av0 - sending 'quit' to $server"; - &ps("quit"); - while(<S>) { - print if $watch; - last if /^\d+ /; - } - close(S); - alarm(0); -} - -$0 = "$av0 - printing final results"; -print "----------\n" if $vw; -select(STDOUT); -for $f (sort @final) { - print "$f\n"; -} -unlink("/tmp/expn$$"); -exit(0); - - -# abandon all attempts deliver to $server -# register the current addresses as the final ones -sub giveup -{ - local($redirect_okay,$reason,$user) = @_; - local($us,@so,$nh,@remaining_users); - local($pk,$file,$line); - ($pk, $file, $line) = caller; - - $0 = "$av0 - giving up on $server: $reason"; - # - # add back a user if we gave up in the middle - # - push(@users,$user) if $user; - # - # don't bother with this system anymore - # - unless ($giveup{$server}) { - $giveup{$server} = $reason; - print STDERR "$reason\n"; - } - print "Giveup at $file:$line!!! redirect okay = $redirect_okay; $reason\n" if $debug; - # - # Wait! - # Before giving up, see if there is a chance that - # there is another host to redirect to! - # (Kids, don't do this at home! Hacking is a dangerous - # crime and you could end up behind bars.) - # - for $u (@users) { - if ($redirect_okay =~ /\bmx\b/) { - next if &try_fallback('mx',$u,*server, - *mx_secondary, - *already_mx_fellback); - } - if ($redirect_okay =~ /\bdomainify\b/) { - next if &try_fallback('domainify',$u,*server, - *domainify_fallback, - *already_domainify_fellback); - } - push(@remaining_users,$u); - } - @users = @remaining_users; - for $u (@users) { - print &compact($u,$server)." ->\n" if ($verbose && $valid && $u); - &verbose(&final($u,$server,$names{"$u *** $server"},$reason)); - } -} -# -# This routine is used only within &giveup. It checks to -# see if we really have to giveup or if there is a second -# chance because we did something before that can be -# backtracked. -# -# %fallback{"$user *** $host"} tracks what is able to fallback -# %fellback{"$user *** $host"} tracks what has fallen back -# -# If there is a valid backtrack, then queue up the new possibility -# -sub try_fallback -{ - local($method,$user,*host,*fall_table,*fellback) = @_; - local($us,$fallhost,$oldhost,$ft,$i); - - if ($debug > 8) { - print "Fallback table $method:\n"; - for $i (sort keys %fall_table) { - print "\t'$i'\t\t'$fall_table{$i}'\n"; - } - print "Fellback table $method:\n"; - for $i (sort keys %fellback) { - print "\t'$i'\t\t'$fellback{$i}'\n"; - } - print "U: $user H: $host\n"; - } - - $us = "$user *** $host"; - if (defined $fellback{$us}) { - # - # Undo a previous fallback so that we can try again - # Nested fallbacks are avoided because they could - # lead to infinite loops - # - $fallhost = $fellback{$us}; - print "Already $method fell back from $us -> \n" if $debug; - $us = "$user *** $fallhost"; - $oldhost = $fallhost; - } elsif (($method eq 'mx') && (defined $mxbacktrace{$us}) && (defined $mx_secondary{$mxbacktrace{$us}})) { - print "Fallback an MX expansion $us -> \n" if $debug; - $oldhost = $mxbacktrace{$us}; - } else { - print "Oldhost($host, $us) = " if $debug; - $oldhost = $host; - } - print "$oldhost\n" if $debug; - if (((defined $fall_table{$us}) && ($ft = $us)) || ((defined $fall_table{$oldhost}) && ($ft = $oldhost))) { - print "$method Fallback = ".$fall_table{$ft}."\n" if $debug; - local(@so,$newhost); - @so = split(' ',$fall_table{$ft}); - $newhost = shift(@so); - print "Falling back ($method) $us -> $newhost (from $oldhost)\n" if $debug; - if ($method eq 'mx') { - if (! defined ($mxbacktrace{"$user *** $newhost"})) { - if (defined $mxbacktrace{"$user *** $oldhost"}) { - print "resetting oldhost $oldhost to the original: " if $debug; - $oldhost = $mxbacktrace{"$user *** $oldhost"}; - print "$oldhost\n" if $debug; - } - $mxbacktrace{"$user *** $newhost"} = $oldhost; - print "mxbacktrace $user *** $newhost -> $oldhost\n" if $debug; - } - $mx{&trhost($oldhost)} = $newhost; - } else { - $temporary_redirect{$us} = $newhost; - } - if (@so) { - print "Can still $method $us: @so\n" if $debug; - $fall_table{$ft} = join(' ',@so); - } else { - print "No more fallbacks for $us\n" if $debug; - delete $fall_table{$ft}; - } - if (defined $create_host_backtrack{$us}) { - $create_host_backtrack{"$user *** $newhost"} - = $create_host_backtrack{$us}; - } - $fellback{"$user *** $newhost"} = $oldhost; - &expn($newhost,$user,$names{$us},$level{$us}); - return 1; - } - delete $temporary_redirect{$us}; - $host = $oldhost; - return 0; -} -# return 1 if you could send mail to the address as is. -sub validAddr -{ - local($addr) = @_; - $res = &do_validAddr($addr); - print "validAddr($addr) = $res\n" if $debug; - $res; -} -sub do_validAddr -{ - local($addr) = @_; - local($urx) = "[-A-Za-z_.0-9+]+"; - - # \u - return 0 if ($addr =~ /^\\/); - # ?@h - return 1 if ($addr =~ /.\@$urx$/); - # @h:? - return 1 if ($addr =~ /^\@$urx\:./); - # h!u - return 1 if ($addr =~ /^$urx!./); - # u - return 1 if ($addr =~ /^$urx$/); - # ? - print "validAddr($addr) = ???\n" if $debug; - return 0; -} -# Some systems use expn and vrfy interchangeably. Some only -# implement one or the other. Some check expn against mailing -# lists and vrfy against users. It doesn't appear to be -# consistent. -# -# So, what do we do? We try everything! -# -# -# Ranking of result codes: good: 250, 251/551, 252, 550, anything else -# -# Ranking of inputs: best: user@host.domain, okay: user -# -# Return value: $error_string, @responses_from_server -sub expn_vrfy -{ - local($u,$server) = @_; - local(@c) = ('expn', 'vrfy'); - local(@try_u) = $u; - local(@ret,$code); - - if (($u =~ /(.+)@(.+)/) && (&trhost($2) eq &trhost($server))) { - push(@try_u,$1); - } - - TRY: - for $c (@c) { - for $try_u (@try_u) { - &alarm("${c}'ing $try_u on $server",'',$u); - &ps("$c $try_u"); - alarm(0); - $s = <S>; - if ($s eq '') { - return "$server: lost connection"; - } - if ($s !~ /^(\d+)([- ])/) { - return "$server: garbled reply to '$c $try_u'"; - } - if ($1 == 250) { - $code = 250; - @ret = ("",$s); - push(@ret,&read_response($2,$debug)); - return (@ret); - } - if ($1 == 551 || $1 == 251) { - $code = $1; - @ret = ("",$s); - push(@ret,&read_response($2,$debug)); - next; - } - if ($1 == 252 && ($code == 0 || $code == 550)) { - $code = 252; - @ret = ("",$s); - push(@ret,&read_response($2,$watch)); - next; - } - if ($1 == 550 && $code == 0) { - $code = 550; - @ret = ("",$s); - push(@ret,&read_response($2,$watch)); - next; - } - &read_response($2,$watch); - } - } - return "$server: expn/vrfy not implemented" unless @ret; - return @ret; -} -# sometimes the old parse routine (now parse2) didn't -# reject funky addresses. -sub parse -{ - local($oldaddr,$server,$oldname,$one_to_one) = @_; - local($newhost, $newaddr, $newname, $um) = &parse2($oldaddr,$server,$oldname,$one_to_one); - if ($newaddr =~ m,^["/],) { - return (undef, $oldaddr, $newname) if $valid; - return (undef, $um, $newname); - } - return ($newhost, $newaddr, $newname); -} - -# returns ($new_smtp_server,$new_address,$new_name) -# given a response from a SMTP server ($newaddr), the -# current host ($server), the old "name" and a flag that -# indicates if it is being called during the initial -# command line parsing ($parsing_args) -sub parse2 -{ - local($newaddr,$context_host,$old_name,$parsing_args) = @_; - local(@names) = $old_name; - local($urx) = "[-A-Za-z_.0-9+]+"; - local($unmangle); - - # - # first, separate out the address part. - # - - # - # [NAME] <ADDR [(NAME)]> - # [NAME] <[(NAME)] ADDR - # ADDR [(NAME)] - # (NAME) ADDR - # [(NAME)] <ADDR> - # - if ($newaddr =~ /^\<(.*)\>$/) { - print "<A:$1>\n" if $debug; - ($newaddr) = &trim($1); - print "na = $newaddr\n" if $debug; - } - if ($newaddr =~ /^([^\<\>]*)\<([^\<\>]*)\>([^\<\>]*)$/) { - # address has a < > pair in it. - print "N:$1 <A:$2> N:$3\n" if $debug; - ($newaddr) = &trim($2); - unshift(@names, &trim($3,$1)); - print "na = $newaddr\n" if $debug; - } - if ($newaddr =~ /^([^\(\)]*)\(([^\(\)]*)\)([^\(\)]*)$/) { - # address has a ( ) pair in it. - print "A:$1 (N:$2) A:$3\n" if $debug; - unshift(@names,&trim($2)); - local($f,$l) = (&trim($1),&trim($3)); - if (($f && $l) || !($f || $l)) { - # address looks like: - # foo (bar) baz or (bar) - # not allowed! - print STDERR "Could not parse $newaddr\n" if $vw; - return(undef,$newaddr,&firstname(@names)); - } - $newaddr = $f if $f; - $newaddr = $l if $l; - print "newaddr now = $newaddr\n" if $debug; - } - # - # @foo:bar - # j%k@l - # a@b - # b!a - # a - # - $unmangle = $newaddr; - if ($newaddr =~ /^\@($urx)\:(.+)$/) { - print "(\@:)" if $debug; - # this is a bit of a cheat, but it seems necessary - return (&domainify($1,$context_host,$2),$2,&firstname(@names),$unmangle); - } - if ($newaddr =~ /^(.+)\@($urx)$/) { - print "(\@)" if $debug; - return (&domainify($2,$context_host,$newaddr),$newaddr,&firstname(@names),$unmangle); - } - if ($parsing_args) { - if ($newaddr =~ /^($urx)\!(.+)$/) { - return (&domainify($1,$context_host,$newaddr),$newaddr,&firstname(@names),$unmangle); - } - if ($newaddr =~ /^($urx)$/) { - return ($context_host,$newaddr,&firstname(@names),$unmangle); - } - print STDERR "Could not parse $newaddr\n"; - } - print "(?)" if $debug; - return(undef,$newaddr,&firstname(@names),$unmangle); -} -# return $u (@$server) unless $u includes reference to $server -sub compact -{ - local($u, $server) = @_; - local($se) = $server; - local($sp); - $se =~ s/(\W)/\\$1/g; - $sp = " (\@$server)"; - if ($u !~ /$se/i) { - return "$u$sp"; - } - return $u; -} -# remove empty (spaces don't count) members from an array -sub trim -{ - local(@v) = @_; - local($v,@r); - for $v (@v) { - $v =~ s/^\s+//; - $v =~ s/\s+$//; - push(@r,$v) if ($v =~ /\S/); - } - return(@r); -} -# using the host part of an address, and the server name, add the -# servers' domain to the address if it doesn't already have a -# domain. Since this sometimes fails, save a back reference so -# it can be unrolled. -sub domainify -{ - local($host,$domain_host,$u) = @_; - local($domain,$newhost); - - # cut of trailing dots - $host =~ s/\.$//; - $domain_host =~ s/\.$//; - - if ($domain_host !~ /\./) { - # - # domain host isn't, keep $host whatever it is - # - print "domainify($host,$domain_host) = $host\n" if $debug; - return $host; - } - - # - # There are several weird situations that need to be - # accounted for. They have to do with domain relay hosts. - # - # Examples: - # host server "right answer" - # - # shiva.cs cs.berkeley.edu shiva.cs.berkeley.edu - # shiva cs.berkeley.edu shiva.cs.berekley.edu - # cumulus reed.edu @reed.edu:cumulus.uucp - # tiberius tc.cornell.edu tiberius.tc.cornell.edu - # - # The first try must always be to cut the domain part out of - # the server and tack it onto the host. - # - # A reasonable second try is to tack the whole server part onto - # the host and for each possible repeated element, eliminate - # just that part. - # - # These extra "guesses" get put into the %domainify_fallback - # array. They will be used to give addresses a second chance - # in the &giveup routine - # - - local(%fallback); - - local($long); - $long = "$host $domain_host"; - $long =~ tr/A-Z/a-z/; - print "long = $long\n" if $debug; - if ($long =~ s/^([^ ]+\.)([^ ]+) \2(\.[^ ]+\.[^ ]+)/$1$2$3/) { - # matches shiva.cs cs.berkeley.edu and returns shiva.cs.berkeley.edu - print "condensed fallback $host $domain_host -> $long\n" if $debug; - $fallback{$long} = 9; - } - - local($fh); - $fh = $domain_host; - while ($fh =~ /\./) { - print "FALLBACK $host.$fh = 1\n" if $debug > 7; - $fallback{"$host.$fh"} = 1; - $fh =~ s/^[^\.]+\.//; - } - - $fallback{"$host.$domain_host"} = 2; - - ($domain = $domain_host) =~ s/^[^\.]+//; - $fallback{"$host$domain"} = 6 - if ($domain =~ /\./); - - if ($host =~ /\./) { - # - # Host is already okay, but let's look for multiple - # interpretations - # - print "domainify($host,$domain_host) = $host\n" if $debug; - delete $fallback{$host}; - $domainify_fallback{"$u *** $host"} = join(' ',sort {$fallback{$b} <=> $fallback{$a};} keys %fallback) if %fallback; - return $host; - } - - $domain = ".$domain_host" - if ($domain !~ /\..*\./); - $newhost = "$host$domain"; - - $create_host_backtrack{"$u *** $newhost"} = $domain_host; - print "domainify($host,$domain_host) = $newhost\n" if $debug; - delete $fallback{$newhost}; - $domainify_fallback{"$u *** $newhost"} = join(' ',sort {$fallback{$b} <=> $fallback{$a};} keys %fallback) if %fallback; - if ($debug) { - print "fallback = "; - print $domainify_fallback{"$u *** $newhost"} - if defined($domainify_fallback{"$u *** $newhost"}); - print "\n"; - } - return $newhost; -} -# return the first non-empty element of an array -sub firstname -{ - local(@names) = @_; - local($n); - while(@names) { - $n = shift(@names); - return $n if $n =~ /\S/; - } - return undef; -} -# queue up more addresses to expand -sub expn -{ - local($host,$addr,$name,$level) = @_; - if ($host) { - $host = &trhost($host); - - if (($debug > 3) || (defined $giveup{$host})) { - unshift(@hosts,$host) unless $users{$host}; - } else { - push(@hosts,$host) unless $users{$host}; - } - $users{$host} .= " $addr"; - $names{"$addr *** $host"} = $name; - $level{"$addr *** $host"} = $level + 1; - print "expn($host,$addr,$name)\n" if $debug; - return "\t$addr\n"; - } else { - return &final($addr,'NONE',$name); - } -} -# compute the numerical average value of an array -sub average -{ - local(@e) = @_; - return 0 unless @e; - local($e,$sum); - for $e (@e) { - $sum += $e; - } - $sum / @e; -} -# print to the server (also to stdout, if -w) -sub ps -{ - local($p) = @_; - print ">>> $p\n" if $watch; - print S "$p\n"; -} -# return case-adjusted name for a host (for comparison purposes) -sub trhost -{ - # treat foo.bar as an alias for Foo.BAR - local($host) = @_; - local($trhost) = $host; - $trhost =~ tr/A-Z/a-z/; - if ($trhost{$trhost}) { - $host = $trhost{$trhost}; - } else { - $trhost{$trhost} = $host; - } - $trhost{$trhost}; -} -# re-queue users if an mx record dictates a redirect -# don't allow a user to be redirected more than once -sub mxredirect -{ - local($server,*users) = @_; - local($u,$nserver,@still_there); - - $nserver = &mx($server); - - if (&trhost($nserver) ne &trhost($server)) { - $0 = "$av0 - mx redirect $server -> $nserver\n"; - for $u (@users) { - if (defined $mxbacktrace{"$u *** $nserver"}) { - push(@still_there,$u); - } else { - $mxbacktrace{"$u *** $nserver"} = $server; - print "mxbacktrace{$u *** $nserver} = $server\n" - if ($debug > 1); - &expn($nserver,$u,$names{"$u *** $server"}); - } - } - @users = @still_there; - if (! @users) { - return $nserver; - } else { - return undef; - } - } - return undef; -} -# follow mx records, return a hostname -# also follow temporary redirections coming from &domainify and -# &mxlookup -sub mx -{ - local($h,$u) = @_; - - for (;;) { - if (defined $mx{&trhost($h)} && $h ne $mx{&trhost($h)}) { - $0 = "$av0 - mx expand $h"; - $h = $mx{&trhost($h)}; - return $h; - } - if ($u) { - if (defined $temporary_redirect{"$u *** $h"}) { - $0 = "$av0 - internal redirect $h"; - print "Temporary redirect taken $u *** $h -> " if $debug; - $h = $temporary_redirect{"$u *** $h"}; - print "$h\n" if $debug; - next; - } - $htr = &trhost($h); - if (defined $temporary_redirect{"$u *** $htr"}) { - $0 = "$av0 - internal redirect $h"; - print "temporary redirect taken $u *** $h -> " if $debug; - $h = $temporary_redirect{"$u *** $htr"}; - print "$h\n" if $debug; - next; - } - } - return $h; - } -} -# look up mx records with the name server. -# re-queue expansion requests if possible -# optionally give up on this host. -sub mxlookup -{ - local($lastchance,$server,$giveup,*users) = @_; - local(*T); - local(*NSLOOKUP); - local($nh, $pref,$cpref); - local($o0) = $0; - local($nserver); - local($name,$aliases,$type,$len,$thataddr); - local(%fallback); - - return 1 if &mxredirect($server,*users); - - if ((defined $mx{$server}) || (! $have_nslookup)) { - return 0 unless $lastchance; - &giveup('mx domainify',$giveup); - return 0; - } - - $0 = "$av0 - nslookup of $server"; - open(T,">/tmp/expn$$") || die "open > /tmp/expn$$: $!\n"; - print T "set querytype=MX\n"; - print T "$server\n"; - close(T); - $cpref = 1.0E12; - undef $nserver; - open(NSLOOKUP,"nslookup < /tmp/expn$$ 2>&1 |") || die "open nslookup: $!"; - while(<NSLOOKUP>) { - print if ($debug > 2); - if (/mail exchanger = ([-A-Za-z_.0-9+]+)/) { - $nh = $1; - if (/preference = (\d+)/) { - $pref = $1; - if ($pref < $cpref) { - $nserver = $nh; - $cpref = $pref; - } elsif ($pref) { - $fallback{$pref} .= " $nh"; - } - } - } - if (/Non-existent domain/) { - # - # These addresses are hosed. Kaput! Dead! - # However, if we created the address in the - # first place then there is a chance of - # salvation. - # - 1 while(<NSLOOKUP>); - close(NSLOOKUP); - return 0 unless $lastchance; - &giveup('domainify',"$server: Non-existent domain",undef,1); - return 0; - } - - } - close(NSLOOKUP); - unlink("/tmp/expn$$"); - unless ($nserver) { - $0 = "$o0 - finished mxlookup"; - return 0 unless $lastchance; - &giveup('mx domainify',"$server: Could not resolve address"); - return 0; - } - - # provide fallbacks in case $nserver doesn't work out - if (defined $fallback{$cpref}) { - $mx_secondary{$server} = $fallback{$cpref}; - } - - $0 = "$av0 - gethostbyname($nserver)"; - ($name,$aliases,$type,$len,$thataddr) = gethostbyname($nserver); - - unless ($thataddr) { - $0 = $o0; - return 0 unless $lastchance; - &giveup('mx domainify',"$nserver: could not resolve address"); - return 0; - } - print "MX($server) = $nserver\n" if $debug; - print "$server -> $nserver\n" if $vw && !$debug; - $mx{&trhost($server)} = $nserver; - # redeploy the users - unless (&mxredirect($server,*users)) { - return 0 unless $lastchance; - &giveup('mx domainify',"$nserver: only one level of mx redirect allowed"); - return 0; - } - $0 = "$o0 - finished mxlookup"; - return 1; -} -# if mx expansion did not help to resolve an address -# (ie: foo@bar became @baz:foo@bar, then undo the -# expansion). -# this is only used by &final -sub mxunroll -{ - local(*host,*addr) = @_; - local($r) = 0; - print "looking for mxbacktrace{$addr *** $host}\n" - if ($debug > 1); - while (defined $mxbacktrace{"$addr *** $host"}) { - print "Unrolling MX expansion: \@$host:$addr -> " - if ($debug || $verbose); - $host = $mxbacktrace{"$addr *** $host"}; - print "\@$host:$addr\n" - if ($debug || $verbose); - $r = 1; - } - return 1 if $r; - $addr = "\@$host:$addr" - if ($host =~ /\./); - return 0; -} -# register a completed expansion. Make the final address as -# simple as possible. -sub final -{ - local($addr,$host,$name,$error) = @_; - local($he); - local($hb,$hr); - local($au,$ah); - - if ($error =~ /Non-existent domain/) { - # - # If we created the domain, then let's undo the - # damage... - # - if (defined $create_host_backtrack{"$addr *** $host"}) { - while (defined $create_host_backtrack{"$addr *** $host"}) { - print "Un&domainifying($host) = " if $debug; - $host = $create_host_backtrack{"$addr *** $host"}; - print "$host\n" if $debug; - } - $error = "$host: could not locate"; - } else { - # - # If we only want valid addresses, toss out - # bad host names. - # - if ($valid) { - print STDERR "\@$host:$addr ($name) Non-existent domain\n"; - return ""; - } - } - } - - MXUNWIND: { - $0 = "$av0 - final parsing of \@$host:$addr"; - ($he = $host) =~ s/(\W)/\\$1/g; - if ($addr !~ /@/) { - # addr does not contain any host - $addr = "$addr@$host"; - } elsif ($addr !~ /$he/i) { - # if host part really something else, use the something - # else. - if ($addr =~ m/(.*)\@([^\@]+)$/) { - ($au,$ah) = ($1,$2); - print "au = $au ah = $ah\n" if $debug; - if (defined $temporary_redirect{"$addr *** $ah"}) { - $addr = "$au\@".$temporary_redirect{"$addr *** $ah"}; - print "Rewrite! to $addr\n" if $debug; - next MXUNWIND; - } - } - # addr does not contain full host - if ($valid) { - if ($host =~ /^([^\.]+)(\..+)$/) { - # host part has a . in it - foo.bar - ($hb, $hr) = ($1, $2); - if ($addr =~ /\@([^\.\@]+)$/ && ($1 eq $hb)) { - # addr part has not . - # and matches beginning of - # host part -- tack on a - # domain name. - $addr .= $hr; - } else { - &mxunroll(*host,*addr) - && redo MXUNWIND; - } - } else { - &mxunroll(*host,*addr) - && redo MXUNWIND; - } - } else { - $addr = "${addr}[\@$host]" - if ($host =~ /\./); - } - } - } - $name = "$name " if $name; - $error = " $error" if $error; - if ($valid) { - push(@final,"$name<$addr>"); - } else { - push(@final,"$name<$addr>$error"); - } - "\t$name<$addr>$error\n"; -} - -sub alarm -{ - local($alarm_action,$alarm_redirect,$alarm_user) = @_; - alarm(3600); - $SIG{ALRM} = 'handle_alarm'; -} -# this involves one great big ugly hack. -# the "next HOST" unwinds the stack! -sub handle_alarm -{ - &giveup($alarm_redirect,"Timed out during $alarm_action",$alarm_user); - next HOST; -} - -# read the rest of the current smtp daemon's response (and toss it away) -sub read_response -{ - local($done,$watch) = @_; - local(@resp); - print $s if $watch; - while(($done eq "-") && ($s = <S>) && ($s =~ /^\d+([- ])/)) { - print $s if $watch; - $done = $1; - push(@resp,$s); - } - return @resp; -} -# print args if verbose. Return them in any case -sub verbose -{ - local(@tp) = @_; - print "@tp" if $verbose; -} -# to pass perl -w: -@tp; -$flag_a; -$flag_d; -$flag_1; -%already_domainify_fellback; -%already_mx_fellback; -&handle_alarm; -################### BEGIN PERL/TROFF TRANSITION -.00 ; - -'di -.nr nl 0-1 -.nr % 0 -.\\"'; __END__ -.\" ############## END PERL/TROFF TRANSITION -.TH EXPN 1 "March 11, 1993" -.AT 3 -.SH NAME -expn \- recursively expand mail aliases -.SH SYNOPSIS -.B expn -.RI [ -a ] -.RI [ -v ] -.RI [ -w ] -.RI [ -d ] -.RI [ -1 ] -.IR user [@ hostname ] -.RI [ user [@ hostname ]]... -.SH DESCRIPTION -.B expn -will use the SMTP -.B expn -and -.B vrfy -commands to expand mail aliases. -It will first look up the addresses you provide on the command line. -If those expand into addresses on other systems, it will -connect to the other systems and expand again. It will keep -doing this until no further expansion is possible. -.SH OPTIONS -The default output of -.B expn -can contain many lines which are not valid -email addresses. With the -.I -aa -flag, only expansions that result in legal addresses -are used. Since many mailing lists have an illegal -address or two, the single -.IR -a , -address, flag specifies that a few illegal addresses can -be mixed into the results. More -.I -a -flags vary the ratio. Read the source to track down -the formula. With the -.I -a -option, you should be able to construct a new mailing -list out of an existing one. -.LP -If you wish to limit the number of levels deep that -.B expn -will recurse as it traces addresses, use the -.I -1 -option. For each -.I -1 -another level will be traversed. So, -.I -111 -will traverse no more than three levels deep. -.LP -The normal mode of operation for -.B expn -is to do all of its work silently. -The following options make it more verbose. -It is not necessary to make it verbose to see what it is -doing because as it works, it changes its -.BR argv [0] -variable to reflect its current activity. -To see how it is expanding things, the -.IR -v , -verbose, flag will cause -.B expn -to show each address before -and after translation as it works. -The -.IR -w , -watch, flag will cause -.B expn -to show you its conversations with the mail daemons. -Finally, the -.IR -d , -debug, flag will expose many of the inner workings so that -it is possible to eliminate bugs. -.SH ENVIRONMENT -No environment variables are used. -.SH FILES -.PD 0 -.B /tmp/expn$$ -.B temporary file used as input to -.BR nslookup . -.SH SEE ALSO -.BR aliases (5), -.BR sendmail (8), -.BR nslookup (8), -RFC 823, and RFC 1123. -.SH BUGS -Not all mail daemons will implement -.B expn -or -.BR vrfy . -It is not possible to verify addresses that are served -by such daemons. -.LP -When attempting to connect to a system to verify an address, -.B expn -only tries one IP address. Most mail daemons -will try harder. -.LP -It is assumed that you are running domain names and that -the -.BR nslookup (8) -program is available. If not, -.B expn -will not be able to verify many addresses. It will also pause -for a long time unless you change the code where it says -.I $have_nslookup = 1 -to read -.I $have_nslookup = -.IR 0 . -.LP -Lastly, -.B expn -does not handle every valid address. If you have an example, -please submit a bug report. -.SH CREDITS -In 1986 or so, Jon Broome wrote a program of the same name -that did about the same thing. It has since suffered bit rot -and Jon Broome has dropped off the face of the earth! -(Jon, if you are out there, drop me a line) -.SH AVAILABILITY -The latest version of -.B expn -is available through anonymous ftp at -.IR ftp://ftp.idiom.com/pub/muir-programs/expn . -.SH AUTHOR -.I David Muir Sharnoff\ \ \ \ <muir@idiom.com> diff --git a/scripts/fixrmtab b/scripts/fixrmtab deleted file mode 100755 index 33b7bcfdb6ce..000000000000 --- a/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/scripts/fixrmtab.in b/scripts/fixrmtab.in index 23003806e4c0..a1fbebf61507 100755 --- a/scripts/fixrmtab.in +++ b/scripts/fixrmtab.in @@ -10,15 +10,23 @@ #set -x -RMTAB=/etc/rmtab -TMP=/tmp/rmtab.$$ +# allow user to pass RMTAB file name from environment +if test -z "${RMTAB}" ; then + RMTAB=/etc/rmtab +fi -if [ ! -f /etc/rmtab ]; then +if [ ! -f "$RMTAB" ]; then exit 0 fi -for host in $* +TMP="$(mktemp ${RMTAB}.XXXXXX)" +if [ -z "$TMP" ]; then + exit 1 +fi + +trap "rm -f $TMP" 0 1 2 3 15 + +for host do - sed -e '/^'$host':/s/^./#/' $RMTAB > $TMP && cp $TMP $RMTAB + sed -e "/^$host:/s/^./#/" "$RMTAB" > "$TMP" && cp "$TMP" "$RMTAB" done -rm -f $TMP diff --git a/scripts/lostaltmail.in b/scripts/lostaltmail.in index 467dedd24e5a..328decffd711 100755 --- a/scripts/lostaltmail.in +++ b/scripts/lostaltmail.in @@ -1,6 +1,6 @@ #!@PERL@ -sw # -# Package: am-utils-6.0 +# Package: am-utils-6.x # Author: James Tanis <jtt@cs.columbia.edu> # |