aboutsummaryrefslogtreecommitdiff
path: root/src/cyrsasl_scram.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cyrsasl_scram.erl')
-rw-r--r--src/cyrsasl_scram.erl32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/cyrsasl_scram.erl b/src/cyrsasl_scram.erl
index 18f52b48f..8643a8924 100644
--- a/src/cyrsasl_scram.erl
+++ b/src/cyrsasl_scram.erl
@@ -67,21 +67,21 @@ mech_step(#state{step = 2} = State, ClientIn) ->
case re:split(ClientIn, <<",">>, [{return, binary}]) of
[_CBind, _AuthorizationIdentity, _UserNameAttribute, _ClientNonceAttribute, ExtensionAttribute | _]
when ExtensionAttribute /= [] ->
- {error, <<"protocol-error-extension-not-supported">>};
+ {error, 'protocol-error-extension-not-supported'};
[CBind, _AuthorizationIdentity, UserNameAttribute, ClientNonceAttribute | _]
when (CBind == <<"y">>) or (CBind == <<"n">>) ->
case parse_attribute(UserNameAttribute) of
{error, Reason} -> {error, Reason};
{_, EscapedUserName} ->
case unescape_username(EscapedUserName) of
- error -> {error, <<"protocol-error-bad-username">>};
+ error -> {error, 'protocol-error-bad-username'};
UserName ->
case parse_attribute(ClientNonceAttribute) of
{$r, ClientNonce} ->
{Ret, _AuthModule} = (State#state.get_password)(UserName),
case {Ret, jid:resourceprep(Ret)} of
- {false, _} -> {error, <<"not-authorized">>, UserName};
- {_, error} when is_binary(Ret) -> ?WARNING_MSG("invalid plain password", []), {error, <<"not-authorized">>, UserName};
+ {false, _} -> {error, 'not-authorized', UserName};
+ {_, error} when is_binary(Ret) -> ?WARNING_MSG("invalid plain password", []), {error, 'not-authorized', UserName};
{Ret, _} ->
{StoredKey, ServerKey, Salt, IterationCount} =
if is_tuple(Ret) -> Ret;
@@ -121,11 +121,11 @@ mech_step(#state{step = 2} = State, ClientIn) ->
server_nonce = ServerNonce,
username = UserName}}
end;
- _Else -> {error, <<"not-supported">>}
+ _Else -> {error, 'not-supported'}
end
end
end;
- _Else -> {error, <<"bad-protocol">>}
+ _Else -> {error, 'bad-protocol'}
end;
mech_step(#state{step = 4} = State, ClientIn) ->
case str:tokens(ClientIn, <<",">>) of
@@ -163,18 +163,18 @@ mech_step(#state{step = 4} = State, ClientIn) ->
{authzid, State#state.username}],
<<"v=",
(jlib:encode_base64(ServerSignature))/binary>>};
- true -> {error, <<"bad-auth">>, State#state.username}
+ true -> {error, 'bad-auth', State#state.username}
end;
- _Else -> {error, <<"bad-protocol">>}
+ _Else -> {error, 'bad-protocol'}
end;
- {$r, _} -> {error, <<"bad-nonce">>};
- _Else -> {error, <<"bad-protocol">>}
+ {$r, _} -> {error, 'bad-nonce'};
+ _Else -> {error, 'bad-protocol'}
end;
- true -> {error, <<"bad-channel-binding">>}
+ true -> {error, 'bad-channel-binding'}
end;
- _Else -> {error, <<"bad-protocol">>}
+ _Else -> {error, 'bad-protocol'}
end;
- _Else -> {error, <<"bad-protocol">>}
+ _Else -> {error, 'bad-protocol'}
end.
parse_attribute(Attribute) ->
@@ -187,11 +187,11 @@ parse_attribute(Attribute) ->
if SecondChar == $= ->
String = str:substr(Attribute, 3),
{lists:nth(1, AttributeS), String};
- true -> {error, <<"bad-format second char not equal sign">>}
+ true -> {error, 'bad-format-second-char-not-equal-sign'}
end;
- _Else -> {error, <<"bad-format first char not a letter">>}
+ _Else -> {error, 'bad-format-first-char-not-a-letter'}
end;
- true -> {error, <<"bad-format attribute too short">>}
+ true -> {error, 'bad-format-attribute-too-short'}
end.
unescape_username(<<"">>) -> <<"">>;