summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2011-11-09 16:07:53 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2011-11-09 16:07:53 +0800
commiteb6081959bf27d4034ca2e5fea3fd112b3d629e5 (patch)
tree149199929011a7a9db9aad53b8517d819f1565a9
parent3351e403553bcca1d0c7da84d2606a5feaa9c49e (diff)
downloadpttbbs-eb6081959bf27d4034ca2e5fea3fd112b3d629e5.tar
pttbbs-eb6081959bf27d4034ca2e5fea3fd112b3d629e5.tar.gz
pttbbs-eb6081959bf27d4034ca2e5fea3fd112b3d629e5.tar.bz2
pttbbs-eb6081959bf27d4034ca2e5fea3fd112b3d629e5.tar.lz
pttbbs-eb6081959bf27d4034ca2e5fea3fd112b3d629e5.tar.xz
pttbbs-eb6081959bf27d4034ca2e5fea3fd112b3d629e5.tar.zst
pttbbs-eb6081959bf27d4034ca2e5fea3fd112b3d629e5.zip
Add limitation to ziphome.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5459 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/mail.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c
index 78b7a779..519cf249 100644
--- a/pttbbs/mbbsd/mail.c
+++ b/pttbbs/mbbsd/mail.c
@@ -920,12 +920,30 @@ mail_all(void)
int
mail_mbox(void)
{
- char cmd[100];
- fileheader_t fhdr;
+ char tagname[PATHLEN];
+ char cmd[PATHLEN*2];
+ fileheader_t fhdr;
+ time4_t last_tag = 0;
+
+ setuserfile(tagname, ".zipped_home");
+ last_tag = dasht(tagname);
+
+ if (last_tag > 0 && (now - last_tag) < 7 * DAY_SECONDS &&
+ !HasUserPerm(PERM_SYSOP)) {
+ vmsgf("每週僅可備份一次,離下次還有 %d 天。",
+ 7 - (now - last_tag) / DAY_SECONDS);
+ return 0;
+ }
snprintf(cmd, sizeof(cmd), "/tmp/%s.uu", cuser.userid);
snprintf(fhdr.title, sizeof(fhdr.title), "%s 私人資料", cuser.userid);
- doforward(cmd, &fhdr, 'Z');
+ // TODO doforward does not return real execution code... we may need to
+ // fix it in future.
+ if (doforward(cmd, &fhdr, 'Z') == 0) {
+ log_filef(tagname, LOG_CREAT,
+ "%s %s\n", Cdatelite(&now), cmd);
+ rotate_text_logfile(tagname, SZ_RECENTLOGIN, 0.2);
+ }
return 0;
}