diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-11-14 11:22:34 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-11-14 11:22:34 +0800 |
commit | 035aaea068f68557bb3d8665d19153864f2768a2 (patch) | |
tree | d4fca3b44d2e285c7238054828fe14c2b275b734 | |
parent | 15da8848c41b000bd91e65a9850da20679b466b6 (diff) | |
download | pttbbs-035aaea068f68557bb3d8665d19153864f2768a2.tar pttbbs-035aaea068f68557bb3d8665d19153864f2768a2.tar.gz pttbbs-035aaea068f68557bb3d8665d19153864f2768a2.tar.bz2 pttbbs-035aaea068f68557bb3d8665d19153864f2768a2.tar.lz pttbbs-035aaea068f68557bb3d8665d19153864f2768a2.tar.xz pttbbs-035aaea068f68557bb3d8665d19153864f2768a2.tar.zst pttbbs-035aaea068f68557bb3d8665d19153864f2768a2.zip |
1. fix invalid operation
2. setuid first in util/cleanpasswd.c
3. add "people/per option" in the result of a vote
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@1329 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/mbbsd/bbs.c | 10 | ||||
-rw-r--r-- | pttbbs/mbbsd/vote.c | 6 | ||||
-rw-r--r-- | pttbbs/util/cleanpasswd.c | 4 |
3 files changed, 16 insertions, 4 deletions
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index 4f399c51..4806e092 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -870,7 +870,7 @@ edit_post(int ent, fileheader_t * fhdr, char *direct) return DONOTHING; if ((!HAS_PERM(PERM_SYSOP)) && - strcmp(fhdr->owner, cuser.userid)) + !(currmode & MODE_POST) && strcmp(fhdr->owner, cuser.userid)) return DONOTHING; if( currmode & MODE_SELECT ) @@ -942,6 +942,12 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) char genbuf[200]; char genbuf2[4]; boardheader_t *bp; + if (!(currmode & MODE_POST)) { + move(5, 10); + outs("對不起,您目前無法轉錄文章!"); + pressanykey(); + return FULLUPDATE; + } move(2, 0); clrtoeol(); move(3, 0); @@ -1268,7 +1274,7 @@ hold_gamble(int ent, fileheader_t * fhdr, char *direct) } move(6, 0); snprintf(genbuf, sizeof(genbuf), - "請到 %s 板 按'f'參與賭博!\n\n一張 %d Ptt幣, 這是%s的賭博\n%s%s", + "請到 %s 板 按'f'參與賭博!\n\n一張 %d Ptt幣, 這是%s的賭博\n%s%s\n", currboard, i, i < 100 ? "小賭式" : i < 500 ? "平民級" : i < 1000 ? "貴族級" : i < 5000 ? "富豪級" : "傾家蕩產", diff --git a/pttbbs/mbbsd/vote.c b/pttbbs/mbbsd/vote.c index 9304a697..8b4d670b 100644 --- a/pttbbs/mbbsd/vote.c +++ b/pttbbs/mbbsd/vote.c @@ -1,4 +1,4 @@ -/* $Id: vote.c,v 1.20 2003/07/06 23:09:25 kcwu Exp $ */ +/* $Id$ */ #include "bbs.h" static int total; @@ -240,10 +240,12 @@ b_result_one(boardheader_t * fh, int ind) fgets(inbuf, sizeof(inbuf), cfp); fprintf(tfp, "\n◆投票結果:(共有 %d 人投票,每人最多可投 %d 票)\n", num, junk); + fprintf(tfp, " 選 項 總票數 得票率 得票分布\n"); while (fgets(inbuf, sizeof(inbuf), cfp)) { inbuf[(strlen(inbuf) - 1)] = '\0'; num = counts[inbuf[0] - 'A']; - fprintf(tfp, " %-42s %3d 票 %02.2f%%\n", inbuf + 3, num, + fprintf(tfp, " %-42s %3d 票 %02.2f%% %02.2f%%\n", inbuf + 3, num, + (float)(num * 100) / (float)(num), (float)(num * 100) / (float)(total)); } fclose(cfp); diff --git a/pttbbs/util/cleanpasswd.c b/pttbbs/util/cleanpasswd.c index c5f8a251..60ae650d 100644 --- a/pttbbs/util/cleanpasswd.c +++ b/pttbbs/util/cleanpasswd.c @@ -18,6 +18,10 @@ int main(int argc, char *argv[]) int i, fd, fdw; userec_t user; + setgid(BBSGID); + setuid(BBSUID); + chdir(BBSHOME); + if ((fd = open(BBSHOME"/.PASSWDS", O_RDONLY)) < 0){ perror("open .PASSWDS error"); exit(-1); |