From cb9328de6d563ae06ee04aa2180416bb8967145b Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Wed, 12 Oct 2005 10:07:00 +0000 Subject: [PATCH] Generate an error if the third argument to ${prvs is not a single digit. --- doc/doc-txt/ChangeLog | 5 ++++- src/src/expand.c | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 07e108e7e..36c45ed10 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.247 2005/10/11 13:50:48 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.248 2005/10/12 10:07:00 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -15,6 +15,9 @@ PH/01 Two changes to the default runtime configuration: clients checks, on the grounds that messages accepted by these statements are most likely to be submissions. +PH/02 Generate an error if the third argument for the ${prvs expansion is not + a single digit. + Exim version 4.54 ----------------- diff --git a/src/src/expand.c b/src/src/expand.c index 739f5e854..cd8032a40 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/expand.c,v 1.43 2005/09/28 10:46:48 ph10 Exp $ */ +/* $Cambridge: exim/src/src/expand.c,v 1.44 2005/10/12 10:07:00 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -3360,15 +3360,24 @@ while (*s != 0) domain = Ustrrchr(sub_arg[0],'@'); if ( (domain == NULL) || (domain == sub_arg[0]) || (Ustrlen(domain) == 1) ) { - expand_string_message = US"first parameter must be a qualified email address"; + expand_string_message = US"prvs first argument must be a qualified email address"; + goto EXPAND_FAILED; + } + + /* Calculate the hash. The second argument must be a single-digit + key number, or unset. */ + + if (sub_arg[2] != NULL && + (!isdigit(sub_arg[2][0]) || sub_arg[2][1] != 0)) + { + expand_string_message = US"prvs second argument must be a single digit"; goto EXPAND_FAILED; } - /* Calculate the hash */ p = prvs_hmac_sha1(sub_arg[0],sub_arg[1],sub_arg[2],prvs_daystamp(7)); if (p == NULL) { - expand_string_message = US"hmac-sha1 conversion failed"; + expand_string_message = US"prvs hmac-sha1 conversion failed"; goto EXPAND_FAILED; } -- 2.25.1