diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-13 13:26:05 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-13 13:26:05 +0800 |
commit | a74e3e0cccde3c0b82dce01236f4acfd6088eaba (patch) | |
tree | 9c2dc37bafcd08df3129b0ca0d6392a234aceb45 /mbbsd/user.c | |
parent | c6ce13457f0f714877bf0d3c0b6fcb59260c5092 (diff) | |
download | pttbbs-a74e3e0cccde3c0b82dce01236f4acfd6088eaba.tar pttbbs-a74e3e0cccde3c0b82dce01236f4acfd6088eaba.tar.gz pttbbs-a74e3e0cccde3c0b82dce01236f4acfd6088eaba.tar.bz2 pttbbs-a74e3e0cccde3c0b82dce01236f4acfd6088eaba.tar.lz pttbbs-a74e3e0cccde3c0b82dce01236f4acfd6088eaba.tar.xz pttbbs-a74e3e0cccde3c0b82dce01236f4acfd6088eaba.tar.zst pttbbs-a74e3e0cccde3c0b82dce01236f4acfd6088eaba.zip |
integrate kill-user's code
bug killed: somethings a new user will be alohaed by friends of previous
owner of the same id.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3032 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/user.c')
-rw-r--r-- | mbbsd/user.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/mbbsd/user.c b/mbbsd/user.c index 7424537c..6f836a78 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -16,14 +16,24 @@ static const char * const chess_type[2] = { #endif int -kill_user(int num) +kill_user(int num, const char *userid) { - userec_t u; - memset(&u, 0, sizeof(userec_t)); - log_usies("KILL", getuserid(num)); - setuserid(num, ""); - passwd_update(num, &u); - return 0; + userec_t u; + char src[256], dst[256]; + + sethomepath(src, userid); + snprintf(dst, sizeof(dst), "tmp/%s", userid); + friend_delete_all(userid, FRIEND_ALOHA); + if (dashd(src) && Rename(src, dst) == 0) { + snprintf(src, sizeof(src), "/bin/rm -fr home/%c/%s >/dev/null 2>&1", userid[0], userid); + system(src); + } + + memset(&u, 0, sizeof(userec_t)); + log_usies("KILL", getuserid(num)); + setuserid(num, ""); + passwd_update(num, &u); + return 0; } int u_loginview(void) @@ -245,14 +255,8 @@ violate_law(userec_t * u, int unum) if (*ans2 != 'y') return; if (ans[0] == '9') { - char src[STRLEN], dst[STRLEN]; - sethomepath(src, u->userid); - snprintf(dst, sizeof(dst), "tmp/%s", u->userid); - friend_delete_all(u->userid, FRIEND_ALOHA); - Rename(src, dst); + kill_user(unum, u->userid); post_violatelaw(u->userid, cuser.userid, reason, "¬å°£ ID"); - kill_user(unum); - } else { kick_all(u->userid); u->userlevel |= PERM_VIOLATELAW; @@ -932,13 +936,7 @@ uinfo_query(userec_t *u, int adminmode, int unum) } memcpy(u, &x, sizeof(x)); if (i == QUIT) { - char src[STRLEN], dst[STRLEN]; - - sethomepath(src, x.userid); - snprintf(dst, sizeof(dst), "tmp/%s", x.userid); - friend_delete_all(x.userid, FRIEND_ALOHA); - Rename(src, dst); /* do not remove user home */ - kill_user(unum); + kill_user(unum, x.userid); return; } else log_usies("SetUser", x.userid); |