summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-12 14:33:22 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-12 14:33:22 +0800
commit3f850274b0b2f83e62b4a26149c41d754e17f614 (patch)
tree62c53e5d64a3f8786bbc3752fc363def86840818
parent2976baf77a56831a4a063acc0c91102dc2ccc4f4 (diff)
downloadpttbbs-3f850274b0b2f83e62b4a26149c41d754e17f614.tar
pttbbs-3f850274b0b2f83e62b4a26149c41d754e17f614.tar.gz
pttbbs-3f850274b0b2f83e62b4a26149c41d754e17f614.tar.bz2
pttbbs-3f850274b0b2f83e62b4a26149c41d754e17f614.tar.lz
pttbbs-3f850274b0b2f83e62b4a26149c41d754e17f614.tar.xz
pttbbs-3f850274b0b2f83e62b4a26149c41d754e17f614.tar.zst
pttbbs-3f850274b0b2f83e62b4a26149c41d754e17f614.zip
- register: do not remove spaces until buildling justify string
- mail: drop old reg-confirm mail - Makefile: prevent corpses when using make test git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4143 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/Makefile1
-rw-r--r--mbbsd/mail.c15
-rw-r--r--mbbsd/register.c13
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 "抱歉我們不接受郵政信箱";