Skip to content

Commit

Permalink
[Renamed] AD parse GPO label loop
Browse files Browse the repository at this point in the history
Signed-off-by: Davi Henrique <[email protected]>
  • Loading branch information
dangerousplay committed Sep 16, 2024
1 parent 0ec0d18 commit a02be93
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/ad/ad.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,14 +515,13 @@ func (ad *AD) parseGPO(ctx context.Context, name, url, keyFilterPrefix string, o
}

var f *os.File
loop:
classLoop:
for _, class := range classes {
var err error
var files []os.DirEntry

policyDir := filepath.Join(ad.sysvolCacheDir, "Policies", filepath.Base(url), class)
files, err = os.ReadDir(policyDir)

if errors.Is(err, fs.ErrNotExist) {
log.Debugf(ctx, "Policy directory %q not found", policyDir)
continue
Expand All @@ -540,12 +539,11 @@ loop:
log.Debugf(ctx, "Found registry policy file %q", policyPath)

f, err = os.Open(policyPath)

if err != nil {
return err
}

break loop
break classLoop
}
}

Expand Down

0 comments on commit a02be93

Please sign in to comment.