Skip to content

fix panic in addControlDescriptions() #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

vetinari
Copy link
Contributor

apply similar patch like in #83, closes #86

apply similar patch like in go-ldap#83, closes go-ldap#86
@@ -153,15 +153,37 @@ func addLDAPDescriptions(packet *ber.Packet) (err error) {
func addControlDescriptions(packet *ber.Packet) {
packet.Description = "Controls"
for _, child := range packet.Children {
var value *ber.Packet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do the same thing here where we declare controlType := "", set it inside the cases, then switch on controlType instead of child.Children[0].Value.(string)?

@liggitt
Copy link
Contributor

liggitt commented Aug 15, 2016

probably worth adding a similar unit test to make sure addControlDescriptions() works when called with packets off the wire

@liggitt
Copy link
Contributor

liggitt commented Aug 15, 2016

looks good, just a couple comments. thanks!

* set controlType from hild.Children[0].Value.(string)
* fix case 1: child 1 value from child, not packet
* add tests ...
@vetinari
Copy link
Contributor Author

done, found a bug with the tests ;-)

@liggitt
Copy link
Contributor

liggitt commented Sep 14, 2016

LGTM, needs a rebase (and squash while you're at it)

@vetinari vetinari closed this Sep 24, 2016
@vetinari vetinari deleted the fix-add-descriptions-panic branch September 24, 2016 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

addControlDescriptions would panic at control without critcality and value
2 participants