Hi! On Sun, Jul 5, 2009 at 00:34, Bernd Fondermann<[email protected]> wrote: > Bernd Fondermann wrote: > After a quick(!) review, I found that the /client/ is required to send a > 'from' address /only/ if it has bound more than one resource at the same > time (rare). > In all other cases, the from is available in the handler via > SessionContext.getInitiatingEntity(). So it is not necessary to enrich > the stanza while it is still in the handler. > > Now, where do you expect the server to add the from, when it currently > doesn't?
I was thinking that a "from" attribute should be present because all examples in the XEP0060 include one. Additionally this error condition explicitely notes it: XEP0060 6.1.3.1: http://xmpp.org/extensions/tmp/xep-0060-1.13.html#subscriber-subscribe-error-nomatch If the specified JID is a bare JID or full JID, the service MUST at a minimum check the bare JID portion against the bare JID portion of the 'from' attribute on the received IQ request to make sure that the requesting entity has the same identity as the JID which is being requested to be added to the subscriber list. Second, the RFC3929 9.1.2 says this: When a server receives an XML stanza within the context of an authenticated stream qualified by the 'jabber:client' namespace, it MUST do one of the following: 1. validate that the value of the 'from' attribute provided by the client is that of a connected resource for the associated entity 2. add a 'from' address to the stanza whose value is the bare JID (<n...@domain>) or the full JID (<n...@domain/resource>) determined by the server for the connected resource that generated the stanza (see Determination of Addresses (Determination of Addresses)) I think it would be easier to just add the "from" attribute to the stanza than have each component that requires it check wether one is included, if not, take the one from the SessionContext. I'd add the from attribute in XMPPCoreStanzaHandler#execute. There we already deal with 9.1.1 of the RFC (veryfying proper "to" attribute). Another way to get this in, in a general way, is to extend Stanza#getFrom, but this isn't the right place to do this IMHO. What do you think about it? Michael
