]> granicus.if.org Git - ejabberd/commitdiff
Merge remote-tracking branch 'processone/master' into xep-0198
authorHolger Weiss <holger@zedat.fu-berlin.de>
Tue, 6 May 2014 19:41:29 +0000 (21:41 +0200)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Tue, 6 May 2014 19:41:29 +0000 (21:41 +0200)
Conflicts:
doc/guide.tex
src/ejabberd_c2s.erl

1  2 
doc/guide.tex
include/ns.hrl
src/ejabberd_c2s.erl
src/ejabberd_sm.erl
src/jlib.erl

diff --cc doc/guide.tex
index 714a62a573afba5e240d0c886c6334c3d2392e5c,2e54193e832f05bda32ae6f0dbf93e35c520ed9a..92beb1f04544689e68d2cb1170e45863a67e2af0
@@@ -869,12 -872,10 +872,12 @@@ The available modules, their purpose an
  \begin{description}
    \titem{\texttt{ejabberd\_c2s}}
      Handles c2s connections.\\
-     Options: \texttt{access}, \texttt{certfile}, \texttt{ciphers},
+     Options: \texttt{access}, \texttt{certfile}, \texttt{ciphers}, \texttt{protocol\_options}
 -    \texttt{max\_fsm\_queue},
 -    \texttt{max\_stanza\_size}, \texttt{shaper},
 -    \texttt{starttls}, \texttt{starttls\_required}, \texttt{tls},
 +    \texttt{max\_ack\_queue}, \texttt{max\_fsm\_queue},
 +    \texttt{max\_stanza\_size}, \texttt{resend\_on\_timeout},
 +    \texttt{resume\_timeout}, \texttt{shaper},
 +    \texttt{starttls}, \texttt{starttls\_required},
 +    \texttt{stream\_management}, \texttt{tls},
      \texttt{zlib}, \texttt{tls\_compression}
    \titem{\texttt{ejabberd\_s2s\_in}}
      Handles incoming s2s connections.\\
diff --cc include/ns.hrl
Simple merge
index 7117e46ab982bcd3f5e7d6be96ee3f020344d6a3,f2e16e15be1a2c44573c8b7082dd6e2a876376a5..8874c48ad7c2e2b1f89dc3a5910bb50c4e9380a0
                auth_module = unknown,
                ip,
                aux_fields = [],
-               lang}).
 +              mgmt_state,
 +              mgmt_xmlns,
 +              mgmt_queue,
 +              mgmt_max_queue,
 +              mgmt_pending_since,
 +              mgmt_timeout,
 +              mgmt_resend,
 +              mgmt_stanzas_in = 0,
 +              mgmt_stanzas_out = 0,
+               lang = <<"">>}).
  
  %-define(DBGFSM, true).
  
@@@ -288,24 -244,20 +287,33 @@@ init([{SockMod, Socket}, Opts]) -
                                (_) -> false
                            end,
                            Opts),
-     TLSOpts2 = case proplists:get_bool(tls_compression, Opts) of
-                    false -> [compression_none | TLSOpts1];
-                    true -> TLSOpts1
+     TLSOpts2 = case lists:keysearch(protocol_options, 1, Opts) of
+                    {value, {_, O}} ->
+                        [_|ProtocolOptions] = lists:foldl(
+                                     fun(X, Acc) -> X ++ Acc end, [],
+                                     [["|" | binary_to_list(Opt)] || Opt <- O, is_binary(Opt)]
+                                    ),
+                         [{protocol_options, iolist_to_binary(ProtocolOptions)} | TLSOpts1];
+                    _ -> TLSOpts1
                 end,
-     TLSOpts = [verify_none | TLSOpts2],
+     TLSOpts3 = case proplists:get_bool(tls_compression, Opts) of
+                    false -> [compression_none | TLSOpts2];
+                    true -> TLSOpts2
+                end,
+     TLSOpts = [verify_none | TLSOpts3],
 +    StreamMgmtEnabled = proplists:get_value(stream_management, Opts, true),
 +    StreamMgmtState = if StreamMgmtEnabled -> inactive;
 +                       true -> disabled
 +                    end,
 +    MaxAckQueue = case proplists:get_value(max_ack_queue, Opts) of
 +                  Limit when is_integer(Limit), Limit > 0 -> Limit;
 +                  _ -> 500
 +                end,
 +    ResumeTimeout = case proplists:get_value(resume_timeout, Opts) of
 +                    Timeout when is_integer(Timeout), Timeout >= 0 -> Timeout;
 +                    _ -> 300
 +                  end,
 +    ResendOnTimeout = proplists:get_bool(resend_on_timeout, Opts),
      IP = peerip(SockMod, Socket),
      %% Check if IP is blacklisted:
      case is_ip_blacklisted(IP) of
@@@ -617,8 -549,8 +625,7 @@@ wait_for_auth({xmlstreamelement, El}, S
                        ?INFO_MSG("(~w) Accepted legacy authentication for ~s by ~p",
                                [StateData#state.socket,
                                 jlib:jid_to_string(JID), AuthModule]),
-                       Conn = (StateData#state.sockmod):get_conn_type(
-                                   StateData#state.socket),
 -                      SID = {now(), self()},
+                       Conn = get_conn_type(StateData),
                        Info = [{ip, StateData#state.ip}, {conn, Conn},
                                    {auth_module, AuthModule}],
                          Res = jlib:make_result_iq_reply(
Simple merge
diff --cc src/jlib.erl
Simple merge