Skip to content

Commit 8ffb7b7

Browse files
committed
fix(activedirectory): silence missing registry probe noise
1 parent 5573dad commit 8ffb7b7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

providers/activedirectory/connection/smb_probe.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,26 @@ import (
1818
"github.com/jfjallid/go-smb/dcerpc/smbtransport"
1919
gosmb "github.com/jfjallid/go-smb/smb"
2020
"github.com/jfjallid/go-smb/spnego"
21+
"github.com/jfjallid/golog"
2122
"github.com/rs/zerolog/log"
2223
)
2324

2425
// smbProbeTimeout caps how long we wait for SMB probe TCP connections.
25-
const smbProbeTimeout = 10 * time.Second
26+
const (
27+
smbProbeTimeout = 10 * time.Second
28+
msrrpLoggerName = "github.com/jfjallid/go-smb/dcerpc/msrrp"
29+
)
2630

2731
// ErrRegistryValueNotFound indicates the queried registry value does not exist.
2832
// Callers use errors.Is to distinguish "not configured" from transport failures.
2933
var ErrRegistryValueNotFound = errors.New("registry value not found")
3034

35+
func init() {
36+
// The upstream msrrp package logs expected missing-value errors before returning
37+
// them. We rely on the returned error path instead of duplicate stderr noise.
38+
golog.Set(msrrpLoggerName, "msrrp", golog.LevelNone, golog.LstdFlags, io.Discard, io.Discard)
39+
}
40+
3141
// ---------------------------------------------------------------------------
3242
// NegotiateResult — cached pre-auth SMB metadata from raw negotiate probes
3343
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)