diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-09-08 16:01:05 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-09-08 16:01:05 +0100 |
commit | d41346b8a3800c8a36e28567efc5abb055563549 (patch) | |
tree | 3534ff75302ad79144932a1cb30eaa03769270bb /src/rabbit_ssl.erl | |
parent | 03e257b9459ae65a59a8078e536d777a7ca562a1 (diff) | |
download | rabbitmq-server-d41346b8a3800c8a36e28567efc5abb055563549.tar.gz |
refactor + manpages update
Diffstat (limited to 'src/rabbit_ssl.erl')
-rw-r--r-- | src/rabbit_ssl.erl | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/rabbit_ssl.erl b/src/rabbit_ssl.erl index 148389d9..4ee34bdd 100644 --- a/src/rabbit_ssl.erl +++ b/src/rabbit_ssl.erl @@ -128,7 +128,7 @@ format_complex_rdn(RDNs) -> %% Format an RDN. If the type name is unknown, use the dotted decimal %% representation. See RFC4514, section 2.3. format_rdn(#'AttributeTypeAndValue'{type = T, value = V}) -> - FV = escape_rdn_value(format_asn1_value(V), start), + FV = escape_rdn_value(format_asn1_value(V)), Fmts = [{?'id-at-surname' , "SN"}, {?'id-at-givenName' , "GIVENNAME"}, {?'id-at-initials' , "INITIALS"}, @@ -156,18 +156,21 @@ format_rdn(#'AttributeTypeAndValue'{type = T, value = V}) -> end. %% Escape a string as per RFC4514. -escape_rdn_value([], _) -> +escape_rdn_value(V) -> + lists:flatten(escape_rdn_value_int(V, start)). + +escape_rdn_value_int([], _) -> []; -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_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([C | S], middle) -> +escape_rdn_value_int([C | S], middle) -> case lists:member(C, ",+\"\\<>;") of - false -> [C | escape_rdn_value(S, middle)]; - true -> ["\\", C | escape_rdn_value(S, middle)] + false -> [C | escape_rdn_value_int(S, middle)]; + true -> ["\\", C | escape_rdn_value_int(S, middle)] end. %% Get the string representation of an OTPCertificate field. |