Skip to content

Commit

Permalink
check if err is not nil before handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ropnop committed Apr 1, 2019
1 parent 61dab93 commit 7fa8001
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ func testLogin(ctx context.Context, username string, password string) {
func testUsername(ctx context.Context, username string) {
atomic.AddInt32(&counter, 1)
usernamefull := fmt.Sprintf("%v@%v", username, domain)
if ok, err := kSession.TestUsername(username); ok {
valid, err := kSession.TestUsername(username)
if valid {
atomic.AddInt32(&successes, 1)
logger.Log.Notice("[+] VALID USERNAME:\t %s", usernamefull)
} else {
} else if err != nil {
// This is to determine if the error is "okay" or if we should abort everything
ok, errorString := kSession.HandleKerbError(err)
if !ok {
Expand All @@ -88,5 +89,7 @@ func testUsername(ctx context.Context, username string) {
} else {
logger.Log.Debugf("[!] %v - %v", usernamefull, errorString)
}
} else {
logger.Log.Debug("[!] Unknown behavior - %v", usernamefull)
}
}

0 comments on commit 7fa8001

Please sign in to comment.