[ejabberd] Flash jabber client : Howto serve cross-domain policy

Matthew Reilly matthew.reilly at sipphone.com
Tue Jun 3 08:02:57 MSD 2008


We implemented this one a while ago.
This is a code snippet from ejabberd_c2s.erl (a much old version than 
the latest public one)

This was added at the beginning of the wait_for_stream/2 function.

This caused ejabberd to spit back the <cross-domain-policy> XML doc, and 
close the TCP connect when it received a <policy-file-request/> (instead 
of the <stream:stream> used by XMPP).

The NUL byte at the end of the stream was necessary for some versions of 
flash.
I can't remember what the purpose of the 
ejabberd_receiver:reset_stream() was for.

%%***CODE START ***
wait_for_stream({xmlstreamstart, "policy-file-request", _Attrs}, 
StateData) ->
        ejabberd_receiver:reset_stream(StateData#state.receiver),
        send_text(StateData,
                "<?xml version=\"1.0\"?>\n"
                "<!DOCTYPE cross-domain-policy SYSTEM 
\"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">\n"
                "<cross-domain-policy>\n"
                "       <allow-access-from domain=\"*\" to-ports=\"*\"/>\n"
                "</cross-domain-policy>\n\0"
        ),
        {stop, normal, StateData};
%%***CODE STOP ***

Use at your own risk, etc. etc.

-Matt

Sergio Bessa wrote:
> Hi,
>
> I had this same problem and opted to create a simple dedicated policy 
> server as I could not find a way to do it using ejabberd.
>
> Regards,
> Sergio
>
> cplusou-s at yahoo.fr wrote:
>> Hi,
>>
>> I use a flash client (XIFF) to connect to ejabberd.
>> I would to know how is it possible to make Ejabberd serve a 
>> cross-domain policy to |<policy-file-request/> request make by flash 
>> client through xmlsocket ?
>>
>> Thanks in advance.
>> |
>> |
>> |
>>
>> __________________________________________________
>> Do You Yahoo!?
>> En finir avec le spam? Yahoo! Mail vous offre la meilleure protection 
>> possible contre les messages non sollicités
>> http://mail.yahoo.fr Yahoo! Mail
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> ejabberd mailing list
>> ejabberd at jabber.ru
>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>   
>
>
> -- 
> Sérgio Bessa
> *Ideavity, Lda.*
> *www*: http://www.ideavity.com
> *email*: sergio.bessa at ideavity.com
> *tel.* +351 222 012 393
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>   



More information about the ejabberd mailing list