Not logged in. · Lost password · Register
Forum: XMPP Protocol RSS
Avatar
Hudson #1
Member since Oct 2007 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: ComBase - manipulate message.From tag - problems
Hello,

i like your agsXMPP package very much.
After a little playing around i tried to do the following.

The plan is to create some kind of doorman and some services.

The user sends a request to the doorman.
The doorman decides if the user is valid for the requested service.
After this decition the doorman should send an request to the requested service.

Everything works really great till here.

The doorman creates a message (type agsXMPP.protocol.client.message).
I tried the change the message.From value. I tried the set the JID of the user instead of the JID of the doorman.
(
first try:

            Message msg = new Message();
            msg.Body = receive.Body;      (receive is the message the doorman gets from the user)
            msg.From = receive.From;
            msg.To = new JID("service@server.de");
            this.comBase.Send(msg);

second try:
            Message msg = new Message();
            msg.Body = receive.Body;      (receive is the message the doorman gets from the user)
            msg.From = new JID("user@server.de");
            msg.To = new JID("service@server.de");
            this.comBase.Send(msg);
)

I did it cause i thought the service could send the request-answer direct to the user and not to the doorman.

This means the communication way is: user -> doorman -> service -> user

All user/doorman/services are authenticated against eachother.

I thought this is a good idea in case of loadbalancing and single point of contact.

In case of debugging i log every xml which passes the ComBase (receive and send).

I saw that the message from the doorman to the service is correct (correct means the right FROM and TO tag).
But after this message the comBase sends a second message (id 24900 in the MessageLog) with wrong FROM tag.
The FROM tag is changed to the JID of the doorman.
(
MessageLog:
| 24901
    - 2007-10-12 17:19:03
    - <message xmlns="jabber:component:accept" to="doorman@server.de/agsXMPP" from="service@server.de/agsXMPP"><body>Hamburg</body></message>
    - XmppComBase - OnWriteXml

| 24900
    - 2007-10-12 17:19:02
    - <message xmlns="jabber:client" from="doorman@server.de/agsXMPP" xml:lang="en" to="service@server.de/agsXMPP"><body>hamburg</body></message>
    - XmppComBase - OnRead

| 24899
    - 2007-10-12 17:19:02
    - <message xmlns="jabber:client" to="service@server.de/agsXMPP" from="user@server.de/Pandion2"><body>hamburg</body></message>
    - XmppComBase - OnWriteXml

| 24898
    - 2007-10-12 17:19:02
    - <message xmlns="jabber:client" from="user@server.de/Pandion2" type="chat" id="mir_23" to="doorman@server.de/agsXMPP"><body>hamburg</body><x xmlns="jabber:x:event"><composing /></x></message>
    - XmppComBase - OnRead

)
The service replais only to the second message (the wrong one).

So the user never gets an answer cause the service answers to the doorman cause of the wrong FROM tag in the second message.

I don´t know why the combase acts like this.
Is there a problem in my implementation?

I hope you got my point you can help me.

Best regards
Hudson
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Hudson,

I don't understand what you are exactly trying to do. But I think I got the problem.
In XMPP you can't spoof the from address like you can with email. The server always stamps the from address with the correct value for security reasons and to protect SPAM and SPIM.

Alex
Avatar
Hudson #3
Member since Oct 2007 · 3 posts
Group memberships: Members
Show profile · Link to this post
Thx Alex,

i think this is exactly the point.

But if the server always stamps the from address with the correct value the message.from property should be read-only.

Best regardes
Hudson
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Hudson,

agsXMPP is also for writing servers and components. There you have to stamp the from and need it.
So we can't make it read only. But i think we should add a comment in the docs.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: