Skip to content
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

empty attribute values are being treated falsely as parsing error #21

Open
nikkicoon opened this issue Jun 12, 2024 · 3 comments
Open
Assignees
Labels

Comments

@nikkicoon
Copy link

Is a linebreak considered an empty value?

		b, err := os.ReadFile(*f)
		if err != nil {
			fmt.Println(err)
		}
		res, err = pkg.ParseUsers(string(b))

where ParseUsers(b) is a function which utilizes ldif.Parse, for an ldif file with several entries I get "Error in line 29: empty value" even when I cut it down to the first two chunks of entries and the file has no line 29 (sorry for the words used, I merely write code which deals with data I get handed and don't have much experience with ldap).

My assumption from the ldif dump I got, and the tests I've seen in your code, is that ldif entries are separated by linebreaks. Why does this happen?

@nikkicoon
Copy link
Author

it is possible that the file I was given as an example was mangled

@nikkicoon
Copy link
Author

 5)  When a zero-length attribute value is to be included directly
          in an LDIF file, it MUST be represented as
          AttributeDescription ":" FILL SEP.  For example, "seeAlso:"
          followed by a newline represents a zero-length "seeAlso"
          attribute value.  It is also permissible for the value
          referred to by a URL to be of zero length.

quote from https://datatracker.ietf.org/doc/html/rfc2849

yet you seem to handle empty attribute values as errors.

@nikkicoon nikkicoon changed the title error in line 29 empty value, even when the file has 28 lines empty attribute values are being treated falsely as parsing error Jun 14, 2024
@nikkicoon nikkicoon reopened this Jun 14, 2024
@cpuschma cpuschma added the bug label Jun 14, 2024
@cpuschma cpuschma self-assigned this Jun 14, 2024
@nikkicoon
Copy link
Author

nikkicoon commented Jun 17, 2024

rough solution: https://github.com/nikkicoon/ldif/commits/master/?since=2024-06-17&until=2024-06-17
If you give me feedback, I can polish this up and send in a proper PR. I'm not that interested in maintaining a solution for my company only if it can be avoided.

This does treat no empty attribute value as error, which - in my understanding of the specs - should be spec conform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants