summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-06-04 10:04:20 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-06-04 10:04:20 +0800
commit5c3861dac3f16ff361b816a5a6b7b092a7b76ca5 (patch)
tree76ea133a1afa71aa55687a1db1b312a8d8ef3cc9 /mbbsd
parent812bb8cc4e7bbab2e958670916b06fd46bbdc09f (diff)
downloadpttbbs-5c3861dac3f16ff361b816a5a6b7b092a7b76ca5.tar
pttbbs-5c3861dac3f16ff361b816a5a6b7b092a7b76ca5.tar.gz
pttbbs-5c3861dac3f16ff361b816a5a6b7b092a7b76ca5.tar.bz2
pttbbs-5c3861dac3f16ff361b816a5a6b7b092a7b76ca5.tar.lz
pttbbs-5c3861dac3f16ff361b816a5a6b7b092a7b76ca5.tar.xz
pttbbs-5c3861dac3f16ff361b816a5a6b7b092a7b76ca5.tar.zst
pttbbs-5c3861dac3f16ff361b816a5a6b7b092a7b76ca5.zip
- prevent wrong email test on multiple '@'s.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4336 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/user.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 10b9f6c8..fe8fede2 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1325,15 +1325,20 @@ u_editplan(void)
}
int
-isvalidemail(const char *email)
+isvalidemail(char *email)
{
FILE *fp;
char buf[128], *c;
int allow = 0;
- if (!strstr(email, "@"))
- return 0;
- for (c = strstr(email, "@"); *c != 0; ++c)
+ c = strchr(email, '@');
+ if (c == NULL) return 0;
+
+ // reject multiple '@'
+ if (c != strrchr(email, '@')) return 0;
+
+ // domain tolower
+ for (; *c != 0; ++c)
if ('A' <= *c && *c <= 'Z')
*c += 32;