🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: mail.uk-sendmail-workers
Article #57

Re: inverted alias lookup?

#57
From: Per Hedeland
Date: Wed, 31 Oct 1990 14:04
112 lines
4471 bytes
In article <8019.9010252245@helios.cs.hw.ac.uk>, A.Macpherson@stl.stc.co.uk
writes:
|> Define a map eg Y for the reverse YP
|> 
|> DYmail.byaddr
|> 
|> Then as the first line in ruleset 4
|> 
|> R$-@$*		$:${Y$1@$2$}

This works, but not too well, if you use the Sun-supplied way of building
the mail.byaddr map, i.e. essentially just reversing the mail.aliases map.
Problems:

- With several aliases pointing to the same userid, there's really no
  telling which of them will be the one selected for the reverse mapping -
  experiments indicate that it is the last one in the aliases file, but I
  certainly wouldn't rely on it and risk having all my mail go out with
  'postmaster' or something as the sender.

- There's no sensible way to have several addresses (e.g. on different
  hosts) map to the same reverse alias.

- The reverse alias will always be all-lowercase, which some would consider
  unaesthetic in a username like Mr Macpherson's above.

If for some reason you don't want to run the IDA setup, at least get the
xalparse program that comes with it, and use it to generate both forward and
reverse aliases. Below is a diff to the yp Makefile in SunOS 4.0.3 that
accomplishes just that, picking the xalparse input from /etc/xaliases and
putting the reversed aliases in the mail.revaliases map (which then goes in
the DY definition as above, I thought it best to use another name than
mail.byaddr for various reasons).

--Per Hedeland
per@erix.ericsson.se  or
per%erix.ericsson.se@uunet.uu.net  or
...uunet!erix.ericsson.se!per


*** /var/yp/Makefile.orig	Tue Apr 25 02:26:50 1989
--- /var/yp/Makefile	Mon Jan  8 10:23:18 1990
***************
*** 4,10 ****
--- 4,12 ----
  DIR =/etc
  DOM = `domainname`
  NOPUSH = ""
+ XALIASES = /etc/xaliases
  ALIASES = /etc/aliases
+ REVALIASES = /etc/revaliases
  YPDIR=/usr/etc/yp
  YPDBDIR=/var/yp
  YPPUSH=$(YPDIR)/yppush
***************
*** 209,225 ****
  		echo "couldn't find $(DIR)/bootparams"; \
  	fi
  
! aliases.time: $(ALIASES)
! 	-@if [ -f $(ALIASES) ]; then \
  		cp $(ALIASES) $(YPDBDIR)/$(DOM)/mail.aliases; \
  		/usr/lib/sendmail -bi -oA$(YPDBDIR)/$(DOM)/mail.aliases; \
  		$(MKALIAS) $(YPDBDIR)/$(DOM)/mail.aliases $(YPDBDIR)/$(DOM)/mail.byaddr; \
  		rm $(YPDBDIR)/$(DOM)/mail.aliases; \
  		touch aliases.time; \
  		echo "updated aliases"; \
  		if [ ! $(NOPUSH) ]; then \
  			$(YPPUSH) mail.aliases; \
  			$(YPPUSH) mail.byaddr; \
  			echo "pushed aliases"; \
  		else \
  			: ; \
--- 211,231 ----
  		echo "couldn't find $(DIR)/bootparams"; \
  	fi
  
! aliases.time: $(ALIASES) $(REVALIASES)
! 	-@if [ -f $(ALIASES) -a -f $(REVALIASES) ]; then \
  		cp $(ALIASES) $(YPDBDIR)/$(DOM)/mail.aliases; \
  		/usr/lib/sendmail -bi -oA$(YPDBDIR)/$(DOM)/mail.aliases; \
  		$(MKALIAS) $(YPDBDIR)/$(DOM)/mail.aliases $(YPDBDIR)/$(DOM)/mail.byaddr; \
  		rm $(YPDBDIR)/$(DOM)/mail.aliases; \
+ 		awk 'BEGIN { OFS="\t"; } {for (i = 2; i <= NF; i++) print $$i, $$1}' \
+ 		    $(REVALIASES) | \
+ 		    $(MAKEDBM) -l - $(YPDBDIR)/$(DOM)/mail.revaliases; \
  		touch aliases.time; \
  		echo "updated aliases"; \
  		if [ ! $(NOPUSH) ]; then \
  			$(YPPUSH) mail.aliases; \
  			$(YPPUSH) mail.byaddr; \
+ 			$(YPPUSH) mail.revaliases; \
  			echo "pushed aliases"; \
  		else \
  			: ; \
***************
*** 348,352 ****
  $(DIR)/netid:
  $(DIR)/security/passwd.adjunct:
  $(DIR)/security/group.adjunct:
! $(ALIASES):
  $(DIR)/netmasks:
--- 354,362 ----
  $(DIR)/netid:
  $(DIR)/security/passwd.adjunct:
  $(DIR)/security/group.adjunct:
! $(ALIASES) $(REVALIASES): $(XALIASES)
! 	/usr/local/bin/xalparse $(XALIASES) $(ALIASES).tmp $(REVALIASES)
! 	echo "### Do not edit this file, it is generated automatically from $(XALIASES)" > $(ALIASES)
! 	cat $(ALIASES).tmp >> $(ALIASES)
! 	rm -f $(ALIASES).tmp
  $(DIR)/netmasks:
Technical Details
Message-ID: <1990Oct31.140413.9632@eua.ericsson.se>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!bloom-beacon!eru!hagbard!sunic!ericom!eua.ericsson.se!erix.ericsson.se!per
References: <8019.9010252245@helios.cs.hw.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!bloom-beacon!eru!hagbard!sunic!ericom!eua.ericsson.se!erix.ericsson.se!per
From: per@erix.ericsson.se (Per Hedeland)
Newsgroups: mail.uk-sendmail-workers,comp.mail.sendmail
Subject: Re: inverted alias lookup?
Message-ID: <1990Oct31.140413.9632@eua.ericsson.se>
Date: 31 Oct 90 14:04:13 GMT
References: <8019.9010252245@helios.cs.hw.ac.uk>
Sender: news@eua.ericsson.se
Reply-To: per@erix.ericsson.se (Per Hedeland)
Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
Lines: 112