bincimap-auth-teapop.sh (1452B)
1 #!/bin/bash 2 # 3 # bincimap authentication using teapop textfile configs 4 # 5 # 2003 - Ivan F. Martinez <ivanfm@users.sourceforge.net> 6 # 7 if [ "$BINC_USERID" != "" ] && [ "$BINC_PASSWORD" != "" ] 8 then 9 DOMAIN=`echo "$BINC_USERID" | cut -f 2 -d "@"` 10 USERID=`echo "$BINC_USERID" | cut -f 1 -d "@"` 11 LN=`grep "^${DOMAIN}:\*:textfile" /etc/teapop.passwd` 12 if [ $? -eq 0 ] 13 then 14 DOMDIR=`echo "$LN" | cut -f 4 -d ":"` 15 USER=`echo "$LN" | cut -f 6 -d ":"` 16 GROUP=`echo "$LN" | cut -f 7 -d ":"` 17 PASSFILE=`echo "$LN" | cut -f 8 -d ":"` 18 if [ "$PASSFILE" != "" ] && [ -f $PASSFILE ] 19 then 20 LN=`grep "^${USERID}:${BINC_PASSWORD}" $PASSFILE` 21 if [ $? -eq 0 ] 22 then 23 USERDIR=`echo "$LN" | cut -f 3 -d ":"` 24 USERDIR="${DOMDIR}/${USERDIR}" 25 XUID=`grep "^${USER}:" /etc/passwd | cut -f 3 -d ":"` 26 # If blank probably already numeric 27 if [ "$XUID" = "" ] 28 then 29 XUID="${USER}" 30 fi 31 XGID=`grep "^${GROUP}:" /etc/group | cut -f 3 -d ":"` 32 # If blank probably already numeric 33 if [ "$XGID" = "" ] 34 then 35 XGID="${GROUP}" 36 fi 37 echo "${XUID}.${XGID}" 38 echo "${USERDIR}" 39 exit 0 40 fi 41 fi 42 fi 43 fi 44 exit 112