On Friday 01 June 2007 22:43:20 Sam Varshavchik wrote:
> You have xxxx.org in locals.  In your case, it should be in hosteddomains.
> 
> and Aidas Kasparas wrote: Have you xxxx.org in locals file?

Yes, that was indeed the case. I completely removed and reinstalled
the Debian packages and it seems the Debian default is to write the
local FQDN host to locals. Again, apologies to the list for my dumb
mistakes and thanks to Sam and Aidas for pointing out the obvious.

This might be useful to someone, or the list archive...

% cat /etc/courier/authProg
#!/bin/bash
#
# authProg v0.1.0 20070602 [EMAIL PROTECTED]
#
# A Bash shell script to handle authentication from the pipe handler
# for the Courier-MTA authdaemon.
#
# See: http://www.courier-mta.org/authlib/README_authlib.html#authpipe

ID=""
PW=""
SQL=()

# Handle the SQL queries, change parameters to suit, separator = <tab>.

dosql () {
  echo "$1;"|/usr/bin/sqlite3 -separator '      ' /home/a/admin.sqlite
}

# Return the authdaemon API required success result.

allok () {
  /bin/cat << EOM
ADDRESS=${SQL[0]}
PASSWD2=${SQL[1]}
HOME=${SQL[2]}
QUOTA=${SQL[3]}
UID=1
GID=1
.
EOM
}

# Read the first line from STDIN.

read TMPIN

# Get the unique first 3 chars representing what incoming authdaemon
# API functionality is needed. Will be one of PRE, AUT, PAS or ENU.

TOKEN=$(echo "$TMPIN"|/usr/bin/cut -c -3)

if [ "x$TOKEN" = "xPRE" ]; then

# PRE . authservice username<newline>
#
# Look up data for an account. authservice identifies the service the
# user is trying to use - e.g. pop3, imap, webmail etc. If the account
# exists, return the account data as a series of ATTR=value
# newline-terminated lines, followed by a period on a line of its own.

  ID=$(echo $TMPIN|/usr/bin/awk '{print $4}')
  SQL=($(dosql "SELECT uid,pw,mpath,mquota FROM passwd WHERE uid='$ID'"))
  if [ "x${SQL[0]}" = "x$ID" ]; then
    allok
  else
    echo FAIL
  fi

elif [ "x$TOKEN" = "xAUT" ]; then

# AUTH len<newline>len-bytes
#
# Validate a login attempt. The AUTH line is followed by len-bytes of
# authentication data, which does not necessarily end with a newline.

  read A # throwaway
  read B # throwaway
  read ID
  read PW
  SQL=($(dosql "SELECT uid,pw,mpath,mquota FROM passwd WHERE uid='$ID' AND 
pw='$PW'"))
  if [ "x${SQL[1]}" = "x$PW" ]; then
    allok
  else
    echo FAIL
  fi

elif [ "x$TOKEN" = "xPAS" ]; then

# PASSWD service<tab>username<tab>oldpasswd<tab>newpasswd<tab><newline>
#
# Request a password change for the given account: validate that the
# oldpassword is correct, and if so, change it to the newpassword.

  ID=$(echo $TMPIN|/usr/bin/awk '{print $3}')
  OLDPW=$(echo $TMPIN|/usr/bin/awk '{print $4}')
  NEWPW=$(echo $TMPIN|/usr/bin/awk '{print $5}')
  PW=$(dosql "SELECT pw FROM passwd WHERE uid='$ID'")

  if [ "x$PW" = "x$OLDPW" ]; then

    dosql "UPDATE passwd SET pw='$NEWPW' WHERE uid='$ID'"
    PW=$(dosql "SELECT pw FROM passwd WHERE uid='$ID'")

    if [ "x$PW" = "x$NEWPW" ]; then
      echo "Password successfully changed"
    else
      echo FAIL
    fi

  else
    echo FAIL
  fi

elif [ "x$TOKEN" = "xENU" ]; then

# ENUMERATE<newline>
#
# Return a list of all accounts, one per line in the following format,
# ending with a period on a line of its own;
#
# username<tab>uid<tab>gid<tab>homedir<tab>maildir<tab>options<newline>

  dosql "SELECT uid,muid,mgid,mpath FROM passwd WHERE uid NOT LIKE '[EMAIL 
PROTECTED]'"
  echo .

fi


--markc

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to