$Cambridge: hermes/src/prayer/docs/ACCOUNTD,v 1.2 2008/09/16 09:59:56 dpc22 Exp $

Accountd uses a simple line based protocol similar to POP or IMAP.

Data types
==========

There are two basic data types:

  Tokens:
    Arbitary ASCII text. URL style encoding are used for anything other
    than alphanumerics e.g: Hello%20World.

  Literals:
    Bastardised version of IMAP literal strings used to insert arbitrary
    amounts of data into a line. Example:

      SOMETHING {5}CRLF
      Hello {5}CRLF
      World

      is equivalent to SOMETHING "Hello World" in IMAP.

IMAP allows you do use literals and other string encoding interchangeably.
This isn't the case with the accountd protocol.

Protocol
========

Login
   LOGIN <username :: token> <password :: token>

Password changing
   PASSWORD <old :: token> <new :: token>

Gecos changing
   FULLNAME <new :: token>

  Both work by running a simple expect-like script against a Hermes
  specific "passwd" program running at the far end of a PTY. (messy,
  but easier than trying to reverse engineering Chris Thompson's code!)

  I don't know if the script language is general enough for other passwd
  programs. FreeBSD and generic Solaris seem to work just fine. There's
  some kind of race condition or other bug which means that passwd on
  Linux doesn't work reliably: I never worked out what was going on there.

Quota checking:
  QUOTA

  accountd cheats on Hermes: I was too lazy to write the 10 line perl
  script which would translate output from the Hermes specific quota
  command into the canonical form described in accountd.cf files.

Exim filter file management:

  Based around (and compatible with) the intermediate format (.MSforward)
  used by menu system on Hermes. This format is undocumented but simple.

  Basic accounts

  MAILSTATUS
     Returns copy of .MSforward file as literal after running consistency
     check on .forward file. Performs on the fly translation of simple
     .forward files which are not Exim filter files. Example:

        OK {102}
        # MSforward file: change only via Hermes menu system
        redirect
          address      dpc22@cam.ac.uk
          copy true

  MAILCHANGE <File :: literal>
     Uploads new .MSforward file, generates .forward from it.

  GET <filename :: token>
     Returns given file as literal. Used to get vacation aliases and
     log file.

  PUT <filename :: token> <contents :: literal>
     Upload file as literal. Used to upload vacation aliases.

  VACATION_CLEAR
     Clears vacation.log, vacation.once.dir, vacation.once.pag

