diff --git a/src/ngx_http_voms_module.cpp b/src/ngx_http_voms_module.cpp index dd3a21c3bdf125b21a9b4892d4f2612188dee137..d03bfa4f787082d9a22b90f276d3e186d173c28e 100644 --- a/src/ngx_http_voms_module.cpp +++ b/src/ngx_http_voms_module.cpp @@ -374,7 +374,7 @@ std::string get_voms_not_after(VomsAc const& ac) static std::string encode(attribute const& a) { - return "n" + a.name + " v=" + a.value + " q=" + a.qualifier; + return "n=" + a.name + " v=" + a.value + " q=" + a.qualifier; } std::string get_voms_generic_attributes(VomsAc const& ac) @@ -387,10 +387,12 @@ std::string get_voms_generic_attributes(VomsAc const& ac) auto& gas = attributes.front().attributes; bool first = true; for (auto& a : gas) { - result += encode(a); - if (!first) { + if (first) { + first = false; + } else { result += ','; } + result += encode(a); } } diff --git a/t/voms_generic_attributes.t b/t/voms_generic_attributes.t index 832c6bf5d85d5ad5a43647c2e34b82fb82fa22b1..b1f1ca68a65c82bd6021b3416ec474470bf5cf8b 100644 --- a/t/voms_generic_attributes.t +++ b/t/voms_generic_attributes.t @@ -5,7 +5,7 @@ run_tests(); __DATA__ -=== TEST 1: https with x509 client authentication, verification of valid VOMS attributes extracted by ngx_http_voms_module +=== TEST 1: valid AC, including generic attributes --- main_config env OPENSSL_ALLOW_PROXY_CERTS=1; env X509_VOMS_DIR=t/vomsdir; @@ -46,11 +46,12 @@ GET / /C=IT/O=IGI/CN=test0 /C=IT/O=IGI/CN=Test CA /test/exp1,/test/exp2,/test/exp3/Role=PIPPO -/C=IT/O=IGI/CN=nginx-voms.example +/C=IT/O=IGI/CN=voms.example /C=IT/O=IGI/CN=Test CA test.vo -2018-01-01T00:00:00 -2030-01-01T00:00:00 -nickname = newland (test.vo),nickname = giaco (test.vo) -1644758975 +voms.example:15000 +20180101000000Z +20300101000000Z +n=nickname v=newland q=test.vo,n=nickname v=giaco q=test.vo +0 --- error_code: 200