rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o regex_cache.o \
route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
std-crypto.o store.o string.o tls.o tod.o transport.o tree.o verify.o \
- environment.o macro.o \
+ xtextencode.o environment.o macro.o \
$(OBJ_LOOKUPS) \
local_scan.o $(EXIM_PERL) $(OBJ_WITH_CONTENT_SCAN) \
$(OBJ_EXPERIMENTAL)
transport.o: $(HDRS) transport.c
tree.o: $(HDRS) tree.c
verify.o: $(HDRS) transports/smtp.h verify.c
+xtextencode.o: $(HDRS) xtextencode.c
dkim.o: $(HDRS) pdkim/pdkim.h dkim.c
dkim_transport.o: $(HDRS) dkim_transport.c
for f in README Makefile call_pam.c call_pwcheck.c \
call_radius.c check_serv_cond.c cyrus_sasl.c cyrus_sasl.h gsasl_exim.c \
gsasl_exim.h get_data.c get_no64_data.c heimdal_gssapi.c heimdal_gssapi.h \
- xtextencode.c xtextdecode.c cram_md5.c cram_md5.h plaintext.c plaintext.h \
+ cram_md5.c cram_md5.h plaintext.c plaintext.h \
pwcheck.c pwcheck.h auth-spa.c auth-spa.h dovecot.c dovecot.h sha1.c spa.c \
spa.h tls.c tls.h external.c external.h
do
sieve.c smtp_in.c smtp_out.c spool_in.c spool_out.c std-crypto.c store.c \
string.c tls.c tlscert-gnu.c tlscert-openssl.c tls-cipher-stdname.c \
tls-gnu.c tls-openssl.c \
- tod.c transport.c tree.c verify.c version.c \
+ tod.c transport.c tree.c verify.c version.c xtextencode.c \
dkim.c dkim.h dkim_transport.c dmarc.c dmarc.h \
valgrind.h memcheck.h \
macro_predef.c macro_predef.h
call_radius.o check_serv_cond.o cram_md5.o cyrus_sasl.o dovecot.o \
external.o get_data.o get_no64_data.o gsasl_exim.o heimdal_gssapi.o \
plaintext.o pwcheck.o \
- spa.o tls.o xtextdecode.o xtextencode.o
+ spa.o tls.o
auths.a: $(OBJ)
@$(RM_COMMAND) -f auths.a
get_data.o: $(HDRS) get_data.c
get_no64_data.o: $(HDRS) get_no64_data.c
pwcheck.o: $(HDRS) pwcheck.c pwcheck.h
-xtextdecode.o: $(HDRS) xtextdecode.c
-xtextencode.o: $(HDRS) xtextencode.c
cram_md5.o: $(HDRS) cram_md5.c cram_md5.h
cyrus_sasl.o: $(HDRS) cyrus_sasl.c cyrus_sasl.h
+++ /dev/null
-/*************************************************
-* Exim - an Internet mail transport agent *
-*************************************************/
-
-/* Copyright (c) The Exim Maintainers 2022 - 2023 */
-/* Copyright (c) University of Cambridge 1995 - 2009 */
-/* See the file NOTICE for conditions of use and distribution. */
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#include "../exim.h"
-
-
-/*************************************************
-* Decode byte-string in xtext *
-*************************************************/
-
-/* This function decodes a string in xtextformat as defined in RFC 1891 and
-required by the SMTP AUTH extension (RFC 2554). We put the result in a piece of
-store of equal length - it cannot be longer than this. Although in general the
-result of decoding an xtext may be binary, in the context in which it is used
-by Exim (for decoding the value of AUTH on a MAIL command), the result is
-expected to be an addr-spec. We therefore add on a terminating zero, for
-convenience.
-
-Arguments:
- code points to the coded string, zero-terminated
- ptr where to put the pointer to the result, which is in
- dynamic store
-
-Returns: the number of bytes in the result, excluding the final zero;
- -1 if the input is malformed
-*/
-
-int
-auth_xtextdecode(uschar * code, uschar ** ptr)
-{
-int x;
-uschar * result = store_get(Ustrlen(code) + 1, code);
-*ptr = result;
-
-while ((x = (*code++)) != 0)
- {
- if (x < 33 || x > 127 || x == '=') return -1;
- if (x == '+')
- {
- register int y;
- if (!isxdigit((x = (*code++)))) return -1;
- y = ((isdigit(x))? x - '0' : (tolower(x) - 'a' + 10)) << 4;
- if (!isxdigit((x = (*code++)))) return -1;
- *result++ = y | ((isdigit(x))? x - '0' : (tolower(x) - 'a' + 10));
- }
- else *result++ = x;
- }
-
-*result = 0;
-return result - *ptr;
-}
-
-/* End of xtextdecode.c */
+++ /dev/null
-/*************************************************
-* Exim - an Internet mail transport agent *
-*************************************************/
-
-/* Copyright (c) The Exim Maintainers 2022 - 2024 */
-/* Copyright (c) University of Cambridge 1995 - 2018 */
-/* See the file NOTICE for conditions of use and distribution. */
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#include "../exim.h"
-
-
-/*************************************************
-* Encode byte-string in xtext *
-*************************************************/
-
-/* This function encodes a string of bytes, containing any values whatsoever,
-as "xtext", as defined in RFC 1891 and required by the SMTP AUTH extension (RFC
-2554).
-
-Arguments:
- clear points to the clear text bytes
- len the number of bytes to encode
-
-Returns: a pointer to the zero-terminated xtext string, which
- is in working store
-*/
-
-uschar *
-auth_xtextencode(uschar *clear, int len)
-{
-gstring * g = NULL;
-for(uschar ch; len > 0; len--, clear++)
- g = (ch = *clear) < 33 || ch > 126 || ch == '+' || ch == '='
- ? string_fmt_append(g, "+%.02X", ch)
- : string_catn(g, clear, 1);
-gstring_release_unused(g);
-return string_from_gstring(g);
-}
-
-
-/* End of xtextencode.c */
-/* vi: aw ai sw=2
-*/
{
/* must be decoded from xtext: see RFC 3461:6.3a */
uschar * xdec_envid;
- if (auth_xtextdecode(dsn_envid, &xdec_envid) > 0)
+ if (xtextdecode(dsn_envid, &xdec_envid) > 0)
fprintf(fp, "Original-Envelope-ID: %s\n", dsn_envid);
else
fprintf(fp, "X-Original-Envelope-ID: error decoding xtext formatted ENVID\n");
{
/* must be decoded from xtext: see RFC 3461:6.3a */
uschar *xdec_envid;
- if (auth_xtextdecode(dsn_envid, &xdec_envid) > 0)
+ if (xtextdecode(dsn_envid, &xdec_envid) > 0)
fprintf(f,"Original-Envelope-ID: %s\n", dsn_envid);
else
fprintf(f,"X-Original-Envelope-ID: error decoding xtext formatted ENVID\n");
if (dsn_envid)
{ /* must be decoded from xtext: see RFC 3461:6.3a */
uschar * xdec_envid;
- if (auth_xtextdecode(dsn_envid, &xdec_envid) > 0)
+ if (xtextdecode(dsn_envid, &xdec_envid) > 0)
fprintf(f, "Original-Envelope-ID: %s\n", dsn_envid);
else
fprintf(f, "X-Original-Envelope-ID: error decoding xtext formatted ENVID\n");
case EOP_XTEXTD:
{
uschar * s;
- int len = auth_xtextdecode(sub, &s);
+ int len = xtextdecode(sub, &s);
yield = string_catn(yield, s, len);
break;
}
extern int auth_prompt(const uschar *);
extern int auth_read_input(const uschar *);
extern gstring * auth_show_supported(gstring *);
-extern uschar *auth_xtextencode(uschar *, int);
-extern int auth_xtextdecode(uschar *, uschar **);
extern uschar *authenticator_current_name(void);
#ifdef EXPERIMENTAL_ARC
extern uschar * xclient_smtp_command(uschar *, int *, BOOL *);
extern gstring * xclient_smtp_advertise_str(gstring *);
#endif
+extern uschar *xtextencode(uschar *, int);
+extern int xtextdecode(uschar *, uschar **);
/******************************************************************************/
int rc;
uschar *ignore_msg;
- if (auth_xtextdecode(value, &authenticated_sender) < 0)
+ if (xtextdecode(value, &authenticated_sender) < 0)
{
/* Put back terminator overrides for error message */
value[-1] = '=';
&& local_authenticated_sender)
{
string_format_nt(p, sizeof(sx->buffer) - (p-sx->buffer), " AUTH=%s",
- auth_xtextencode(local_authenticated_sender,
+ xtextencode(local_authenticated_sender,
Ustrlen(local_authenticated_sender)));
client_authenticated_sender = string_copy(local_authenticated_sender);
}
static int
xclient_xtextdecode(uschar * code, uschar * end, uschar ** ptr)
{
-return auth_xtextdecode(string_copyn(code, end-code), ptr);
+return xtextdecode(string_copyn(code, end-code), ptr);
}
/*************************************************
--- /dev/null
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) The Exim Maintainers 2022 - 2024 */
+/* Copyright (c) University of Cambridge 1995 - 2018 */
+/* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "exim.h"
+
+
+/*************************************************
+* Encode byte-string in xtext *
+*************************************************/
+
+/* This function encodes a string of bytes, containing any values whatsoever,
+as "xtext", as defined in RFC 1891 and required by the SMTP AUTH extension (RFC
+2554).
+
+Arguments:
+ clear points to the clear text bytes
+ len the number of bytes to encode
+
+Returns: a pointer to the zero-terminated xtext string, which
+ is in working store
+*/
+
+uschar *
+xtextencode(uschar *clear, int len)
+{
+gstring * g = NULL;
+for(uschar ch; len > 0; len--, clear++)
+ g = (ch = *clear) < 33 || ch > 126 || ch == '+' || ch == '='
+ ? string_fmt_append(g, "+%.02X", ch)
+ : string_catn(g, clear, 1);
+gstring_release_unused(g);
+return string_from_gstring(g);
+}
+
+
+/*************************************************
+* Decode byte-string in xtext *
+*************************************************/
+
+/* This function decodes a string in xtextformat as defined in RFC 1891 and
+required by the SMTP AUTH extension (RFC 2554). We put the result in a piece of
+store of equal length - it cannot be longer than this. Although in general the
+result of decoding an xtext may be binary, in the context in which it is used
+by Exim (for decoding the value of AUTH on a MAIL command), the result is
+expected to be an addr-spec. We therefore add on a terminating zero, for
+convenience.
+
+Arguments:
+ code points to the coded string, zero-terminated
+ ptr where to put the pointer to the result, which is in
+ dynamic store
+
+Returns: the number of bytes in the result, excluding the final zero;
+ -1 if the input is malformed
+*/
+
+int
+xtextdecode(uschar * code, uschar ** ptr)
+{
+int x;
+uschar * result = store_get(Ustrlen(code) + 1, code);
+*ptr = result;
+
+while ((x = (*code++)) != 0)
+ {
+ if (x < 33 || x > 127 || x == '=') return -1;
+ if (x == '+')
+ {
+ register int y;
+ if (!isxdigit((x = (*code++)))) return -1;
+ y = ((isdigit(x))? x - '0' : (tolower(x) - 'a' + 10)) << 4;
+ if (!isxdigit((x = (*code++)))) return -1;
+ *result++ = y | ((isdigit(x))? x - '0' : (tolower(x) - 'a' + 10));
+ }
+ else *result++ = x;
+ }
+
+*result = 0;
+return result - *ptr;
+}
+
+/* End of xtextencode.c */
+/* vi: aw ai sw=2
+*/