]> granicus.if.org Git - ejabberd/commitdiff
* src/ejabberd_c2s.erl: Init shaper with a default value first
authorAlexey Shchepin <alexey@process-one.net>
Mon, 19 Feb 2007 23:35:42 +0000 (23:35 +0000)
committerAlexey Shchepin <alexey@process-one.net>
Mon, 19 Feb 2007 23:35:42 +0000 (23:35 +0000)
after stream opening

* src/ejabberd_c2s.erl: Log failed SASL login attempts
* src/cyrsasl.erl: Updated API
* src/cyrsasl_plain.erl: Likewise
* src/cyrsasl_digest.erl: Likewise

SVN Revision: 735

ChangeLog
src/cyrsasl.erl
src/cyrsasl_digest.erl
src/cyrsasl_plain.erl
src/ejabberd_c2s.erl

index c4e30e4af12574ef23e0ab101230b850b3eeb5c4..73243654337042a01827038fdb8e86a484ebe065 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,33 +1,46 @@
+2007-02-20  Alexey Shchepin  <alexey@sevcom.net>
+
+       * src/ejabberd_c2s.erl: Init shaper with a default value first
+       after stream opening
+
+       * src/ejabberd_c2s.erl: Log failed SASL login attempts
+       * src/cyrsasl.erl: Updated API
+       * src/cyrsasl_plain.erl: Likewise
+       * src/cyrsasl_digest.erl: Likewise
+
 2007-02-19  Mickael Remond  <mickael.remond@process-one.net>
 
        * src/mod_muc/mod_muc_room.erl: Added an option set affiliations.
 
