Browse Source

force lowercase for /etc/hosts profile names

to test:
create newtwork with Upper case name
check profile in /etc/hosts is created with all lowercase
Matthew R. Kasun 3 years ago
parent
commit
afe12b277d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      netclient/functions/mqhandlers.go

+ 2 - 2
netclient/functions/mqhandlers.go

@@ -244,7 +244,7 @@ func setHostDNS(dns, iface string, windows bool) error {
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}
-	profile.Name = iface
+	profile.Name = strings.ToLower(iface)
 	profile.Status = types.Enabled
 	profile.Status = types.Enabled
 	if err := hosts.ReplaceProfile(profile); err != nil {
 	if err := hosts.ReplaceProfile(profile); err != nil {
 		return err
 		return err
@@ -264,7 +264,7 @@ func removeHostDNS(iface string, windows bool) error {
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}
-	if err := hosts.RemoveProfile(iface); err != nil {
+	if err := hosts.RemoveProfile(strings.ToLower(iface)); err != nil {
 		if err == types.ErrUnknownProfile {
 		if err == types.ErrUnknownProfile {
 			return nil
 			return nil
 		}
 		}