gloox1.0中注册账号不成功的问题
2011-05-15 18:44
357 查看
前段时间研究gloox1.0版的注册,用官方自带的example,注册应该是很简单的例子,代码如下:
但是我用自带的register_example编程成功后运行,在最后一步提交注册信息后返回如下的结果:
“bad-request”。。。仔细看返回的结果,在gloox1.0版本,在register_example运行时候,有Sasl验证过程,跟代码发现进行的是匿名验证。但是我记得在之前0.99版本都不会有验证的过程呀!于是我考虑在注册的时候像之前的版本那样禁用掉Sasl验证,禁用过程用Client::setForceNonSasl函数,代码如下:
修改后运行发现居然还要进行Sasl验证过程,单步调试发现setForceNonSasl没有起作用,找到匿名验证验证的代码处,在Client::handleNormalNode函数中,截取代码段:
匿名验证是在倒数第二段,于是在它的if判断语句加上检测是否禁止验证如下
else if( !m_forceNonSasl && m_streamFeatures & SaslMechAnonymous
&& m_availableSaslMechs & SaslMechAnonymous )
保存重新编译,这样就可以不用进行匿名验证,实现正常的注册了。
我对gloox1.0理解还很浅,如果哪位知道register_example为什么会运行失败的真正原因,麻烦说明一下!
1: j = new Client( "pc-20110409pvwc" );
2: j->disableRoster();
3: j->registerConnectionListener( this );
4:
5: m_reg = new Registration( j );
6: m_reg->registerRegistrationHandler( this );
7:
8: j->logInstance().registerLogHandler( LogLevelDebug, LogAreaAll, this );
9:
10: j->connect();
11:
12: delete( m_reg );
13: delete( j );
但是我用自带的register_example编程成功后运行,在最后一步提交注册信息后返回如下的结果:
“bad-request”。。。仔细看返回的结果,在gloox1.0版本,在register_example运行时候,有Sasl验证过程,跟代码发现进行的是匿名验证。但是我记得在之前0.99版本都不会有验证的过程呀!于是我考虑在注册的时候像之前的版本那样禁用掉Sasl验证,禁用过程用Client::setForceNonSasl函数,代码如下:
1: j = new Client( "pc-20110409pvwc" );
2: j->disableRoster();
3: j->setForceNonSasl();
4:j->registerConnectionListener( this );
5:
6: m_reg = new Registration( j );
7:m_reg->registerRegistrationHandler( this );
8:
9:j->logInstance().registerLogHandler( LogLevelDebug, LogAreaAll, this );
10:
11: j->connect();
12:
13: delete( m_reg );
14: delete( j );
修改后运行发现居然还要进行Sasl验证过程,单步调试发现setForceNonSasl没有起作用,找到匿名验证验证的代码处,在Client::handleNormalNode函数中,截取代码段:
1: else if( !m_clientCerts.empty() && !m_clientKey.empty()
2: && m_streamFeatures & SaslMechExternal && m_availableSaslMechs & SaslMechExternal )
3: {
4: notifyStreamEvent( StreamEventAuthentication );
5: startSASL( SaslMechExternal );
6: }
7:#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
8: else if( m_streamFeatures & SaslMechGssapi && m_availableSaslMechs & SaslMechGssapi )
9: {
10: notifyStreamEvent( StreamEventAuthentication );
11: startSASL( SaslMechGssapi );
12: }
13: else if( m_streamFeatures & SaslMechNTLM && m_availableSaslMechs & SaslMechNTLM )
14: {
15: notifyStreamEvent( StreamEventAuthentication );
16: startSASL( SaslMechNTLM );
17: }
18: #endif
19: else if( m_streamFeatures & SaslMechAnonymous
20: && m_availableSaslMechs & SaslMechAnonymous )
21: {
22: notifyStreamEvent( StreamEventAuthentication );
23: startSASL( SaslMechAnonymous );
24: }
25: else
26: {
27: notifyStreamEvent( StreamEventFinished );
28: connected();
29: }
匿名验证是在倒数第二段,于是在它的if判断语句加上检测是否禁止验证如下
else if( !m_forceNonSasl && m_streamFeatures & SaslMechAnonymous
&& m_availableSaslMechs & SaslMechAnonymous )
保存重新编译,这样就可以不用进行匿名验证,实现正常的注册了。
我对gloox1.0理解还很浅,如果哪位知道register_example为什么会运行失败的真正原因,麻烦说明一下!
相关文章推荐
- gloox不能注册新用户的问题
- GLOOX 1.0---注册模块
- 【配置DATAGUARD 时的监听静态注册不成功】 问题解决
- 更改邮件发送语言为英语,解决编码为UTF8邮箱注册账号,邮件内容乱码问题
- 关于javaScript注册click事件传递参数的不成功问题
- 2014/10/23——记一次新生账号注册的问题吧
- .NET2.0下CommunityServer21新注册用户成功,注销重新登录失败的问题
- GLOOX 1.0---注册模块
- ATM简易模拟更新1.0 控制台输出 Map存储账号密码 可注册 余额尚未研究出怎么修改存储
- VMware虚拟机软件账号的注册问题
- 2014/10/23——记一次新生账号注册的问题吧
- directshow 与 ffmpeg 联合使用时filter注册不成功的问题
- 关于javaScript注册click事件传递参数的不成功问题
- 注册苹果企业开发账号遇到的问题
- admob_账号注册相关问题
- dubbo服务端启动注册成功,客户端无法调用问题
- Android之切换账号登录依然能登录成功问题解决办法
- gloox1.0使用Emai格式的账号登录
- 症状解决,原因不详的用非默认管理权限账户登录COM注册成功但找不到类型问题