Annotation of pgp/contrib/mailx/pgpmail2, revision 1.1.1.1

1.1       root        1: From mstar.morningstar.com!n8emr!colnet!res Fri May 14 07:18:01 1993
                      2: Return-Path: <[email protected]>
                      3: Received: from volitans.MorningStar.Com by web.apc.org with smtp
                      4:        (Smail3.1.28.1 #6) id m0ntxlx-0000nBC; Fri, 14 May 93 07:17 EDT
                      5: Received: from trigger.morningstar.com by volitans.MorningStar.Com (5.65a/92122901)
                      6:        id AA12267; Fri, 14 May 93 07:24:03 -0400
                      7: Received: by trigger.MorningStar.Com (5.65a/93011501)
                      8:        id AA01843; Fri, 14 May 93 07:24:01 -0400
                      9: Received: by n8emr.cmhnet.org (Ohio AMPR Gateway Smail3.1.16.1 #16.33)
                     10:        id <[email protected]>; Fri, 14 May 93 04:21 EDT
                     11: Received: by colnet.cmhnet.org (smail2.5+)
                     12:        id AA05251; Thu, 13 May 93 22:04:33 EDT (-0400)
                     13: To: [email protected] (Colin Plumb)
                     14: Subject: Re: Contributions to the PGP 2.3 release
                     15: Message-Id: <[email protected]>
                     16: Date: Thu, 13 May 93 22:04:33 EDT (-0400)
                     17: From: [email protected] (Rob Stampfli)
                     18: Status: R
                     19: 
                     20: In recent email to me you write:
                     21: >Hi, folks!  The 2.3 release of PGP is coming, as they say, Real Soon Now.
                     22: >If you have any changes you'd like made to scripts in the contrib part
                     23: >of PGP 2.2, now is the time to send them in.
                     24: >
                     25: >If you want to start any work for inclusion in the release, it's
                     26: >needed in roughly a week ("roughly" means maybe a day or two less!),
                     27: >but write and I'll keep you informed.
                     28: 
                     29: Colin,
                     30: 
                     31: I don't know what the latest version I sent you contains, but here is
                     32: the latest of what I am using.  Also, I would like to ask if the pgp
                     33: maintainers have made the signal mods I have suggested repeatedly on
                     34: the alt.security.pgp group:  namely, if the interrupt or quit signals
                     35: are ignored on entry, then pgp leaves them ignored.  This permits running
                     36: pgp as a background task under Unix.  If they have not put these changes
                     37: into 2.3, let me know and I'll send the diffs to you.  They are very
                     38: straightforward, simple and noncontroversial, and I'd like to see this
                     39: made the standard.
                     40: 
                     41: Here is my latest version of "pgpmail" the script which takes the
                     42: place of the standard mailer in "mailx" to perform in-line encryption.
                     43: I have dropped bourne shell support entirely -- this now requires ksh
                     44: to run:
                     45: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                     46: # This ksh script is invoked by adding the line "set sendmail=pgpmail" to your
                     47: # .mailrc file.  mailx then invokes pgpmail instead of /bin/mail to deliver
                     48: # email.  This script checks whether encryption, a signature, or both are
                     49: # specified, and automatically performs whatever is required.
                     50: #      Rob Stampfli                    12 March 1993
                     51: 
                     52: STDSIG="John Q. Public"                        # sig to use if "sig=y"
                     53: trap "" 1 2 3                          # req'd so this can run in bg
                     54: exec 2>/dev/tty                                # can be "exec 2>/dev/null"
                     55: set +o nounset
                     56: unset en sg nl
                     57: 
                     58: j=1
                     59: for i                                  # for each argument...
                     60: do
                     61:   case "$i" in                         # look for encryption specifier...
                     62:   *encrypt=*)  en[$j]="${i#*=}";;      # requires KSH
                     63:   *enc=*)      en[$j]="${i#*=}";;      # requires KSH
                     64:   *sig=*)      sg="${i#*=}";;          # a pgp signature specification...
                     65:   *)           nl[$j]="$i";;           # a real mail address...
                     66:   esac
                     67:   ((j += 1))                           # increment array counter...
                     68: done
                     69: 
                     70: [ X = "X${en[*]}" -a X = "X$sg" ] && exec /bin/rmail "$@"   # not a pgp request
                     71: [ Xy = "X$sg" -o Xyes = "X$sg" ] && sg="$STDSIG"           # std sig request
                     72: 
                     73: # If we get here, encryption and/or sig *was* specified:
                     74: (
                     75:   OIFS="$IFS"                          # needed to preserve tabs in header
                     76:   IFS='
                     77: '
                     78:   while read x                         # read and process header intact
                     79:   do
                     80:     echo "$x"                          # echo the line...
                     81:     [ X = "X$x" ] && break             # and if NULL line, break
                     82:   done
                     83:   IFS="$OIFS"                          # reset field separators
                     84:   if [ X = "X$sg" ]; then              # no signature specified:
                     85:     pgp -feat "${en[@]}"               #   encrypt the message...
                     86:   elif [ X = "X${en[*]}" ]; then       # no encrypt specified:
                     87:     sed -e 's/^From />From /' |                #   pre-convert mail glitcher...
                     88:     pgp -fast +clearsig=on -u "$sg"    #   sign msg in MIC-CLEAR mode...
                     89:   else                                 # both encrypt and sig specified:
                     90:     pgp -feast "${en[@]}" -u "$sg"     #   encrypt and sign armored...
                     91:   fi
                     92:   echo "Encryption phase completed" 1>&2
                     93: ) | /bin/rmail "${nl[@]}"
                     94: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                     95: 
                     96: Here is a copy of "pgpm", which I use to decrypt pgp mail I receive.  To use,
                     97: just pipe the encrypted mail message to "pgpm" and it will ask the questions,
                     98: decrypt it, and remail the decrypted version back to you.  You can then delete
                     99: the encrypted version and do what you like with the plaintext mail msg:
                    100: 
                    101: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    102: # This script is used from mailx or vi to mail invoker the decrypted input
                    103: # make sure stderr comes out on screen, to undo vi bogosity
                    104: exec 2>/dev/tty
                    105: (
                    106:        OIFS="$IFS"                     # we must preserve tabs in header
                    107:        IFS='
                    108: '
                    109:        while read x                    # read and process header intact
                    110:        do
                    111:        echo "$x"
                    112:        [ "" = "$x" ] && break
                    113:        done
                    114:        IFS="$OIFS"                     # reset field separators
                    115:        pgp ${1-}                       # encrypt or decrypt the rest
                    116: ) | rmail $LOGNAME
                    117: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    118: -- 
                    119: Rob Stampfli  [email protected]      The neat thing about standards:
                    120: 614-864-9377  HAM RADIO: [email protected]  There are so many to choose from.
                    121: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.