diff options
author | Gibheer <gibheer@gmail.com> | 2015-02-04 21:55:00 +0100 |
---|---|---|
committer | Gibheer <gibheer@gmail.com> | 2015-02-04 21:55:00 +0100 |
commit | 7c55a837cd6a3a8a3dc8d7ba934b8eb2d398d2c0 (patch) | |
tree | a4d51ce71bd04add5aa9df206a5e2f3140d9cb33 | |
parent | 58100320b7969cd2a58ff33cd6f38b45d2e7b02a (diff) |
only add ips and names when they are set
If these options are not set, they would produce invalid values in the
resulting csr.
-rw-r--r-- | sign_request.go | 12 |
1 files 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) |