diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-06-04 10:04:20 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-06-04 10:04:20 +0800 |
commit | 5c3861dac3f16ff361b816a5a6b7b092a7b76ca5 (patch) | |
tree | 76ea133a1afa71aa55687a1db1b312a8d8ef3cc9 | |
parent | 812bb8cc4e7bbab2e958670916b06fd46bbdc09f (diff) | |
download | pttbbs-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
-rw-r--r-- | include/proto.h | 8 | ||||
-rw-r--r-- | mbbsd/user.c | 13 |
2 files changed, 15 insertions, 6 deletions
diff --git a/include/proto.h b/include/proto.h index 74139931..55df5c00 100644 --- a/include/proto.h +++ b/include/proto.h @@ -221,7 +221,6 @@ int chicken_main(void); int chickenpk(int fd); int load_chicken(const char *uid, chicken_t *mychicken); void chicken_query(const char *userid); -void ch_buyitem(int money, const char *picture, int *item, int haveticket); void show_chicken_data(chicken_t *thechicken, chicken_t *pkchicken); void chicken_toggle_death(const char *uid); @@ -691,7 +690,7 @@ int topsong(void); int kill_user(int num, const char *userid); int u_editcalendar(void); void user_display(const userec_t *u, int real); -int isvalidemail(const char *email); +int isvalidemail(char *email); void uinfo_query(userec_t *u, int real, int unum); int showsignature(char *fname, int *j, SigInfo *psi); int u_cancelbadpost(); @@ -779,6 +778,11 @@ int initcuser(const char *userid); int freecuser(void); int passwd_add_my_numpost(int diff); // temporary hack before new account system ready. +// current user help utilities +int pwcuSetSignature (unsigned char newsig); +int pwcuBitSetLevel (unsigned int mask); +int pwcuBitUnsetLevel (unsigned int mask); + /* calendar */ int calendar(void); 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; |