File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -46,12 +46,20 @@ func sudoersAction(cmd *cobra.Command, args []string) error {
46
46
if runtime .GOOS != "darwin" {
47
47
return errors .New ("sudoers command is only supported on macOS right now" )
48
48
}
49
+ config , err := networks .Config ()
50
+ if err != nil {
51
+ return err
52
+ }
53
+ // Make sure the current network configuration is secure
54
+ if err := config .Validate (); err != nil {
55
+ return err
56
+ }
49
57
check , err := cmd .Flags ().GetBool ("check" )
50
58
if err != nil {
51
59
return err
52
60
}
53
61
if check {
54
- return verifySudoAccess (args )
62
+ return verifySudoAccess (config , args )
55
63
}
56
64
switch len (args ) {
57
65
case 0 :
@@ -69,14 +77,7 @@ func sudoersAction(cmd *cobra.Command, args []string) error {
69
77
return nil
70
78
}
71
79
72
- func verifySudoAccess (args []string ) error {
73
- config , err := networks .Config ()
74
- if err != nil {
75
- return err
76
- }
77
- if err := config .Validate (); err != nil {
78
- return err
79
- }
80
+ func verifySudoAccess (config networks.YAML , args []string ) error {
80
81
var file string
81
82
switch len (args ) {
82
83
case 0 :
You can’t perform that action at this time.
0 commit comments