在ejabberd16.09上创建用户的例外:ACL拒绝

时间:2016-10-21 08:11:14

标签: android xmpp ejabberd smack

我在Linux中安装了ejabberd16.09。当我在Android中创建新用户时,请获取以下代码:

<iq from='hsoft.com' to='kfb@hsoft.com/Smack' id='T61DB-59' type='error'>        
    <query xmlns='jabber:iq:register'><username>ddk</username>
    <password>123456</password><registered/></query><error code='403' type='auth'>
    <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
    Denied by ACL</text></error></iq>

我的文件'conf / ejabberd.yml'在Linux中:

  ## To disable in-band registration, replace 'allow' with 'deny'.
  register:
    - allow 
  ## Only allow to register from localhost
  trusted_network:
    - allow
  ## Do not establish S2S connections with bad servers
  ## s2s:
  ##   - deny:
  ##     - ip: "XXX.XXX.XXX.XXX/32"
  ##   - deny:
  ##     - ip: "XXX.XXX.XXX.XXX/32"
  ##   - allow

我的Android代码:

    private void XmppRegister(){
        AccountManager account = AccountManager.getInstance(con);
        account.sensitiveOperationOverInsecureConnection(true);
        try {
            account.createAccount("ddk".toLowerCase(), "123456");
            Log.d("PushTest", "register successfully");
        } catch (SmackException.NoResponseException e) {
            e.printStackTrace();
        } catch (XMPPException.XMPPErrorException e) {
            e.printStackTrace();
        } catch (SmackException.NotConnectedException e) {
            e.printStackTrace();
        }
    }

请帮帮我!谢谢!

1 个答案:

答案 0 :(得分:0)

你必须添加

AccountManager.getInstance(connection)
                .sensitiveOperationOverInsecureConnection(true);

在注册新用户时禁用ACL,然后切换回默认设置:

AccountManager.getInstance(connection)
                .sensitiveOperationOverInsecureConnection(false);