.
topal-84/Changelog.html 0000664 0000000 0000000 00000073731 14616434652 0015231 0 ustar 00root root 0000000 0000000
Topal — Changelog
Topal — Changelog
Copyright © 2001–2024 Phillip J. Brooke
- 06/2001, 0.1
- First alpha release.
- 06/2001, 0.2
- Minor changes.
- 06/2001, 0.3
- Major changes to how keys are identified and
looked up.
- 06/2001, 0.4
- Adding more customization features.
- 11/2001, 0.4.4
- Cleaned up some error messages; added -nps
mode.
- 11/2001, 0.4.5
- Added ‘gpg-options’ config item with
default ‘--no-options’. (Forgot to add this note as well....)
- 11/2001, 0.5.0
- Dumped -verify and -decrypt modes in
favour of the multiple-block ‘-display’ mode. Added -help. Added
caching. Added more switches relating to caching. Better output
formatting.
- 11/2001, 0.5.1
- Improved menus. Tidied up some of the
interface. Added -s, which does the same as -nps.
- 12/2001, 0.5.2
- Tidied disclaimer. Added synonyms for
-help (-h, -?, --help, --h) Cleaned up menus; keypresses aren't echoed
any longer.
- 12/2001, 0.5.3
- Altered packaging to include version in
directory name. Changed names of some -clear options to be a bit more
sensible. Changing config settings method (big change). Making -s
the default operation. Some rearrangement of code, constants. Some
configuration editing possible via Topal. Send has access to
configuration menu.
- 12/2001, 0.5.4
- Bug fix; one-off error in the sending
menus.
- 12/2001, 0.5.5
- Removed redundant examples directory.
Changed over to HTML documentation. Tweaked the RELEASE stuff. Use
space instead of enter when waiting to continue: this looks forward to
offering a help option at every prompt. The receive/blocks
stuff now uses an expanding array. The GPG return value is checked
when receiving: if it's bad, then some bits of the output are omitted;
the cache file is not written. The date bit of Topal output moved
onto the previous line (echo -n blah blah).
- 12/2001, 0.5.6
- Adding installation instructions. Using
tee and PIPESTATUS to get stderr on screen during receiving while also
saving that output and recording gpg's exit status. Changed RELEASE
filename to release. Tidied up the Makefile. Invalid passphrase
messages are grep'd out of the output. Added ‘fast continue’ options.
Key lists in the configuration section now use expanding arrays.
Changed key details selection message. Secret key selection now
offers a menu of secret keys on the secret keyring. Initial recipient
search excludes keys in XK list. Added key search/selection menu
choice - much nicer to use than the add menu. More configuration
stuff added (still more to do, although the config file can always be
used). Partial documentation update.
- 2/2002, 0.5.7
- Adding limited RFC2015/MIME decoding of
multipart email.
- 2/2002, 0.5.8
- Adding mime-construct to configuration in
expectation of more RFC2015 features. Put test for the config file
existing before actually attempting to read it (oops). Added -O2
-Wall and the TOPALDEBUG variable for compiling. Put up WWW page via
own Freeserve site. Announcing via Freshmeat. Automating output WWW
site generation (all the grunge in the Makefile).
- 3/2002, 0.6.0
- Distribution uses a gzip'd binary now....
Added a pre-built binary that is statically linked against the GNAT
stuff so that people don't need to acquire GNAT first (this, I
believe, complies with the GNAT licence).
Added the scripts
topal-fix-email and topal-fix-folder. This makes it a lot easier to
work with other people's multipart/signed or /encrypted email.
Procmail recipe added to this README.
Added display of
application/pgp messages. Including the text of one of these in a
reply might be difficult, but then, it was difficult without topal's
mangling. At least they can be verified and read now.
-sendmime
option added. Hack needed (in topal-pine-patch [now pine-4.44.patch])
to allow non-text/blah content-types in Pine. RFC2015 send and
received done (including micalg detection when sending clearsigned
messages: list used from RFC3156.). Ditto for application/pgp, but
I'm not sure of some of the parameters, since I've only ever seen
signed emails of this form.
Removed some of the waits for execution,
since it seems reliable. Added error checking on return value of GPG
in sends.
- 3/2002, 0.6.1
- The Content-Type for MIME sending is
displayed on the screen using ‘cat’ rather than ‘less’, which was
getting to be annoying.
Two changes that are related to how I
manage the source code: Slight tweak to makefile for keeping track
of RCS files; and using rcs -n<symbolic-name> to tag the
released files.
- 3/2002, 0.6.2
- MIME clear-signed messages: trailing blank
lines are now deleted before signing (this would cause BAD signature
when verifying on some other MTAs). Added remarks to documentation
about the patch to Pine and attachments.
- 4/2002, 0.6.3
- RFC1847 multipart encapsulation added.
(See section 6.1 of RFC3156.) Cleaned up related receiving/caching
behaviour.
Another MIME clear-signed messages bugfix. This one
sorts out line-end conventions correctly.
New patch for Pine: this
stops a SEGFAULT when using RFC2015 stuff and other attachments at the
same time.
Updated documentation; added man pages for the two scripts.
- 4/2002, 0.6.4
- New patch for Pine. Adds a workaround for
the problem where some versions of MS Exchange would silently lose
inbound MIME clearsigned email. It turns out that a slight formatting
change stops the problem.
- 5/2002, 6/2002; 0.6.5, 0.6.6, 0.6.7, 0.6.8
- Adding more debugging,
mostly to the menus code. Used for tracking down a nasty problem
causing exceptions. Many thanks to Felix Madlener for pointing this
out and testing the revised code.
- 7/2002, 0.6.9
- Renamed the Pine patch for when new versions
come out. (It's still the same patch as for Topal 0.6.4.) Added trap
for non-existent file when using ‘-s’. Cache directory as well as
.topal directory is also chmod'd to 700. Added README.txt to package
file (even though it's generated from the .html) so that those who
just want to ‘less’ it (instead of firing up a HTML reader) can do so.
- 8/2002, 0.7.0
- Changed email address in man page. Lots more
exception handling for extra info when something goes wrong. Moderate
code reorganisation: mostly splitting blocks of code out for future
work. Fixed ‘bug’ (feature?) where send fails if a public key is
unusable (although this may risk sending plaintext through; we assume
that if an output file was generated, then the GPG errors weren't
fatal). Now we check instead if the output file exists. Checking all
source files for any similar bugs in menus (cf. the 5/2002 entry).
Modified MIME RFC2015 receiving function so that it isn't so reliant
on shell calls of sed (which can fall over with nasty characters in an
incoming emails boundary). Moreover, it can now cope with MIME parts
that don't end with a newline. Tweaking MIME/verify cache handling:
we shouldn't actually get an output file from GPG (since we're only
verifying one part with the other); we put a vague warning if this
happens, and trap when reading the cache. Added content-type to
plaintext for MIME/encrypted. Documentation update.
- 8/2002, 0.7.1
- Fixed minor bug with inverted return code
(‘-s’ trap). Doc update.
- 9/2002, 0.7.2
- Fixed minor bug in key list handling code
(dealing with key selection).
- 9/2002; 0.7.3, 0.7.4 (BETA)
- Disposed of the dependency on a shell by
introducing Ada bindings for fork/exec/dup/pipe/glob, etc.. Several
external binaries are no longer needed (cat, echo). Most return codes
are now properly checked (although still need to do a better audit).
Followed Eduardo Chappa's advice and changed Pine patch version
letter. Miscellaneous cleanups and fixes. Many thanks to Peter
Losher for giving me the incentive to sort out the external calls.
- 9/2002; 0.7.5 (BETA)
- Tidying up structure of external calls, and
how the various messages are built up and torn down. Changed the lynx
switches at the suggestion of Felix Madlener (many thanks!). When
receiving MIME encrypted attachments, the output is not included in
the Topal output, but only in the metamail invocation.
- 10/2002; 0.7.6 (BETA)
- Explicitly noted which versions are
not intended for general use (beta versions). Rearranged command line
parsing for more flexibility in future.
- 10/2002; 0.7.7 (BETA)
- Re-implementing topal-fix-email and
topal-fix-folder as part of the main topal binary. This removes the
(script) dependency on munpack, but adds formail and diff to the main
binary. Fixed some missing bits for particular binaries in
configuration handling. Adding ‘important changes from last stable
version’ documentation. Tweaked the body extraction procedure.
Tweaked some output messages. Major changes to menus: they now use
enumerated types rather than integers.... Tweaking cl_menu some
more. Added ‘pass-thu’ option to send menu (so you can always use the
Topal filter. This might also fix the minor problem with text/html
occasionally being sent when it shouldn't be....) Fixed bug where
MIME decrypt failure would still cause metamail to be invoked, but
that's a waste of time.
- 10/2002; 0.7.8
- Clearing out case statements with ‘when
others’. Tidying up sending.adb. Fixed problem in MIME output where
a leading blank line was added. Finally implemented ‘topal
--fix-folders’ functionality added. No longer need the two old
scripts (I hope)! Another documentation tidy-up. Added
‘inline-separate-output’ option: this effectively turns off the GnuPG/Topal
wrappers in output. However, the side-effect is that the cache must
be cleared when upgrading to this version.
- 11/2002; 0.7.9
- Added some infrastructure for
encrypting/signing attachments (but this is nowhere near working yet).
Documentation and manpage update (again). Seems stable, will release.
- 2/2003; 0.7.10, 0.7.11
- Tweaking distribution pages (mkdistrib).
Including patches against Pine versions 4.50 and 4.53. (They're all
more-or-less the same patch. It's pretty
easy to apply them against 4.51 and 4.52 if you feel so inclined.)
Further doc clean up (particular the stuff about important changes
from previous stable versions). Implemented Felix M.'s suggestion for
handling non-existant command-line options: things that aren't valid
options, but are prefixed with a ‘-’ get a more helpful error
message. --fix-email workaround also writes out the original input in
the exception handler. Changed recommended procmail recipe so that
Topal's exit code is checked.
- 2/2003; 0.7.12
- Adding ‘workaround-error-log’ file to
.topal. This accepts output from topal --fix-email when it fails to
exit cleanly. Not quite clear if this bit works yet (was tracking
down other problem). It appears that when running without a real
terminal, the call to set_echo fails. Odd. Nasty workaround
implemented.
- 2/2002; 0.7.13
- Added missing includes to ada-echo-c.c.
Perhaps related to issue in the previous entry.
- 4/2003; 0.7.13b
- Bug fix release only - backported from
(not-yet-released 0.8.0). Fixed bug when
changing own signing key using the -config option - thanks to Stewart
James for the bug report.
- 10/2003; 0.7.13.2
- Bug fix release only - backported from
(not-yet-released 0.8.0). Changed bug fix versioning scheme.
Makefile now links properly against static GNAT runtime. Fixed
problem which manifests as: ‘relocation error: /lib/libreadline.so.4:
undefined symbol: BC’ (needed instruction to link against ncurses) -
thanks to Marty Hoff for the bug report. Added patch against Pine
version 4.58.
- 10/2003; 0.7.13.3
- Now use -gnatwa and -gnato for all Ada
compilation. It was omitted from the main binary build command
before. Fixed all the resulting warnings.
- 1/2004; 0.7.13.4
- Patched externals calls for errno to
prevent (in some cases) warnings from ld.so, and in other cases,
failures to build.
- 6/2004; 0.7.13.5
- Added patch against Pine version
4.60. Updated some notices.
- 1/4/2005; 0.7.13.6
- Calls to the GPG binary now have LANG
set to C before exec so that we don't have to worry about different
language output in GPG. Thanks for Joern Brederec for the bug report
and suggestion of how to fix it.
- 2005-2007
- Four internal development releases junked.
- 8/1/2008; release 55
-
--fix-email now replaces the original message with a
multipart/misc wrapper, rather than expanding it into a
multipart/alternative message.
Replaced some key selection code. Hopefully, this reduces the number
of locale-dependent and GPG version-specific problems. Additionally,
revoked, disabled and invalid keys are no longer offered; checks are
made to ensure that the key is valid for encryption/signing when applicable.
New patch for Alpine 1.00. Includes configuration setting.
The ‘pass through unchanged’ send option no longer modifies the
content-type to text/plain.
Should now build and run on Cygwin.
Licence is now GPL-3.
Attempt to prevent potential memory leak (if running for a long time)
by making the implementation of expanding_array a controlled type.
Cleaned up Ada source to reduce warnings.
Other minor changes, e.g., better checks on keylists, documentation clean-up.
Changed release numbering.
HTML cleaned up and CSS added.
- 8/1/2008; release 56
-
--read-from option added to select different signing keys
depending on the From line. Also added sake and sxk
configurations.
Fixed bug in Keys.Remove.Key (didn't match if the full fingerprint
wasn't given).
Command-line parser now accepts 1 or more hyphens for any option.
Improved keylist documentation.
Corrected release date for release 55... oops.
- 8/1/2008; release 57
-
Initial attempt at supporting attachments within Topal.
Changed MIME boundary detection code (the previous algorithm couldn't
cope with multipart included in a signed email). Please tell me if
this breaks your emails....
Bug fix to _INCLUDEALLHDRS_ - it needs to turn the CRLF back into LF
or it might chop off some of your message....
- 22/6/2008; release 58
-
UI improvements (count keys in keylist, clearer indication of position
in menus).
Added patch for Alpine 1.10. Renamed all patch files.
Default paths for binaries are no longer absolute.
Configuration files now allow comments, but they're not preserved by Topal.
Added more exception handling messages.
Sending and receiving both save off original input as tempfiles to
help debugging.
Added --ask-charset command line option. This is really only for
testing a new workaround for locale-related bad signatures. Please
see locale problems in the notes and
send feedback.
Started removing dependency on mime-construct; new source files mime.ad[sb].
Build date added to binary.
- 3/7/2008; release 59
-
Added sequence numbers to temporary files to reduce possible name
conflicts.
The makefile's install target now installs to INSTALLPATH. This can
be overridden, e.g., make install INSTALLPATH=/usr/local.
The four more specific paths, INSTALLPATHBIN, INSTALLPATHMAN,
INSTALLPATHDOC and INSTALLPATHPATCHES can also be overridden. Fixes
request from Nils Schlupp re: ebuild.
The --ask-charset command-line option is now only used if a bad signature
is returned; a second attempt is then made if a different character
set is suggested by the user.
- 13/7/2008; release 60
-
Update installation instructions for make install.
We now use a modified version of Jeffrey S. Dutky's mime-tool instead
of mime-construct for creating MIME messages. We include our modified
version in the Topal tarball (since both are GPL, and our
modifications are needed if creating MIME messages).
MIME viewing can now use metamail, use run-mailcap or save the attachment to the
folder ~/.topal/viewmime (which you can then open in
Alpine). run-mailcap and saving support are new.
Sending menu allows user to view and edit the email. A quicker
method for changing/setting the signing (own) key is available.
- 14/7/2008; release 61
-
An initial, rather crude, but (for my purposes at least) effective
remote mode for sending.
Some history is now saved.
- 17/7/2008; release 62
-
Added basic support for S/MIME verification of messages.
Quoted-printable encoder (in MIME-tool) improved (single dots and
leading "From ") as per RFC2049.
Decode quoted-printable and base64 before calling run-mailcap.
Ignore errors in strip in Makefile (trips up Cygwin, which expects the
executable to be foo.exe).
Update feature list for remote sending.
Internal changes to configuration storage.
- 31/8/2008; release 63
-
Update change list for release 62 (omitted some items...).
Give a sensible warning message instead of dying with an exception
when (1) signing operations are called without own key set; (2)
attempting to choose own key without any secret keys available.
Added some hints in the documentation.
Initial attempt at supporting remote decryption.
Handle SIGINT ourselves so that temporary files are cleaned up. Also
clean up more often when exceptions occur.
- 24/10/2008; release 64
-
Update feature list for release 63's remote decryption support.
Add patch to Topal sources for Cygwin. (The recent interrupt code
doesn't build.)
Bug fix: temporary files weren't being deleted, because
Rm_Tempfiles_PID hadn't been changed to match Temp_File_Name.
Added patch for Alpine 2.00. Alpine's S/MIME needs to be turned off
for Topal's S/MIME verification to work.
Bug fix in Externals.Simple.Guess_Content_Type.
- 1/5/2009; release 65
-
MIME sending now uses the current locale as the content-type header charset.
MIME receiving (verification) tries to use the character set given in
its first attempt.
Signing calls to GPG use --textmode flag (shouldn't be needed
if the dos2unix calls work, but experiments suggest some problems if
we don't do this).
Fix remote server so that emails with multiple recipients are handled
properly.
Added new patch to Alpine that might make it easier to read
multipart signed/encrypted messages. This makes the procmail recipe
redundant, but needs more testing.
Attempt to manage different character sets when verifying S/MIME.
MIME messages now include a prolog explaining that they're OpenPGP
messages. Also added appropriate Content-Disposition headers to help
client programs.
Update docs re: Alpine patches.
Code cleanup (e.g., vars that could be declared constant, and some
unused procedure formals).
- 6/6/2009; release 66
-
Removed spurious spaces from Topal ‘-----’ text that were messing up
format=flowed text. Note that this doesn't fix cache files that
already have this problem.
Changed the default sending and receiving GPG options (use
the -default option to see them). This does not override
whatever is in your current .topal/config file.
Added a configuration option ‘omit-inline-disposition-name’:
apparently some mail services mistreat inline MIME parts if they have
a filename. If this option is set, then no filename parameter is
added to inline content-disposition headers. The option can be
changed via the configuration menu.
- 6/6/2009; release 67
-
Added another configuration option ‘omit-inline-disposition-header’.
If a disposition header of value inline would be added, it's simply
omitted altogether.
- 27/6/2009; release 68
-
Minor bug fix with configuration handling of
omit-inline-disposition-header.
Added new configuration option save-on-send.
A range of major and minor changes to the sending interface.
Added the sd configuration option that allows keys or emails to be
associated with particularly sending options.
When secret keys aren't available, still try to add a suitable key for
self for encryption.
MIME viewer setting has been replaced by two: one for decrypt and one
for verify.
Bad lines in the configuration file now result in a warning, not an exception.
Internal modifications to configuration handling.
- 21/7/2009; release 69
-
No longer calling an external app for line-end conversions.
Added a note re: Alpine's S/MIME message about certificates.
Show the list of recipients just before sending (from the to/cc/bcc
lists; not lcc, as Alpine doesn't pass those to in the _RECIPIENTS_
token). The idea is to allow the user to spot the “oh no, I didn't
intend to email that person” problem.
- 22/9/2009; release 70
-
Added use-agent configuration option. This has three values:
(1) never use an agent, (2) only use it for decryption, (3) always use
it. Don't put GPG's --[no-]use-agent options in any other
configuration options or it might be confusing.
Adding attachments when using a non-MIME mode forces a change to a
suitable mode (where possible).
Presentation changes for recipient list check.
Fixed a minor typo in a user message.
- 25/2/2010; release 71
-
Added more MICALGs from RFC4880.
Handle missing Content-Type headers in multipart messages.
Reorganise menus: hopefully, they're easier to read now.
Add some colourisation (this can be disabled by
setting ansi-terminal to off).
Assorted tidying.
Warn if sending defaults to encryption, but some keys are missing.
Add -pd - pipe-display mode. Takes stdin and treats it as a MIME
email for display/verification.
Release code is now taken from the README.html file rather
than a separate release file.
Slight clean-up of this README.
- 25/2/2010; release 72
-
Fix menus for non-Pine sending. (‘Go’ wasn't working!)
Trap attempts to encrypt when no keys are in the key list.
Minor change to distrib text and Makefile.
Distrib target in Makefile now uses GPG agent.
- 29/4/2011; release 73
-
Fix crash when sending attachments with spaces in filenames.
Add new switch, wait-if-missing-keys, which requires the user
to acknowledge if keys are missing when defaulting to encryption.
Slightly reorganise configuration menu to keep it within 24 lines.
Update documentation re: crashes related to the second patch and
mailcap files.
Topal makes greater efforts to check that external commands exist
before running them.
Exception messages are repeated via Ada's exception handling (if Topal
panics).
Added decrypt-prereq option. See this note.
Experimental S/MIME sending support added.
More use of GnuPG's --status-fd option so that we can determine exit
status properly.
Replaced ancient expanding_array package
with Ada.Containers.Vectors.
Adding sendmail-path filter mode. This is needed for the S/MIME
encrypted and S/MIME sign+encrypted modes. (Otherwise only Topal can
read them; neither Outlook nor Thunderbird will cope with an S/MIME
part inside multipart/mixed.) This mode also
needs pinentry-qt
for gpgsm: pinentry-curses doesn't like this environment.
In the sendmail-path filter mode, we no longer need the content-type
guessing. We can simply re-use the content-type from the original
header.
Added replace-ids option which can replace Message-ID (and also
Content-ID) in sendmail-path filter mode.
The sendmail-path mode can also add a token to help spot our cc'd
emails. Use something like st=user@domain,token to set a
password. This is hashed with some headers for each email and added
to an X-Topal-Send-Token header. Topal then has a -cst
token mode which adds a X-Topal-Check-Send-Token
header with either yes or no for that header.
Investigation suggests that group addresses are handled other than I
expect. E.g., Group name:; in the to: field and the actual
list of addresses in lcc field will result in the addresses appearing
in the bcc field in sendmail-path filter mode.
Rewrite main documentation in LaTeX: the main manual is
now topal.pdf. The
change log is still in HTML.
Start adding interoperability notes to manual.
Diagnosing issue with clearsigned (both OpenPGP and S/MIME) emails
that have passed through an MS Exchange server being corrupted.
Added opaque signing option for S/MIME.
Added attachment-trap boolean option. In -asend
mode, this causes Topal to complain if the message body contains the
string “attach” but doesn't have any attachments.
- 23/6/2011; release 74
-
Oops, wrong year in release 73 date….
Topal needs GNAT's -gnat05 switch.
Documentation update:
- Noted the need for GNU's sed (particularly
important if you're using
Mac OS X).
- Noted that gpg-agent needs HUPing
if trustlist.txt is updated.
Added include-send-token switch, where 1 never includes them,
2 asks and 3 always includes them.
Warnings about configuration errors now go to stderr, rather than
messing up other processing output.
Heuristic for attachment trap is improved. This now copes with the
case where the email comprises a single multipart/mixed MIME part.
Some comparisons for content-types are case-insensitive now.
- 26/2/2012; release 75
-
Most changes this time are to cope with non-cryptographic meddling for
my work environment.
Fix Clean_Email_Address to cope with mailboxes with double quotes and
commas.
Added fix-fcc option that modifies a X-Topal-Fcc header. It
is encrypted using the send-token for that sender to X-Topal-Fcce.
The --check-send-token filter will also reverse this.
Added fix-bcc option that adds a X-Topal-Bcce header. It's
handled similarly to X-Topal-Fcce, but records the Bcc contents.
The --check-send-token filter will also reverse this.
Fix token hashing so that it copes with different outputs
from openssl sha1.
- 22/2/2015; release 76
-
- Add -raw command, that can be used by piping a raw
message (with free output) from Alpine. Also usable on an mbox from
the command-line.
Multiple documentation updates, including deprecation of the two
patches to Alpine, contact email address and copyright dates.
- 20/9/2015; release 77
-
Fix bad HTML formatting in this file.
Bug fix for clearsigning MIME files that don't have a MIME prologue.
Typo fixes from Nicolas Boulenguez to MIME-tool README, man page and
mime.c. Thank you!
- 22/7/2018; release 78
-
Replace some ancient use of DES3 with AES128CBC.
Move from SHA1 to SHA256.
Packaging improvements (remove unnecessary binaries and change
detached signature name).
Improvements to Makefile for downstream distributors.
Some of these changes are based on suggestions from Nicolas
Boulenguez (particularly around the Makefile). Thank you again!
- 22/2/2019; release 79
-
Correct last changelog to show that we really did move from SHA1 to
SHA256, not the other way!
Refactor key handling so that key selection works better. (If this
breaks your setup, please let me know which GPG version you're using.)
Improved de-duplication.
Change debug handling so that debug data goes to a file rather than
messing up terminals.
- 22/2/2019; release 80
-
Fix broken build of mime-tool.
- 24/4/2022; release 81
-
Update documentation re: decryption and verification via
the -raw option (thank you to E.E. for useful feedback).
Improvements for parallel Make.
Multiple changes to Makefiles, closely following suggestions from Nicolas Boulenguez (thank you).
Fix up deprecated use of OpenSSL "enc" for cryptograms, adding PBKDF2 and Iter.
- 27/8/2022; release 82
-
Switch to Git from Mercurial.
Some operations that relied on GPG implicitly figuring out the required operation now explicit (verify or decrypt).
Apply patch from Nicolas B. for portable gcc (thank you).
Tidy up code and default config.
- >7/5/2024; release 83
-
Package and process tidying.
- 7/5/2024; release 84
-
Package and process tidying.
See the documentation in topal.pdf
for further details.
topal-84/Features.html 0000664 0000000 0000000 00000005065 14616434652 0015113 0 ustar 00root root 0000000 0000000
Topal — Features
Topal — Features
Copyright © 2001–2024 Phillip J. Brooke
Topal is a ‘glue’ program that links
GnuPG
and
Pine/Alpine/Re-Alpine.
It
offers facilities to encrypt, decrypt, sign and verify emails,
including inline OpenPGP, MIME/OpenPGP and S/MIME. It can also be
used directly from the command-line.
- Multiple inline PGP blocks can be processed in display filters.
- Decryption and verification output can be cached to reduce the
number of times a passphrase is entered. This also helps when
secret keys aren't always available, at the expense of storing
decrypted output.
- MIME/OpenPGP (RFC2015/RFC3156) multipart messages can be sent
and received. Depending on configuration, this might involve
procmail, using sendmail-path or patching Alpine.
- The deprecated application/pgp content-type can be sent and received.
- S/MIME messages can be sent and received if gpgsm is
available. (openssl is also used in some circumstances, but
gpgsm is still required.)
- Topal can be used as Alpine's sendmail-path command.
- Topal has a remote sending mode (a server and a means of
accessing the server) for reading email on a distant computer via
SSH with secret keys on the local computer.
- A range of mechanisms for selecting keys for both self and recipients.
- There is a high level of configurability (although the
configuration interface does not expose all of it; you might have to
edit .topal/config).
See the documentation in topal.pdf
for further details.
topal-84/MIME-tool/ 0000775 0000000 0000000 00000000000 14616434652 0014143 5 ustar 00root root 0000000 0000000 topal-84/MIME-tool/GPL.txt 0000664 0000000 0000000 00000043131 14616434652 0015330 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
topal-84/MIME-tool/Makefile 0000664 0000000 0000000 00000000747 14616434652 0015613 0 ustar 00root root 0000000 0000000 .PHONY: all clean realclean distclean distrib
executable := mime-tool
archive := mime-tool.tar.gz
components := GPL.txt Makefile mime.c $(executable).man \
README.txt README.Topal.txt
include ../Buildflags.mk
all: $(executable)
$(executable): mime.c
$(CC) $(default_CFLAGS) $(default_LDFLAGS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@
realclean distclean: clean
-$(RM) $(executable) $(archive)
clean:
-$(RM) *~
distrib: $(archive)
$(archive): $(components)
tar cvaf $@ $^
topal-84/MIME-tool/README.Topal.txt 0000664 0000000 0000000 00000000406 14616434652 0016717 0 ustar 00root root 0000000 0000000 This directory contains Jeffrey S. Dutky's MIME-tool, with
modifications by me to better support Topal.
Original source
http://members.bellatlantic.net/~dutky/mime-tool.tgz
downloaded July 2008.
Both Topal and MIME-tool are GPL.
--
Phil Brooke,
July 2008.
topal-84/MIME-tool/mime-tool.man 0000664 0000000 0000000 00000007453 14616434652 0016553 0 ustar 00root root 0000000 0000000 .TH "MIME message tool" 1 mime "MIME tool"
.SH NAME
mime-tool \- a simple program to construct MIME messages with attached files
.SH SYNOPSIS
.B mime
[
.B -dDvV
] [
.B -S
subject
] [
.B -F
from-address
] [
.B -T
to-address
] [
.B -C
carbon-copy address
] [
.B -P
prolog-text
] [
.B -E
epiplogue-text
] [
.B -B
boundary
] [
.B -O
overall content-type
] { [
.B -78abiquxopm
] [
.B -t
content-type
] filename }
.SH DESCRIPTION
The
.B mime
program constructs MIME messages with attached files. The user can specify
the content type (application/octet-stream, text/plain or a user specified
type), content type encoding (7bit, 8bit, binary, base64 and auto-detect),
content disposition (attached or inline) and the content boundary string.
The user can also specify some mail related options: subject, from-address,
to-address, carbon-copy address, prolog-text and epilog-text.
The output of the MIME-tool program can be sent directly to the
.IR mail ", " mailx " or " sendmail
commands (or any other command that accepts RFC-822 formatted messages).
.B NOTE:
Specifying 7-bit encoding for an attachment that contains 8-bit data will
convert any data bytes whose high-bit is set to question marks.
.SH OPTIONS
.TP
.B -7
7-bit ASCII encoding
.TP
.B -8
8-bit ASCII encoding
.TP
.B -a
application/octet-stream content type
.TP
.B -b
binary encoding
.TP
.B -d
low detail debugging
.TP
.B -D
high detail debugging
.TP
.B -s
write a subpart
.TP
.B -i
disposition: inline (instead of attachment)
.TP
.B -q
quoted-printable encoding
.TP
.B -c content-type
explicit content type
.TP
.B -t
text/plain content type
.TP
.B -o
omit disposition line
.TP
.B -u
unknown encoding, auto-detect
.TP
.B -v
verbose messages
.TP
.B -V
very verbose messages
.TP
.B -x
base64 encoding
.TP
.B -p
copy existing MIME part
.TP
.B -o
omit content-disposition
.TP
.B -m
omit content-transfer-encoding
.TP
.B -n filename
override the filename in the disposition header
.TP
.B -N
don't add a filename parameter in the disposition header
.TP
.B -0
no-op
.SH EXAMPLES
Using MIME-tool to write a mail message to a file:
.RS
mime -S "test message" -F me@foo.net -T someone@somewhere.net file1 > test.msg
.RE
Using MIME-tool with the
.I mail
command:
.RS
mime -S "test message" -F me@foo.net file1 | mail someone@somewhere.net
.RE
Using MIME-tool with the
.I mailx
command:
.RS
mime -S "test message" -F me@foo.net file1 | mailx someone@somewhere.net
.RE
Using MIME-tool with the
.I sendmail
command:
.RS
mime -S "test message" -F me@foo.net file1 | sendmail someone@somewhere.net
.RE
.SH VERSION
This is version 1.5.topal3 from June 2009.
.SH KNOWN BUGS
Most of the header values are not properly quoted or folded, so long or
complex values for these headers may cause problems. Specifically, the
from-address, to-address, carbon-copy-address and content-type headers
may not be properly quoted or folded.
For some reason, certain e-mail clients (espcially from a large software
company located in Redmond, Washington) don't seem to recognize file
attachments as attachments, but instead displays them as inline attachments.
(maybe this isn't MIME-tool's fault, but I've gotten a few e-mails about it,
so I'm mentioning it here)
.SH AUTHOR
.B mime
is written by Jeffrey Dutky
Oscar Esteban spotted an off-by-one error in the base64 encoding function.
Sergey Lapin spotted a bug in the filename header construction.
Chris Hemphill noticed that the documentation (this manual page and the
README file) didn't include any examples of how to call the program with
common mail commands.
Some additional fixes and additions by Phil Brooke to support Topal.
.SH AVAILABILITY
The original MIME-tool package can be downloaded from my web page at
http://members.bellatlantic.net/~dutky
This modified version is distributed with Topal:
http://homepage.ntlworld.com/phil.brooke/topal/
topal-84/MIME-tool/mime.c 0000664 0000000 0000000 00000056476 14616434652 0015260 0 ustar 00root root 0000000 0000000 /* Notice of Copyright, License and Warranty
**
** This software is Copyright 2004, 2006 Jeffrey S. Dutky
** Updated February 2005 to fix off-by-one error reported by Oscan Esteban
** Updated May 2006 to restrict byte values in 7-bit endcoded data
** Updated May 2006 to fix filename header contents, thanks to Sergey Lapin
** Updated June 2006 (manpage and README.txt files) for Chris Hemphill
** Updated June 2006 to better handle long filenames (quote and fold)
** Updated July 2008 by Phillip J. Brooke:
** - Minor cleanup (stop warning about err variable)
** - Added Makefile.
** - Corrected docs/info re: -c and -t options.
** - Added -p (copy thru') option (for use by Topal).
** - Boundary option not honoured -- fixed.
** - Added -o to omit disposition line.
** - Added -O to give an overall content type.
** - Added -m to omit content-transfer-encoding.
** - Fixed quoted-printable encoder (at least, to what I
** understand RFC2045 requires).
** - Added subpart (-s) switch.
** - Escape a single `.' on a line, and 'From ' at line-start, as
** suggested by RFC2049.
** Updated April 2009 by Phillip J. Brooke:
** - Correct a typo in comments.
** - Add option to force name in disposition (-n).
** - Add no-op option (-0 -- that's a zero).
** Updated June 2009 by Phillip J. Brooke:
** - Add option to omit disposition name (-N).
** - Man page update.
** - Typo corrections.
** Updated March 2011 by Phillip J. Brooke:
** - Bug fix in base64() where very short files (1 or 2 byte)
** weren't processed.
** Updated September 2019, PJB, applying typo fixes from Nicolas Boulenguez.
**
** This software is licensed for use under the terms of the GNU General
** Public License (also called the GPL), a copy of which must be included
** with any distribution of this software. You may also find a copy of the
** GPL at the Free Software Foundation's web site at http://www.fsf.org/
** or http://www.gnu.org.
**
** This software is provided "as is" and without any express or implied
** warranties, including, without limitation, the implied waranties of
** merchantability and fitness for a particular purpose.
*/
#include
#include
#include
#include
#define MT_VERSION "1.5.topal3"
#define MT_DATE "June 2009"
/*
** A simple mime message utility: create MIME encoded messages with attached
** files. The program can be used to construct input to the standard unix
** mail and mailx commands.
**
** mime [-dDvV] [-S subject] [-F from-address] [-T to-address]
** [-C carbon-copy address] [-P prolog-text] [-E epiplogue-text]
** [-O overall content-type] [-B boundary] -s
** {[-78abiquxtpom] [-c content-type] [-n filename] filename}
**
** -d low detail debugging
** -D high detail debugging
** -v verbose messages
** -V very verbose messages
** -s write this as a subpart (makes little sense if more than
** one filename given)
**
** -O overall content-type (e.g., multipart/signed)
** -7 7-bit ASCII encoding
** -8 8-bit ASCII encoding
** -a application/octet-stream content type
** -b binary encoding
** -i disposition: inline (instead of the default of attachment)
** -q quoted-printable encoding
** -t text/plain content type
** -c explicit content-type
** -n override filename in disposition header
** -N don't include the filename parameter in the disposition header
** -u unknown encoding, auto-detect
** -x base64 encoding
** -p copy part already containing relevant headers and encoding
** -o omit disposition
** -m omit content-transfer-encoding
**
** The program will construct a MIME encoded message from a list of filenames
** and other specified values (subject, from address, to address, boundary,
** prolog text, epilog-text, and carbon-copy list). All of the files are
** flagged with type "application/octet-stream" and encoded using base64,
** regardless of actual file contents (unless explicity flagged for another
** encoding using the -7, -8,-b, -q, or -u flags).
**
** The program has been written in K&R C, so that it can be compiled with the
** bundled HP-UX compiler (a limited K&R compiler). The program will, probably,
** compile with similar bundled compilers on other comercial unices. The program
** will also compile using modern ANSI/ISO C compilers (such as gcc).
*/
/*
** Print the usage message for the MIME-tool program, showing how the program
** should be called and what the command line options and parameters are.
*/
#ifdef __STDC__
int printusage(FILE *f)
#else
int printusage(f) FILE *f;
#endif
{
fprintf(f, "\nMIME message utility (ver. %s, %s) - create MIME ",
MT_VERSION, MT_DATE);
fprintf(f, "email messages \nwith file attachments. The program can ");
fprintf(f, "be used to construct input to the \nstandard unix mail and ");
fprintf(f, "mailx commands.\n\n");
fprintf(f, "Usage:\n");
fprintf(f, "\tmime [-dDvV] [-S subject] [-F from-address] [-T to-address]\n");
fprintf(f, "\t\t[-C carbon-copy-addresses] [-P prolog-text] [-E epilog-text]\n");
fprintf(f, "\t\t[-B boundary] -s [-O overall content-type]\n");
fprintf(f, "\t\t{[-78abiqtuxo] [-c content-type] [-n filename] filename}\n");
fprintf(f, "\n\t-d debugging (low detail level)\n");
fprintf(f, "\t-D debugging (high detail level)\n");
fprintf(f, "\t-v verbose messages\n");
fprintf(f, "\t-V very verbose messages\n");
fprintf(f, "\t-s subpart mode\n\n");
fprintf(f, "\t-7 7-bit ASCII encoding\n");
fprintf(f, "\t-8 8-bit ASCII encoding\n");
fprintf(f, "\t-a application/octet-stream content\n");
fprintf(f, "\t-b binary encoding\n");
fprintf(f, "\t-i disposition: inline (instead of attachment)\n");
fprintf(f, "\t-q quoted-printable encoding\n");
fprintf(f, "\t-t text/plain content\n");
fprintf(f, "\t-c explicit content-type\n");
fprintf(f, "\t-n override filename in disposition \n");
fprintf(f, "\t-u unknown encoding (auto-detect)\n");
fprintf(f, "\t-x base64 encoding\n");
fprintf(f, "\t-p copy part already containing relevant headers and encoding\n");
fprintf(f, "\t-o omit disposition line\n");
fprintf(f, "\t-m omit content-transfer-encoding\n");
fprintf(f, "\nThis program is free software distributed under the terms");
fprintf(f, "of the GNU General \nPublic License (GPL), and comes with ");
fprintf(f, "ABSOLUTELY NO WARRANTY. See the GPL \nfor details. ");
fprintf(f, "You should have received a copy of the GPL with this ");
fprintf(f, "program, \nif not, you can get a copy at the Free Software ");
fprintf(f, "Foundation's website at \n or ");
fprintf(f, ".\n");
return 0;
}
#define ENC_UNKNOWN 0
#define ENC_ASCII7 1
#define ENC_ASCII8 2
#define ENC_BINARY 3
#define ENC_BASE64 4
#define ENC_QUOTED 5
#define ENC_COPYTHRU 6
#define DISP_ATTACHED 0
#define DISP_INLINE 1
#define DISP_OMIT 2
#define MAX_LINE_LENGTH 75
#define DEBUG(X) if(debug){X;}
/*
** flags to indicate debugging and verbosity levels
*/
static int debug=0, verbose=0;
/*
** wrapped text buffer, used by wrap() function
*/
static char *wbuf=NULL;
/*
** wrap input text to the specified maximum width
*/
#ifdef __STDC__
char *wrap(char *text, int max, int margin)
#else
char *wrap(text, max, margin) char *text; int max, margin;
#endif
{
int width=0, i, j;
if(wbuf)
free(wbuf);
wbuf=malloc(strlen(text)+2+(strlen(text)/max));
if(wbuf==NULL)
return NULL;
for(i=0, j=0; text[i]; i++)
{
if(text[i]=='\n')
{ /* if we see a newline, start a new line */
wbuf[j++]='\n';
width=0;
}else if(width>max && !isspace(text[i]))
{ /* if we have run over the maximum length, put in a newline */
wbuf[j++]='\n';
width=1;
wbuf[j++]=text[i];
}else if(width>max-margin && (isspace(text[i]) || !isalnum(text[i])))
{ /* if we see a space in the margin, put in a newline */
if(!isspace(text[i]))
wbuf[j++]=text[i];
wbuf[j++]='\n';
width=0;
}else
{ /* in allo ther cases, just copy the text to wbuf */
wbuf[j++]=text[i];
width++;
}
}
wbuf[j]='\0';
return wbuf;
}
/*
** convert the contents of the input file to base64 encoding.
*/
#ifdef __STDC__
int base64(FILE *f)
#else
int base64(f) FILE *f;
#endif
{
int i, n;
char buf[100];
char *b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
do
{ /* write out blocks of 4 base64 characters (3 input bytes) */
n=fread(buf, sizeof(char), 57, f);
DEBUG(fprintf(stderr, "%d chars read from file\n", n));
for(i=0; i<=n-3; i+=3)
{
int b0, b1, b2, b3; /* output base64 characters */
b0=(buf[i]>>2)&0x3f;
b1=(((buf[i]<<4)&0x30)|((buf[i+1]>>4)&0xf))&0x3f;
b2=(((buf[i+1]<<2)&0x3c)|((buf[i+2]>>6)&3))&0x3f;
b3=(buf[i+2]&0x3f)&0x3f;
printf("%c%c%c%c", b64[b0], b64[b1],
b64[b2], b64[b3]);
}
if(n<57)
break;
printf("\n");
}while(!feof(f));
if(ferror(f)) {
DEBUG(fprintf(stderr, "ferror in base64 encode\n"));
return 1;
}
else
{ /* handle any trailing input bytes (1 or 2 trailing bytes) */
int b0, b1, b2; /* output base64 characters */
DEBUG(fprintf(stderr, "Handling trailing bytes. n=%d, i=%d\n", n, i));
if(n-i==1)
{ /* write out a single input byte as 2 base64 characters */
b0=(buf[i]>>2)&0x3f;
b1=((buf[i]<<4)&0x30)&0x3f;
printf("%c%c==", b64[b0], b64[b1]);
}
if(n-i==2)
{ /* write out two input bytes as 3 base64 characters */
b0=(buf[i]>>2)&0x3f;
b1=(((buf[i]<<4)&0x30)|((buf[i+1]>>4)&0xf))&0x3f;
b2=((buf[i+1]<<2)&0x3c)&0x3f;
printf("%c%c%c=", b64[b0], b64[b1],
b64[b2]);
}
}
return 0;
}
/*
** quote the input file, replacing newlines and white space with escape
** sequences.
*/
#ifdef __STDC__
int quoted(FILE *f)
#else
int quoted(f) FILE *f;
#endif
{
int width=0, ch;
int fstate=0;
/* 'From ' state.
0 => Normal
1 => Have read F at start of line
2 => Fr
3 => Fro
4 => From
If reading ' ' when in fstate=4, write "=46rom " instead. */
while((ch=fgetc(f))!=EOF)
{
if (fstate==0 && width==0 && ch=='F') fstate=1;
else if (fstate==1) {
if (ch=='r') fstate=2;
else { printf("F"); width++; fstate=0; }
}
else if (fstate==2) {
if (ch=='o') fstate=3;
else { printf("Fr"); width=width+2; fstate=0; }
}
else if (fstate==3) {
if (ch=='m') fstate=4;
else { printf("Fro"); width=width+3; fstate=0; }
}
else if (fstate==4) {
if (ch==' ') {printf("=46rom"); width=width+6; fstate=0; }
else { printf("From"); width=width+4; fstate=0; }
}
if (fstate==0) {
if(width>MAX_LINE_LENGTH && ch!='\n')
{ /* soft line break at 75 characters */
printf("=\015\012");
width=0;
}
else if(ch=='\n')
{ /* emit this one without problem (as CR LF */
printf("\015\012");
width=0;
}
else if(ch==' ' || ch=='\t' || (ch=='.' && width==0)) {
/* tabs, spaces and full-stops at line-ends are escaped */
/* full-stops only escaped at start of line */
int nextch = fgetc(f);
if (nextch != EOF) {
ungetc(nextch, f);
}
if (nextch=='\n') {
printf("=%2.2X", ch);
width+=3;
} else {
printf("%c", ch);
width++;
}
}
else if((!isprint(ch)) || ch=='=')
{ /* escape non-printable characters and equal signs (=) */
printf("=%2.2X", ch);
width+=3;
}
else
{
/* emit all other characters without ado */
printf("%c", ch);
width++;
}
}
}
if(ferror(f))
return 1;
return 0;
}
/*
** copy the input file without modification
*/
#ifdef __STDC__
int copy(FILE *f)
#else
int copy(f) FILE *f;
#endif
{
int ch;
while((ch=fgetc(f))!=EOF)
printf("%c", ch);
if(ferror(f))
return 1;
return 0;
}
/*
** copy the input file, restricting output to 7-bit ASCII
*/
#ifdef __STDC__
int copy7(FILE *f)
#else
int copy7(f) FILE *f;
#endif
{
int ch;
while((ch=fgetc(f))!=EOF)
{
if(ch >= 0 && ch < 128)
printf("%c", ch);
else /* convert 8-bit characters to question marks (?) */
printf("?");
}
if(ferror(f))
return 1;
return 0;
}
/*
** detect an appropriate encoding for the input file
*/
#ifdef __STDC__
int fencode(FILE *f)
#else
int fencode(f) FILE *f;
#endif
{
int ch, ascii=1, hibit=0, maxline=0, line=0, ctrl=0; /* content flags */
while((ch=fgetc(f))!=EOF)
{ /* search the file for the follwoing: */
if(!isascii(ch)) /* non-ASCII characters */
ascii=0;
if(ch>127 || ch<0) /* 8-bit characters (bit-7 set) */
hibit=1;
if(iscntrl(ch) && !isspace(ch)) /* control characters */
ctrl=1;
if(ch=='\n')
{ /* long lines */
if(line>maxline)
maxline=line;
line=0;
}else
line++;
}
if(ferror(f))
return -1;
if(fseek(f, 0, SEEK_SET))
return -2;
if(maxline>998 || ctrl)
return ENC_BASE64;
if(hibit)
return ENC_ASCII8;
if(ascii)
return ENC_ASCII7;
return ENC_BASE64;
}
char *qstr = NULL;
int qstrlen = 0;
/*
** fold and quote the string parameter, given that the parameter starts
** at the nth column.
**
** NOTE: every call to foldquote() overwrites the return value from the
** previous call, so you can't call this function several times in another
** functions argument list or you will get corrupt output.
*/
#ifdef __STDC__
char *foldquote(char *str, int col, int margin)
#else
char *foldquote(str, col, margin) char *str; int col, int margin;
#endif
{
int needsquotes = 0;
int needsescapes = 0;
int needsfolding = 0;
int qcol = 0, len = 0, i, j;
if(str == NULL)
return NULL;
/* count chars in str, noticing special chars and fold points */
for(i = 0, qcol = col; str[i] != '\0'; i++)
{
if(str[i] == '"')
needsescapes++, needsquotes = 1;
switch(str[i]) /* RFC-822 special characters: "\()[]<>@.,:; */
{
case '"': case '\\': case '(': case ')': case '[': case ']':
case '<': case '>': case '@': case '.': case ',': case ';': case ':':
needsquotes = 1;
}
if(str[i] == ' ' || str[i] == '\t') /* white space */
needsquotes = 1;
if(qcol++ > MAX_LINE_LENGTH) /* line too long, folding needed */
needsfolding++, qcol = 1;
len++;
}
if(needsquotes || needsescapes || needsfolding)
{
len = len+needsquotes*2+needsescapes+needsfolding*3+1;
if(qstrlen < len)
{
if(qstr != NULL)
free(qstr);
qstr = (char*)malloc(len);
if(qstr == NULL)
return NULL;
qstrlen = len;
}
if(qstr == NULL)
return NULL;
i = j = 0;
qcol = col;
if(needsquotes)
qstr[i++] = '"';
/* copy str into qstr applying quotes, escapes and folding */
while(str[j] != '\0')
{
if(str[j] == '"')
qstr[i++] = '\\'; /* escape quotes */
qstr[i++] = str[j];
if(needsfolding && qcol++ >= MAX_LINE_LENGTH-margin
&& (str[j] == ' ' || str[j] == '\t'))
{ /* fold at spaces in the margin */
qstr[i++] = '\n';
qstr[i++] = ' ';
qcol = 1;
}
j++;
}
if(qstr[0] == '"')
qstr[i++] = '"';
qstr[i] = '\0';
return qstr;
}
return str;
}
#ifdef __STDC__
int main(int args, char **arg)
#else
int main(args, arg) int args; char **arg;
#endif
{
FILE *f;
int i, err=0, headerneeded=1, encoding=ENC_BASE64, disposition=DISP_ATTACHED, omitCTE=0, subpart=0, omitDisponame=0;
char *prolog=NULL, *epilog=NULL, *boundary="MIME_CONTENT_BREAK", *p;
char *subject=NULL, *fromaddress=NULL, *toaddress=NULL, *carboncopy=NULL;
char *contenttype="application/octet-stream";
char *overallcontenttype="multipart/mixed";
char *disponame=NULL;
if(args<2)
{
printusage(stderr);
return 1;
}
for(i=1; i