jsxc / xmpp-cloud-auth

:key: Authentication hub for Nextcloud+JSXC→Prosody, ejabberd, saslauthd, Postfix
https://www.jsxc.org
MIT License
60 stars 18 forks source link

add isuser operation #11

Closed sualko closed 7 years ago

sualko commented 7 years ago

@mejo- @wargreen can you test this fix? Beware that you also have to modify your nextcloud app, see https://github.com/nextcloud/jsxc.nextcloud/commit/2b41611ee8093a45cba51b7a0f6185b6a5d52b27

fix #8

mejo- commented 7 years ago

Hi @sualko, thanks a lot for working on that. I just gave it a try (after updating both xmpp-cloud-auth and the OJSXC Nextcloud app) and discovered the following issue:

Apr 13 13:21:47 mod_bosh    debug   BOSH body open (sid: 896615ea-0f47-4bed-8962-9e5148d0bde2)
Apr 13 13:21:47 mod_bosh    debug   BOSH stanza received: <iq id='f380c19d-bdf9-442f-a591-151ead211d28:sendIQ' type='set'>

Apr 13 13:21:47 bosh896615ea-0f47-4bed-8962-9e5148d0bde2    debug   Received[c2s]: <iq id='f380c19d-bdf9-442f-a591-151ead211d28:sendIQ' type='set'>
Apr 13 13:21:47 cloud.example.org:auth_external debug   Sent 32 bytes
Apr 13 13:21:47 rostermanager   debug   not saving roster for admin@cloud.example.org: the user doesn't exist
Apr 13 13:21:47 mod_bosh    debug   BOSH stanza received: <presence to='admin_carlo@cloud.example.org' type='subscribe'>

Apr 13 13:21:47 bosh896615ea-0f47-4bed-8962-9e5148d0bde2    debug   Received[c2s]: <presence to='admin_carlo@cloud.example.org' type='subscribe'>
Apr 13 13:21:47 cloud.example.org:presence  debug   outbound presence subscribe from admin@cloud.example.org for admin_carlo@cloud.example.org
Apr 13 13:21:47 rostermanager   debug   load_roster: asked for: admin@cloud.example.org
Apr 13 13:21:47 rostermanager   debug   set_contact_pending_out: saving roster; set admin@cloud.example.org.roster["admin_carlo@cloud.example.org"].ask=subscribe
Apr 13 13:21:47 cloud.example.org:auth_external debug   Sent 32 bytes

==> /var/log/prosody/extauth.log <==
2017-04-13 13:21:47,036 INFO: Receive operation isuser
2017-04-13 13:21:47,037 DEBUG: Starting new HTTPS connection (1): cloud.example.org
2017-04-13 13:21:47,083 DEBUG: https://cloud.example.org:443 "POST /index.php/apps/ojsxc/ajax/externalApi.php HTTP/1.1" 200 43
2017-04-13 13:21:47,087 INFO: Cloud says this user exists
2017-04-13 13:21:47,087 INFO: Receive operation isuser
2017-04-13 13:21:47,088 DEBUG: Starting new HTTPS connection (1): cloud.example.org

==> /var/log/prosody/prosody.log <==
Apr 13 13:21:47 rostermanager   debug   save_roster: saving roster for admin@cloud.example.org
Apr 13 13:21:47 cloud.example.org:presence  debug   inbound presence subscribe from admin@cloud.example.org for admin_carlo@cloud.example.org
Apr 13 13:21:47 rostermanager   debug   load_roster: asked for: admin_carlo@cloud.example.org
Apr 13 13:21:47 rostermanager   debug   load_roster: loading for offline user: admin_carlo@cloud.example.org
Apr 13 13:21:47 datamanager debug   Assuming empty roster storage ('cannot open /var/lib/prosody/cloud%2eexample%2eorg/roster/admin%5fcarlo.dat: No such file or directory') for user: admin_carlo@cloud.example.org
Apr 13 13:21:47 rostermanager   debug   load_roster: asked for: admin_carlo@cloud.example.org
Apr 13 13:21:47 rostermanager   debug   load_roster: loading for offline user: admin_carlo@cloud.example.org
Apr 13 13:21:47 datamanager debug   Assuming empty roster storage ('cannot open /var/lib/prosody/cloud%2eexample%2eorg/roster/admin%5fcarlo.dat: No such file or directory') for user: admin_carlo@cloud.example.org
Apr 13 13:21:47 cloud.example.org:auth_external debug   Sent 38 bytes
sualko commented 7 years ago

This probably happens, because a user exists in the oc/nc instance, but didn't log in yet. Currently I have no idea how to solve this issue.

According to a the prosody issue tracker this message "is perfectly normal and it appears when everything is working ok.". Can you confirm that this message has no impact on the functionality, because it was posted in the context of mam?

mejo- commented 7 years ago

I can verify that the fix works here. The issue disappeared after upgrading xmpp-cloud-auth and ojsxc to latest versions.