-
Notifications
You must be signed in to change notification settings - Fork 364
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
fix dn parsing without attr or value #119
Conversation
LGTM, squash before merge |
@liggitt done |
@@ -143,6 +143,9 @@ func ParseDN(str string) (*DN, error) { | |||
} | |||
} else if char == ',' || char == '+' { | |||
// We're done with this RDN or value, push it | |||
if len(attribute.Type) == 0 { | |||
return nil, errors.New("incomplete type, value pair") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just had a thought... should we include stringFromBuffer()
in the error to aid debugging the bad attribute? or if we don't want to allow injecting arbitrary values into the message, at least include the position?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we didn't include the bad attribute in the "DN ended with incomplete type, value pair" message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we also need to check for len(attribute.Type) == 0
in the if char == '='
block, to catch =foo,DC=example,DC=com
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's caught here or with the "DN ended with incomplete type, value pair" error, adding
"=test,DC=example,DC=com": "incomplete type, value pair",
in dn_test.go:TestErrorDNParsing()
passes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added as test and squashed
thanks, looks like it needs a rebase on top of your other PR |
done... |
* upstream/master: fix dn parsing without attr or value (go-ldap#119) fix unbalanced parenthesis panic when compiling filter
fixes #114