-
Notifications
You must be signed in to change notification settings - Fork 371
Support DN to string conversion #154 #155
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
Conversation
dn.go
Outdated
| if j > 0 { | ||
| buffer.WriteString("+") | ||
| } | ||
| buffer.WriteString(d.RDNs[i].Attributes[j].Type) |
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.
where is escaping done?
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.
Value inspection and escaping (RFC 2253, 4514) is not implemented. Only canonical representation with spaces removed from [=,+] was done. I can add value inspection and escaping.
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.
@liggitt I have added the changes for handing escaping of attribute values as per RFC 4512, 4514. Implementation is generic at DN level and can be used easily.
dn.go
Outdated
| buffer.WriteString(d.RDNs[i].Attributes[j].Type) | ||
| buffer.WriteString("=") | ||
| //Escape the value before building DN string | ||
| val := EscapeAttrValue(d.RDNs[i].Attributes[j].Value) |
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.
@liggitt Here is the change (EscapeAttrValue), please review.
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.
@liggitt Can you please provide your review inputs on this? - Thnx
|
@liggitt Please check and approve the PR |
johnweldon
left a comment
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.
Thank you
|
@asambeka - I really appreciate your work on this. I have a couple reservations that incline me to want to use #104 instead of this PR:
I am sorry I didn't review the differences more thoroughly before you worked on the updates today. Have I missed any benefits of this PR over the other one that I did not enumerate? |
Here are few red flags from #104 for me, I think these makes this SDK non compliant: a) PR is explicitly sorting multi-valued RNDs. LDAPs do not modify DN Inserted by user, they will preserve the format. Sorting is done only for “DN Normalization” which is typically needed for DN compare operation (which does not modify DN). So String() should not sort. Realization that a DN and Normalized value is same is done by Matching Rules (in this case DN Matching Rule). Matching rules are immutable, String() should be no different. Sorting and lower case functionality #104 is implementing should be under "DN Normalization". |
|
I'm inclined to agree that lowercasing and sorting do not belong in I would still rather see a parser than a regular expression. I would be interested in your analysis of the hex encoding. It seems important to do it right, although the |
|
Feel free to reopen or make a new PR if you'd like to pursue this further. Thanks for you contribution. |
Added String method to dn.go, for supporting DN to string conversion.