-       * doc/api/*: Added Erlang documentation generation script (EJAB-188).
+       * doc/api/*: Added Erlang documentation generation script
+       (EJAB-188).
        * doc/version.tex: Updated.
        * src/ejabberd.app: Updated.
 
-       * src/odbc/pg.sql: last table, state column cannot be NULL (EJAB-191).
+       * src/odbc/pg.sql: last table, state column cannot be NULL
+       (EJAB-191).
        * src/odbc/mysql.sql: likewise.
-       * src/odbc/mssql.sql. likewise.
+       * src/odbc/mssql.sql: likewise.
 
-       * src/ejabberd_auth_ldap.erl: prevent anonymous bind on LDAP servers
-       as ejabberd is providing other anonymous authentication mechanism
+       * src/ejabberd_auth_ldap.erl: prevent anonymous bind on LDAP
+       servers as ejabberd is providing other anonymous authentication
+       mechanism
        (EJAB-190).
 
-       * src/cyrsasl_plain.erl: bad-auth error code replaced by not-authorized
-       (EJAB-187).
+       * src/cyrsasl_plain.erl: bad-auth error code replaced by
+       not-authorized (EJAB-187).
        
-       * src/aclocal.m4: configure --with-erlang option is now working (Thanks
-       to Jerome Sautret) (EJAB-186).
+       * src/aclocal.m4: configure --with-erlang option is now working
+       (Thanks to Jerome Sautret) (EJAB-186).
 
-       * src/mod_muc/mod_muc_log.erl: Spam prevention: The default behaviour 
-       is now to use the nofollow rel attributes for links that are submitted
-       by users (EJAB-185).
+       * src/mod_muc/mod_muc_log.erl: Spam prevention: The default
+       behaviour is now to use the nofollow rel attributes for links that
+       are submitted by users (EJAB-185).
        * doc/guide.tex: Likewise.
 
-       * src/mod_muc/mod_muc_room.erl: API improvement: Implementation of an
-       event to destroy MUC room from an external application (Thanks to
-    Massimiliano Mirra) (EJAB-184).
+       * src/mod_muc/mod_muc_room.erl: API improvement: Implementation of
+       an event to destroy MUC room from an external application (Thanks
+       to Massimiliano Mirra) (EJAB-184).
 
 2007-02-18  Alexey Shchepin  <alexey@sevcom.net>
 
 
 2007-01-11  Mickael Remond  <mickael.remond@process-one.net>
 
-       * doc/guide.tex: Latex / Hevea related improvements for documentation
-       generation (thanks to Sander Devrieze). 
+       * doc/guide.tex: Latex / Hevea related improvements for
+       documentation generation (thanks to Sander Devrieze).
        * doc/introduction.tex: Likewise.
        * doc/dev.tex: Likewise.
        * doc/features.tex: Likewise.
 
 2007-01-08  Christophe Romain <christophe.romain@process-one.net>
 
-       * src/mod_pubsub/mod_pubsub.erl: add presence_based_delivery cluster
-       support
+       * src/mod_pubsub/mod_pubsub.erl: add presence_based_delivery
+       cluster support
 
 2007-01-05  Alexey Shchepin  <alexey@sevcom.net>
 
index f8e548826cf2d115ec983de191033b509a55f108..eb2346cda30b05563f11ef7a5568e2e3cdddc521 100644 (file)
@@ -136,6 +136,8 @@ server_step(State, ClientIn) ->
        {continue, ServerOut, NewMechState} ->
            {continue, ServerOut,
             State#sasl_state{mech_state = NewMechState}};
+       {error, Error, Username} ->
+           {error, Error, Username};
        {error, Error} ->
            {error, Error}
     end.
index cc44b1a9505d354eed6f59e710b8dcb4f997cd39..9966bddd1ee8c1a70f2f28944a69c61c430a628c 100644 (file)
@@ -44,7 +44,7 @@ mech_step(#state{step = 3, nonce = Nonce} = State, ClientIn) ->
            AuthzId = xml:get_attr_s("authzid", KeyVals),
            case (State#state.get_password)(UserName) of
                false ->
-                   {error, "not-authorized"};
+                   {error, "not-authorized", UserName};
                Passwd ->
                    Response = response(KeyVals, UserName, Passwd,
                                        Nonce, AuthzId, "AUTHENTICATE"),
@@ -59,7 +59,7 @@ mech_step(#state{step = 3, nonce = Nonce} = State, ClientIn) ->
                                         username = UserName,
                                         authzid = AuthzId}};
                        _ ->
-                           {error, "not-authorized"}
+                           {error, "not-authorized", UserName}
                    end
            end
     end;
index 59f88bf25ae43557476f6b325bbc7b0911beb7e1..a2fee76ecafa826d4ec1390b4da870441ff58ffc 100644 (file)
@@ -33,7 +33,7 @@ mech_step(State, ClientIn) ->
                true ->
                    {ok, [{username, User}, {authzid, AuthzId}]};
                _ ->
-                   {error, "not-authorized"}
+                   {error, "not-authorized", User}
            end;
        _ ->
            {error, "bad-protocol"}
index 0865fba5b63d8ec5455e079eb31b9a70ee63b5e5..f1c3dddfcdfce415bf2370a8e9dc46ebed1cfa3c 100644 (file)
@@ -174,6 +174,7 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
            case lists:member(Server, ?MYHOSTS) of
                true ->
                    Lang = xml:get_attr_s("xml:lang", Attrs),
+                   change_shaper(StateData, jlib:make_jid("", Server, "")),
                    case xml:get_attr_s("version", Attrs) of
                        "1.0" ->
                            Header = io_lib:format(?STREAM_HEADER,
@@ -493,6 +494,16 @@ wait_for_feature_request({xmlstreamelement, El}, StateData) ->
                                    jlib:encode_base64(ServerOut)}]}),
                    {next_state, wait_for_sasl_response,
                     StateData#state{sasl_state = NewSASLState}};
+               {error, Error, Username} ->
+                   ?INFO_MSG(
+                      "(~w) Failed authentication for ~s@~s",
+                      [StateData#state.socket,
+                       Username, StateData#state.server]),
+                   send_element(StateData,
+                                {xmlelement, "failure",
+                                 [{"xmlns", ?NS_SASL}],
+                                 [{xmlelement, Error, [], []}]}),
+                   {next_state, wait_for_feature_request, StateData};
                {error, Error} ->
                    send_element(StateData,
                                 {xmlelement, "failure",
@@ -609,6 +620,16 @@ wait_for_sasl_response({xmlstreamelement, El}, StateData) ->
                                    jlib:encode_base64(ServerOut)}]}),
                    {next_state, wait_for_sasl_response,
                     StateData#state{sasl_state = NewSASLState}};
+               {error, Error, Username} ->
+                   ?INFO_MSG(
+                      "(~w) Failed authentication for ~s@~s",
+                      [StateData#state.socket,
+                       Username, StateData#state.server]),
+                   send_element(StateData,
+                                {xmlelement, "failure",
+                                 [{"xmlns", ?NS_SASL}],
+                                 [{xmlelement, Error, [], []}]}),
+                   {next_state, wait_for_feature_request, StateData};
                {error, Error} ->
                    send_element(StateData,
                                 {xmlelement, "failure",