diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/Makefile | 1 | ||||
-rw-r--r-- | mbbsd/mail.c | 15 | ||||
-rw-r--r-- | mbbsd/register.c | 13 |
3 files changed, 17 insertions, 12 deletions
diff --git a/mbbsd/Makefile b/mbbsd/Makefile index 749dd32f..41bd4863 100644 --- a/mbbsd/Makefile +++ b/mbbsd/Makefile @@ -123,6 +123,7 @@ ctags: test: $(PROG) killall -TERM testmbbsd || true + sleep 1 killall -9 testmbbsd || true cp mbbsd testmbbsd ./testmbbsd 9000 diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 2f4ee3e1..b81b1e3a 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -1908,16 +1908,11 @@ bbs_sendmail(const char *fpath, const char *title, char *receiver) return send_inner_mail(fpath, title, hacker); } /* Running the sendmail */ - if (fpath == NULL) { - snprintf(genbuf, sizeof(genbuf), - "/usr/sbin/sendmail %s > /dev/null", receiver); - fin = fopen("etc/confirm", "r"); - } else { - snprintf(genbuf, sizeof(genbuf), - "/usr/sbin/sendmail -f %s%s %s > /dev/null", - cuser.userid, str_mail_address, receiver); - fin = fopen(fpath, "r"); - } + assert(*fpath); + snprintf(genbuf, sizeof(genbuf), + "/usr/sbin/sendmail -f %s%s %s > /dev/null", + cuser.userid, str_mail_address, receiver); + fin = fopen(fpath, "r"); if (fin == NULL) return -1; fout = popen(genbuf, "w"); diff --git a/mbbsd/register.c b/mbbsd/register.c index 0a49fde4..e2231960 100644 --- a/mbbsd/register.c +++ b/mbbsd/register.c @@ -163,7 +163,7 @@ isvalidcareer(char *career) { #ifndef FOREIGN_REG const char *rejectstr[] = {NULL}; - if (!(removespace(career) && career[0] < 0 && strlen(career) >= 6) || + if (!(career[0] < 0 && strlen(career) >= 6) || strcmp(career, "家裡") == 0 || HaveRejectStr(career, rejectstr) ) return "您的輸入不正確"; if (strcmp(&career[strlen(career) - 2], "大") == 0 || @@ -183,6 +183,15 @@ isvalidcareer(char *career) return NULL; } +static int +strlen_without_space(const char *s) +{ + int i = 0; + while (*s) + if (*s++ != ' ') i++; + return i; +} + static char * isvalidaddr(char *addr) { @@ -194,7 +203,7 @@ isvalidaddr(char *addr) #endif // DBG_DISABLE_CHECK // addr[0] > 0: check if address is starting by Chinese. - if (!removespace(addr) || strlen(addr) < 15) + if (strlen_without_space(addr) < 15) return "這個地址似乎並不完整"; if (strstr(addr, "信箱") != NULL || strstr(addr, "郵政") != NULL) return "抱歉我們不接受郵政信箱"; |