]> granicus.if.org Git - ejabberd/commitdiff
Make sure that ejabberd_sm sid are unique
authorPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 8 Apr 2016 08:46:21 +0000 (10:46 +0200)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 8 Apr 2016 08:52:29 +0000 (10:52 +0200)
rebar.config
src/ejabberd_auth_anonymous.erl
src/ejabberd_c2s.erl
src/ejabberd_sm.erl

index 5b6676a130827db6487691db11abfb15c07c998c..d006dc64c414b0f5f4ef16663fa0b2374daf013f 100644 (file)
@@ -8,7 +8,7 @@
 %%%-------------------------------------------------------------------
 
 {deps, [{lager, ".*", {git, "https://github.com/basho/lager", {tag, "3.0.2"}}},
-        {p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.3"}}},
+        {p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.4"}}},
         {cache_tab, ".*", {git, "https://github.com/processone/cache_tab", {tag, "1.0.2"}}},
         {fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.1"}}},
         {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.3"}}},
index 9c4b719c31080ce13c796512f7eb775c2134895b..5a5b395bf8d3eb35683db9ff1103cda70c10b287 100644 (file)
@@ -56,7 +56,7 @@
 %% Create the anonymous table if at least one virtual host has anonymous features enabled
 %% Register to login / logout events
 -record(anonymous, {us = {<<"">>, <<"">>} :: {binary(), binary()},
-                    sid = {p1_time_compat:timestamp(), self()} :: ejabberd_sm:sid()}).
+                    sid = ejabberd_sm:make_sid() :: ejabberd_sm:sid()}).
 
 start(Host) ->
     %% TODO: Check cluster mode
index 9fe1100b5a945f7c5ca6460e8042b94308333e86..948e2027ba24a4c8536e71677f8cafa5ad5a04c1 100644 (file)
@@ -327,7 +327,7 @@ init([{SockMod, Socket}, Opts]) ->
                       xml_socket = XMLSocket, zlib = Zlib, tls = TLS,
                       tls_required = StartTLSRequired,
                       tls_enabled = TLSEnabled, tls_options = TLSOpts,
-                      sid = {p1_time_compat:timestamp(), self()}, streamid = new_id(),
+                      sid = ejabberd_sm:make_sid(), streamid = new_id(),
                       access = Access, shaper = Shaper, ip = IP,
                       mgmt_state = StreamMgmtState,
                       mgmt_max_queue = MaxAckQueue,
index 4f7cfeeaaa18bb9fbf3852f4effacdbc522c10f8..7ab0a5f782352cb4d55487b67721887f3e2be03d 100644 (file)
@@ -66,7 +66,8 @@
         get_max_user_sessions/2,
         get_all_pids/0,
         is_existing_resource/3,
-        get_commands_spec/0
+        get_commands_spec/0,
+        make_sid/0
        ]).
 
 -export([init/1, handle_call/3, handle_cast/2,
@@ -806,6 +807,9 @@ kick_user(User, Server) ->
        end, Resources),
     length(Resources).
 
+make_sid() ->
+    {p1_time_compat:unique_timestamp(), self()}.
+
 opt_type(sm_db_type) ->
     fun (mnesia) -> mnesia;
        (internal) -> mnesia;