Commit 688be215 authored by Heiko Reese's avatar Heiko Reese
Browse files

Removed custom types/validation for IP and URL

parent 4d16f752
......@@ -8,7 +8,6 @@ import (
"strings"
)
// TODO: broken
func IPSliceToStrings(ip interface{}) []string {
if v, ok := ip.([]net.IP); ok {
iplist := make([]string, 0, len(v))
......
......@@ -32,7 +32,6 @@ import (
"net/url"
"git.scc.kit.edu/KIT-CA/dfnpki"
"github.com/davecgh/go-spew/spew"
"github.com/kennygrant/sanitize"
"github.com/spf13/cobra"
"github.com/spf13/viper"
......@@ -247,20 +246,18 @@ var requestCmd *cobra.Command = &cobra.Command{
Values: viper.GetStringSlice("dns"),
},
{
// TODO: broken
Kind: dfnpki.URI,
Values: strings.Split(viper.GetString("uri"), ","),
Values: viper.GetStringSlice("uri"),
},
{
Kind: dfnpki.IP,
Values: strings.Split(viper.GetString("ip"), ","),
Values: viper.GetStringSlice("ip"),
},
} {
for _, value := range sanGenerator.Values {
SubjectAlternativeNames = append(SubjectAlternativeNames, dfnpki.SAN(sanGenerator.Kind, value))
}
}
spew.Dump(SubjectAlternativeNames)
// fix requester date for profile User
if profile == "User" {
if viper.GetString("RequesterName") == "" {
......@@ -340,8 +337,8 @@ func init() {
requestCmd.PersistentFlags().StringVar(&cmdArguments.State, "state", "", "Set »ST« (state) part of distinguished name")
requestCmd.PersistentFlags().StringVar(&cmdArguments.Country, "country", "", "Set »C« (country) part of distinguished name")
requestCmd.PersistentFlags().StringSliceVar(&cmdArguments.DNS, "dns", nil, "Add »DNS« (hostname or domain name) Subject Alternative Name(s)")
requestCmd.PersistentFlags().Var(&cmdArguments.IP, "ip", "Add »IP« (ip address) Subject Alternative Name(s)")
requestCmd.PersistentFlags().Var(&cmdArguments.URI, "uri", "Add »URI« Subject Alternative Name(s)")
requestCmd.PersistentFlags().StringSliceVar(&cmdArguments.IP, "ip", nil, "Add »IP« (ip address) Subject Alternative Name(s)")
requestCmd.PersistentFlags().StringSliceVar(&cmdArguments.URI, "uri", nil, "Add »URI« Subject Alternative Name(s)")
requestCmd.PersistentFlags().StringSliceVar(&cmdArguments.Email, "email", nil, "Add »email« Subject Alternative Name(s)")
requestCmd.PersistentFlags().StringVar(&cmdArguments.RequesterName, "RequesterName", "", "Name of requester (»Beantrager«); set to CommonName for personal certificate")
requestCmd.PersistentFlags().StringVar(&cmdArguments.RequesterEmail, "RequesterEmail", "", "E-Mail of requester (»Beantrager«)")
......
......@@ -71,8 +71,8 @@ var (
State string
Country string
DNS []string
IP IPSLice
URI URLSlice
IP []string
URI []string
Email []string
RequesterName string
RequesterEmail string
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment