tools: relax x509 Subject regexes to allow numbers and more
The virt-pki-validate tool is extracting components in the x509 certificate Subject field. Unfortunately the regex it is is using is far too strict, and so truncating valid data. It needs to consider ',' as a field separator, and if that's not there take all data until the EOL. With the broken regex: $ echo " Subject: O=Test,CN=guestHyp1ver" | sed 's+.*CN=\(.[a-zA-Z \._-]*\).*+\1+' guestHyp And with the fixed regex $ echo "Subject: O=Test,CN=guestHyp1ver" | sed 's+.*CN=\([^,]*\).*+\1+' guestHyp1ver Reported-by: NKashyap Chamarthy <kchamart@redhat.com> Reviewed-by: NKashyap Chamarthy <kchamart@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
Showing
想要评论请 注册 或 登录