Address panic in GetLDAPError, add fuzzer#582
Conversation
| conn, err := DialURL(ldapServer) | ||
| if err != nil { | ||
| t.Error(err) | ||
| t.Fatal(err) |
There was a problem hiding this comment.
This now matches the logic in TestExtendedRequest_WhoAmI above and ensures that the test doesn't panic due to calling conn.Close() on a nil conn if the test LDAP server isn't available.
| default: fmt vet lint build test | ||
|
|
||
| CONTAINER_CMD := $(shell command -v docker 2>/dev/null || shell command -v podman 2>/dev/null) | ||
| CONTAINER_CMD := $(shell (command -v docker 2>/dev/null || command -v podman 2>/dev/null)) |
There was a problem hiding this comment.
In the prior code, the second shell was not being treated as a make keyword. This resulted in the podman check not working. The change here is to group the shell statements and pass them to shell.
| } | ||
|
|
||
| // TestNilPacket tests that nil packets don't cause a panic. | ||
| func TestNilPacket(t *testing.T) { |
There was a problem hiding this comment.
Here and elsewhere below: All removed tests have been added to generateGetLDAPErrorCorpus.
|
Added a fix and test coverage for another panic shook out by the fuzzer added in this PR. I expected a panic here but didn't know how to replicate the invalid data. |
cpuschma
left a comment
There was a problem hiding this comment.
Thank you for your PR and your work! Especially the fuzzing part is a nice addition
|
Thanks for the approval and comments @cpuschma |
|
I'm planning to create a new release within approx. next week. |
This PR addresses a panic in the following line that occurs if
response.Children[0].Valueis nil.ldap/v3/error.go
Line 213 in 539d8f5
This panic was original discovered when fuzzing our own code.
The PR:
nilto avoid the panicmake fuzzcommand inMakefileto remove fuzzers that no longer exist and add the new one.Misc other changes:
Makefilethat preventedpodmanfrom being used.TestExtendedRequest_FastBindwhere the test would error if the test target wasn't available. Since the error didn't stop the test a panic would be triggered whendefercalledconn.Close()on anilconn.Running the fuzzer with
podman: