| 1 | # Above should have been added a QMPATH definition |
| 2 | # DEBUG=1 |
| 3 | # This program is meant to test ezmlm-idx. |
| 4 | # Several criteria have to be met for this to work: |
| 5 | # 0. you need to have qmail installed allowing mail delivery to |
| 6 | # "eztest@host" and subaddresses. |
| 7 | # 2. you need to have a user "eztest" or edit the script to change to a |
| 8 | # user that exists on your system. |
| 9 | # 3. you need to be that user when you invoke this script and the script |
| 10 | # needs to reside in the same dir as the binaries you want to test. |
| 11 | # 4. this user needs to have execute permission for the build dir |
| 12 | # |
| 13 | # The script will use ~eztest/__TSTDIR and ~eztest/__TSTDIR__err and destroy |
| 14 | # any files therein. Both user name and directory names etc can be configured |
| 15 | # below, but this should only very rarely be necessary. |
| 16 | # |
| 17 | # This program is experimental and not yet properly documented. Please |
| 18 | # send comments to lindberg@id.wustl.edu. I'm attempting to make this a |
| 19 | # rigorous test for future ezmlm+idx installations so that full function |
| 20 | # can be verified when upgrading to a new version. |
| 21 | |
| 22 | # must be absolute |
| 23 | EZBIN=`pwd` |
| 24 | |
| 25 | # the user that should run the scripts (test list is created in this |
| 26 | # users home directory). |
| 27 | EZTEST='eztest' |
| 28 | |
| 29 | # HOST is normally set from /var/qmail/control/me. Set it here to override |
| 30 | HOST='' |
| 31 | |
| 32 | # Version of ezmlm-idx for which this test script is designed |
| 33 | OLD_VER='ezmlm-idx-031' # ezmlm-idx-0.31x |
| 34 | VER='ezmlm-idx-0.40' |
| 35 | EZVER='40' # default version |
| 36 | |
| 37 | #does the current version have qmail<1.02 support? |
| 38 | OLD_QMAIL='n' |
| 39 | |
| 40 | # basedir for test list. It and all files therein are destroyed by |
| 41 | # the script |
| 42 | DIR="$HOME/__TSTDIR" |
| 43 | |
| 44 | # part that follows user name of local name of the list |
| 45 | LIST='__tstlist' |
| 46 | |
| 47 | # file not within listdir where some error output is stored. If something |
| 48 | # fails, this file may have more info. |
| 49 | ERR="${DIR}__err" |
| 50 | |
| 51 | # file that can hold crated test msg to avoid sigpipe |
| 52 | TMP="${DIR}/__tmp" |
| 53 | |
| 54 | # defaults for SQL version - overridden by command line switches |
| 55 | TABLE='list' |
| 56 | DB='ezmlm' |
| 57 | SQLHOST='' |
| 58 | SQLUSR="$EZTEST" # -u overrides, -l overrides that |
| 59 | |
| 60 | # sets umask so that qmail paternalism doesn't complain. With most |
| 61 | # installations, there is a umask in the user's profile. 022 should be ok, |
| 62 | # but 002 is safer. |
| 63 | |
| 64 | UMASK='umask 002' |
| 65 | |
| 66 | #programs: |
| 67 | # to report disk usage summary |
| 68 | DU='du -s' |
| 69 | # Need full path in case qmail doesn't have these in the path |
| 70 | ECHO=`which echo` 2>/dev/null || ECHO='echo' |
| 71 | GREP=`which grep` 2>/dev/null || GREP='grep' |
| 72 | # std programs |
| 73 | HEAD='head' |
| 74 | MKDIR='mkdir' |
| 75 | MV='mv' |
| 76 | # a ps command that would list qmail if running. This works for RedHat Linux |
| 77 | PS='ps auxw' |
| 78 | RM='rm' |
| 79 | SED='sed' |
| 80 | STRINGS='strings' |
| 81 | TAIL='tail' |
| 82 | UNSET='unset' |
| 83 | WC='wc' |
| 84 | # if you don't have this, you can put 'echo "user"' where user is the current |
| 85 | # login user name. |
| 86 | WHOAMI='whoami' |
| 87 | |
| 88 | ###################### END CONFIRGRABLE ITEMS ######################### |
| 89 | SQLUSER='' # must be empty |
| 90 | ARR='-------------------->' |
| 91 | ALLOW='allow' |
| 92 | DENY='deny' |
| 93 | DASH='-' |
| 94 | # switch for ezmlm-return |
| 95 | DLC='-d' |
| 96 | DUC='-D' |
| 97 | # file for ezmlm-request testing |
| 98 | REQ="${DIR}/__req" |
| 99 | # Set if we've found bug from old version |
| 100 | BUG='' |
| 101 | # Use RDBMS, set if -p was specified even if PW empty, e.g. Postgres |
| 102 | USESQL='' |
| 103 | # process arguments |
| 104 | |
| 105 | SECT="1" |
| 106 | while [ ! -z "$1" ]; do # not everyone has getopt :-( |
| 107 | case "$1" in |
| 108 | -/) |
| 109 | DASH='-/'; shift;; |
| 110 | -d) |
| 111 | DB="$2"; shift; shift;; |
| 112 | -h) |
| 113 | SQLHOST="$2"; shift; shift;; |
| 114 | -l) |
| 115 | SQLUSER="$2"; shift; shift;; |
| 116 | -n) |
| 117 | QMVER=n; shift;; |
| 118 | -o) |
| 119 | QMVER=o; shift;; |
| 120 | -p) |
| 121 | PW="$2"; USESQL=1; shift; shift;; |
| 122 | -u) |
| 123 | EZTEST="$2"; SQLUSR="$2"; shift; shift;; |
| 124 | -s) |
| 125 | SECT="$2"; shift; shift;; |
| 126 | -t) |
| 127 | TABLE="$2"; shift; shift;; |
| 128 | --) |
| 129 | shift; break;; |
| 130 | *) |
| 131 | ${ECHO} "$i" |
| 132 | ${ECHO} "Usage: ezmlm-test [-/] [-on] [-u user]" \ |
| 133 | "[-p sqlpassword [-l sqluser] [-d sqldb]" \ |
| 134 | "[-t sqltable] [-h sqlhost]] [-s section]" |
| 135 | ${ECHO} |
| 136 | ${ECHO} "args have to be separated from switches!" |
| 137 | ${ECHO} |
| 138 | ${ECHO} "defaults: -d ezmlm" |
| 139 | ${ECHO} " -h [empty => RDBMS default]" |
| 140 | ${ECHO} " -l eztest or -u arg if specified" |
| 141 | ${ECHO} " -n/o [autodetected]" |
| 142 | ${ECHO} " -p [empty - don't use SQL support]" |
| 143 | ${ECHO} " -s 1 [run test from beginning]" |
| 144 | ${ECHO} " -t list" |
| 145 | ${ECHO} " -u eztest" |
| 146 | ${ECHO} |
| 147 | exit 99;; |
| 148 | esac |
| 149 | done |
| 150 | |
| 151 | if [ -z "$SQLUSER" ]; then |
| 152 | SQLUSER="$SQLUSR" |
| 153 | fi |
| 154 | |
| 155 | USER=`${WHOAMI}` >/dev/null 2>&1 || \ |
| 156 | { ${ECHO} "whoami doesn't work. If you're not \"${EZTEST}\" the"; |
| 157 | ${ECHO} "will fail."; USER="${EZTEST}"; } |
| 158 | |
| 159 | if [ "$USER" != "${EZTEST}" ]; then |
| 160 | ${ECHO} "Must be user ${EZTEST} to execute"; exit 99 |
| 161 | fi |
| 162 | LOC="$EZTEST-$LIST" |
| 163 | # calculate position in LOCAL where [normally] default starts |
| 164 | LOCLEN=`${ECHO} "$LOC-" | ${WC} -c | ${SED} 's/ //g'` |
| 165 | REJLEN=`${ECHO} "$LOC-reject-" | ${WC} -c | ${SED} 's/ //g'` |
| 166 | ACCLEN=`${ECHO} "$LOC-accept-" | ${WC} -c | ${SED} 's/ //g'` |
| 167 | |
| 168 | ${UMASK} >/dev/null || \ |
| 169 | { |
| 170 | ${ECHO} "Umask failed. Usually, this is OK. Fix this if ezmlm-test" |
| 171 | ${ECHO} "fails and messages remain queued with the qmail error" |
| 172 | ${ECHO} "'Uh-oh: .qmail file is writable'." |
| 173 | ${ECHO} |
| 174 | } |
| 175 | |
| 176 | DOT="$HOME/.qmail$DASH$LIST" |
| 177 | |
| 178 | if [ "$SECT" != "1" ]; then |
| 179 | ${ECHO} "Starting with section $SECT ..." |
| 180 | fi |
| 181 | |
| 182 | # test addresses. These are all within the list dir and all addresses |
| 183 | # are subaddresses of the list address. You can change this, but it is |
| 184 | # usually pointless. |
| 185 | SINK='sink' |
| 186 | SINKDIR="${DIR}/${SINK}" |
| 187 | SND="${LOC}-${SINK}" |
| 188 | |
| 189 | # moddir |
| 190 | MODACC='modacc' |
| 191 | MODDIR="${DIR}/${MODACC}" |
| 192 | MOD="$LOC-${MODACC}" |
| 193 | |
| 194 | # digdir |
| 195 | DIGGG='dig' |
| 196 | DIGDIR="${DIR}/${DIGGG}" |
| 197 | DIG="$LOC-${DIGGG}" |
| 198 | |
| 199 | # mandir |
| 200 | MANAG="man" |
| 201 | MANDIR="${DIR}/${MANAG}" |
| 202 | MAN="$LOC-${MANAG}" |
| 203 | |
| 204 | # bouncedir |
| 205 | BOUNCE='bnc' |
| 206 | BNC="$LOC-bnc" |
| 207 | |
| 208 | if [ -z "$HOST" ]; then |
| 209 | HOST=`${HEAD} -1 ${QMPATH}/control/me` || \ |
| 210 | { ${ECHO} "unable to get host name. Set HOST in script" ; exit 99; } |
| 211 | fi |
| 212 | |
| 213 | if [ ! -x "${EZBIN}/ezmlm-make" ]; then |
| 214 | ${ECHO} "can't execute ${EZBIN}/ezmlm-make. Most likely, user ``$USER''" |
| 215 | ${ECHO} "doesn't have execute permission to files in directory" |
| 216 | ${ECHO} "``${EZBIN}''. Adjust permissions or edit the script to" |
| 217 | ${ECHO} "use a different test user." |
| 218 | exit 99 |
| 219 | fi |
| 220 | |
| 221 | if [ ! -x "/usr/sbin/qmail-local" ]; then |
| 222 | ${ECHO} "can't find qmail-local. Please correct the path in the script" |
| 223 | exit 99 |
| 224 | fi |
| 225 | if [ ! -x "/usr/sbin/qmail-inject" ]; then |
| 226 | ${ECHO} "can't find qmail-inject. Please correct the path in the script" |
| 227 | exit 99 |
| 228 | fi |
| 229 | # Check if qmail is running. Don't fail if not, as it's most likely a |
| 230 | # ps issue and not a lack of qmail. |
| 231 | ${PS} | ${GREP} qmai\l-send >/dev/null 2>&1 || \ |
| 232 | { |
| 233 | ${ECHO} "qmail isn't running or ps doesn't work as expected. If" |
| 234 | ${ECHO} "qmail is not running, this script will fail. Will continue..." |
| 235 | } |
| 236 | |
| 237 | ############################### |
| 238 | # message generating function # |
| 239 | ############################### |
| 240 | make_body() |
| 241 | { |
| 242 | ${ECHO} "This is a simple message body" |
| 243 | ${ECHO} "--bound123ary" |
| 244 | ${ECHO} "Content-type: Text/pLAIn" |
| 245 | ${ECHO} |
| 246 | ${ECHO} "plain text" |
| 247 | ${ECHO} "--bound123ary" |
| 248 | ${ECHO} "Content-type: texT/Html" |
| 249 | ${ECHO} |
| 250 | ${ECHO} "html text" |
| 251 | ${ECHO} "--bound123ary--" |
| 252 | ${ECHO} |
| 253 | ${ECHO} "junk after boundary" |
| 254 | return 0 |
| 255 | } |
| 256 | |
| 257 | make_message() |
| 258 | { |
| 259 | ${ECHO} "ReCEIved: #LAST#" |
| 260 | ${ECHO} "ReCeIved: #PENULTIMATE#" |
| 261 | ${ECHO} "retuRN-RECeipt-to: nobody" |
| 262 | ${ECHO} "To: $TO" |
| 263 | ${ECHO} "CC: " |
| 264 | ${ECHO} " $CC" |
| 265 | ${ECHO} "FROM: $FROM" |
| 266 | if [ ! -z "$CONTENT" ]; then |
| 267 | ${ECHO} "MIME-Version: 1.0" |
| 268 | ${ECHO} "Content-type: $CONTENT;" |
| 269 | ${ECHO} " boundary=bound123ary${AFTERBOUND}" |
| 270 | fi |
| 271 | if [ ! -z "$SUBJECT" ]; then |
| 272 | ${ECHO} "Subject: $SUBJECT" |
| 273 | fi |
| 274 | ${ECHO} |
| 275 | make_body |
| 276 | return 0 |
| 277 | } |
| 278 | |
| 279 | ############################ |
| 280 | # function to test testmsg # |
| 281 | ############################ |
| 282 | send_test() |
| 283 | { |
| 284 | { |
| 285 | ${ECHO} "X-num: #TSTMSG$1#" |
| 286 | ${ECHO} "To: ${SND}@$HOST" |
| 287 | } | /usr/sbin/qmail-inject |
| 288 | return 0 |
| 289 | } |
| 290 | |
| 291 | ############################ |
| 292 | # sleeping 5 secs function # |
| 293 | ############################ |
| 294 | sleep_5() |
| 295 | { |
| 296 | sleep 1; ${ECHO} -n "."; sleep 1; ${ECHO} -n "." |
| 297 | sleep 1; ${ECHO} -n "."; sleep 1; ${ECHO} -n "." |
| 298 | sleep 1; ${ECHO} -n "${1}" |
| 299 | return 0 |
| 300 | } |
| 301 | |
| 302 | ################################ |
| 303 | # waiting for delivery fuction # |
| 304 | ################################ |
| 305 | wait_test() |
| 306 | { |
| 307 | ${ECHO} -n "max 35s for delivery: " |
| 308 | sleep_5 5s |
| 309 | TSTMSG=`${GREP} -l "#TSTMSG$1" $SINKDIR/new/* 2>/dev/null` |
| 310 | if [ -z "$TSTMSG" ]; then |
| 311 | sleep_5 10s |
| 312 | TSTMSG=`${GREP} -l "#TSTMSG$1" $SINKDIR/new/* 2>/dev/null` |
| 313 | if [ -z "$TSTMSG" ]; then |
| 314 | sleep_5 15s |
| 315 | TSTMSG=`${GREP} -l "#TSTMSG$1" $SINKDIR/new/* 2>/dev/null` |
| 316 | if [ -z "$TSTMSG" ]; then |
| 317 | sleep_5 20s |
| 318 | TSTMSG=`${GREP} -l "#TSTMSG$1" $SINKDIR/new/* 2>/dev/null` |
| 319 | if [ -z "$TSTMSG" ]; then |
| 320 | sleep_5 25s |
| 321 | TSTMSG=`${GREP} -l "#TSTMSG$1" $SINKDIR/new/* 2>/dev/null` |
| 322 | if [ -z "$TSTMSG" ]; then |
| 323 | sleep_5 30s |
| 324 | TSTMSG=`${GREP} -l "#TSTMSG$1" $SINKDIR/new/* 2>/dev/null` |
| 325 | if [ -z "$TSTMSG" ]; then |
| 326 | ${ECHO} |
| 327 | ${ECHO} "Delivery of test message failed. Fix qmail or wait" |
| 328 | ${ECHO} "longer and continue with argument \"-s $1\"" |
| 329 | exit 100 |
| 330 | fi |
| 331 | fi |
| 332 | fi |
| 333 | fi |
| 334 | fi |
| 335 | fi |
| 336 | sleep_5 OK |
| 337 | ${ECHO} |
| 338 | ${RM} -f "$TSTMSG" > "${ERR}" 2>&1 || \ |
| 339 | { ${ECHO} "failed to remove test message for section $1"; exit 100; } |
| 340 | TSTMSG='' |
| 341 | return 0 |
| 342 | } |
| 343 | |
| 344 | ######################## |
| 345 | # remove old test list # |
| 346 | ######################## |
| 347 | if [ "$SECT" = "1" ]; then |
| 348 | if [ $USESQL ]; then |
| 349 | ${EZBIN}/ezmlm-unsub "${DIR}/digest" "${MAN}@$HOST" "${DIG}@$HOST" \ |
| 350 | >"${ERR}" 2>&1 |
| 351 | ${EZBIN}/ezmlm-unsub "${DIR}/mod" "${MOD}@$HOST" \ |
| 352 | >"${ERR}" 2>&1 |
| 353 | ${EZBIN}/ezmlm-unsub "${DIR}/${ALLOW}" "aaa@bbb" "ccc@ddd" "eee@fff" \ |
| 354 | >"${ERR}" 2>&1 |
| 355 | fi |
| 356 | ${RM} -rf "${DIR}" ${DOT}* "${ERR}" >/dev/null 2>&1 |
| 357 | fi |
| 358 | ${ECHO} |
| 359 | |
| 360 | ################# |
| 361 | # check version # |
| 362 | ################# |
| 363 | |
| 364 | # assume ezmlm-idx and ezmlm-test are different versions |
| 365 | SAME_VER='n' |
| 366 | |
| 367 | TMP_VER=`${EZBIN}/ezmlm-make -V 2>&1` || \ |
| 368 | { |
| 369 | ${ECHO} "This program only works with ezmlm-idx" |
| 370 | exit 100 |
| 371 | } |
| 372 | # ezmlm-idx-0313 does not support DEFAULT, so no sense testing it |
| 373 | THIS_VER=`${ECHO} "$TMP_VER" | cut -d'+' -f2` |
| 374 | ${ECHO} "$THIS_VER" | ${GREP} "ezmlm-idx" > /dev/null 2>&1 || |
| 375 | THIS_VER=`${ECHO} "$TMP_VER" | cut -d' ' -f4` |
| 376 | |
| 377 | ${ECHO} "testing ezmlm-idx: $THIS_VER" |
| 378 | ${ECHO} "Using FQDN host name: $HOST" |
| 379 | |
| 380 | ${ECHO} "$THIS_VER" | ${GREP} "$OLD_VER" >/dev/null 2>&1 |
| 381 | if [ "$?" = "0" ]; then |
| 382 | DLC='' |
| 383 | DUC='' |
| 384 | EZVER='31' |
| 385 | QMVER='o' |
| 386 | ALLOW='extra' # support old nomenclature |
| 387 | DENY='blacklist' |
| 388 | else |
| 389 | ${ECHO} "$THIS_VER" | ${GREP} "$VER" >/dev/null 2>&1 |
| 390 | if [ "$?" != "0" ]; then |
| 391 | ${ECHO} "Warning: ezmlm-make version is not $VER" |
| 392 | ${ECHO} " test info may not be reliable" |
| 393 | ${ECHO} |
| 394 | fi |
| 395 | ########## should add testing of From line logging for non-0.31x |
| 396 | SW_FROM="-f" |
| 397 | fi |
| 398 | |
| 399 | # Now see if we support old qmail |
| 400 | |
| 401 | ${ECHO} "$THIS_VER" | ${GREP} "ezmlm-idx-0.32" >/dev/null 2>&1 && \ |
| 402 | EZVER='32'; |
| 403 | |
| 404 | if [ "$EZVER" != '31' -a "$EZVER" != '32' -a "$QMVER" = 'o' ]; then |
| 405 | ${ECHO} "Sorry, this version of ezmlm-idx requires qmail>=1.02" |
| 406 | exit 100; |
| 407 | fi |
| 408 | |
| 409 | if [ "$SECT" = "1" ]; then |
| 410 | ############## |
| 411 | # ezmlm-make # |
| 412 | ############## |
| 413 | ${ECHO} -n "ezmlm-make (1/2): " |
| 414 | |
| 415 | # edit non-existant list |
| 416 | ${EZBIN}/ezmlm-make -e -C${EZBIN}/ezmlmrc "${DIR}" "${DOT}" \ |
| 417 | "$LOC" "$HOST" > /dev/null 2>&1 && \ |
| 418 | { ${ECHO} "ezmlm-make failed reject edit of non-existing list:" |
| 419 | exit 100; } |
| 420 | |
| 421 | # make simple test list |
| 422 | ${EZBIN}/ezmlm-make -C${EZBIN}/ezmlmrc "${DIR}" "${DOT}" \ |
| 423 | "$LOC" "$HOST" || \ |
| 424 | { ${ECHO} "ezmlm-make failed to create test list"; exit 100; } |
| 425 | |
| 426 | # remake simple test list which should fail |
| 427 | ${EZBIN}/ezmlm-make -C${EZBIN}/ezmlmrc "${DIR}" "${DOT}" \ |
| 428 | "$LOC" "$HOST" >/dev/null 2>&1 && \ |
| 429 | { ${ECHO} "failed to reject creation of existing list"; exit 100; } |
| 430 | |
| 431 | # edit the list (add digest) |
| 432 | ${EZBIN}/ezmlm-make -+d -C${EZBIN}/ezmlmrc "${DIR}" || \ |
| 433 | { ${ECHO} "ezmlm-make failed to edit test list"; exit 100; } |
| 434 | |
| 435 | # edit the list (add digest) |
| 436 | ${MV} "${DIR}/config" "${DIR}/config~" |
| 437 | ${EZBIN}/ezmlm-make -ed -C${EZBIN}/ezmlmrc "${DIR}" "$DOT" "$LOC" "$HOST" \ |
| 438 | >/dev/null 2>&1 || \ |
| 439 | { ${ECHO} "failed without DIR/config: 0.313 bug, fixed in 0.314." |
| 440 | ${ECHO} -n "ezmlm-make ...... " |
| 441 | BUG="${BUG} config" |
| 442 | } |
| 443 | ${MV} "${DIR}/config~" "${DIR}/config" |
| 444 | |
| 445 | ${GREP} "ezmlm-weed" "${DIR}/bouncer" >/dev/null 2>&1 || \ |
| 446 | { ${ECHO} "no ezmlm-weed in bouncer"; exit 100; } |
| 447 | ${GREP} "ezmlm-return" "${DIR}/bouncer" >/dev/null 2>&1 || \ |
| 448 | { ${ECHO} "no ezmlm-return in bouncer: 0.32 bug, fixed in 0.321." |
| 449 | ${ECHO} -n "ezmlm-make ...... " |
| 450 | BUG="${BUG} return" |
| 451 | } |
| 452 | # digest/bouncer only for >=0.32 |
| 453 | if [ "$EZVER" != '31' ]; then |
| 454 | if [ ! -f "${DIR}/digest/bouncer" ]; then |
| 455 | echo "failed to create digest/bouncer"; exit 100; |
| 456 | fi |
| 457 | ${GREP} "ezmlm-weed" "${DIR}/digest/bouncer" >/dev/null 2>&1 || \ |
| 458 | { ${ECHO} "no ezmlm-weed in bouncer"; exit 100; } |
| 459 | ${GREP} "ezmlm-return" "${DIR}/digest/bouncer" >/dev/null 2>&1 || \ |
| 460 | { ${ECHO} "no ezmlm-return in digest/bouncer: 0.32 bug, OK in 0.321." |
| 461 | ${ECHO} -n "ezmlm-make ...... " |
| 462 | BUG="${BUG} return" |
| 463 | } |
| 464 | fi |
| 465 | ${ECHO} "OK" |
| 466 | |
| 467 | # Add sql files for sql testing |
| 468 | RDBMS='STD' |
| 469 | ${ECHO} -n "Using RDBMS support: " |
| 470 | if [ $USESQL ]; then |
| 471 | ${EZBIN}/ezmlm-make -+6 "$SQLHOST::$SQLUSER:$PW:$DB:$TABLE" \ |
| 472 | -C${EZBIN}/ezmlmrc "${DIR}"|| \ |
| 473 | { ${ECHO} "ezmlm-make failed to add SQL config info"; exit 100; } |
| 474 | |
| 475 | ${STRINGS} ${EZBIN}/ezmlm-sub | ${GREP} -i 'MySQL' >/dev/null 2>&1 && \ |
| 476 | RDBMS='MySQL' |
| 477 | ${STRINGS} ${EZBIN}/ezmlm-sub | ${GREP} -i 'libpq.' >/dev/null 2>&1 && \ |
| 478 | RDBMS='PostgreSQL' |
| 479 | if [ "$RDBMS" = 'STD' ]; then |
| 480 | ${ECHO} "No recognized support. If none, will default to std dbs." |
| 481 | else |
| 482 | ${ECHO} "$RDBMS. Hope empty tables exist." |
| 483 | fi |
| 484 | |
| 485 | else |
| 486 | ${ECHO} "No." |
| 487 | fi |
| 488 | |
| 489 | ############################################################### |
| 490 | # set up subscriber/moderator/sender/digest recipient account # |
| 491 | ############################################################### |
| 492 | ${MKDIR} "$SINKDIR" "$SINKDIR/new" "$SINKDIR/cur" "$SINKDIR/tmp" || \ |
| 493 | { ${ECHO} "mkdir for sinkdir failed"; exit 100; } |
| 494 | ${ECHO} "${SINKDIR}/" > "$DOT-$SINK" |
| 495 | # link for qmail version testing |
| 496 | ${ECHO} '|echo $DEFAULT >' "${DIR}/default" > "$DOT-$SINK-default" |
| 497 | ${ECHO} "${SINKDIR}/" >> "$DOT-$SINK-default" |
| 498 | |
| 499 | ${MKDIR} "$MODDIR" "$MODDIR/new" "$MODDIR/cur" "$MODDIR/tmp" || \ |
| 500 | { ${ECHO} "mkdir for moddir failed"; exit 100; } |
| 501 | ${ECHO} "${MODDIR}/" > "$DOT-$MODACC" |
| 502 | |
| 503 | ${MKDIR} "$MANDIR" "$MANDIR/new" "$MANDIR/cur" "$MANDIR/tmp" || \ |
| 504 | { ${ECHO} "mkdir for mandir failed"; exit 100; } |
| 505 | ${ECHO} "${MANDIR}/" > "$DOT-$MANAG" |
| 506 | |
| 507 | ${MKDIR} "$DIGDIR" "$DIGDIR/new" "$DIGDIR/cur" "$DIGDIR/tmp" || \ |
| 508 | { ${ECHO} "mkdir for digdir failed"; exit 100; } |
| 509 | ${ECHO} "${DIGDIR}/" > "$DOT-$DIGGG" |
| 510 | |
| 511 | fi |
| 512 | |
| 513 | ########################### |
| 514 | # determine qmail version # |
| 515 | ########################### |
| 516 | |
| 517 | if [ "$SECT" != "9" ]; then |
| 518 | |
| 519 | ${ECHO} "Subject: zzz-test" > "${DIR}/__tmp" |
| 520 | /usr/sbin/qmail-local "$EZTEST" "$HOME" "$SND-zzz" "$DASH" \ |
| 521 | "$LIST-$SINK-zzz" "$HOST" \ |
| 522 | "<>" '' < "${DIR}/__tmp" >"${ERR}" 2>&1 || \ |
| 523 | { ${ECHO} "-failed to deliver message with qmail-local"; exit 100; } |
| 524 | |
| 525 | if [ ! -r "${DIR}/default" ]; then |
| 526 | ${ECHO} "qmail-local failed to deliver the message. Can't determine" |
| 527 | ${ECHO} "qmail version" |
| 528 | exit 99 |
| 529 | fi |
| 530 | |
| 531 | if [ `cat "${DIR}/default"` = "zzz" ]; then |
| 532 | if [ -z "$QMVER" ]; then |
| 533 | QMVER="n" |
| 534 | fi |
| 535 | else |
| 536 | if [ -z "$QMVER" ]; then |
| 537 | QMVER="o" |
| 538 | fi |
| 539 | fi |
| 540 | |
| 541 | ${ECHO} -n "testing for qmail: " |
| 542 | if [ "$QMVER" = "n" ]; then |
| 543 | ${ECHO} ">=1.02" |
| 544 | else |
| 545 | ${ECHO} "[any]" |
| 546 | fi |
| 547 | |
| 548 | # if testing for old version, make sure DEFAULT is not defined. If printenv |
| 549 | # is not available, we hope for the best and continue. unset should work ... |
| 550 | # Set BADUNSET if unset doesn't do the job |
| 551 | |
| 552 | A='a' |
| 553 | export A |
| 554 | ${UNSET} A |
| 555 | [ -z "$A" ] || BADUNSET='y' |
| 556 | |
| 557 | ${UNSET} DEFAULT |
| 558 | |
| 559 | if [ "$QMVER" = "o" ]; then |
| 560 | printenv PATH >/dev/null 2>&1 && \ |
| 561 | printenv DEFAULT > /dev/null 2>&1 && \ |
| 562 | { ${ECHO} "Can't test for old version of qmail if DEFAULT is defined. "; |
| 563 | ${ECHO} "Please undefine it."; exit 99; } |
| 564 | fi |
| 565 | |
| 566 | # correct bouncer for our binaries: |
| 567 | ################################### |
| 568 | # NOTE: This is duplicated (and should be) after next ezmlm-make block. |
| 569 | ${ECHO} "|/${EZBIN}/ezmlm-weed" > "${DIR}/bouncer" |
| 570 | ${ECHO} "|/${EZBIN}/ezmlm-weed" > "${DIR}/digest/bouncer" |
| 571 | if [ "$EZVER" = "31" ]; then # autodetecting bouncer for 0.31x |
| 572 | ${ECHO} "|/${EZBIN}/ezmlm-return '${DIR}'" >> "${DIR}/bouncer" |
| 573 | ${ECHO} "|/${EZBIN}/ezmlm-return '${DIR}'" >> "${DIR}/digest/bouncer" |
| 574 | else # split bouncer with args for later versions |
| 575 | # edited for ezmlm-new |
| 576 | ${ECHO} "|/${EZBIN}/ezmlm-return '${DIR}'" >> "${DIR}/bouncer" |
| 577 | ${ECHO} "|/${EZBIN}/ezmlm-return '${DIR}'" >> "${DIR}/digest/bouncer" |
| 578 | fi |
| 579 | |
| 580 | # if testing qmail>=1.02, remove inlocal/inhost - shouldn't be used |
| 581 | if [ "$QMVER" = "n" ]; then |
| 582 | ${RM} -f "${DIR}/inlocal" "${DIR}/inhost" > /dev/null || \ |
| 583 | { ${ECHO} "failed to remove inlocal/inhost for testlist"; exit 100; } |
| 584 | fi |
| 585 | |
| 586 | ########################### |
| 587 | # set up bouncing account # |
| 588 | ########################### |
| 589 | ${ECHO} "|${GREP} 'MAILER-DAEMON' >/dev/null && exit 99" > "$DOT-$BOUNCE" |
| 590 | ${ECHO} "|exit 100" > "$DOT-$BOUNCE" |
| 591 | |
| 592 | fi |
| 593 | |
| 594 | ################################################### |
| 595 | # account to receive digests and archive excerpts # |
| 596 | ################################################### |
| 597 | |
| 598 | if [ "$SECT" = "1" ]; then |
| 599 | |
| 600 | ##################### |
| 601 | # test ezmlm-reject # |
| 602 | ##################### |
| 603 | ${ECHO} -n "ezmlm-reject: " |
| 604 | FROM="$EZTEST" |
| 605 | TO="$EZTEST-__tstlist@$HOST" |
| 606 | SUBJECT="test" |
| 607 | CONTENT="multipart/mixed" |
| 608 | CC="<>" |
| 609 | BODY='' |
| 610 | |
| 611 | # with directory |
| 612 | make_message | ${EZBIN}/ezmlm-reject "${DIR}" || \ |
| 613 | { ${ECHO} "failed to accept good message with dir"; \ |
| 614 | exit 100; } |
| 615 | # without directory |
| 616 | |
| 617 | make_message | ${EZBIN}/ezmlm-reject || \ |
| 618 | { ${ECHO} "failed to accept good message without dir: $?"; \ |
| 619 | exit 100; } |
| 620 | |
| 621 | #too small |
| 622 | ${ECHO} "5000:1000" > "${DIR}/msgsize" |
| 623 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}" 2>&1` && \ |
| 624 | { ${ECHO} "ezmlm-reject failed to reject too small message"; \ |
| 625 | exit 100; } |
| 626 | |
| 627 | # just right |
| 628 | ${ECHO} "500:5" > "${DIR}/msgsize" |
| 629 | make_message | ${EZBIN}/ezmlm-reject "${DIR}" || \ |
| 630 | { ${ECHO} "failed to accept message of ok size"; \ |
| 631 | exit 100; } |
| 632 | |
| 633 | #too large |
| 634 | ${ECHO} "20:10" > "${DIR}/msgsize" |
| 635 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}" 2>&1` && \ |
| 636 | { ${ECHO} "ezmlm-reject failed to reject too large message"; \ |
| 637 | exit 100; } |
| 638 | |
| 639 | # restore |
| 640 | ${RM} -f "${DIR}/msgsize" |
| 641 | |
| 642 | # without subject |
| 643 | SUBJECT='' |
| 644 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}" 2>&1` && \ |
| 645 | { ${ECHO} "ezmlm-reject failed to reject message without subject"; \ |
| 646 | exit 100; } |
| 647 | OUT=`make_message | ${EZBIN}/ezmlm-reject 2>&1` && \ |
| 648 | { ${ECHO} "ezmlm-reject failed to reject message without subject"; \ |
| 649 | exit 100; } |
| 650 | |
| 651 | # with empty subject |
| 652 | SUBJECT='(NUll)' |
| 653 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}" 2>&1` && \ |
| 654 | { ${ECHO} "ezmlm-reject failed to reject null subject"; \ |
| 655 | exit 100; } |
| 656 | OUT=`make_message | ${EZBIN}/ezmlm-reject 2>&1` && \ |
| 657 | { ${ECHO} "ezmlm-reject failed to reject null subject"; \ |
| 658 | exit 100; } |
| 659 | |
| 660 | # testing -S |
| 661 | OUT=`make_message | ${EZBIN}/ezmlm-reject -S "${DIR}"` || \ |
| 662 | { ${ECHO} "-S switch failed with dir"; exit 100; } |
| 663 | OUT=`make_message | ${EZBIN}/ezmlm-reject -S ` || \ |
| 664 | { ${ECHO} "-S switch failed without dir"; exit 100; } |
| 665 | |
| 666 | # with command subject |
| 667 | SUBJECT='REmOVE' |
| 668 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}" 2>&1` && \ |
| 669 | { ${ECHO} "failed to reject command subject with dir"; \ |
| 670 | exit 100; } |
| 671 | OUT=`make_message | ${EZBIN}/ezmlm-reject 2>&1` && \ |
| 672 | { ${ECHO} "failed to reject command subject without dir"; \ |
| 673 | exit 100; } |
| 674 | |
| 675 | # testing -C |
| 676 | OUT=`make_message | ${EZBIN}/ezmlm-reject -C "${DIR}"` || \ |
| 677 | { ${ECHO} "-C switch failed with dir"; exit 100; } |
| 678 | OUT=`make_message | ${EZBIN}/ezmlm-reject -C ` || \ |
| 679 | { ${ECHO} "-C switch failed without dir"; exit 100; } |
| 680 | |
| 681 | SUBJECT='test' |
| 682 | |
| 683 | # Test with list name in Cc: |
| 684 | CC="$TO" |
| 685 | TO="nobody@$HOST" |
| 686 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}"` || \ |
| 687 | { ${ECHO} "failed to accept good Cc: with dir"; \ |
| 688 | exit 100; } |
| 689 | OUT=`make_message | ${EZBIN}/ezmlm-reject` || \ |
| 690 | { ${ECHO} "failed to accept good Cc: without dir"; \ |
| 691 | exit 100; } |
| 692 | |
| 693 | # Bad To/Cc |
| 694 | CC="$TO" |
| 695 | OUT=`make_message "$MESSAGE" | ${EZBIN}/ezmlm-reject "${DIR}" 2>&1` && \ |
| 696 | { ${ECHO} "failed to reject bad To/Cc with dir"; \ |
| 697 | exit 100; } |
| 698 | if [ "$?" != "100" ]; then |
| 699 | ${ECHO} "failed to exit 100 on error"; exit 100 |
| 700 | fi |
| 701 | OUT=`make_message "$MESSAGE" | ${EZBIN}/ezmlm-reject -q "${DIR}" 2>&1` && \ |
| 702 | { ${ECHO} "failed to reject bad To/Cc with dir"; \ |
| 703 | exit 100; } |
| 704 | if [ "$?" -ne "99" ]; then |
| 705 | ${ECHO} "-q failed"; exit 100 |
| 706 | fi |
| 707 | |
| 708 | # for backwards-compatibility and since we don't know inlocal@inhost without |
| 709 | # dir, ezmlm-reject doesn't check To/Cc when there is no dir |
| 710 | OUT=`make_message "$MESSAGE" | ${EZBIN}/ezmlm-reject` || \ |
| 711 | { ${ECHO} "failed to accept bad To/Cc without dir"; \ |
| 712 | exit 100; } |
| 713 | |
| 714 | # testing -T |
| 715 | OUT=`make_message | ${EZBIN}/ezmlm-reject -T "${DIR}"` || \ |
| 716 | { ${ECHO} "-T switch failed with dir"; exit 100; } |
| 717 | OUT=`make_message | ${EZBIN}/ezmlm-reject -T ` || \ |
| 718 | { ${ECHO} "-T switch failed without dir"; exit 100; } |
| 719 | |
| 720 | # restore good TO |
| 721 | TO="$EZTEST-__tstlist@$HOST" |
| 722 | |
| 723 | # if part is mimereject message should be rejected |
| 724 | touch "${DIR}"/mimeremove |
| 725 | ${ECHO} "text/html" > "${DIR}"/mimereject |
| 726 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}" 2>&1` && \ |
| 727 | { ${ECHO} "mimereject failed with dir"; exit 100; } |
| 728 | OUT=`make_message | ${EZBIN}/ezmlm-reject` || \ |
| 729 | { ${ECHO} "mimereject without dir"; exit 100; } |
| 730 | |
| 731 | # if part is removed ezmlm-reject should not reject |
| 732 | ${ECHO} "tExt/htMl" > "${DIR}"/mimeremove |
| 733 | ${ECHO} "" > "${DIR}"/mimereject |
| 734 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}"` || \ |
| 735 | { ${ECHO} "mimeremove failed with dir"; exit 100; } |
| 736 | OUT=`make_message | ${EZBIN}/ezmlm-reject` || \ |
| 737 | { ${ECHO} "mimeremove without dir"; exit 100; } |
| 738 | |
| 739 | # test content-type with something after boundary=xxx |
| 740 | AFTERBOUND=';micalg=pgp-md5' |
| 741 | ${ECHO} "text/html" > "${DIR}"/mimereject |
| 742 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}" 2>&1` && \ |
| 743 | { ${ECHO} "err with text after boundary: 0.30 bug fixed in 0.322" |
| 744 | ${ECHO} -n "ezmlm-reject....... " |
| 745 | BUG="${BUG} reject_bound" |
| 746 | } |
| 747 | |
| 748 | # restore |
| 749 | ${RM} "${DIR}"/mimereject |
| 750 | AFTERBOUND='' |
| 751 | |
| 752 | # if entire message is mimeremove type is should be rejected |
| 753 | ${ECHO} "multipart/mixed" > "${DIR}"/mimeremove |
| 754 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}" 2>&1` && \ |
| 755 | { ${ECHO} "mimereject failed with dir"; exit 100; } |
| 756 | OUT=`make_message | ${EZBIN}/ezmlm-reject` || \ |
| 757 | { ${ECHO} "mimereject without dir"; exit 100; } |
| 758 | |
| 759 | # restore |
| 760 | ${RM} "${DIR}"/mimeremove |
| 761 | |
| 762 | # test headerreject |
| 763 | ${ECHO} "Content-TYPE" > "${DIR}"/headerreject |
| 764 | OUT=`make_message | ${EZBIN}/ezmlm-reject -H "${DIR}"` || \ |
| 765 | { ${ECHO} "headerreject -H failed with dir"; exit 100; } |
| 766 | OUT=`make_message | ${EZBIN}/ezmlm-reject -h "${DIR}" 2>&1` && \ |
| 767 | { ${ECHO} "headerreject failed with dir"; exit 100; } |
| 768 | OUT=`make_message | ${EZBIN}/ezmlm-reject` || \ |
| 769 | { ${ECHO} "headerreject failed without dir"; exit 100; } |
| 770 | OUT=`make_message | ${EZBIN}/ezmlm-reject -h 2>&1` && \ |
| 771 | { ${ECHO} "-h was accepted without dir"; exit 100; } |
| 772 | |
| 773 | # Suppress content-type header |
| 774 | CONTENT='' |
| 775 | OUT=`make_message | ${EZBIN}/ezmlm-reject "${DIR}"` || \ |
| 776 | { ${ECHO} "headerreject rejected even though header isn't there"; \ |
| 777 | exit 100; } |
| 778 | |
| 779 | CONTENT='multIpart/mIXed' |
| 780 | |
| 781 | ${ECHO} "OK" |
| 782 | ############################### |
| 783 | # ezmlm-sub/unsub/list/issubn # |
| 784 | ############################### |
| 785 | |
| 786 | ${ECHO} -n "ezmlm-[un|is]sub[n]: " |
| 787 | |
| 788 | SENDER="XYZZY@HOst"; export SENDER |
| 789 | |
| 790 | # With mysql testing, there may be junk left from earlier testing that |
| 791 | # gives false positives in testing. Make sure it's detected |
| 792 | ${EZBIN}/ezmlm-list "${DIR}" >/dev/null || \ |
| 793 | { ${ECHO} "ezmlm-list: failed"; exit 100; } |
| 794 | |
| 795 | ${EZBIN}/ezmlm-list "${DIR}" | ${GREP} '@' >/dev/null 2>&1 && \ |
| 796 | { ${ECHO} "already addresses in table - please remove and start again"; |
| 797 | exit 100; } |
| 798 | |
| 799 | ${EZBIN}/ezmlm-list "${DIR}/digest" | ${GREP} '@' >/dev/null 2>&1 && \ |
| 800 | { ${ECHO} "already addresses in table - please remove and start again"; |
| 801 | exit 100; } |
| 802 | |
| 803 | ${EZBIN}/ezmlm-list "${DIR}/${ALLOW}" | ${GREP} '@' >/dev/null 2>&1 && \ |
| 804 | { ${ECHO} "already addresses in table - please remove and start again"; |
| 805 | exit 100; } |
| 806 | |
| 807 | # not subscriber. Test default |
| 808 | ${EZBIN}/ezmlm-issubn "${DIR}" "${DIR}/${ALLOW}" && \ |
| 809 | { ${ECHO} "ezmlm-issubn: failed: exit 0 on non-subscriber"; exit 100; } |
| 810 | |
| 811 | # not subscriber. Test -n |
| 812 | ${EZBIN}/ezmlm-issubn -n "${DIR}" "${DIR}/${ALLOW}" || \ |
| 813 | { ${ECHO} "ezmlm-issubn: -n failed for non-subscriber"; exit 100; } |
| 814 | |
| 815 | # add subscriber |
| 816 | ${EZBIN}/ezmlm-sub "${DIR}" "xyZZy@hoSt" || \ |
| 817 | { ${ECHO} "ezmlm-sub: failed to add subscriber"; exit 100; } |
| 818 | |
| 819 | # is subscriber. Test default |
| 820 | ${EZBIN}/ezmlm-issubn "${DIR}" "${DIR}/${ALLOW}" || \ |
| 821 | { ${ECHO} "ezmlm-issubn: failed: exit false for subscriber"; exit 100; } |
| 822 | |
| 823 | # is subscriber. Test -n |
| 824 | ${EZBIN}/ezmlm-issubn -n "${DIR}" "${DIR}/${ALLOW}" && \ |
| 825 | { ${ECHO} "ezmlm-issubn: -n failed for subscriber"; exit 100; } |
| 826 | |
| 827 | # add to allow |
| 828 | ${EZBIN}/ezmlm-sub "${DIR}/${ALLOW}" "ZZtop@hoSt" || \ |
| 829 | { ${ECHO} "ezmlm-sub: failed to add address to ${DIR}/${ALLOW}"; exit 100; } |
| 830 | |
| 831 | # list subscribers |
| 832 | ${EZBIN}/ezmlm-list "${DIR}" | ${GREP} "xyZZy" >"${ERR}" 2>&1 || \ |
| 833 | { ${ECHO} "ezmlm-list: failed to list subscribers"; exit 100; } |
| 834 | |
| 835 | # remove subscriber |
| 836 | ${EZBIN}/ezmlm-unsub "${DIR}" "xYzZy@hOst" || \ |
| 837 | { ${ECHO} "ezmlm-sub: failed to add subscriber"; exit 100; } |
| 838 | |
| 839 | # see that it was removed |
| 840 | ${EZBIN}/ezmlm-list "${DIR}" | ${GREP} "xyZZy" >"${ERR}" 2>&1 && \ |
| 841 | { ${ECHO} "ezmlm-unsub: failed to remove subscriber"; exit 100; } |
| 842 | |
| 843 | SENDER="zztop@HOst"; export SENDER |
| 844 | |
| 845 | # check for address in allow |
| 846 | ${EZBIN}/ezmlm-issubn "${DIR}" "${DIR}/${ALLOW}" || \ |
| 847 | { ${ECHO} "ezmlm-sub/issubn: failed to add/look in 2nd db"; exit 100; } |
| 848 | |
| 849 | # remove (multiple) (non)existing addresses from allow |
| 850 | ${EZBIN}/ezmlm-unsub "${DIR}/${ALLOW}" "xYzZy@hOst" "zZToP@HOSt" || \ |
| 851 | { ${ECHO} "ezmlm-unsub: failed to remove subscriber"; exit 100; } |
| 852 | |
| 853 | # verify removal |
| 854 | ${EZBIN}/ezmlm-issubn "${DIR}" "${DIR}/${ALLOW}" && \ |
| 855 | { ${ECHO} "ezmlm-unsub/issubn: failed to remove address"; exit 100; } |
| 856 | |
| 857 | # clean up |
| 858 | LOCAL=''; export LOCAL |
| 859 | |
| 860 | ${ECHO} "OK" |
| 861 | ############## |
| 862 | # ezmlm-send # |
| 863 | ############## |
| 864 | ${ECHO} -n "ezmlm-send (1/2): " |
| 865 | |
| 866 | SENDER="${SND}@$HOST"; export SENDER |
| 867 | ${EZBIN}/ezmlm-sub "${DIR}" "$SENDER" |
| 868 | # set up prefix |
| 869 | ${ECHO} "[PFX]" > "${DIR}/prefix" |
| 870 | # set up trailer |
| 871 | { ${ECHO} "--- TRAILER ---"; ${ECHO}; } > "${DIR}/text/trailer" |
| 872 | # test |
| 873 | { ${ECHO} "X-num: msg1"; make_message; } | \ |
| 874 | ${EZBIN}/ezmlm-send "${DIR}" >"${ERR}" 2>&1 || \ |
| 875 | { ${ECHO} "failed to accept normal message"; exit 100; } |
| 876 | if [ `cat "${DIR}/num"` != "1:1" ]; then |
| 877 | ${ECHO} "failed to create num for normal message 1"; exit 100; |
| 878 | fi |
| 879 | if [ ! -x "${DIR}/archive/0/01" ]; then |
| 880 | { ${ECHO} "failed to archive normal message"; exit 100; } |
| 881 | fi |
| 882 | ${GREP} "1:" "${DIR}/archive/0/index" >/dev/null 2>&1 || \ |
| 883 | { ${ECHO} "failed to index archive"; exit 100; } |
| 884 | |
| 885 | ${RM} -f "${DIR}/indexed" |
| 886 | ${RM} -f "${DIR}/archived" |
| 887 | |
| 888 | # test to see that trailer is added to nom-mime messages |
| 889 | CONTENT='' |
| 890 | { echo "X-num: msg5"; make_message; } | \ |
| 891 | ${EZBIN}/ezmlm-send "${DIR}" >"${ERR}" 2>&1 || \ |
| 892 | { ${ECHO} "failed to accept non-mime message"; exit 100; } |
| 893 | |
| 894 | # test to see that trailer is suppressed for multipart/signed |
| 895 | CONTENT='multipart/signed' |
| 896 | { echo "X-num: msg6"; make_message; } | \ |
| 897 | ${EZBIN}/ezmlm-send "${DIR}" >"${ERR}" 2>&1 || \ |
| 898 | { ${ECHO} "failed to accept multipart/signed message"; exit 100; } |
| 899 | |
| 900 | # restore |
| 901 | CONTENT='multipart/mixed' |
| 902 | |
| 903 | # test content-type with something after boundary=xxx |
| 904 | AFTERBOUND=';micalg=pgp-md5' |
| 905 | ${ECHO} "text/html" > "${DIR}"/mimeremove |
| 906 | make_message | ${EZBIN}/ezmlm-send "${DIR}" >"${ERR}" 2>&1 || \ |
| 907 | { ${ECHO} "err with text after boundary: 0.30 bug fixed in 0.322" |
| 908 | ${ECHO} -n "ezmlm-send......... " |
| 909 | BUG="${BUG} send_bound" |
| 910 | } |
| 911 | # restore |
| 912 | AFTERBOUND='' |
| 913 | ${ECHO} "1:1" > "${DIR}/num" |
| 914 | ${RM} "${DIR}"/mimeremove |
| 915 | |
| 916 | # -r => don't trim received headers |
| 917 | { ${ECHO} "X-num: msg2"; make_message; } | \ |
| 918 | ${EZBIN}/ezmlm-send -r "${DIR}" >"${ERR}" 2>&1 || \ |
| 919 | { ${ECHO} "failed to accept normal message 2"; exit 100; } |
| 920 | |
| 921 | ${GREP} "2:" "${DIR}/archive/0/index" >/dev/null 2>&1 && \ |
| 922 | { ${ECHO} "indexed message with DIR/indexed missing"; exit 100; } |
| 923 | ${GREP} "msg2" ${DIR}/archive/0/* >/dev/null 2>&1 && \ |
| 924 | { ${ECHO} "archived message with DIR/archived missing"; exit 100; } |
| 925 | |
| 926 | # -C eliminate SENDER from addressees |
| 927 | { ${ECHO} "X-num: msg3"; make_message; } | \ |
| 928 | ${EZBIN}/ezmlm-send -C "${DIR}" >"${ERR}" 2>&1 || \ |
| 929 | { ${ECHO} "failed to accept normal message 3"; exit 100; } |
| 930 | ${EZBIN}/ezmlm-unsub "${DIR}" "$SENDER" |
| 931 | |
| 932 | # make sure headerremove was done |
| 933 | ${GREP} -i 'return-receipt-to' < "${DIR}/archive/0/01" >/dev/null && |
| 934 | { ${ECHO} "failed to remove headerremove"; exit 100; } |
| 935 | # test mimeremove |
| 936 | touch "${DIR}/archived" "${DIR}/indexed" |
| 937 | ${ECHO} "teXT/hTml" > "${DIR}/mimeremove" |
| 938 | { ${ECHO} "X-num: msg4"; make_message; } | \ |
| 939 | ${EZBIN}/ezmlm-send "${DIR}" >"${ERR}" 2>&1 || \ |
| 940 | { ${ECHO} "failed to accept mimeremove message"; exit 100; } |
| 941 | ${GREP} -i 'text/html' < "${DIR}/archive/0/04" >/dev/null && |
| 942 | { ${ECHO} "failed to remove mimeremove part"; exit 100; } |
| 943 | |
| 944 | ${ECHO} "OK" |
| 945 | ################ |
| 946 | # ezmlm-tstdig # |
| 947 | ################ |
| 948 | ${ECHO} -n "ezmlm-tstdig: " |
| 949 | |
| 950 | ${EZBIN}/ezmlm-tstdig -k2 -m5 -t1 "${DIR}" || \ |
| 951 | { ${ECHO} "-t1 failed"; exit 100; } |
| 952 | ${EZBIN}/ezmlm-tstdig -k2 -m5 -t0 "${DIR}" && \ |
| 953 | { ${ECHO} "-t0 failed"; exit 100; } |
| 954 | |
| 955 | LOCAL="$LOC-xx"; export LOCAL |
| 956 | if [ "$QMVER" = "n" ]; then |
| 957 | DEFAULT='xx'; export DEFAULT |
| 958 | fi |
| 959 | ${EZBIN}/ezmlm-tstdig -k2 -m5 -t0 "${DIR}" || \ |
| 960 | { ${ECHO} "problem with -xx in manager position"; exit 100; } |
| 961 | LOCAL="$LOC-dig."; export LOCAL |
| 962 | if [ "$QMVER" = "n" ]; then |
| 963 | DEFAULT='dig.'; export DEFAULT |
| 964 | fi |
| 965 | ${EZBIN}/ezmlm-tstdig -k2 -m5 -t0 "${DIR}" && \ |
| 966 | { ${ECHO} "problem with -dig in manager position"; exit 100; } |
| 967 | LOCAL="$LOC-digest-"; export LOCAL |
| 968 | if [ "$QMVER" = "n" ]; then |
| 969 | DEFAULT='digest-'; export DEFAULT |
| 970 | fi |
| 971 | ${EZBIN}/ezmlm-tstdig -k2 -m5 -t0 "${DIR}" || \ |
| 972 | { ${ECHO} "err with -digest- in mgr pos: 0.31 bug fixed in 0.321" |
| 973 | ${ECHO} -n "ezmlm-tstdig....... " |
| 974 | BUG="${BUG} digest" |
| 975 | } |
| 976 | LOCAL=''; export LOCAL |
| 977 | if [ "$QMVER" = "n" ]; then |
| 978 | unset DEFAULT |
| 979 | fi |
| 980 | ${EZBIN}/ezmlm-tstdig -k2 -m4 -t1 "${DIR}" || \ |
| 981 | { ${ECHO} "-m failed"; exit 100; } |
| 982 | ${EZBIN}/ezmlm-tstdig -k1 -m5 -t0 "${DIR}" || \ |
| 983 | { ${ECHO} "-k failed"; exit 100; } |
| 984 | LOCAL="$LOC"; export LOCAL |
| 985 | ${EZBIN}/ezmlm-tstdig -k1 -m5 -t0 "${DIR}" > "${ERR}" 2>&1 || \ |
| 986 | { |
| 987 | ${ECHO} "problem with DEFAULT unset: 0.32 bug, OK in 0.321." |
| 988 | ${ECHO} -n "ezmlm-tstdig....... " |
| 989 | BUG="${BUG} tstdig" |
| 990 | } |
| 991 | ${ECHO} "OK" |
| 992 | |
| 993 | ############## |
| 994 | # ezmlm-weed # |
| 995 | ############## |
| 996 | |
| 997 | ${ECHO} -n "ezmlm-weed: " |
| 998 | |
| 999 | ${ECHO} "Subject: test" | ${EZBIN}/ezmlm-weed || \ |
| 1000 | { ${ECHO} "failed to accept good message"; exit 100; } |
| 1001 | ${ECHO} "Subject: success notice" | ${EZBIN}/ezmlm-weed >/dev/null 2>&1 && \ |
| 1002 | { ${ECHO} "failed to reject bad message"; exit 100; } |
| 1003 | |
| 1004 | ${ECHO} "OK" |
| 1005 | |
| 1006 | ############## |
| 1007 | # ezmlm-make # |
| 1008 | ############## |
| 1009 | ${ECHO} -n "ezmlm-make (2/2): " |
| 1010 | |
| 1011 | # make sure a few ezmlm-make switches work |
| 1012 | ${EZBIN}/ezmlm-make -+qkgu -C${EZBIN}/ezmlmrc "${DIR}" || \ |
| 1013 | { ${ECHO} "failed to edit test list to +qkgu"; exit 100; } |
| 1014 | ${GREP} "${DENY}" "${DIR}/editor" >/dev/null 2>&1 || \ |
| 1015 | { ${ECHO} "failed to implement -k for list"; exit 100; } |
| 1016 | ${GREP} "ezmlm-request" "${DIR}/manager" >/dev/null 2>&1 || \ |
| 1017 | { ${ECHO} "failed to implement -q for list"; exit 100; } |
| 1018 | ${GREP} "ezmlm-get -s" "${DIR}/manager" >/dev/null 2>&1 || \ |
| 1019 | { ${ECHO} "failed to implement -g for list"; exit 100; } |
| 1020 | ${GREP} "${ALLOW}" "${DIR}/editor" >/dev/null 2>&1 || \ |
| 1021 | { ${ECHO} "failed to implement -u for list"; exit 100; } |
| 1022 | |
| 1023 | ${EZBIN}/ezmlm-make -+QKGU -C${EZBIN}/ezmlmrc "${DIR}" || \ |
| 1024 | { ${ECHO} "failed to edit test list to +QKGU"; exit 100; } |
| 1025 | ${GREP} "${DENY}" "${DIR}/editor" >/dev/null 2>&1 && \ |
| 1026 | { ${ECHO} "failed to implement -K for list"; exit 100; } |
| 1027 | ${GREP} "ezmlm-request" "${DIR}/manager" >/dev/null 2>&1 && \ |
| 1028 | { ${ECHO} "failed to implement -Q for list"; exit 100; } |
| 1029 | ${GREP} "ezmlm-get -s" "${DIR}/manager" >/dev/null 2>&1 && \ |
| 1030 | { ${ECHO} "failed to implement -G for list"; exit 100; } |
| 1031 | ${GREP} "${ALLOW}" "${DIR}/editor" >/dev/null 2>&1 && \ |
| 1032 | { ${ECHO} "failed to implement -U for list"; exit 100; } |
| 1033 | |
| 1034 | # edit the list (add moderation and remove admin) |
| 1035 | ${EZBIN}/ezmlm-make -+rsm -C${EZBIN}/ezmlmrc "${DIR}" || \ |
| 1036 | { ${ECHO} "failed to edit test list to +rsm"; exit 100; } |
| 1037 | # edit the list (add text file editing and list/log) |
| 1038 | ${EZBIN}/ezmlm-make -+ln -C${EZBIN}/ezmlmrc "${DIR}" || \ |
| 1039 | { ${ECHO} "failed to edit test list to +ln"; exit 100; } |
| 1040 | |
| 1041 | # Now to create our own manager for later tests: |
| 1042 | |
| 1043 | ${ECHO} "|${GREP} 'req1' >/dev/null 2>&1 && { ${ECHO} \"\$LOCAL\" >> '${REQ}'; exit 99; }; exit 0" > "${DIR}/manager" |
| 1044 | ${ECHO} "|${EZBIN}/ezmlm-manage -le ${SW_FROM} '${DIR}'" >> "${DIR}/manager" |
| 1045 | ${ECHO} "OK" |
| 1046 | |
| 1047 | # correct bouncer for our binaries: |
| 1048 | ################################### |
| 1049 | ${ECHO} "|/${EZBIN}/ezmlm-weed" > "${DIR}/bouncer" |
| 1050 | ${ECHO} "|/${EZBIN}/ezmlm-weed" > "${DIR}/digest/bouncer" |
| 1051 | if [ "$EZVER" = "31" ]; then # autodetecting bouncer for 0.31x |
| 1052 | ${ECHO} "|/${EZBIN}/ezmlm-return '${DIR}'" >> "${DIR}/bouncer" |
| 1053 | ${ECHO} "|/${EZBIN}/ezmlm-return '${DIR}'" >> "${DIR}/digest/bouncer" |
| 1054 | else # split bouncer with args for later versions |
| 1055 | ${ECHO} "|/${EZBIN}/ezmlm-return -D '${DIR}'" >> "${DIR}/bouncer" |
| 1056 | ${ECHO} "|/${EZBIN}/ezmlm-return -d '${DIR}'" >> "${DIR}/digest/bouncer" |
| 1057 | fi |
| 1058 | |
| 1059 | # if testing qmail>=1.02, remove inlocal/inhost - shouldn't be used |
| 1060 | if [ "$QMVER" = "n" ]; then |
| 1061 | ${RM} -f "${DIR}/inlocal" "${DIR}/inhost" > /dev/null || \ |
| 1062 | { ${ECHO} "failed to remove inlocal/inhost for testlist"; exit 100; } |
| 1063 | fi |
| 1064 | |
| 1065 | |
| 1066 | ############### |
| 1067 | # ezmlm-clean # |
| 1068 | ############### |
| 1069 | |
| 1070 | ${ECHO} -n "ezmlm-clean (1/2): " |
| 1071 | |
| 1072 | # clean1 should be silently removed (no -x). |
| 1073 | # clean2 should result in a message |
| 1074 | # clean3 should not since it's time hasn't come |
| 1075 | # clean4 should be removed, but not result in a message since we use -R |
| 1076 | |
| 1077 | ${ECHO} "Return-Path: <${DIG}@$HOST>" > "${DIR}/mod/pending/1" |
| 1078 | ${ECHO} "X-num: clean1" >> "${DIR}/mod/pending/1" |
| 1079 | ${ECHO} "Return-Path: <${DIG}@${HOST}>" > "${DIR}/mod/pending/2" |
| 1080 | ${ECHO} "X-num: clean2" >> "${DIR}/mod/pending/2" |
| 1081 | ${ECHO} "Return-Path: <${DIG}@$HOST>" > "${DIR}/mod/pending/999999999" |
| 1082 | ${ECHO} "X-num: clean3" >> "${DIR}/mod/pending/999999999" |
| 1083 | |
| 1084 | chmod +x "${DIR}/mod/pending/2" "${DIR}/mod/pending/999999999" |
| 1085 | |
| 1086 | ${EZBIN}/ezmlm-clean "${DIR}" >"${ERR}" 2>&1 || |
| 1087 | { ${ECHO} "failed first invocation"; exit 100; } |
| 1088 | if [ -r "${DIR}/mod/pending/1" ]; then |
| 1089 | ${ECHO} "failed to remove non-x moderation queue entry 1" |
| 1090 | exit 100 |
| 1091 | fi |
| 1092 | if [ -r "${DIR}/mod/pending/2" ]; then |
| 1093 | ${ECHO} "failed to remove moderation queue entry 2" |
| 1094 | exit 100 |
| 1095 | fi |
| 1096 | if [ ! -r "${DIR}/mod/pending/999999999" ]; then |
| 1097 | ${ECHO} "removed mod queue entry 3 that wasn't due" |
| 1098 | exit 100 |
| 1099 | fi |
| 1100 | |
| 1101 | ${ECHO} <<EOF > "${DIR}/mod/pending/4" |
| 1102 | Return-Path: <${DIG}@$HOST> |
| 1103 | X-num: clean4 |
| 1104 | EOF |
| 1105 | chmod +x "${DIR}/mod/pending/4" |
| 1106 | ${EZBIN}/ezmlm-clean -R "${DIR}" >"${ERR}" 2>&1 || |
| 1107 | { ${ECHO} "-R failed"; exit 100; } |
| 1108 | if [ -r "${DIR}/mod/pending/4" ]; then |
| 1109 | ${ECHO} "failed to remove moderation queue entry 4"; exit 100 |
| 1110 | fi |
| 1111 | |
| 1112 | ${ECHO} "OK" |
| 1113 | |
| 1114 | ############### |
| 1115 | # ezmlm-store # |
| 1116 | ############### |
| 1117 | |
| 1118 | ${ECHO} -n "ezmlm-store (1/2): " |
| 1119 | |
| 1120 | SENDER="${SND}@$HOST"; export SENDER |
| 1121 | ${EZBIN}/ezmlm-sub "${DIR}/mod" "$SENDER" |
| 1122 | |
| 1123 | # message from mod, normal use -> should queue |
| 1124 | { ${ECHO} "X-num: mod1"; make_message; } > ${TMP}; |
| 1125 | ${EZBIN}/ezmlm-store "${DIR}" >"${ERR}" 2>&1 < ${TMP} || \ |
| 1126 | { ${ECHO} "failed to process message 1"; exit 100; } |
| 1127 | |
| 1128 | cat ${DIR}/mod/pending/* | ${GREP} "mod1" > /dev/null || \ |
| 1129 | { ${ECHO} "failed to queue message 1"; exit 100; } |
| 1130 | |
| 1131 | ${RM} -f "${DIR}/modpost" |
| 1132 | |
| 1133 | # no modpost - should go directly to list |
| 1134 | { ${ECHO} "X-num: mod2"; make_message; } > ${TMP}; |
| 1135 | ${EZBIN}/ezmlm-store "${DIR}" >"${ERR}" 2>&1 < ${TMP} || \ |
| 1136 | { |
| 1137 | ${GREP} -v "child" "${ERR}" > /dev/null 2>&1 |
| 1138 | if [ "$?" != "0" ]; then |
| 1139 | ${ECHO} "Failed to process message mod2"; exit 100 |
| 1140 | else |
| 1141 | EZFORK='no' |
| 1142 | fi |
| 1143 | } |
| 1144 | |
| 1145 | cat ${DIR}/mod/pending/* | ${GREP} "mod2" > /dev/null && \ |
| 1146 | { ${ECHO} "queued message 2 despite non-modpost"; exit 100; } |
| 1147 | |
| 1148 | if [ -z "$EZFORK" ]; then |
| 1149 | cat ${DIR}/archive/0/* | ${GREP} "mod2" > /dev/null || \ |
| 1150 | { ${ECHO} "failed to archive message 2 (non-modpost)"; exit 100; } |
| 1151 | fi |
| 1152 | |
| 1153 | touch "${DIR}/modpost" |
| 1154 | |
| 1155 | # from moderator. Should be queued, even with -P |
| 1156 | { ${ECHO} "X-num: mod3"; make_message; } > ${TMP}; |
| 1157 | ${EZBIN}/ezmlm-store -P "${DIR}" >"${ERR}" 2>&1 < ${TMP} || \ |
| 1158 | { ${ECHO} "-P failed to accept mods post 3"; exit 100; } |
| 1159 | |
| 1160 | cat ${DIR}/mod/pending/* | ${GREP} "mod3" > /dev/null || \ |
| 1161 | { ${ECHO} "failed to queue message 3"; exit 100; } |
| 1162 | |
| 1163 | ${EZBIN}/ezmlm-unsub "${DIR}/mod" "$SENDER" |
| 1164 | |
| 1165 | # not from moderator, should be rejected directly with -P |
| 1166 | { ${ECHO} "X-num: mod4"; make_message; } > ${TMP}; |
| 1167 | ${EZBIN}/ezmlm-store -P "${DIR}" >"${ERR}" 2>&1 < ${TMP} && \ |
| 1168 | { ${ECHO} "-P failed to reject non-mod message 4"; exit 100; } |
| 1169 | |
| 1170 | ${ECHO} "OK" |
| 1171 | |
| 1172 | ################ |
| 1173 | # ezmlm-return # |
| 1174 | ################ |
| 1175 | ${ECHO} -n "ezmlm-return: " |
| 1176 | |
| 1177 | SENDER="${BNC}@$HOST"; export SENDER |
| 1178 | HOST="$HOST"; export HOST |
| 1179 | LOCAL="$LOC-return-1-$BNC=$HOST"; export LOCAL |
| 1180 | if [ "$QMVER" = "n" ]; then |
| 1181 | DEFAULT="1-$BNC=$HOST"; export DEFAULT |
| 1182 | fi |
| 1183 | # we use 'du' because bounce handling is different in 0.31x and >=0.32 |
| 1184 | BSIZE1=`${DU} "${DIR}/bounce"` || \ |
| 1185 | { ${ECHO} "du doesn't work"; exit 99; } |
| 1186 | make_message | ${EZBIN}/ezmlm-return "${DIR}" || \ |
| 1187 | [ "$?" -eq "99" ] || \ |
| 1188 | { ${ECHO} "failed to process normal bounce from non-sub" ; exit 100; } |
| 1189 | BSIZE2=`${DU} "${DIR}/bounce"` |
| 1190 | if [ "$BSIZE1" != "$BSIZE2" ]; then |
| 1191 | ${ECHO} "failed to ignore non-subscriber bounce" ; exit 100 |
| 1192 | fi |
| 1193 | ${EZBIN}/ezmlm-sub "${DIR}" "${BNC}@$HOST" |
| 1194 | make_message | ${EZBIN}/ezmlm-return "${DIR}" || \ |
| 1195 | [ "$?" -eq "99" ] || \ |
| 1196 | { ${ECHO} "failed to process normal bounce from sub" ; exit 100; } |
| 1197 | BSIZE1=`${DU} "${DIR}/bounce"` |
| 1198 | if [ "$BSIZE1" = "$BSIZE2" ]; then |
| 1199 | ${ECHO} "failed to note subscriber bounce" ; exit 100 |
| 1200 | fi |
| 1201 | LOCAL="$LOC-digest-return-1-$BNC=$HOST"; export LOCAL |
| 1202 | if [ "$QMVER" = "n" ]; then |
| 1203 | DEFAULT="1-$BNC=$HOST"; export DEFAULT |
| 1204 | fi |
| 1205 | BSIZE1=`${DU} "${DIR}/digest/bounce"` |
| 1206 | make_message | ${EZBIN}/ezmlm-return $DLC "${DIR}" || \ |
| 1207 | [ "$?" -eq "99" ] || \ |
| 1208 | { ${ECHO} "failed to process normal digest non-sub bounce" ; exit 100; } |
| 1209 | BSIZE2=`${DU} "${DIR}/digest/bounce"` |
| 1210 | if [ "$BSIZE1" != "$BSIZE2" ]; then |
| 1211 | ${ECHO} "failed to ignore non-digest-subscriber bounce" ; exit 100 |
| 1212 | fi |
| 1213 | ${EZBIN}/ezmlm-unsub "${DIR}" "${BNC}@$HOST" |
| 1214 | ${EZBIN}/ezmlm-sub "${DIR}/digest" "${BNC}@$HOST" |
| 1215 | make_message | ${EZBIN}/ezmlm-return $DLC "${DIR}" || \ |
| 1216 | [ "$?" -eq "99" ] || \ |
| 1217 | { ${ECHO} "failed to proc. nl digest-subscriber bounce" ; exit 100; } |
| 1218 | BSIZE1=`${DU} "${DIR}/digest/bounce"` |
| 1219 | if [ "$BSIZE1" = "$BSIZE2" ]; then |
| 1220 | ${ECHO} "failed to note digest-subscriber bounce" ; exit 100 |
| 1221 | fi |
| 1222 | ${EZBIN}/ezmlm-sub "${DIR}" "${BNC}@$HOST" |
| 1223 | |
| 1224 | ${ECHO} "OK" |
| 1225 | |
| 1226 | # as we exit, the bounce address is subscribed to both list and digest-list |
| 1227 | # and is the SENDER |
| 1228 | |
| 1229 | ############## |
| 1230 | # ezmlm-warn # |
| 1231 | ############## |
| 1232 | ${ECHO} -n "ezmlm-warn (1/3): " |
| 1233 | |
| 1234 | # should send a warning |
| 1235 | ${EZBIN}/ezmlm-warn -t0 "${DIR}" >"${ERR}" 2>&1 || \ |
| 1236 | { ${ECHO} "failed with normal bounce for warning"; exit 100; } |
| 1237 | ${EZBIN}/ezmlm-issubn "${DIR}" || \ |
| 1238 | { ${ECHO} "script error: SENDER is not a subscriber"; exit 100; } |
| 1239 | |
| 1240 | ${EZBIN}/ezmlm-warn -d -t0 "${DIR}" >"${ERR}" 2>&1 || \ |
| 1241 | { ${ECHO} "failed with digest bounce for warning"; exit 100; } |
| 1242 | ${EZBIN}/ezmlm-issubn "${DIR}/digest" || \ |
| 1243 | { ${ECHO} "script error: SENDER is not a digest subscriber"; exit 100; } |
| 1244 | |
| 1245 | ${ECHO} "OK" |
| 1246 | |
| 1247 | ################ |
| 1248 | # ezmlm-manage # |
| 1249 | ################ |
| 1250 | ${ECHO} -n "ezmlm-manage (1/4): " |
| 1251 | |
| 1252 | LOCAL="$LOC-unsubscribe"; export LOCAL |
| 1253 | if [ "$QMVER" = "n" ]; then |
| 1254 | DEFAULT='unsubscribe'; export DEFAULT |
| 1255 | fi |
| 1256 | SENDER="${SND}@$HOST"; export SENDER |
| 1257 | |
| 1258 | ${EZBIN}/ezmlm-sub "${DIR}" "${SND}@$HOST" |
| 1259 | ${EZBIN}/ezmlm-manage -U "${DIR}" </dev/null >"${ERR}" 2>&1 || \ |
| 1260 | { ${ECHO} "failed with -U"; exit 100; } |
| 1261 | ${EZBIN}/ezmlm-issubn "${DIR}" && \ |
| 1262 | { ${ECHO} "unsubscribe with -U failed"; exit 100; } |
| 1263 | |
| 1264 | LOCAL="$LOC-digest-subscribe"; export LOCAL |
| 1265 | if [ "$QMVER" = "n" ]; then |
| 1266 | DEFAULT='digest-subscribe'; export DEFAULT |
| 1267 | fi |
| 1268 | ${EZBIN}/ezmlm-unsub "${DIR}/digest" "${SND}@$HOST" |
| 1269 | |
| 1270 | # test that access to the deny db is restricted to remote admins |
| 1271 | LOCAL="$LOC-deny-subscribe"; export LOCAL |
| 1272 | if [ "$QMVER" = "n" ]; then |
| 1273 | DEFAULT='deny-subscribe'; export DEFAULT |
| 1274 | fi |
| 1275 | ${EZBIN}/ezmlm-manage "${DIR}" </dev/null >/dev/null 2>&1 && \ |
| 1276 | { |
| 1277 | ${ECHO} "Deny open to regular subscribers: 0.31 bug, OK in 0.321." |
| 1278 | ${ECHO} -n "ezmlm-manage ... " |
| 1279 | BUG="${BUG} deny" |
| 1280 | } |
| 1281 | SENDER="${MOD}@$HOST"; export SENDER |
| 1282 | ${EZBIN}/ezmlm-sub "${DIR}/mod" "$SENDER" || exit 100 |
| 1283 | ${EZBIN}/ezmlm-manage "${DIR}" </dev/null > "${ERR}" 2>&1 || \ |
| 1284 | { ${ECHO} "Deny access denied to remote admin!"; exit 100; } |
| 1285 | |
| 1286 | # make non-moderated |
| 1287 | ${RM} -f "${DIR}/modsub" || \ |
| 1288 | { ${ECHO} "Failed to remove DIR/modsub"; exit 99; } |
| 1289 | |
| 1290 | # make non-remote |
| 1291 | ${RM} -f "${DIR}/remote" || \ |
| 1292 | { ${ECHO} "Failed to remove DIR/remote"; exit 99; } |
| 1293 | ${EZBIN}/ezmlm-manage "${DIR}" </dev/null > "${ERR}" 2>&1 && \ |
| 1294 | { |
| 1295 | ${ECHO} "Deny even without remote/modsub: 0.31 bug, OK in 0.321." |
| 1296 | ${ECHO} -n "ezmlm-manage ... " |
| 1297 | BUG="${BUG} deny" |
| 1298 | } |
| 1299 | |
| 1300 | # restore remote/SENDER/mod/LOCAL/DEFAULT |
| 1301 | ${EZBIN}/ezmlm-unsub "${DIR}/mod" "$SENDER" || exit 100 |
| 1302 | SENDER="${SND}@$HOST"; export SENDER # restore order |
| 1303 | touch "${DIR}/remote" || \ |
| 1304 | { ${ECHO} "Failed to remove DIR/remote"; exit 99; } |
| 1305 | LOCAL="$LOC-digest-subscribe"; export LOCAL |
| 1306 | if [ "$QMVER" = "n" ]; then |
| 1307 | DEFAULT='digest-subscribe'; export DEFAULT |
| 1308 | fi |
| 1309 | |
| 1310 | ${EZBIN}/ezmlm-manage -S "${DIR}" </dev/null >"${ERR}" 2>&1 || \ |
| 1311 | { ${ECHO} "failed with -S"; exit 100; } |
| 1312 | ${EZBIN}/ezmlm-issubn "${DIR}/digest" || \ |
| 1313 | { ${ECHO} "digest-subscribe with -S failed"; exit 100; } |
| 1314 | ${EZBIN}/ezmlm-unsub "${DIR}/digest" "${SND}@$HOST" |
| 1315 | touch "${DIR}/modsub" || \ |
| 1316 | { ${ECHO} "Failed to restore DIR/modsub"; exit 99; } |
| 1317 | |
| 1318 | SENDER="${MAN}@$HOST"; export SENDER |
| 1319 | |
| 1320 | ${ECHO} "X-num: sub1" > "${DIR}/__tmp" |
| 1321 | ${ECHO} "From: Mr. $EZTEST requests <${MAN}@$HOST>" >> "${DIR}/__tmp" |
| 1322 | ${ECHO} >> "${DIR}/__tmp" |
| 1323 | ${EZBIN}/ezmlm-manage ${SW_FROM} "${DIR}" < "${DIR}/__tmp" \ |
| 1324 | >"${ERR}" 2>&1 || \ |
| 1325 | { ${ECHO} "digest-subscribe with request failed"; exit 100; } |
| 1326 | |
| 1327 | ${EZBIN}/ezmlm-sub "${DIR}" "${MAN}@$HOST" |
| 1328 | LOCAL="$LOC-unsubscribe"; export LOCAL |
| 1329 | if [ "$QMVER" = "n" ]; then |
| 1330 | DEFAULT='unsubscribe'; export DEFAULT |
| 1331 | fi |
| 1332 | ${ECHO} "X-num: sub2" > "${DIR}/__tmp" |
| 1333 | ${EZBIN}/ezmlm-manage "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 || \ |
| 1334 | { ${ECHO} "unsubscribe request failed"; exit 100; } |
| 1335 | |
| 1336 | # -get function for backwards compatibility |
| 1337 | LOCAL="$LOC-get.1"; export LOCAL |
| 1338 | if [ "$QMVER" = "n" ]; then |
| 1339 | DEFAULT='get.1'; export DEFAULT |
| 1340 | fi |
| 1341 | ${ECHO} "X-num: manget1" > "${DIR}/__tmp" |
| 1342 | ${EZBIN}/ezmlm-manage "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 || \ |
| 1343 | { ${ECHO} "get failed"; exit 100; } |
| 1344 | # -C should disable it |
| 1345 | ${EZBIN}/ezmlm-manage -C "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 && \ |
| 1346 | { ${ECHO} "-C failed to disable -get"; exit 100; } |
| 1347 | |
| 1348 | ${ECHO} "OK" |
| 1349 | |
| 1350 | ################# |
| 1351 | # ezmlm-request # |
| 1352 | ################# |
| 1353 | ${ECHO} -n "ezmlm-request (1/2): " |
| 1354 | |
| 1355 | SENDER="${SND}@$HOST"; export SENDER |
| 1356 | LOCAL="$LOC-request"; export LOCAL |
| 1357 | if [ "$QMVER" = "n" ]; then |
| 1358 | DEFAULT='request'; export DEFAULT |
| 1359 | fi |
| 1360 | |
| 1361 | ${ECHO} "X-num: req1" > "${DIR}/__tmp" |
| 1362 | # use a non-existing command |
| 1363 | ${ECHO} "Subject: qqqq ${SND}@$HOST" >> "${DIR}/__tmp" |
| 1364 | ${EZBIN}/ezmlm-request "${DIR}" < "${DIR}/__tmp" > "${ERR}" 2>&1 |
| 1365 | if [ "$?" != "99" ]; then |
| 1366 | ${ECHO} "qqqq command in subject failed to exit 99" |
| 1367 | exit 100 |
| 1368 | fi |
| 1369 | |
| 1370 | ${ECHO} "X-num: req1" > "${DIR}/__tmp" |
| 1371 | # test full ezmlm cmd in subject and command substitution |
| 1372 | ${ECHO} "Subject: ${LOC}-remove-${SND}=${HOST}@${HOST}" >> "${DIR}/__tmp" |
| 1373 | ${EZBIN}/ezmlm-request "${DIR}" < "${DIR}/__tmp" > "${ERR}" 2>&1 |
| 1374 | if [ "$?" != "99" ]; then |
| 1375 | ${ECHO} "full ezmlm command in subject failed to exit 99" |
| 1376 | exit 100 |
| 1377 | fi |
| 1378 | |
| 1379 | |
| 1380 | |
| 1381 | ${ECHO} "OK" |
| 1382 | |
| 1383 | ############### |
| 1384 | # ezmlm-split # |
| 1385 | ############### |
| 1386 | if [ "$QMVER" = "n" ]; then |
| 1387 | ${ECHO} -n "ezmlm-split (1/2): " |
| 1388 | # set up split file |
| 1389 | ${ECHO} "edu:1:26:l1@h1" > "${DIR}/split" |
| 1390 | ${ECHO} "edu:27:52:l2@h2" >> "${DIR}/split" |
| 1391 | ${ECHO} "com:::l3@h3" >> "${DIR}/split" |
| 1392 | # most testing with -D |
| 1393 | ${ECHO} "lindberg@ezmlm.org" | ${EZBIN}/ezmlm-split -D "${DIR}" | \ |
| 1394 | ${GREP} "$LIST@$HOST" >/dev/null || \ |
| 1395 | { ${ECHO} "failed to split correctly on domain"; exit 100; } |
| 1396 | ${ECHO} "lindberg@id.com" | ${EZBIN}/ezmlm-split -D "${DIR}" | \ |
| 1397 | ${GREP} 'l3' >/dev/null || \ |
| 1398 | { ${ECHO} "failed to split correctly on domain"; exit 100; } |
| 1399 | ${ECHO} "lindberg@id.wustl.edu" | ${EZBIN}/ezmlm-split -D "${DIR}" | \ |
| 1400 | ${GREP} 'l1' >/dev/null || \ |
| 1401 | { ${ECHO} "failed to split correctly on hash + domain"; exit 100; } |
| 1402 | ${ECHO} "cfl@id.wustl.edu" | ${EZBIN}/ezmlm-split -D "${DIR}" | \ |
| 1403 | ${GREP} 'l2' >/dev/null || \ |
| 1404 | { ${ECHO} "failed to split correctly on hash + domain"; exit 100; } |
| 1405 | # one test with delivery - redirect to local manager |
| 1406 | # should exit 99 after redirecting |
| 1407 | ${ECHO} ":::${LOC}@$HOST" > "${DIR}/split" |
| 1408 | SENDER="${MOD}@$HOST"; export SENDER |
| 1409 | DTLINE="Delivered-To: ezmlm-split@$HOST"; export DTLINE |
| 1410 | LOCAL="$LOC-subscribe-${SND}=$HOST"; export LOCAL |
| 1411 | if [ "$QMVER" = "n" ]; then |
| 1412 | DEFAULT="subscribe-${SND}=$HOST"; export DEFAULT |
| 1413 | fi |
| 1414 | ${ECHO} "X-num: spl1" | ${EZBIN}/ezmlm-split "${DIR}" >"${ERR}" 2>&1 |
| 1415 | |
| 1416 | EC="$?" |
| 1417 | if [ "$EC" -eq "0" ]; then |
| 1418 | ${ECHO} "exited 0 after forwarding, rather than 99"; exit 100 |
| 1419 | elif [ "$EC" != "99" ]; then |
| 1420 | ${ECHO} "failed to process message for forwarding"; exit 100 |
| 1421 | fi |
| 1422 | # if no match, should exit 0 |
| 1423 | ${ECHO} "___:::${LOC}@$HOST" > "${DIR}/split" |
| 1424 | ${ECHO} "X-num: spl1" | ${EZBIN}/ezmlm-split "${DIR}" >"${ERR}" 2>&1 || \ |
| 1425 | { ${ECHO} "failed to exit 0 after failing to match"; exit 100; } |
| 1426 | |
| 1427 | ${ECHO} "OK" |
| 1428 | fi |
| 1429 | |
| 1430 | ######################## |
| 1431 | # waiting for delivery # |
| 1432 | ######################## |
| 1433 | send_test 2 |
| 1434 | fi # end of sect 1 |
| 1435 | |
| 1436 | ####################################### start of section 2 |
| 1437 | |
| 1438 | if [ "$SECT" -le "2" ]; then |
| 1439 | wait_test 2 |
| 1440 | |
| 1441 | ############# |
| 1442 | # ezmlm-idx # |
| 1443 | ############# |
| 1444 | ${ECHO} -n "ezmlm-idx: " |
| 1445 | ${RM} -f "${DIR}/archive/0/index" "${DIR}/indexed" |
| 1446 | ${EZBIN}/ezmlm-idx "${DIR}" >"${ERR}" 2>&1 || \ |
| 1447 | { ${ECHO} "failed to run"; exit 100; } |
| 1448 | if [ ! -r "${DIR}/indexed" ]; then |
| 1449 | ${ECHO} "failed to create DIR/indexed"; exit 100 |
| 1450 | fi |
| 1451 | if [ ! -r "${DIR}/archive/0/index" ]; then |
| 1452 | ${ECHO} "failed to create index"; exit 100 |
| 1453 | fi |
| 1454 | ${ECHO} "OK" |
| 1455 | |
| 1456 | ############# |
| 1457 | # ezmlm-get # |
| 1458 | ############# |
| 1459 | ${ECHO} -n "ezmlm-get (1/2): " |
| 1460 | |
| 1461 | # blast digest recipient account with all these excerpts. |
| 1462 | ${EZBIN}/ezmlm-sub "${DIR}/digest" "${DIG}@$HOST" |
| 1463 | |
| 1464 | # first ezmlm-get in the manager position: |
| 1465 | |
| 1466 | # index1/get1/thread1 should bounce and will not be looked for |
| 1467 | # index2 ... should be in DIG@HOST's inbox |
| 1468 | # get3 - r format to DIG@HST |
| 1469 | # get4 - n |
| 1470 | # get5 - v |
| 1471 | # get6 - x |
| 1472 | |
| 1473 | SENDER="${BNC}@$HOST"; export SENDER |
| 1474 | LOCAL="$LOC-xxxx"; export LOCAL |
| 1475 | if [ "$QMVER" = "n" ]; then |
| 1476 | DEFAULT='xxxx'; export DEFAULT |
| 1477 | fi |
| 1478 | ${ECHO} "X-num: index1" > "${DIR}/__tmp" |
| 1479 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 1480 | { ${ECHO} " failed to exit 0 for non-recognized commands"; exit 100; } |
| 1481 | |
| 1482 | # This should not give a digest |
| 1483 | LOCAL="$LOC-"; export LOCAL |
| 1484 | if [ "$QMVER" = "n" ]; then |
| 1485 | DEFAULT=''; export DEFAULT |
| 1486 | fi |
| 1487 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 1488 | { ${ECHO} " failed to exit 0 for list-@host"; exit 100; } |
| 1489 | |
| 1490 | LOCAL="$LOC-index"; export LOCAL |
| 1491 | if [ "$QMVER" = "n" ]; then |
| 1492 | DEFAULT='index'; export DEFAULT |
| 1493 | fi |
| 1494 | ${EZBIN}/ezmlm-get -s "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1495 | { ${ECHO} "-s failed to reject -index from non-sub"; exit 100; } |
| 1496 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1497 | if [ "$?" -ne "99" ]; then |
| 1498 | ${ECHO} "failed to exit 99 after -index" |
| 1499 | exit 100 |
| 1500 | fi |
| 1501 | |
| 1502 | ${ECHO} "X-num: index2" > "${DIR}/__tmp" |
| 1503 | SENDER="${DIG}@$HOST"; export SENDER |
| 1504 | ${EZBIN}/ezmlm-get -s "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1505 | if [ "$?" -ne "99" ]; then |
| 1506 | ${ECHO} "-s failed to exit 99 after -index" |
| 1507 | exit 100 |
| 1508 | fi |
| 1509 | |
| 1510 | SENDER="${BNC}@$HOST"; export SENDER |
| 1511 | ${ECHO} "X-num: get1" > "${DIR}/__tmp" |
| 1512 | LOCAL="$LOC-get.2_4"; export LOCAL |
| 1513 | if [ "$QMVER" = "n" ]; then |
| 1514 | DEFAULT='get.2_4'; export DEFAULT |
| 1515 | fi |
| 1516 | ${EZBIN}/ezmlm-get -s "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1517 | { ${ECHO} "-s failed to reject -get from non-sub"; exit 100; } |
| 1518 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1519 | if [ "$?" != "99" ]; then |
| 1520 | ${ECHO} "failed to exit 99 after -get" |
| 1521 | exit 100 |
| 1522 | fi |
| 1523 | ${ECHO} "X-num: get2" > "${DIR}/__tmp" |
| 1524 | SENDER="${DIG}@$HOST"; export SENDER |
| 1525 | ${EZBIN}/ezmlm-get -s "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1526 | if [ "$?" != "99" ]; then |
| 1527 | ${ECHO} "-s failed to exit 99 after -get" |
| 1528 | exit 100 |
| 1529 | fi |
| 1530 | |
| 1531 | # test formats for -get |
| 1532 | ${ECHO} "X-num: get3" > "${DIR}/__tmp" |
| 1533 | LOCAL="$LOC-getr.2_4"; export LOCAL |
| 1534 | if [ "$QMVER" = "n" ]; then |
| 1535 | DEFAULT='getr.2_4'; export DEFAULT |
| 1536 | fi |
| 1537 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1538 | if [ "$?" != "99" ]; then |
| 1539 | ${ECHO} "failed to exit 99 after -getr" |
| 1540 | exit 100 |
| 1541 | fi |
| 1542 | ${ECHO} "X-num: get4" > "${DIR}/__tmp" |
| 1543 | LOCAL="$LOC-getn.2_4"; export LOCAL |
| 1544 | if [ "$QMVER" = "n" ]; then |
| 1545 | DEFAULT='getn.2_4'; export DEFAULT |
| 1546 | fi |
| 1547 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1548 | if [ "$?" != "99" ]; then |
| 1549 | ${ECHO} "failed to exit 99 after -getn" |
| 1550 | exit 100 |
| 1551 | fi |
| 1552 | |
| 1553 | ${ECHO} "X-num: get5" > "${DIR}/__tmp" |
| 1554 | LOCAL="$LOC-getv.2_4"; export LOCAL |
| 1555 | if [ "$QMVER" = "n" ]; then |
| 1556 | DEFAULT='getv.2_4'; export DEFAULT |
| 1557 | fi |
| 1558 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1559 | if [ "$?" != "99" ]; then |
| 1560 | ${ECHO} "failed to exit 99 after -getv" |
| 1561 | exit 100 |
| 1562 | fi |
| 1563 | |
| 1564 | ${ECHO} "X-num: get6" > "${DIR}/__tmp" |
| 1565 | LOCAL="$LOC-getx.2_4"; export LOCAL |
| 1566 | if [ "$QMVER" = "n" ]; then |
| 1567 | DEFAULT='getx.2_4'; export DEFAULT |
| 1568 | fi |
| 1569 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1570 | if [ "$?" != "99" ]; then |
| 1571 | ${ECHO} "failed to exit 99 after -getx" |
| 1572 | exit 100 |
| 1573 | fi |
| 1574 | |
| 1575 | SENDER="${BNC}@$HOST"; export SENDER |
| 1576 | LOCAL="$LOC-index"; export LOCAL |
| 1577 | if [ "$QMVER" = "n" ]; then |
| 1578 | DEFAULT='index'; export DEFAULT |
| 1579 | fi |
| 1580 | ${ECHO} "X-num: thread1" > "${DIR}/__tmp" |
| 1581 | LOCAL="$LOC-thread.1"; export LOCAL |
| 1582 | if [ "$QMVER" = "n" ]; then |
| 1583 | DEFAULT='thread.1'; export DEFAULT |
| 1584 | fi |
| 1585 | ${EZBIN}/ezmlm-get -s "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1586 | { ${ECHO} "-s failed to reject -thread from non-sub"; exit 100; } |
| 1587 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1588 | if [ "$?" != "99" ]; then |
| 1589 | ${ECHO} "failed to exit 99 after -thread" |
| 1590 | exit 100 |
| 1591 | fi |
| 1592 | ${ECHO} "X-num: thread2" > "${DIR}/__tmp" |
| 1593 | SENDER="${DIG}@$HOST"; export SENDER |
| 1594 | ${EZBIN}/ezmlm-get -s "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1595 | if [ "$?" != "99" ]; then |
| 1596 | ${ECHO} "-s failed to exit 99 after -thread" |
| 1597 | exit 100 |
| 1598 | fi |
| 1599 | |
| 1600 | ######### digests |
| 1601 | # we use headeradd to label them since trigger headers aren't propagated |
| 1602 | ${ECHO} "X-num: not_propagated" > "${DIR}/__tmp" |
| 1603 | |
| 1604 | # dig1 from manager will go to DIG@HOST |
| 1605 | # dig2 from editor |
| 1606 | # dig3 from command line |
| 1607 | # dig4 -fr format check from command line. We check only that they get there. |
| 1608 | # dig5 -fn |
| 1609 | # dig6 -fx |
| 1610 | # dig7 -fv |
| 1611 | # we check that dignum is created and digissue is updated |
| 1612 | |
| 1613 | # now -dig in the manager position: |
| 1614 | mv -f "${DIR}/headeradd" "${DIR}/headeradd.bak" |
| 1615 | ${ECHO} "X-num: dig1" > "${DIR}/headeradd" |
| 1616 | SENDER="${BNC}@$HOST"; export SENDER |
| 1617 | LOCAL="$LOC-dig.code"; export LOCAL |
| 1618 | if [ "$QMVER" = "n" ]; then |
| 1619 | DEFAULT='dig.code'; export DEFAULT |
| 1620 | fi |
| 1621 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1622 | { ${ECHO} "failed to reject -dig when no digest code was on cmd-line" |
| 1623 | exit 100 |
| 1624 | } |
| 1625 | if [ -r "${DIR}/dignum" ]; then |
| 1626 | ${ECHO} "script error: dignum exists"; exit 100 |
| 1627 | fi |
| 1628 | ${EZBIN}/ezmlm-get "${DIR}" 'code' < "${DIR}/__tmp" >"${ERR}" 2>&1 |
| 1629 | if [ "$?" != "99" ]; then |
| 1630 | ${ECHO} "failed to exit 99 after digest in manager position" |
| 1631 | exit 100 |
| 1632 | fi |
| 1633 | if [ ! -r "${DIR}/dignum" ]; then |
| 1634 | ${ECHO} "failed to generate dignum"; exit 100 |
| 1635 | fi |
| 1636 | if [ ! -r "${DIR}/digissue" ]; then |
| 1637 | ${ECHO} "failed to generate digissue"; exit 100 |
| 1638 | fi |
| 1639 | ${EZBIN}/ezmlm-get "${DIR}" 'code' < "${DIR}/__tmp" >/dev/null 2>&1 |
| 1640 | if [ "$?" != "99" ]; then |
| 1641 | ${ECHO} "failed to exit 99 when nothing to digest in manager position" |
| 1642 | exit 100 |
| 1643 | fi |
| 1644 | |
| 1645 | ${EZBIN}/ezmlm-get "${DIR}" 'coden' < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1646 | { ${ECHO} "failed to reject -dig with bad digest code 'coden'"; exit 100; } |
| 1647 | ${EZBIN}/ezmlm-get "${DIR}" 'cod' < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1648 | { ${ECHO} "failed to reject -dig with bad digest code 'cod'"; exit 100; } |
| 1649 | |
| 1650 | # now in the editor position: |
| 1651 | ${RM} -f "${DIR}/dignum" |
| 1652 | LOCAL="$LOC"; export LOCAL |
| 1653 | if [ "$QMVER" = "n" ]; then |
| 1654 | ${UNSET} DEFAULT |
| 1655 | fi |
| 1656 | ${ECHO} "X-num: dig2" > "${DIR}/headeradd" |
| 1657 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 || \ |
| 1658 | { ${ECHO} "failed to exit 0 after digest in editor"; exit 100; } |
| 1659 | |
| 1660 | # This causes an error on systems where 'unset' doesn't work |
| 1661 | # For these, we skip this test. |
| 1662 | if [ -z "$BADUNSET" ]; then |
| 1663 | if [ ! -r "${DIR}/dignum" ]; then |
| 1664 | ${ECHO} "failed to generate dignum after digest in editor"; exit 100 |
| 1665 | fi |
| 1666 | |
| 1667 | ${GREP} "2:" "${DIR}/digissue" >/dev/null 2>&1 || \ |
| 1668 | { ${ECHO} "failed to update digissue after digest in editor"; |
| 1669 | exit 100; } |
| 1670 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 || \ |
| 1671 | { ${ECHO} "failed to exit 0 when nothing to digest in editor"; |
| 1672 | exit 100; } |
| 1673 | fi |
| 1674 | |
| 1675 | # now from the command line with formats ... |
| 1676 | ${RM} -f "${DIR}/dignum" |
| 1677 | LOCAL=''; export LOCAL |
| 1678 | ${ECHO} "X-num: dig3" > "${DIR}/headeradd" |
| 1679 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 1680 | { ${ECHO} "failed to exit 0 after cmd line digest"; exit 100; } |
| 1681 | ${GREP} "3:" "${DIR}/digissue" >/dev/null 2>&1 || \ |
| 1682 | { ${ECHO} "failed to update digissue after cmd line digest"; exit 100; } |
| 1683 | ${EZBIN}/ezmlm-get "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 1684 | { ${ECHO} "failed to exit 0 when nothing to digest from cmd line" |
| 1685 | exit 100; } |
| 1686 | ${RM} -f "${DIR}/dignum" |
| 1687 | ${ECHO} "X-num: dig4" > "${DIR}/headeradd" |
| 1688 | ${EZBIN}/ezmlm-get -fr "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 1689 | { ${ECHO} "-fr failed for digest"; exit 100; } |
| 1690 | ${RM} -f "${DIR}/dignum" |
| 1691 | ${ECHO} "X-num: dig5" > "${DIR}/headeradd" |
| 1692 | ${EZBIN}/ezmlm-get -fn "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 1693 | { ${ECHO} "-fn failed for digest"; exit 100; } |
| 1694 | ${RM} -f "${DIR}/dignum" |
| 1695 | ${ECHO} "X-num: dig6" > "${DIR}/headeradd" |
| 1696 | ${EZBIN}/ezmlm-get -fv "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 1697 | { ${ECHO} "-fv failed for digest"; exit 100; } |
| 1698 | ${RM} -f "${DIR}/dignum" |
| 1699 | ${ECHO} "X-num: dig7" > "${DIR}/headeradd" |
| 1700 | ${EZBIN}/ezmlm-get -fx "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 1701 | { ${ECHO} "-fx failed for digest"; exit 100; } |
| 1702 | |
| 1703 | # restore headeradd |
| 1704 | mv -f "${DIR}/headeradd.bak" "${DIR}/headeradd" |
| 1705 | |
| 1706 | ${ECHO} "OK" |
| 1707 | |
| 1708 | ############## |
| 1709 | # ezmlm-send # |
| 1710 | ############## |
| 1711 | ${ECHO} -n "ezmlm-send (2/2): " |
| 1712 | MSG1=`${GREP} -l "msg1" $SINKDIR/new/*` || \ |
| 1713 | { ${ECHO} "failed to deliver message 1 to subscriber"; \ |
| 1714 | exit 100; } |
| 1715 | # make sure headeradd was done |
| 1716 | ${GREP} -i 'precedence: bulk' < "$MSG1" >/dev/null 2>&1 || |
| 1717 | { ${ECHO} "failed to add headeradd"; exit 100; } |
| 1718 | # check on received: header handling |
| 1719 | ${GREP} '#PENULTIMATE#' "$MSG1" >/dev/null && \ |
| 1720 | { ${ECHO} "-r failed to remove received header"; \ |
| 1721 | exit 100; } |
| 1722 | ${GREP} '#LAST#' "$MSG1" >/dev/null || \ |
| 1723 | { ${ECHO} "-r failed to leave last received header"; \ |
| 1724 | exit 100; } |
| 1725 | ${GREP} 'Subject:' "$MSG1" | ${GREP} 'PFX' >/dev/null 2>&1 || \ |
| 1726 | { ${ECHO} "failed to add subject prefix"; exit 100; } |
| 1727 | # the trailer should be a MIME part, so not at the very end |
| 1728 | ${TAIL} -6 "$MSG1" | ${HEAD} -2 | ${GREP} 'TRAILER' >/dev/null 2>&1 || \ |
| 1729 | { ${ECHO} "failed to add trailer"; exit 100; } |
| 1730 | |
| 1731 | MSG2=`${GREP} -l "msg2" $SINKDIR/new/*` || \ |
| 1732 | { ${ECHO} "failed to deliver message 2 to subscriber"; \ |
| 1733 | exit 100; } |
| 1734 | ${GREP} '#PENULTIMATE#' "$MSG2" >/dev/null || \ |
| 1735 | { ${ECHO} "-R failed to leave received header"; \ |
| 1736 | exit 100; } |
| 1737 | |
| 1738 | ${GREP} "msg3" $SINKDIR/new/* >/dev/null 2>&1 && \ |
| 1739 | { ${ECHO} "-C failed to exclude sender (no longer supported)"; \ |
| 1740 | BUG="${BUG}_noself"; \ |
| 1741 | echo -n "ezmlm-send: "; } |
| 1742 | |
| 1743 | MSG5=`${GREP} -l "msg5" $SINKDIR/new/*` || \ |
| 1744 | { ${ECHO} "failed to deliver message 5 to subscriber"; \ |
| 1745 | exit 100; } |
| 1746 | ${GREP} 'TRAILER' "$MSG5" >/dev/null 2>&1 || \ |
| 1747 | { ${ECHO} "failed to add trailer to non-mime message"; \ |
| 1748 | exit 100; } |
| 1749 | |
| 1750 | MSG6=`${GREP} -l "msg6" $SINKDIR/new/*` || \ |
| 1751 | { ${ECHO} "failed to deliver message 6 to subscriber"; \ |
| 1752 | exit 100; } |
| 1753 | |
| 1754 | ${GREP} 'TRAILER' "$MSG6" >/dev/null 2>&1 && \ |
| 1755 | { ${ECHO} "failed to suppress trailer for multipart/signed message"; \ |
| 1756 | echo " 0.31 bug fixed in 0.316/0.323"; |
| 1757 | BUG="${BUG}_signed"; \ |
| 1758 | echo -n "ezmlm-send ......: "; } |
| 1759 | |
| 1760 | ${GREP} "msg3" $SINKDIR/new/* >/dev/null 2>&1 && \ |
| 1761 | { |
| 1762 | ${ECHO} "${BUG}" | ${GREP} 'noself' >/dev/null 2>&1 || \ |
| 1763 | { |
| 1764 | ${ECHO} "-C failed to exclude sender (no longer supported)" |
| 1765 | BUG="${BUG}_noself" |
| 1766 | echo -n "ezmlm-send ......: ${BUG} " |
| 1767 | } |
| 1768 | } |
| 1769 | |
| 1770 | ${ECHO} "OK" |
| 1771 | ############### |
| 1772 | # ezmlm-clean # |
| 1773 | ############### |
| 1774 | |
| 1775 | ${ECHO} -n "ezmlm-clean (2/2): " |
| 1776 | |
| 1777 | ${GREP} "clean1" ${DIGDIR}/new/* >/dev/null 2>&1 && \ |
| 1778 | { ${ECHO} "removal of non-x mod queue entry 1 wasn't silent"; exit 100; } |
| 1779 | ${GREP} "clean2" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 1780 | { ${ECHO} "failed to notify sender of mod queue entry 2 time out" |
| 1781 | exit 100 |
| 1782 | } |
| 1783 | ${GREP} "clean3" ${DIGDIR}/new/* >/dev/null 2>&1 && \ |
| 1784 | { ${ECHO} "notified sender about entry 3 even though it wasn't rejected" |
| 1785 | exit 100 |
| 1786 | } |
| 1787 | ${GREP} "clean4" ${DIGDIR}/new/* >/dev/null 2>&1 && \ |
| 1788 | { ${ECHO} "-R failed: notified sender about entry 3 rejection"; exit 100; } |
| 1789 | |
| 1790 | |
| 1791 | # clean1 should be silently removed (no -x). |
| 1792 | # clean2 should result in a message |
| 1793 | # clean3 should not since it's time hasn't come |
| 1794 | # clean4 should be removed, but not result in a message since we use -R |
| 1795 | |
| 1796 | ${ECHO} "OK" |
| 1797 | |
| 1798 | ############### |
| 1799 | # ezmlm-store # |
| 1800 | ############### |
| 1801 | ${ECHO} -n "ezmlm-store (2/2): " |
| 1802 | |
| 1803 | MOD1=`${GREP} -l "mod1" $SINKDIR/new/* 2>/dev/null` |
| 1804 | if [ -z "$MOD1" ]; then |
| 1805 | ${ECHO} "ezmlm-store: failed to deliver mod request to moderator" |
| 1806 | exit 100 |
| 1807 | fi |
| 1808 | ${GREP} "mod2" $SINKDIR/new/* >/dev/null && \ |
| 1809 | { ${ECHO} "ezmlm-store: didn't post directly in absence of DIR/modpost"; \ |
| 1810 | exit 100; } |
| 1811 | MOD3=`${GREP} -l "mod3" $SINKDIR/new/* 2>/dev/null` |
| 1812 | if [ -z "$MOD3" ]; then |
| 1813 | ${ECHO} "ezmlm-store: -P failed to deliver mod request to moderator" |
| 1814 | exit 100 |
| 1815 | fi |
| 1816 | ${GREP} "mod4" $SINKDIR/new/* >/dev/null && \ |
| 1817 | { ${ECHO} "ezmlm-store: -P failed to reject message from non-mod"; \ |
| 1818 | exit 100; } |
| 1819 | |
| 1820 | ${ECHO} "OK" |
| 1821 | |
| 1822 | ################ |
| 1823 | # ezmlm-manage # |
| 1824 | ################ |
| 1825 | ${ECHO} -n "ezmlm-manage (2/4): " |
| 1826 | |
| 1827 | # check digest-subscribe and list-unsubscribe replies |
| 1828 | SUB1=`${GREP} -l 'sub1' $MANDIR/new/*` || \ |
| 1829 | { ${ECHO} "failed getting digest-subscribe confirm request"; exit 100; } |
| 1830 | |
| 1831 | SUB2=`${GREP} -l 'sub2' $MANDIR/new/*` || \ |
| 1832 | { ${ECHO} "failed getting -unsubscribe confirm request"; exit 100; } |
| 1833 | |
| 1834 | # Check -get.1 reply |
| 1835 | MANGET1=`${GREP} -l 'manget1' $MANDIR/new/*` || \ |
| 1836 | { ${ECHO} "failed getting -get.1 reply"; exit 100; } |
| 1837 | |
| 1838 | ${GREP} 'msg1' "$MANGET1" >/dev/null || \ |
| 1839 | { ${ECHO} "get.1 failed to return archived message"; exit 100; } |
| 1840 | |
| 1841 | # Add moderator |
| 1842 | ${EZBIN}/ezmlm-sub "${DIR}/mod" "${MOD}@$HOST" |
| 1843 | |
| 1844 | LOCAL=`${GREP} "Reply-To:" "$SUB1" | cut -d' ' -f2 | cut -d'@' -f1` || \ |
| 1845 | { ${ECHO} "failed to find confirm address in -subscribe reply"; exit 100; } |
| 1846 | export LOCAL |
| 1847 | if [ "$QMVER" = "n" ]; then |
| 1848 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$LOCLEN"-`; export DEFAULT |
| 1849 | fi |
| 1850 | ${ECHO} "X-num: sub3" > "${DIR}/__tmp" |
| 1851 | ${ECHO} "From: Mr. $EZTEST confirms <$SENDER>" >> "${DIR}/__tmp" |
| 1852 | ${ECHO} >> "${DIR}/__tmp" |
| 1853 | ${EZBIN}/ezmlm-manage ${SW_FROM} "${DIR}" < "${DIR}/__tmp" \ |
| 1854 | >"${ERR}" 2>&1 || \ |
| 1855 | { ${ECHO} "failed to send user conf for sub1"; exit 100; } |
| 1856 | |
| 1857 | LOCAL=`${GREP} "Reply-To:" "$SUB2" | cut -d' ' -f2 | cut -d'@' -f1` || \ |
| 1858 | { ${ECHO} "failed to find confirm address in -unsubscribe reply" |
| 1859 | exit 100; } |
| 1860 | export LOCAL |
| 1861 | if [ "$QMVER" = "n" ]; then |
| 1862 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$LOCLEN"-`; export DEFAULT |
| 1863 | fi |
| 1864 | ${ECHO} "X-num: sub4" > "${DIR}/__tmp" |
| 1865 | ${EZBIN}/ezmlm-manage "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 1866 | { ${ECHO} "failed to send conf for sub2"; exit 100; } |
| 1867 | |
| 1868 | # now test remote admin functions |
| 1869 | # add a few addresses to allow |
| 1870 | ${EZBIN}/ezmlm-sub "${DIR}/${ALLOW}" "aaa@bbb" "ccc@ddd" "eee@fff" |
| 1871 | |
| 1872 | # test -edit |
| 1873 | ${ECHO} "#TEST_TEXT#" > "${DIR}/text/test" |
| 1874 | LOCAL="$LOC-edit.test-$MAN=$HOST"; export LOCAL |
| 1875 | if [ "$QMVER" = "n" ]; then |
| 1876 | DEFAULT="edit.test-$MAN=$HOST"; export DEFAULT |
| 1877 | fi |
| 1878 | ${ECHO} "X-num: edit1" > "${DIR}/__tmp" |
| 1879 | ${EZBIN}/ezmlm-manage -e "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1880 | { ${ECHO} "failed to reject edit request from non-mod"; exit 100; } |
| 1881 | LOCAL="$LOC-edit.test-$MOD=$HOST"; export LOCAL |
| 1882 | if [ "$QMVER" = "n" ]; then |
| 1883 | DEFAULT="edit.test-$MOD=$HOST"; export DEFAULT |
| 1884 | fi |
| 1885 | ${ECHO} "X-num: edit2" > "${DIR}/__tmp" |
| 1886 | ${EZBIN}/ezmlm-manage "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 && \ |
| 1887 | { ${ECHO} "-E failed for edit2"; exit 100; } |
| 1888 | ${ECHO} "X-num: edit3" > "${DIR}/__tmp" |
| 1889 | ${EZBIN}/ezmlm-manage -e "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 || \ |
| 1890 | { ${ECHO} "-e failed for remote admin for edit3"; exit 100; } |
| 1891 | |
| 1892 | # test list/log |
| 1893 | LOCAL="$LOC-allow-list-$MAN=$HOST"; export LOCAL |
| 1894 | if [ "$QMVER" = "n" ]; then |
| 1895 | DEFAULT="allow-list-$MAN=$HOST"; export DEFAULT |
| 1896 | fi |
| 1897 | ${ECHO} "X-num: list1" > "${DIR}/__tmp" |
| 1898 | ${EZBIN}/ezmlm-manage -l "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1899 | { ${ECHO} "failed to reject list request from non-mod"; exit 100; } |
| 1900 | |
| 1901 | LOCAL="$LOC-allow-log-$MAN=$HOST"; export LOCAL |
| 1902 | if [ "$QMVER" = "n" ]; then |
| 1903 | DEFAULT="allow-log-$MAN=$HOST"; export DEFAULT |
| 1904 | fi |
| 1905 | ${ECHO} "X-num: log1" > "${DIR}/__tmp" |
| 1906 | ${EZBIN}/ezmlm-manage -l "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1907 | { ${ECHO} "failed to reject log request from non-mod"; exit 100; } |
| 1908 | |
| 1909 | LOCAL="$LOC-allow-list-$MOD=$HOST"; export LOCAL |
| 1910 | if [ "$QMVER" = "n" ]; then |
| 1911 | DEFAULT="allow-list-$MOD=$HOST"; export DEFAULT |
| 1912 | fi |
| 1913 | ${ECHO} "X-num: list2" > "${DIR}/__tmp" |
| 1914 | ${EZBIN}/ezmlm-manage "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 && \ |
| 1915 | { ${ECHO} "-L failed to reject list request"; exit 100; } |
| 1916 | |
| 1917 | ${ECHO} "X-num: list3" > "${DIR}/__tmp" |
| 1918 | ${EZBIN}/ezmlm-manage -l "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 || \ |
| 1919 | { ${ECHO} "-l failed for remote admin for list3"; exit 100; } |
| 1920 | |
| 1921 | LOCAL="$LOC-allow-log-$MOD=$HOST"; export LOCAL |
| 1922 | if [ "$QMVER" = "n" ]; then |
| 1923 | DEFAULT="allow-log-$MOD=$HOST"; export DEFAULT |
| 1924 | fi |
| 1925 | ${ECHO} "X-num: log2" > "${DIR}/__tmp" |
| 1926 | ${EZBIN}/ezmlm-manage "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 && \ |
| 1927 | { ${ECHO} "-L failed to reject log request"; exit 100; } |
| 1928 | |
| 1929 | ${ECHO} "X-num: log3" > "${DIR}/__tmp" |
| 1930 | ${EZBIN}/ezmlm-manage -l "${DIR}" < "${DIR}/__tmp" >"${ERR}" 2>&1 || \ |
| 1931 | { ${ECHO} "-l failed for remote admin for log3"; exit 100; } |
| 1932 | |
| 1933 | |
| 1934 | ${ECHO} "OK" |
| 1935 | |
| 1936 | ################## |
| 1937 | # ezmlm-moderate # |
| 1938 | ################## |
| 1939 | |
| 1940 | ${ECHO} -n "ezmlm-moderate (1/2): " |
| 1941 | |
| 1942 | # MOD1 and MOD3 are defined from ezmlm-store testing |
| 1943 | |
| 1944 | REJ=`${GREP} "From: $LOC-reject" "$MOD1"| cut -d' ' -f2` |
| 1945 | if [ -z "$REJ" ]; then |
| 1946 | ${ECHO} "No From: ...-reject header in mod request for mod1" |
| 1947 | exit 100 |
| 1948 | fi |
| 1949 | |
| 1950 | ACC=`${GREP} "Reply-To: $LOC-accept" "$MOD3"| cut -d' ' -f2` |
| 1951 | if [ -z "$ACC" ]; then |
| 1952 | ${ECHO} "No From: ...-accept header in mod request for mod3" |
| 1953 | exit 100 |
| 1954 | fi |
| 1955 | |
| 1956 | # remove moderation request from sinkdir |
| 1957 | ${RM} -f "$MOD1" 2>/dev/null || \ |
| 1958 | { ${ECHO} "failed to remove mod request for mod1"; exit 100; } |
| 1959 | ${RM} -f "$MOD3" 2>/dev/null || \ |
| 1960 | { ${ECHO} "failed to remove mod request for mod3"; exit 100; } |
| 1961 | |
| 1962 | # make sure we get the (mis)accepted message(s) |
| 1963 | ${EZBIN}/ezmlm-sub "${DIR}" "${SND}@$HOST" |
| 1964 | |
| 1965 | LOCAL=`${ECHO} "$REJ" | cut -d@ -f1` |
| 1966 | export LOCAL |
| 1967 | |
| 1968 | if [ "$QMVER" = "n" ]; then |
| 1969 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$REJLEN"-`; export DEFAULT |
| 1970 | fi |
| 1971 | ${EZBIN}/ezmlm-moderate "${DIR}" "${EZBIN}/ezmlm-send ${DIR}" \ |
| 1972 | </dev/null >"${ERR}" 2>&1 || \ |
| 1973 | { ${ECHO} "failed on rejection"; exit 100; } |
| 1974 | |
| 1975 | LOCAL=`${ECHO} "$ACC" | cut -d@ -f1` |
| 1976 | export LOCAL |
| 1977 | if [ "$QMVER" = "n" ]; then |
| 1978 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$ACCLEN"-`; export DEFAULT |
| 1979 | fi |
| 1980 | ${EZBIN}/ezmlm-moderate "${DIR}" "${EZBIN}/ezmlm-send ${DIR}" \ |
| 1981 | </dev/null >"${ERR}" 2>&1 || \ |
| 1982 | { ${ECHO} "failed on acceptance"; exit 100; } |
| 1983 | |
| 1984 | ls -l "${DIR}/mod/rejected/" | ${GREP} '[0-9]' >/dev/null 2>&1 || \ |
| 1985 | { ${ECHO} "failed to write reject stub"; exit 100; } |
| 1986 | ls -l "${DIR}/mod/accepted/" | ${GREP} '[0-9]' >/dev/null 2>&1 || \ |
| 1987 | { ${ECHO} "failed to write accept stub"; exit 100; } |
| 1988 | |
| 1989 | REJ1=`${ECHO} "$REJ" | sed s/reject/accept/` |
| 1990 | LOCAL=`${ECHO} "$REJ1" | cut -d@ -f1` |
| 1991 | export LOCAL |
| 1992 | if [ "$QMVER" = "n" ]; then |
| 1993 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$REJLEN"-`; export DEFAULT |
| 1994 | fi |
| 1995 | ${EZBIN}/ezmlm-moderate "${DIR}" "${EZBIN}/ezmlm-send ${DIR}" \ |
| 1996 | </dev/null >/dev/null 2>&1 && \ |
| 1997 | { ${ECHO} "failed to bounce accept of rejected message"; exit 100; } |
| 1998 | LOCAL=`${ECHO} "$REJ" | cut -d@ -f1` |
| 1999 | export LOCAL |
| 2000 | if [ "$QMVER" = "n" ]; then |
| 2001 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$REJLEN"-`; export DEFAULT |
| 2002 | fi |
| 2003 | ${EZBIN}/ezmlm-moderate "${DIR}" "${EZBIN}/ezmlm-send ${DIR}" \ |
| 2004 | </dev/null >/dev/null 2>&1 || \ |
| 2005 | { ${ECHO} "failed to silently ignore re-rejection"; exit 100; } |
| 2006 | |
| 2007 | ACC1=`${ECHO} "$ACC" | sed s/accept/reject/` |
| 2008 | LOCAL=`${ECHO} "$ACC1" | cut -d@ -f1` |
| 2009 | export LOCAL |
| 2010 | if [ "$QMVER" = "n" ]; then |
| 2011 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$REJLEN"-`; export DEFAULT |
| 2012 | fi |
| 2013 | ${EZBIN}/ezmlm-moderate "${DIR}" "${EZBIN}/ezmlm-send ${DIR}" \ |
| 2014 | </dev/null >/dev/null 2>&1 && \ |
| 2015 | { ${ECHO} "failed to bounce reject of accepted message"; exit 100; } |
| 2016 | LOCAL=`${ECHO} "$ACC" | cut -d@ -f1` |
| 2017 | export LOCAL |
| 2018 | if [ "$QMVER" = "n" ]; then |
| 2019 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$ACCLEN"-`; export DEFAULT |
| 2020 | fi |
| 2021 | ${EZBIN}/ezmlm-moderate "${DIR}" "${EZBIN}/ezmlm-send ${DIR}" \ |
| 2022 | </dev/null >/dev/null 2>&1 || \ |
| 2023 | { ${ECHO} "failed to silently ignore re-acceptance"; exit 100; } |
| 2024 | |
| 2025 | ${ECHO} "OK" |
| 2026 | |
| 2027 | # cleanup |
| 2028 | ${EZBIN}/ezmlm-unsub "${DIR}" "${SND}@$HOST" |
| 2029 | |
| 2030 | ############## |
| 2031 | # ezmlm-warn # |
| 2032 | ############## |
| 2033 | ${ECHO} -n "ezmlm-warn (2/3): " |
| 2034 | |
| 2035 | ${EZBIN}/ezmlm-warn -t0 "${DIR}" >"${ERR}" 2>&1 || \ |
| 2036 | { ${ECHO} "failed with normal bounce for warning"; exit 100; } |
| 2037 | |
| 2038 | ${EZBIN}/ezmlm-warn -d -t0 "${DIR}" >"${ERR}" 2>&1 || \ |
| 2039 | { ${ECHO} "failed with digest bounce for warning"; exit 100; } |
| 2040 | |
| 2041 | ${ECHO} "OK" |
| 2042 | |
| 2043 | ################# |
| 2044 | # ezmlm-request # |
| 2045 | ################# |
| 2046 | |
| 2047 | ${ECHO} -n "ezmlm-request (2/2): " |
| 2048 | |
| 2049 | ${GREP} "$LOC-qqqq-$SND=$HOST" "${REQ}" >/dev/null || \ |
| 2050 | { ${ECHO} "'qqqq' subject query rewriting failed"; exit 100; } |
| 2051 | |
| 2052 | ${GREP} "$LOC-unsubscribe-$SND=$HOST" "${REQ}" >/dev/null || \ |
| 2053 | { ${ECHO} "ezmlm 'remove' subject query rewriting failed"; exit 100; } |
| 2054 | |
| 2055 | ${ECHO} "OK" |
| 2056 | |
| 2057 | ######################## |
| 2058 | # waiting for delivery # |
| 2059 | ######################## |
| 2060 | send_test 3 |
| 2061 | fi # end section 2 |
| 2062 | |
| 2063 | ######################################### start of section 3 |
| 2064 | if [ "$SECT" -le "3" ]; then |
| 2065 | wait_test 3 |
| 2066 | |
| 2067 | ############### |
| 2068 | # ezmlm-split # |
| 2069 | ############### |
| 2070 | if [ "$QMVER" = "n" ]; then |
| 2071 | ${ECHO} -n "ezmlm-split (2/2): " |
| 2072 | |
| 2073 | # we know that ezmlm-manage works. A bounce would go to MODDIR, so a |
| 2074 | # message in SINKDIR means that the request was forwarded to ezmlm-manage, |
| 2075 | # which replied with a confirmation request. |
| 2076 | ${GREP} 'X-num: spl1' $SINKDIR/new/* > /dev/null 2>&1 || \ |
| 2077 | { ${ECHO} "failed to receive sub conf req."; |
| 2078 | ${ECHO} "this could be a failure of ezmlm-split, but usually,"; |
| 2079 | ${ECHO} "it happens because ezmlm binaries when run by qmail"; |
| 2080 | ${ECHO} "don't have access to shared libraries required for"; |
| 2081 | ${ECHO} "RDBMS access. This happens on systems where RDBMS"; |
| 2082 | ${ECHO} "shared libs are installed in the /usr/local hierarchy."; |
| 2083 | ${ECHO} "fix: see ld.so man page on how to modify /etc/ld.so.conf"; |
| 2084 | ${ECHO} "or compile statically by adding -static to conf-sqlld."; |
| 2085 | ${ECHO} |
| 2086 | exit 100; } |
| 2087 | |
| 2088 | ${ECHO} "OK" |
| 2089 | fi |
| 2090 | |
| 2091 | ################## |
| 2092 | # ezmlm-moderate # |
| 2093 | ################## |
| 2094 | |
| 2095 | ${ECHO} -n "ezmlm-moderate (2/2): " |
| 2096 | |
| 2097 | MOD1=`${GREP} -l "mod1" $SINKDIR/new/* | head -1` || \ |
| 2098 | { ${ECHO} "failed to send rejection notice for message mod1"; exit 100; } |
| 2099 | |
| 2100 | # ${SND}@$HOST means it was rejected, not send through the list |
| 2101 | ${GREP} "To: ${SND}@$HOST" "$MOD1" > /dev/null 2>&1 || \ |
| 2102 | { ${ECHO} "failed to reject message mod1"; exit 100; } |
| 2103 | |
| 2104 | MOD3=`${GREP} -l "mod3" $SINKDIR/new/* | head -1` |
| 2105 | if [ -z "$MOD3" ]; then |
| 2106 | ${ECHO} "failed to post message mod3" |
| 2107 | exit 100 |
| 2108 | fi |
| 2109 | |
| 2110 | # ${LOC}@$HOST means it was not rejected, but sent through the list |
| 2111 | ${GREP} "To: ${LOC}@$HOST" "$MOD3" > /dev/null 2>&1 || \ |
| 2112 | { ${ECHO} "failed to reject message mod3"; exit 100; } |
| 2113 | |
| 2114 | ${ECHO} "OK" |
| 2115 | |
| 2116 | ################ |
| 2117 | # ezmlm-manage # |
| 2118 | ################ |
| 2119 | ${ECHO} -n "ezmlm-manage (3/4): " |
| 2120 | |
| 2121 | SENDER="${MOD}@$HOST"; export SENDER |
| 2122 | ${EZBIN}/ezmlm-issubn "${DIR}" && \ |
| 2123 | { ${ECHO} "unsub without mod for moderated list failed"; exit 100; } |
| 2124 | |
| 2125 | SUB3=`${GREP} -l 'sub3' $MODDIR/new/*` || \ |
| 2126 | { ${ECHO} "failed getting subscribe moderation confirm request"; \ |
| 2127 | exit 100; } |
| 2128 | |
| 2129 | # confirm subscription request |
| 2130 | LOCAL=`${GREP} "Reply-To:" "$SUB3" | cut -d' ' -f2 | cut -d'@' -f1` || \ |
| 2131 | { ${ECHO} "no confirm address in sub3 mod confirm request"; exit 100; } |
| 2132 | export LOCAL |
| 2133 | if [ "$QMVER" = "n" ]; then |
| 2134 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$LOCLEN"-`; export DEFAULT |
| 2135 | fi |
| 2136 | ${ECHO} "X-num: modR1" > "${DIR}/__tmp" |
| 2137 | ${ECHO} "FROM: moderator agrees <$SENDER>" >> "${DIR}/__tmp" |
| 2138 | ${ECHO} >> "${DIR}/__tmp" |
| 2139 | ${EZBIN}/ezmlm-manage ${SW_FROM} "${DIR}" < "${DIR}/__tmp"\ |
| 2140 | >/dev/null 2>&1 || \ |
| 2141 | { ${ECHO} "failed to send digest sub mod accept for sub3"; exit 100; } |
| 2142 | |
| 2143 | # complete edit. SENDER can be any address |
| 2144 | SENDER="${MAN}@$HOST"; export SENDER |
| 2145 | EDIT3=`${GREP} -l 'edit3' $MODDIR/new/*` || \ |
| 2146 | { ${ECHO} "failed getting edit reply for edit3"; \ |
| 2147 | exit 100; } |
| 2148 | ${GREP} "#TEST_TEXT#" "$EDIT3" >/dev/null 2>&1 || \ |
| 2149 | { ${ECHO} "old text missing in edit3 edit reply"; exit 100; } |
| 2150 | LOCAL=`${GREP} "Reply-To:" "$EDIT3" | cut -d' ' -f2 | cut -d'@' -f1` || \ |
| 2151 | { ${ECHO} "no reply address in edit3 edit reply"; exit 100; } |
| 2152 | export LOCAL |
| 2153 | if [ "$QMVER" = "n" ]; then |
| 2154 | DEFAULT=`${ECHO} "$LOCAL" | cut -c"$LOCLEN"-`; export DEFAULT |
| 2155 | fi |
| 2156 | ${ECHO} "X-num: edit4" > "${DIR}/__tmp" |
| 2157 | ${ECHO} >> "${DIR}/__tmp" |
| 2158 | ${ECHO} "%%% START OF TEXT FILE" >> "${DIR}/__tmp" |
| 2159 | ${ECHO} "#NEW_TEXT#" >> "${DIR}/__tmp" |
| 2160 | ${ECHO} "%%% END OF TEXT FILE" >> "${DIR}/__tmp" |
| 2161 | ${EZBIN}/ezmlm-manage -e "${DIR}" < "${DIR}/__tmp" >/dev/null 2>&1 || \ |
| 2162 | { ${ECHO} "failed to send edit4 reply for edit3"; exit 100; } |
| 2163 | |
| 2164 | # check results of log/list |
| 2165 | LOG3=`${GREP} -l 'log3' $MODDIR/new/*` || \ |
| 2166 | { ${ECHO} "failed getting -log reply to log3"; \ |
| 2167 | exit 100; } |
| 2168 | ${GREP} "aaa@bbb" "$LOG3" | ${GREP} "+m" > /dev/null 2>&1 || \ |
| 2169 | { ${ECHO} "failed to get log reply to log3"; exit 100; } |
| 2170 | |
| 2171 | LIST3=`${GREP} -l 'list3' $MODDIR/new/*` || \ |
| 2172 | { ${ECHO} "failed getting -list reply to list3"; \ |
| 2173 | exit 100; } |
| 2174 | ${GREP} "aaa@bbb" "$LIST3" > /dev/null 2>&1 || \ |
| 2175 | { ${ECHO} "failed to get list reply to list3"; exit 100; } |
| 2176 | |
| 2177 | ${ECHO} "OK" |
| 2178 | |
| 2179 | ############# |
| 2180 | # ezmlm-get # |
| 2181 | ############# |
| 2182 | ${ECHO} -n "ezmlm-get (2/2): " |
| 2183 | |
| 2184 | # index1/get1/thread1 should bounce and will not be looked for |
| 2185 | # index2 ... should be in DIG@HOST's inbox |
| 2186 | # get3 - r format to DIG@HST |
| 2187 | # get4 - n |
| 2188 | # get5 - v |
| 2189 | # get6 - x |
| 2190 | |
| 2191 | # well - just a consistency check |
| 2192 | ${GREP} "index1" ${DIGDIR}/new/* >/dev/null 2>&1 && \ |
| 2193 | { ${ECHO} "index1 found in wrong mailbox"; exit 100; } |
| 2194 | |
| 2195 | # now check that they've been delivered. We don't check the formats, |
| 2196 | # as this would be quite involved. |
| 2197 | ${GREP} "index2" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2198 | { ${ECHO} "index2 failed to return"; exit 100; } |
| 2199 | ${GREP} "get2" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2200 | { ${ECHO} "get2 failed to return"; exit 100; } |
| 2201 | ${GREP} "get3" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2202 | { ${ECHO} "get3 format 'r' failed to return"; exit 100; } |
| 2203 | ${GREP} "get4" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2204 | { ${ECHO} "get3 format 'n' failed to return"; exit 100; } |
| 2205 | ${GREP} "get5" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2206 | { ${ECHO} "get3 format 'v' failed to return"; exit 100; } |
| 2207 | ${GREP} "get6" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2208 | { ${ECHO} "get3 format 'x' failed to return"; exit 100; } |
| 2209 | |
| 2210 | ${GREP} "dig1" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2211 | { ${ECHO} "dig1 from manager wasn't delivered"; exit 100; } |
| 2212 | ${GREP} "dig2" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2213 | { ${ECHO} "dig2 from editor wasn't delivered"; exit 100; } |
| 2214 | ${GREP} "dig3" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2215 | { ${ECHO} "dig3 from command line wasn't delivered"; exit 100; } |
| 2216 | ${GREP} "dig4" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2217 | { ${ECHO} "dig4 format 'r' wasn't delivered"; exit 100; } |
| 2218 | ${GREP} "dig5" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2219 | { ${ECHO} "dig5 format 'n' wasn't delivered"; exit 100; } |
| 2220 | ${GREP} "dig6" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2221 | { ${ECHO} "dig6 format 'x' wasn't delivered"; exit 100; } |
| 2222 | ${GREP} "dig6" ${DIGDIR}/new/* >/dev/null 2>&1 || \ |
| 2223 | { ${ECHO} "dig6 format 'v' wasn't delivered"; exit 100; } |
| 2224 | |
| 2225 | ${ECHO} "OK" |
| 2226 | |
| 2227 | |
| 2228 | ######################## |
| 2229 | # waiting for delivery # |
| 2230 | ######################## |
| 2231 | send_test 4 |
| 2232 | fi # end section 3 |
| 2233 | |
| 2234 | ####################################### start of section 4 |
| 2235 | if [ "$SECT" -le "4" ]; then |
| 2236 | wait_test 4 |
| 2237 | |
| 2238 | ############## |
| 2239 | # ezmlm-warn # |
| 2240 | ############## |
| 2241 | ${ECHO} -n "ezmlm-warn (3/3): " |
| 2242 | |
| 2243 | SENDER="${BNC}@${HOST}" |
| 2244 | export SENDER |
| 2245 | ${EZBIN}/ezmlm-issubn -n "${DIR}" || \ |
| 2246 | { ${ECHO} "failed to remove bouncing subscriber"; exit 100; } |
| 2247 | ${EZBIN}/ezmlm-issubn -n "${DIR}/digest" || \ |
| 2248 | { ${ECHO} "failed to remove bouncing digest subscriber"; exit 100; } |
| 2249 | |
| 2250 | ${ECHO} "OK" |
| 2251 | |
| 2252 | ################ |
| 2253 | # ezmlm-manage # |
| 2254 | ################ |
| 2255 | ${ECHO} -n "ezmlm-manage (4/4): " |
| 2256 | |
| 2257 | ${GREP} "#NEW_TEXT#" "${DIR}/text/test" >/dev/null 2>&1 || \ |
| 2258 | { ${ECHO} "edit4 failed to update text file"; exit 100; } |
| 2259 | |
| 2260 | ${ECHO} "OK" |
| 2261 | |
| 2262 | fi # end section 4 |
| 2263 | |
| 2264 | ########################## start of section 9 (cleanup) |
| 2265 | if [ "$SECT" -eq "9" -o -z "$DEBUG" ]; then |
| 2266 | |
| 2267 | ##################### |
| 2268 | # remove test files # |
| 2269 | ##################### |
| 2270 | |
| 2271 | |
| 2272 | # cleanup the mysql sub tables so we can repeat if necessary |
| 2273 | # the Log test will pass due to old data once we access the mysql log, |
| 2274 | # rather than the file, but what the ... |
| 2275 | if [ $USESQL ]; then |
| 2276 | ${EZBIN}/ezmlm-unsub "${DIR}/digest" "${MAN}@$HOST" "${DIG}@$HOST" \ |
| 2277 | >/dev/null 2>&1 |
| 2278 | ${EZBIN}/ezmlm-unsub "${DIR}/mod" "${MOD}@$HOST" \ |
| 2279 | >/dev/null 2>&1 |
| 2280 | ${EZBIN}/ezmlm-unsub "${DIR}/${ALLOW}" "aaa@bbb" "ccc@ddd" "eee@fff" \ |
| 2281 | >/dev/null 2>&1 |
| 2282 | fi |
| 2283 | ${RM} -rf "${DIR}" ${DOT}* "${ERR}" >/dev/null 2>&1 |
| 2284 | |
| 2285 | fi |
| 2286 | ${ECHO} |
| 2287 | if [ ! -z "${BUG}" ]; then |
| 2288 | ${ECHO} "${BUG}" | ${GREP} "config" >/dev/null 2>&1 && \ |
| 2289 | { |
| 2290 | ${ECHO} |
| 2291 | ${ECHO} "The config bug prevents editing lists created with" |
| 2292 | ${ECHO} "ezmlm-idx<0.31 or ezmlm-0.53. 'touch DIR/config' is a work-" |
| 2293 | ${ECHO} "around, and upgrading to >=0.314 corrects it." |
| 2294 | } |
| 2295 | ${ECHO} "${BUG}" | ${GREP} "deny" >/dev/null 2>&1 && \ |
| 2296 | { |
| 2297 | ${ECHO} |
| 2298 | if [ "$EZVER" = '31' ]; then |
| 2299 | ${ECHO} "The DENY bug allows users to remove themselves" |
| 2300 | ${ECHO} "from DIR/blacklist which is not intended, but OTOH," |
| 2301 | ${ECHO} "DIR/blacklist is not intended for this and as a SENDER check" |
| 2302 | ${ECHO} "inherently insecure anyway. If you need this feature and the" |
| 2303 | ${ECHO} "bug is a problem, upgrade to >=0.321." |
| 2304 | else |
| 2305 | ${ECHO} "DENY access means that subscribers can remove"; |
| 2306 | ${ECHO} "themselves from DIR/deny. This is a bug, but DENY" |
| 2307 | ${ECHO} "is easy to circumvent and not intended to keep users from" |
| 2308 | ${ECHO} "posting, anyway." |
| 2309 | ${ECHO} "The bug is fixed in >=0.321." |
| 2310 | fi |
| 2311 | } |
| 2312 | ${ECHO} "${BUG}" | ${GREP} "return" >/dev/null 2>&1 && \ |
| 2313 | { |
| 2314 | ${ECHO} |
| 2315 | ${ECHO} "The failure to add the ezmlm-return lines means" |
| 2316 | ${ECHO} "that old lists will work correctly, but bounce handling" |
| 2317 | ${ECHO} "won't work in lists created with this version." |
| 2318 | ${ECHO} "The bug is fixed in >=0.321." |
| 2319 | } |
| 2320 | ${ECHO} "${BUG}" | ${GREP} "tstdig" >/dev/null 2>&1 && \ |
| 2321 | { |
| 2322 | ${ECHO} |
| 2323 | ${ECHO} "The ezmlm-tstdig bug means that DIR/inlocal still needs to be" |
| 2324 | ${ECHO} "adjusted for with digests within virtual domains." |
| 2325 | ${ECHO} "The bug is fixed in >=0.321." |
| 2326 | } |
| 2327 | ${ECHO} "${BUG}" | ${GREP} "digest" >/dev/null 2>&1 && \ |
| 2328 | { |
| 2329 | ${ECHO} |
| 2330 | ${ECHO} "The ezmlm-tstdig -digest- bug means that ezmlm-tstdig when" |
| 2331 | ${ECHO} "in DIR/manager does not pass on digest subscribe request." |
| 2332 | ${ECHO} "Upgrade to ezmlm-idx>=0.321 if you use ezmlm-tstdig in" |
| 2333 | ${ECHO} "DIR/manager (this is NOT used except in custom or very" |
| 2334 | ${ECHO} "old (ezlm-idx<0.30) digest setups)." |
| 2335 | } |
| 2336 | ${ECHO} "${BUG}" | ${GREP} "_bound" >/dev/null 2>&1 && \ |
| 2337 | { |
| 2338 | ${ECHO} |
| 2339 | ${ECHO} "The ezmlm-send/reject mimeremove bug caused erroneous" |
| 2340 | ${ECHO} "rejection of messages with text after the mime boundary in the" |
| 2341 | ${ECHO} "Content-type header when DIR/mimeremove was used. This type" |
| 2342 | ${ECHO} "of message is very rare (mainly Mutt with PGP MIME)." |
| 2343 | } |
| 2344 | ${ECHO} "${BUG}" | ${GREP} "_noself" >/dev/null 2>&1 && \ |
| 2345 | { |
| 2346 | ${ECHO} |
| 2347 | ${ECHO} "The ezmlm-send -C switch 'not to sender' is no longer" |
| 2348 | ${ECHO} "supported. For backwards compatibility the switch is" |
| 2349 | ${ECHO} "ignored. Instead, implement this feature in the recipients" |
| 2350 | ${ECHO} "mailbox by rejecting messages from the list with the" |
| 2351 | ${ECHO} "recipient's address in the From: header." |
| 2352 | } |
| 2353 | ${ECHO} "${BUG}" | ${GREP} "_signed" >/dev/null 2>&1 && \ |
| 2354 | { |
| 2355 | ${ECHO} |
| 2356 | ${ECHO} "The trailer is added as a separate MIME part to multipart" |
| 2357 | ${ECHO} "messages, but should be suppressed not only for multipart" |
| 2358 | ${ECHO} "alternative, but also for many other multipart types," |
| 2359 | ${ECHO} "including multipart/signed." |
| 2360 | } |
| 2361 | ${ECHO} |
| 2362 | fi |
| 2363 | |
| 2364 | exit 0 |
| 2365 | |
| 2366 | |