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

openldap_password inserting newline in LDIF #3

Closed
lazyfrosch opened this issue Apr 23, 2014 · 5 comments
Closed

openldap_password inserting newline in LDIF #3

lazyfrosch opened this issue Apr 23, 2014 · 5 comments

Comments

@lazyfrosch
Copy link

Sorry for one more issue ;)

I just observed this while adding other databases:

openldap_database { 'test':
    directory => '/var/lib/ldap.test',
    suffix    => $suffix,
    rootdn    => "cn=Manager,${suffix}",
    rootpw    => openldap_password('secret'),
    provider  => olc,
}
ldap_add: Other (e.g., implementation specific) error (80)
    additional info: <olcRootPW> can only be set when rootdn is under suffix

While enabling puts debug output I noticed a newline in the LDIF data

olcDbDirectory: /var/lib/ldap.test
olcRootDN: cn=Manager,dc=...
olcRootPW: {SSHA}XXX

olcSuffix: dc=...

So maybe just a missing strip?

When adding a ".strip!" the problem is gone. Not sure if thats the best solution, because I'm no Ruby developer ;)

@mcanevet
Copy link
Member

@lazyfrosch where do you add ".strip!" ?

@lazyfrosch
Copy link
Author

Just after the slappasswd execution.

diff --git a/lib/puppet/parser/functions/openldap_password.rb b/lib/puppet/parser/functions/openldap_password.rb
index bdfeefb..8ac8be8 100644
--- a/lib/puppet/parser/functions/openldap_password.rb
+++ b/lib/puppet/parser/functions/openldap_password.rb
@@ -11,6 +11,6 @@ module Puppet::Parser::Functions
     scheme = args[1] if args[1]
     command << ['-h', scheme] if scheme

-    Puppet::Util::Execution.execute(command.flatten)
+    Puppet::Util::Execution.execute(command.flatten).strip!
   end
 end

@mcanevet
Copy link
Member

@lazyfrosch what ruby version are you using ?

@lazyfrosch
Copy link
Author

@mcanevet The system is a vagrant box based on Debian Wheezy, Ruby is 1.9.3.194-8.1+deb7u2

@mcanevet
Copy link
Member

@lazyfrosch I'm not sure that '!' is mandatory in this case.
Could you provide a PR with your patch (without '!' if it's not necessary) ?

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

No branches or pull requests

2 participants