Uploaded image for project: 'Openfire'
  1. OF-1796

Error when remote user subscribes to local user

    Details

    • Type: Bug
    • Status: Resolved (View workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 4.4.0
    • Components: None
    • Labels:
      None

      Description

      When a remote JID performs a subscription request to a local user, the following is logged right after the local user accepts the subscription request.

      2019.06.15 17:55:17 ERROR [Server SR - 1061360218]: org.jivesoftware.openfire.handler.PresenceSubscribeHandler - Internal server error
      org.jivesoftware.openfire.user.UserNotFoundException: guus@test.goodbytes.im
              at org.jivesoftware.openfire.roster.Roster.getRosterItem(Roster.java:218) ~[xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.spi.PresenceManagerImpl.canProbePresence(PresenceManagerImpl.java:339) ~[xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.handler.PresenceSubscribeHandler.process(PresenceSubscribeHandler.java:209) [xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.PresenceRouter.handle(PresenceRouter.java:172) [xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.PresenceRouter.route(PresenceRouter.java:76) [xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:84) [xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.net.SocketReader.processPresence(SocketReader.java:295) [xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.net.ServerSocketReader.processPresence(ServerSocketReader.java:93) [xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.net.SocketReader.process(SocketReader.java:218) [xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.net.BlockingReadingMode.readStream(BlockingReadingMode.java:172) [xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.net.BlockingReadingMode.run(BlockingReadingMode.java:79) [xmppserver-4.3.2.jar:4.3.2]
              at org.jivesoftware.openfire.net.SocketReader.run(SocketReader.java:148) [xmppserver-4.3.2.jar:4.3.2]
              at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]

      There's code in `PresenceSubscribeHandler` that blindly assumes that the sender of a `subscribed` stanza is a local user (see how 'senderJID.getNode()` is used, without a check if senderJID is a local user):

      if (type == Presence.Type.subscribed) {
          // Send the presence of the local user to the remote user. The remote user
          // subscribed to the presence of the local user and the local user accepted
          JID prober = localServer.isLocal(recipientJID) ? recipientJID.asBareJID() : recipientJID;
          if (presenceManager.canProbePresence(prober, senderJID.getNode())){
              presenceManager.probePresence(prober, senderJID);
              PresenceEventDispatcher.subscribedToPresence(recipientJID, senderJID);
          }
          else {
              Presence nonProbablePresence = new Presence();
              nonProbablePresence.setStatus("unavailable");
              nonProbablePresence.setFrom(senderJID);
              nonProbablePresence.setTo(recipientJID);
              presenceManager.handleProbe(nonProbablePresence);
          }
      }

      I've reproduced this with Converse 4.1.2.

        Attachments

          Activity

            People

            • Assignee:
              Dave Cridland
              Reporter:
              Guus der Kinderen
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: