aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2011-09-05 15:35:46 +1000
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2011-09-05 15:35:46 +1000
commit0da2107974c151be57e6e0533909d1cd6c273d1e (patch)
tree6a6a39a0ae7c4dafb613f3d6eb7858d9ba7d330a
parentChange argument of open_port/2 to string in order to shut up the dialyzer (diff)
Fix some case clauses
-rw-r--r--src/cyrsasl_scram.erl16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/cyrsasl_scram.erl b/src/cyrsasl_scram.erl
index e3d63e612..2cd146353 100644
--- a/src/cyrsasl_scram.erl
+++ b/src/cyrsasl_scram.erl
@@ -55,6 +55,8 @@ mech_step(#state{step = 2} = State, ClientIn) ->
case string:tokens(ClientIn, ",") of
[CBind, UserNameAttribute, ClientNonceAttribute] when (CBind == "y") or (CBind == "n") ->
case parse_attribute(UserNameAttribute) of
+ {error, Reason} ->
+ {error, Reason};
{_, EscapedUserName} ->
case unescape_username(EscapedUserName) of
error ->
@@ -89,11 +91,7 @@ mech_step(#state{step = 2} = State, ClientIn) ->
_Else ->
{error, "not-supported"}
end
- end;
- {error, Reason} ->
- {error, Reason};
- _Else ->
- {error, "bad-protocol"}
+ end
end;
_Else ->
{error, "bad-protocol"}
@@ -145,12 +143,8 @@ parse_attribute(Attribute) ->
true ->
if
SecondChar == $= ->
- case string:substr(Attribute, 3) of
- String when is_list(String) ->
- {lists:nth(1, Attribute), String};
- _Else ->
- {error, "bad-format failed"}
- end;
+ String = string:substr(Attribute, 3),
+ {lists:nth(1, Attribute), String};
true ->
{error, "bad-format second char not equal sign"}
end;