summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2004-10-07 10:39:01 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2004-10-07 10:39:01 +0000
commit059ec3d9952740285fb1ebf47961b8aca2eb1b4a (patch)
treee86817287b362e728c8d9ce5d890073553e877ae /src/util
parent61ec970df30325dbcd8c9d0f0e431dc793126656 (diff)
downloadexim4-059ec3d9952740285fb1ebf47961b8aca2eb1b4a.tar.gz
Start
Diffstat (limited to 'src/util')
-rwxr-xr-xsrc/util/cramtest.pl59
-rwxr-xr-xsrc/util/logargs.sh27
-rwxr-xr-xsrc/util/unknownuser.sh33
3 files changed, 119 insertions, 0 deletions
diff --git a/src/util/cramtest.pl b/src/util/cramtest.pl
new file mode 100755
index 000000000..87b3eb451
--- /dev/null
+++ b/src/util/cramtest.pl
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+# $Cambridge: exim/src/util/cramtest.pl,v 1.1 2004/10/07 10:39:03 ph10 Exp $
+
+# This script is contributed by Vadim Vygonets to aid in debugging CRAM-MD5
+# authentication.
+
+# A patch was contributed by Jon Warbrick to upgrade it to use the Digest::MD5
+# module instead of the deprecated MD5 module.
+
+# The script prompts for three data values: a user name, a password, and the
+# challenge as sent out by an SMTP server. The challenge is a base-64 string.
+# It should be copied (cut-and-pasted) literally as the third data item. The
+# output of the program is the base-64 string that is to be returned as the
+# response to the challenge. Using the example in RFC 2195:
+#
+# User: tim
+# Password: tanstaaftanstaaf
+# Challenge: PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2UucmVzdG9uLm1jaS5uZXQ+
+# dGltIGI5MTNhNjAyYzdlZGE3YTQ5NWI0ZTZlNzMzNGQzODkw
+#
+# The last line is what you you would send back to the server.
+
+
+# Copyright (c) 2002
+# Vadim Vygonets <vadik-exim@vygo.net>. All rights reserved.
+# Public domain is OK with me.
+
+use MIME::Base64;
+use DIGEST::MD5;
+
+print "User: ";
+chop($user = <>);
+print "Password: ";
+chop($passwd = <>);
+print "Challenge: ";
+chop($chal = <>);
+$chal =~ s/^334 //;
+
+$context = new Digest::MD5;
+if (length($passwd) > 64) {
+ $context->add($passwd);
+ $passwd = $context->digest();
+ $context->reset();
+}
+
+@passwd = unpack("C*", pack("a64", $passwd));
+for ($i = 0; $i < 64; $i++) {
+ $pass_ipad[$i] = $passwd[$i] ^ 0x36;
+ $pass_opad[$i] = $passwd[$i] ^ 0x5C;
+}
+$context->add(pack("C64", @pass_ipad), decode_base64($chal));
+$digest = $context->digest();
+$context->reset();
+$context->add(pack("C64", @pass_opad), $digest);
+$digest = $context->digest();
+
+print encode_base64($user . " " . unpack("H*", $digest));
+
+# End
diff --git a/src/util/logargs.sh b/src/util/logargs.sh
new file mode 100755
index 000000000..1b0b32124
--- /dev/null
+++ b/src/util/logargs.sh
@@ -0,0 +1,27 @@
+#! /bin/sh
+# $Cambridge: exim/src/util/logargs.sh,v 1.1 2004/10/07 10:39:03 ph10 Exp $
+
+# This script can be interposed between a calling program and another
+# program, in order to log the arguments which are being used. This can
+# be helpful in finding out what is going on if some program is calling
+# Exim with arguments it doesn't understand.
+
+# Set this to the the path of the program that must ultimately be called.
+
+CALL=exim
+
+# Set this to the name of the file where the data is to be logged. The
+# script writes on the end of it. It must be accessible to the user who
+# runs the script.
+
+LOGFILE=/home/ph10/tmp/zz
+
+# The arguments are copied to the log file
+
+echo $@ >>$LOGFILE
+
+# The real program is now called
+
+exec $CALL $@
+
+# End
diff --git a/src/util/unknownuser.sh b/src/util/unknownuser.sh
new file mode 100755
index 000000000..741248481
--- /dev/null
+++ b/src/util/unknownuser.sh
@@ -0,0 +1,33 @@
+#! /bin/sh
+# $Cambridge: exim/src/util/unknownuser.sh,v 1.1 2004/10/07 10:39:03 ph10 Exp $
+
+# This is a sample script for demonstrating how to handle unknown users in
+# a more friendly way than just returning a "user unknown" error. It can
+# be called from a pipe transport set up like this:
+
+# unknownuser_pipe:
+# driver = pipe;
+# command = "/opt/exim/util/unknownuser.sh",
+# ignore_status,
+# return_output,
+# user = nobody
+
+# which is specified by a smartuser director set up like this:
+
+# unknownuser:
+# transport = unknownuser_pipe,
+# no_verify,
+# driver = smartuser;
+
+# Any output generated by this script is then returned to the sender of
+# the message. You can run any commands you like at this point, for example,
+# to attempt fuzzy matches on the local part of the address. Here we just
+# give a bland message, demonstrating the availability of the variables
+# $LOCAL_PART and $DOMAIN.
+
+cat <<End
+"$LOCAL_PART" is not a known user mailbox in the domain "$DOMAIN".
+End
+
+
+