Am Montag, dem 10.07.2023 um 08:52 -0400 schrieb Viktor Dukhovni via
Postfix-users:
> > On 10 Jul 2023, at 5:50 am, Matus UHLAR - fantomas via Postfix-
> > users <postfix-users@postfix.org> wrote:
> > 
> > > > #!/bin/bash
> > > > user=`echo "$2" | sed 's/[<>]//g'`
> > > > ret=`echo "select destination from virtual_aliases where
> > > > source=\"$user\";" | /usr/bin/mysql -upostfix -psecretpassword
> > > > mailserver | tail -n 1`
> > > > if [ -z "$ret" ]; then
> > > >     echo "nobody... deliverable: mailer local, user $user"
> > > > else
> > > >     echo "nobody... deliverable: mailer local, user $ret"
> > > > fi
> 
> I do hope the final code avoids the https://xkcd.com/327/ issues
> seen above.

Hey, that was me! My full given name *is* Robert'); DROP ...

CONFDIR=/etc/postfix
POSTMAP=/usr/sbin/postmap
LOCAL_VIRTUAL_USERS=mysql:${CONFDIR}/virtual_mailboxes.mysql.cf

recipient=$(printf '%s' "$2" | sed 's/[<>]//g')
username=$(([ ! -z ${LOCAL_VIRTUAL_USERS} ] && ${POSTMAP} -q "${recipient}" 
${LOCAL_VIRTUAL_USERS}))

Okay?

-- 
Robert Senger



_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to