From 7c55a837cd6a3a8a3dc8d7ba934b8eb2d398d2c0 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Wed, 4 Feb 2015 21:55:00 +0100 Subject: only add ips and names when they are set If these options are not set, they would produce invalid values in the resulting csr. --- sign_request.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sign_request.go b/sign_request.go index 2f7dd7b..dfb9f9f 100644 --- a/sign_request.go +++ b/sign_request.go @@ -79,10 +79,14 @@ func parse_sign_flags() SignFlags { fs.Parse(os.Args[2:]) // convert array flags to config structs - flags.DNSNames = COMMA_SPLIT.Split(dns_names, -1) - tmp_ips := COMMA_SPLIT.Split(ips, -1) - for _, sip := range tmp_ips { - flags.IPAddresses = append(flags.IPAddresses, net.ParseIP(sip)) + if dns_names != "" { + flags.DNSNames = COMMA_SPLIT.Split(dns_names, -1) + } + if ips != "" { + tmp_ips := COMMA_SPLIT.Split(ips, -1) + for _, sip := range tmp_ips { + flags.IPAddresses = append(flags.IPAddresses, net.ParseIP(sip)) + } } container_type := reflect.ValueOf(container) -- cgit v1.2.3-70-g09d2