XEP-0095 SI / File Transfer compliance issues

Hi,

I think I’ve found some file transfer compliance issues with XEP-0095.

  1. si:no-valid-streams/ is not included in the Stanza error, when offering invalid streams.

  2. si:bad-profile/ is not send, when the profile is invalid.

  3. This is probably the most important one:

is not sent, when the recipient rejects the stream initiation.

Instead Smack sends .

http://xmpp.org/extensions/xep-0095.html#def-error

  1. sounds familiar. I think it was already fixed, but I’ve to check first. Which version of Smack are you using?

4.0.0.

It’s not fixed there:

protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException {

StreamInitiation initiation = request.getStreamInitiation();

IQ rejection = IQ.createErrorResponse(initiation, new XMPPError(XMPPError.Condition.no_acceptable));

connection().sendPacket(rejection);

}

It confuses me now as I found also this in the sources:

public void rejectStream(final StreamInitiation si) throws NotConnectedException {

XMPPError error = new XMPPError(XMPPError.Condition.forbidden, “Offer Declined”);

IQ iqPacket = IQ.createErrorResponse(si, error);

connection().sendPacket(iqPacket);

}

This is strange.

Seems, two methods are there for rejecting.

I’ve just found and re-opened the old issue SMACK-346. Let’s see if we can squash the bug, also note that there is a typo: s/no_acceptable/not_acceptable/

It appears that FileTransferNegotiator.rejectStream() is dead code.

Looking at 197548b5, the relevant commit for SMACK-346, reveales that it was at first forbidden, but then got changed to no(t)_acceptable. XEP-95 4.2 specifies forbidden, this was obvisouly what the inital author of the code had in mind. XEP-65 5.3.1 Example 13 mentiones not-acceptable.

I tend to favor not_acceptable right now. But this should be discussed first.

Now I came to the conclusion that ‘forbidden’ in this case is right and that the intial bug report mixed up Socks 5 Bytestream rejection with Stream Initiation rejection. My proposed fix is https://github.com/Flowdalic/Smack/commit/c063fb137689a987bb7a589443ac4ac74e136d c3 and will go into 4.0.1 if there are no objections.

Looks good to me.