我现在很难过 我试图让ejabberd基于我的web应用程序已经存在的MySQL用户表进行身份validation。
ejabberd.cfg : 我已经注释掉了下面的默认auth_method行:
%%{auth_method, internal}.
并取消注释并编辑以下几行:
{auth_method, external}. {extauth_program, "/var/myapplication/xmpp_auth.php"}.
PHP脚本是基于这个来自ejabberd的doc页面的示例脚本 。
我的checkuser()和checkpass()函数完美地工作。 我已经分别testing了它们。 php -l在xmpp_auth.php中没有显示语法错误。
但是,当auth_method设置为internal ,我可以以ejabberdctl创build的用户身份login,但是当切换到外部方法时,什么都不起作用。
以下是我尝试使用删除的标识信息login时的相应日志条目。 CLIENT_IP_REMOVED是我的客户端IP, SERVER_IP_REMOVED是我服务器的IP,而myapplication.com是我服务器的域名。
/var/ejabberd/ejabberd.log :
=INFO REPORT==== 2009-10-28 16:01:46 === I(<0.244.0>:ejabberd_listener:112) : (#Port<0.446>) Accepted connection {{CLIENT_IP_REMOVED},65263} -> {{SERVER_IP_REMOVED},5222} =ERROR REPORT==== 2009-10-28 16:01:48 === ** State machine <0.447.0> terminating ** Last event in was {xmlstreamelement, {xmlelement, "auth", [{"xmlns","urn:ietf:params:xml:ns:xmpp-sasl"}, {"mechanism","PLAIN"}, {"xmlns:ga", "http://www.google.com/talk/protocol/auth"}, {"ga:client-uses-full-bind-result","true"}], [{xmlcdata,<<"AHNlbnNsZXkAam9iNDI0">>}]}} ** When State == wait_for_feature_request ** Data == {state,{socket_state,tls, {tlssock,#Port<0.446>,#Port<0.448>}, <0.446.0>}, ejabberd_socket, #Ref<0.0.0.9159>, "53195611", {sasl_state,"jabber", "myapplication.com", [], #Fun<ejabberd_c2s.1.74696376>, #Fun<ejabberd_c2s.2.131707924>, undefined, undefined}, c2s, c2s_shaper, false, true, false, true, [{certfile,"/etc/ejabberd/ejabberd.pem"}], false, undefined, [], "myapplication.com", [], undefined, {0,nil}, {0,nil}, {0,nil}, {0,nil}, {dict,0, 16, 16, 8, 80, 48, {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}, {{[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}}}, undefined, undefined, undefined, false, {userlist,none,[]}, unknown, unknown, {{CLIENT_IP_REMOVED},65263}, []} ** Reason for termination = ** {badarg,[{extauth,call_port,2}, {ejabberd_auth,'-check_password_with_authmodule/3-fun-0-',4}, {lists,dropwhile,2}, {ejabberd_auth,check_password_with_authmodule,3}, {cyrsasl_plain,mech_step,2}, {cyrsasl,server_step,2}, {ejabberd_c2s,wait_for_feature_request,2}, {gen_fsm,handle_msg,7}]}
/var/log/ejabberd/sasl.log :
=CRASH REPORT==== 28-Oct-2009::16:14:50 === crasher: pid: <0.457.0> registered_name: [] error_info: {badarg, [{extauth,call_port,2}, {ejabberd_auth, '-check_password_with_authmodule/3-fun-0-', 4}, {lists,dropwhile,2}, {ejabberd_auth,check_password_with_authmodule,3}, {cyrsasl_plain,mech_step,2}, {cyrsasl,server_step,2}, {ejabberd_c2s,wait_for_feature_request,2}, {gen_fsm,handle_msg,7}]} initial_call: {gen, init_it, [gen_fsm, <0.235.0>, <0.235.0>, ejabberd_c2s, [{ejabberd_socket, {socket_state,gen_tcp,#Port<0.458>,<0.456.0>}}, [{access,c2s}, {shaper,c2s_shaper}, {max_stanza_size,65536}, starttls, {certfile,"/etc/ejabberd/ejabberd.pem"}]], []]} ancestors: [ejabberd_c2s_sup,ejabberd_sup,<0.36.0>] messages: [] links: [<0.235.0>,#Port<0.460>] dictionary: [] trap_exit: false status: running heap_size: 2584 stack_size: 21 reductions: 3425 neighbours: =SUPERVISOR REPORT==== 28-Oct-2009::16:14:50 === Supervisor: {local,ejabberd_c2s_sup} Context: child_terminated Reason: {badarg, [{extauth,call_port,2}, {ejabberd_auth, '-check_password_with_authmodule/3-fun-0-', 4}, {lists,dropwhile,2}, {ejabberd_auth,check_password_with_authmodule,3}, {cyrsasl_plain,mech_step,2}, {cyrsasl,server_step,2}, {ejabberd_c2s,wait_for_feature_request,2}, {gen_fsm,handle_msg,7}]} Offender: [{pid,<0.457.0>}, {name,undefined}, {mfa, {ejabberd_c2s, start_link, [{ejabberd_socket, {socket_state,gen_tcp,#Port<0.458>,<0.456.0>}}, [{access,c2s}, {shaper,c2s_shaper}, {max_stanza_size,65536}, starttls, {certfile,"/etc/ejabberd/ejabberd.pem"}]]}}, {restart_type,temporary}, {shutdown,brutal_kill}, {child_type,worker}]
我不知道发生了什么事。 请帮忙。 =)
脚本有问题,如果您使用Ubuntu,我会build议su'ing到ejabberd帐户,并尝试运行脚本。 我遇到类似的问题,当脚本尝试打开日志文件时,由于权限问题而拒绝进行身份validation。