NUBIC / ladle

Ladle dishes out steaming helpings of lightweight directory access (LDAP) for use in testing with rspec, cucumber, or any other ruby test framework.
MIT License
59 stars 15 forks source link

Enabling NIS schema #19

Open astratto opened 10 years ago

astratto commented 10 years ago

Hi,

I need to enable the NIS schema and, according to ApacheDS documentation, I just need to modify the m-disabled attribute.

I tried starting Ladle with an LDIF file containing my data and these lines at the top:

dn: cn=nis,ou=schema
changetype: modify
replace: m-disabled
m-disabled: FALSE
-

other_stuff_here

but it fails with:

ApacheDS: ERROR: ERR_12004_CHANGE_NOT_ALLOWED We cannot have changes when reading a file which already contains entries
ApacheDS process failed: FATAL: ERR_12005_NO_CHANGE No changes within entries
ApacheDS: java.util.NoSuchElementException: ERR_12005_NO_CHANGE No changes within entries
...

Any ideas?

Thanks

rsutphin commented 10 years ago

Can you show me how you're building Ladle::Server?

cherweg commented 9 years ago

Hi. Any suggestions/examples how to enable the nis Schema at startup? I have the same problem like astratto. in my spec test i initilize like this:

 before :all do
    @ldap_server = Ladle::Server.new(
    :port => 3897,
    :ldif => "./spec/support/my.ldif",
    :custom_schemas => "./spec/support/my_schema.ldif",
    :domain => "dc=my,dc=domain,dc=de",
    :tmpdir => Dir.tmpdir()
  )
    @ldap_server.start
  end

in my.ldif i have tried to do:

  dn: cn=nis,ou=schema
  changetype: modify
  replace: m-disabled
  m-disabled: FALSE
  -
[...]
dn: uid=tester,ou=tester,ou=people,dc=my,dc=domain,dc=de
objectClass: top
objectClass: person
objectClass: posixAccount
objectClass: organizationalPerson
objectClass: ldapPublicKey
objectClass: inetOrgPerson
cn: Max Mustermann
[...]

results in:

Starting server on 3897
ApacheDS: ERROR: ERR_12004_CHANGE_NOT_ALLOWED We cannot have changes when reading a file which already contains entries
ApacheDS process failed: FATAL: ERR_12005_NO_CHANGE No changes within entries
ApacheDS: java.util.NoSuchElementException: ERR_12005_NO_CHANGE No changes within entries
ApacheDS:   at org.apache.directory.api.ldap.model.ldif.LdifReader.nextInternal(LdifReader.java:1793)
ApacheDS:   at org.apache.directory.api.ldap.model.ldif.LdifReader.access$100(LdifReader.java:168)
ApacheDS:   at org.apache.directory.api.ldap.model.ldif.LdifReader$1.next(LdifReader.java:1892)
ApacheDS:   at org.apache.directory.api.ldap.model.ldif.LdifReader$1.next(LdifReader.java:1883)
ApacheDS:   at net.detailedbalance.ladle.Server.loadLDIF(Server.java:194)
ApacheDS:   at net.detailedbalance.ladle.Server.start(Server.java:162)
ApacheDS:   at net.detailedbalance.ladle.Main.main(Main.java:64)

regards Christian

astratto commented 9 years ago

@rsutphin I'm sorry, but somehow I missed your reply...

Basically I was doing what @cherweg is doing now. If I recall correctly I needed to enable other object classes (i.e., posix*) and I tried to pass a custom schema, that didn't work and I narrowed down the issue to the fact that it doesn't accept an LDIF that changes the schema.

LorenzBischof commented 8 years ago

Any progress on this? I would really like to use object classes from the nis schema like posixaccount etc.

edit: is there anyway to load it? I found an xml online but that doesn't seem to work and I don't know how to convert it.

gtorre commented 8 years ago

Running into the same issue. @rsutphin any thoughts on how to accomplish this? Thanks!

gtorre commented 8 years ago

@silarsis perhaps you might be able to assist?

cherweg commented 8 years ago

Hey Folks, sorry for my late response... I solved my problem by updating the cn=nis.ldif inside the apacheds-all-2.0.0-M16.jar:

`diff cn=nis.ldif.enabled cn=nis.ldif 4c4

< m-disabled: FALSE

m-disabled: TRUE`

You could unzip the jar, change that file (apacheds-all-2.0.0-M16.jar/schema/ou=schema/cn=nis.ldif) and zip it again (as a jar file).

Perhaps somebody could release a new Version of ladle with an updated jar?

regards Christian