← Back to team overview

maria-discuss team mailing list archive

Re: Remove everything except email addresses in from_addr table in mariaDB

 

On Friday 27 November 2020 at 13:12:44, Indunil Jayasooriya wrote:

> +----------------------------------------------------------------+
> | from_addr                                                             |
> +----------------------------------------------------------------+
> | admin@xxxxxxxxxx                                             |
> | userl@xxxxxxxxx                                                 |
> | Firstname Lastname <user622@xxxxxxxxx>     |
> | userl@xxxxxxxxx                                                 |
> | Firstname Lastname <user75@xxxxxxxxx>      |
> | root@xxxxxxxxxx (root)                                     |
> | userl@xxxxxxxxx                                               |
> | userl@xxxxxxxxx                                               |
> | Firstname Lastname <user75@xxxxxxxxx>      |
> | userl@xxxxxxxxx                                               |
> +--------------------------------------------------------------+
> 
> When Users send mails this from_addr column fills. some times with just
> email addresses, Some times email address with Display names.
> 
> What I expect is to remove all the display name part. I only need email
> addresses.

I would look at whatever process is putting this information IN to MariaDB - 
it seems that you are not parsing the address sufficiently to pick out just the 
part enclosed within < >

Given that you are accepting Internet-supplied input and simply feeding it in 
to a MariaDB table like this, I would strongly advise you also to consider 
input sanitisation to ensure that someone doesn't claim that their lastname 
is, for example "; drop table msgs" in the hope that your input parser simply 
passes this through as part of a SQL statement...


Regards,


Antony.

-- 
How I want a drink, alcoholic of course, after the heavy chapters involving 
quantum mechanics.

 - mnemonic for 3.14159265358979

                                                   Please reply to the list;
                                                         please *don't* CC me.


References