/* This file is part of anastasis-gtk. Copyright (C) 2020 Anastasis SARL Anastasis is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Anastasis; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @file src/anastasis/anastasis-gtk_handle-method-email.c * @brief Handle dialogs for security email * @author Christian Grothoff */ #include #include #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_handle-identity-changed.h" #include /** * Return obfuscated variant of an e-mail address. * * @param email input address * @return obfuscated version, NULL on errors */ static char * mask_email (const char *email) { char *at; char *tld; size_t nlen; char *result; result = GNUNET_strdup (email); at = strchr (result, '@'); if (NULL == at) { GNUNET_break (0); GNUNET_free (result); return NULL; } tld = strrchr (result, '.'); if (NULL == tld) { GNUNET_break (0); GNUNET_free (result); return NULL; } if ( (ssize_t) (at - tld) > 0) { GNUNET_break (0); GNUNET_free (result); return NULL; } nlen = at - result; switch (nlen) { case 0: GNUNET_break (0); GNUNET_free (result); return NULL; case 1: result[0] = '?'; break; case 2: case 3: result[0] = '?'; result[1] = '?'; break; default: for (unsigned int i = 1; i