diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-03-27 00:57:05 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-03-27 00:57:05 +0800 |
commit | 55367b29e2e0b49e96a9c75f259d60554b45c704 (patch) | |
tree | a27baa60682fa12b4a7d1f5a97e3a5cb5ed098e2 /mbbsd/chess.c | |
parent | dd19aa6ea6f949485cd6df72e525d5e334d73337 (diff) | |
download | pttbbs-55367b29e2e0b49e96a9c75f259d60554b45c704.tar pttbbs-55367b29e2e0b49e96a9c75f259d60554b45c704.tar.gz pttbbs-55367b29e2e0b49e96a9c75f259d60554b45c704.tar.bz2 pttbbs-55367b29e2e0b49e96a9c75f259d60554b45c704.tar.lz pttbbs-55367b29e2e0b49e96a9c75f259d60554b45c704.tar.xz pttbbs-55367b29e2e0b49e96a9c75f259d60554b45c704.tar.zst pttbbs-55367b29e2e0b49e96a9c75f259d60554b45c704.zip |
verify userid when sethome path.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3308 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/chess.c')
-rw-r--r-- | mbbsd/chess.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/mbbsd/chess.c b/mbbsd/chess.c index 8606d652..c7277f1d 100644 --- a/mbbsd/chess.c +++ b/mbbsd/chess.c @@ -1328,16 +1328,23 @@ ChessPhotoInitial(ChessInfo* info) char country[5], level[11]; userec_t xuser; char* photo; + int hasphoto = 0; if (info->mode == CHESS_MODE_REPLAY) return NULL; - sethomefile(genbuf, info->user1.userid, info->constants->photo_file_name); - if (!dashf(genbuf)) { + if(is_validuserid(info->user1.userid)) { + sethomefile(genbuf, info->user1.userid, info->constants->photo_file_name); + if (dashf(genbuf)) + hasphoto++; + } + if(is_validuserid(info->user2.userid)) { sethomefile(genbuf, info->user2.userid, info->constants->photo_file_name); - if (!dashf(genbuf)) - return NULL; + if (dashf(genbuf)) + hasphoto++; } + if(hasphoto==0) + return NULL; photo = (char*) calloc( CHESS_PHOTO_LINE * CHESS_PHOTO_COLUMN, sizeof(char)); @@ -1345,9 +1352,11 @@ ChessPhotoInitial(ChessInfo* info) /* simulate photo as two dimensional array */ #define PHOTO(X) (photo + (X) * CHESS_PHOTO_COLUMN) - getuser(info->user1.userid, &xuser); - sethomefile(genbuf, info->user1.userid, info->constants->photo_file_name); - fp = fopen(genbuf, "r"); + fp = NULL; + if(getuser(info->user1.userid, &xuser)) { + sethomefile(genbuf, info->user1.userid, info->constants->photo_file_name); + fp = fopen(genbuf, "r"); + } if (fp == NULL) { strcpy(country, "µL"); @@ -1404,9 +1413,11 @@ ChessPhotoInitial(ChessInfo* info) info->constants->turn_color[info->myturn ^ 1], info->constants->turn_str[info->myturn ^ 1]); - getuser(info->user2.userid, &xuser); - sethomefile(genbuf, info->user2.userid, info->constants->photo_file_name); - fp = fopen(genbuf, "r"); + fp = NULL; + if(getuser(info->user2.userid, &xuser)) {; + sethomefile(genbuf, info->user2.userid, info->constants->photo_file_name); + fp = fopen(genbuf, "r"); + } if (fp == NULL) { strcpy(country, "µL"); |