Skip to content

Commit

Permalink
More sophisticated defaultsep logic.
Browse files Browse the repository at this point in the history
Update rpm packaging, fix typos in documentation.
  • Loading branch information
svarshavchik committed Sep 14, 2024
1 parent 7412948 commit 602b0f6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 12 deletions.
4 changes: 3 additions & 1 deletion courier/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dnl
dnl Copyright 1998 - 2022 Double Precision, Inc. See COPYING for
dnl distribution information.

AC_INIT([courier],[1.3.12.20240912],[[email protected]])
AC_INIT([courier],[1.3.12.20240914],[[email protected]])
version=$PACKAGE_VERSION
AC_CONFIG_SRCDIR(courier/courier.c)
AM_INIT_AUTOMAKE
Expand Down Expand Up @@ -334,6 +334,8 @@ done
AC_ARG_WITH(repository, [], REPOSITORY="$withval")
AC_SUBST(REPOSITORY)

DATE=`env LC_ALL=en_US perl -e 'print scalar localtime'`
AC_SUBST(DATE)
echo $real_configure_args >configure.args
AC_CONFIG_SUBDIRS(afx libs/gdbmobj libs/bdbobj libs/cgi libs/http11 libs/numlib libs/soxwrap libs/md5 libs/sha1 libs/libhmac libs/random128 libs/rfc822 libs/rfc1035 libs/rfc2045 libs/liblock libs/maildir libs/waitlib libs/threadlib libs/makedat libs/tcpd libs/rootcerts libs/imap libs/maildrop libs/ldapaddressbook libs/gpglib libs/pcp libs/sqwebmail webadmin courier)

Expand Down
4 changes: 2 additions & 2 deletions courier/courier.spec.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 1998 - 2021 Double Precision, Inc. See COPYING for
# Copyright 1998 - 2024 Double Precision, Inc. See COPYING for
# distribution information.
#

Expand Down Expand Up @@ -1031,5 +1031,5 @@ fi

%changelog

* Tue Nov 22 2022 Sam Varshavchik <[email protected]>
* @DATE@ Sam Varshavchik <[email protected]>
- Update Makefile
6 changes: 3 additions & 3 deletions courier/courier/doc/dot-courier.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ either <literal>user+foo@domain</literal>.</para>
<filename>$HOME/.courier-<replaceable>foo</replaceable></filename>.
All occurences of <quote>+</quote> characters in the email address
are replaced by a <quote>-</quote>. The corresponding
<filename>.courier</filename> gets processed afterwards.
<filename>.courier</filename> file then gets processed.
</para>

<para>
All examples in the following documentation uses <quote>-</quote>
All examples in the following documentation use <quote>-</quote>
in E-mail addresses, but this also applies to
<quote>+</quote> as well (however
note that all actual <filename>.courier</filename>
Expand All @@ -83,7 +83,7 @@ either <literal>user+foo@domain</literal>.</para>

<para>
<quote>+</quote> is the default content of
The <filename>@sysconfdir@/defaultsep</filename> configuration file,
the <filename>@sysconfdir@/defaultsep</filename> configuration file,
if it does not exist. This configuration file
contains a single line with a list of all punctuation characters
that are considered to be equivalent to <quote>-</quote>.
Expand Down
44 changes: 38 additions & 6 deletions courier/courier/module.local/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ static void rw_del_local(struct rw_info *rwi,
free(addr);
}

static const char *defaultsep(char c)
{
return c == '-' ? "-" : strchr(config_defaultsep(), c);
}

static void rw_del_local2(struct rw_info *rwi,
char *addr,
Expand Down Expand Up @@ -243,17 +247,13 @@ static void rw_del_local2(struct rw_info *rwi,
localat=atdomain=strrchr(addr, '@');
if (atdomain)
*atdomain++=0;

for (ext=addr; *ext; ext++)
if (strchr(config_defaultsep(), *ext))
*ext='-';
#endif

i=0;
for (ext=addr; *ext; ext++)
{
#if LOCAL_EXTENSIONS
if (*ext == '-' && ++i > 3)
if (defaultsep(*ext) && ++i > 3)
break;
#endif
}
Expand Down Expand Up @@ -314,7 +314,7 @@ static void rw_del_local2(struct rw_info *rwi,
*ext=c;

while (ext > addr)
if (*--ext == '-') break;
if (defaultsep(*--ext)) break;
if (ext == addr)
{
if (atdomain)
Expand Down Expand Up @@ -440,8 +440,40 @@ static void rw_del_local2(struct rw_info *rwi,
}
}

static int local_callback2(struct authinfo *a, void *vp);


static int local_callback(struct authinfo *a, void *vp)
{
struct localauthinfo *lai=(struct localauthinfo *)vp;
const char *orig_ext=lai->ext;

char *ext=0;
int rc;

if (orig_ext)
{
char *p;

if ((ext=strdup(orig_ext)) == 0)
clog_msg_errno();

lai->ext=ext;

for (p=ext; *p; p++)
if (defaultsep(*p))
*p='-';
}

rc=local_callback2(a, vp);
lai->ext=orig_ext;

if (ext)
free(ext);
return rc;
}

static int local_callback2(struct authinfo *a, void *vp)
{
struct localauthinfo *lai=(struct localauthinfo *)vp;
struct rfc822token tacct, text, tuid, tgid, thomedir, tmaildir, tquota, trecip;
Expand Down

0 comments on commit 602b0f6

Please sign in to comment.