summaryrefslogtreecommitdiff
path: root/src/rabbit_ssl.erl
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2010-09-08 22:30:40 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2010-09-08 22:30:40 +0100
commit19aae5bd34925f50126ae7203c39c11369e20872 (patch)
tree635b906d3db3a9bbbda89109225b24d8ee283d62 /src/rabbit_ssl.erl
parentd7e63d9da5796b6789cbb2b06607bb87ebbf100f (diff)
downloadrabbitmq-server-19aae5bd34925f50126ae7203c39c11369e20872.tar.gz
tweak rdn value escaping so it doen't need flattening
Diffstat (limited to 'src/rabbit_ssl.erl')
-rw-r--r--src/rabbit_ssl.erl26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/rabbit_ssl.erl b/src/rabbit_ssl.erl
index 75df8796..51c3f984 100644
--- a/src/rabbit_ssl.erl
+++ b/src/rabbit_ssl.erl
@@ -135,21 +135,21 @@ format_rdn(#'AttributeTypeAndValue'{type = T, value = V}) ->
%% Escape a string as per RFC4514.
escape_rdn_value(V) ->
- lists:flatten(escape_rdn_value_int(V, start)).
+ escape_rdn_value(V, start).
-escape_rdn_value_int([], _) ->
+escape_rdn_value([], _) ->
[];
-escape_rdn_value_int([C | S], start) when C =:= $ ; C =:= $# ->
- ["\\", [C] | escape_rdn_value_int(S, middle)];
-escape_rdn_value_int(S, start) ->
- escape_rdn_value_int(S, middle);
-escape_rdn_value_int([$ ], middle) ->
- ["\\ "];
-escape_rdn_value_int([C | S], middle) ->
- case lists:member(C, ",+\"\\<>;") of
- false -> [C | escape_rdn_value_int(S, middle)];
- true -> ["\\", C | escape_rdn_value_int(S, middle)]
- end.
+escape_rdn_value([C | S], start) when C =:= $ ; C =:= $# ->
+ [$\\, C | escape_rdn_value(S, middle)];
+escape_rdn_value(S, start) ->
+ escape_rdn_value(S, middle);
+escape_rdn_value([$ ], middle) ->
+ [$\\, $ ];
+escape_rdn_value([C | S], middle) when C =:= $"; C =:= $+; C =:= $,; C =:= $;;
+ C =:= $<; C =:= $>; C =:= $\\ ->
+ [$\\, C | escape_rdn_value(S, middle)];
+escape_rdn_value([C | S], middle) ->
+ [C | escape_rdn_value(S, middle)].
%% Get the string representation of an OTPCertificate field.
format_asn1_value({ST, S}) when ST =:= teletexString; ST =:= printableString;