- 主题:封禁匿名版面内匿名用户掉线的gdb调试信息
第一次成功的执行了gdb...各位帮忙看看错误该如何修改吧
BBS正常登陆,进入匿名版面内,将光标定位到匿名发文的文章前
切换到linux(debian)终端界面,用ps aux|grep bbsd找到当前登录进程的pid
进入gdb
(gdb) attach pid
(gdb) c
Continuing.
回到BBS,在匿名版面内,匿名发文的文章前按Ctrl+Y
再回到gdb调试界面,出现提示
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1075966080 (LWP 8396)]
0x080d2ad7 in getuser ()
(gdb) bt
#0 0x080d2ad7 in getuser ()
#1 0x080d387a in giveup_addpost ()
#2 0x0805f757 in deny_anony (conf=0xbfffefe0, fileinfo=0x8168998, extraarg=0x0) at bbs.c:3207
#3 0x080cb267 in read_key (conf=0xbfffefe0, command=25) at newread.c:230
#4 0x080b59b2 in do_select_internal (conf=0xbfffefe0, key=25) at select.c:368
#5 0x080b5a3d in list_select (conf=0xbfffefe0, key=25) at select.c:388
#6 0x080b5d79 in list_select_loop (conf=0xbfffefe0) at select.c:486
#7 0x080cc65a in new_i_read (cmdmode=DIR_MODE_NORMAL, direct=0xbffff170 "boards/Test/.DIR",
dotitle=0x8058675 <readtitle>, doentry=0x8058d00 <readdoent>, rcmdlist=0x8142060, ssize=140)
at newread.c:720
#8 0x08064574 in Read () at bbs.c:5083
#9 0x080a97a1 in fav_onselect (conf=0xbffff740) at boards_t.c:707
#10 0x080b54f1 in do_select_internal (conf=0xbffff740, key=4099) at select.c:268
#11 0x080b5bb4 in list_select (conf=0xbffff740, key=259) at select.c:425
#12 0x080b5d79 in list_select_loop (conf=0xbffff740) at select.c:486
#13 0x080ab51e in choose_board (newflag=1, boardprefix=0x0, group=0, favmode=1) at boards_t.c:1427
#14 0x080ab803 in FavBoard () at boards_t.c:1518
#15 0x0807b246 in domenu (menu_name=0x811ff68 "TOPMENU") at comm_lists.c:640
#16 0x080b8b0a in main_bbs (convit=0, argv=0xbffffcb7 "bbsd:roctall") at newmain_single.c:1160
#17 0x080b3cf8 in bbs_main (argv=0xbffffcb7 "bbsd:roctall") at bbsd_single.c:484
#18 0x080b459e in bbs_standalone_main (argv=0xbffffcb7 "bbsd:roctall") at bbsd_single.c:657
#19 0x080b46a0 in main (argc=3, argv=0xbffffbc4) at bbsd_single.c:684
--
FROM 218.11.57.*
bt出来的信息看得不是太明白,我看大致意思是
执行到deny_anony函数里的giveup_addpost函数中的getuser函数出错,相关部分代码
/* stiger,增加封禁某人的发文权限1天 */
int giveup_addpost(char *userid){
struct userec *user;
int i,s[GIVEUPINFO_PERM_COUNT];
if(!(getuser(userid,user)))
return 0;
get_giveupinfo(user,s);
s[1]=-(1+(!s[1]?(time(NULL)/86400):((s[1]<0)?(-s[1]):s[1])));
user->userlevel&=~PERM_POST;
return (save_giveupinfo(user,s)+1);
}
以及
int getuser(const char *userid, struct userec **user)
{ /* 取用户信息 */
int uid = searchuser(userid);
if (uid == 0) {
if (user)
*user = NULL;
return 0;
}
if (user)
*user = &uidshm->passwd[uid - 1];
return uid;
}
没看出来问题所在....请各位指点~
【 在 roctall (蛇王阿奔) 的大作中提到: 】
: 第一次成功的执行了gdb...各位帮忙看看错误该如何修改吧
: BBS正常登陆,进入匿名版面内,将光标定位到匿名发文的文章前
: 切换到linux(debian)终端界面,用ps aux|grep bbsd找到当前登录进程的pid
: ...................
--
FROM 60.4.28.*
hoho~
原来如此:)
唉,由此可见我C语言水平还是太凹...努力!
【 在 stiger (Software like sex,better when it's free) 的大作中提到: 】
: 这才是我写的代码,哼,
: 肯定是etn搞错了,cvs里的代码不对
: #ifdef DENYANONY
: ...................
--
FROM 60.4.28.*
我问这个问题这么多天也算有个成果了~
【 在 etnlegend (etn|金字塔·神|perplexity) 的大作中提到: 】
: admire, 错了这么久, 唉唉, 修了...
--
FROM 60.4.28.*
嗯呢,努力!
【 在 stiger (Software like sex,better when it's free) 的大作中提到: 】
: 你也算学到东西了:)
: 加油
--
FROM 60.4.28.*