I am trying to add the following record stored in cwagon.ldif:
dn: uid=cwagon,ou=People,dc=network,dc=com
cn: Chuck Wagon
sn: Wagon
objectClass: top
objectClass: person
objectClass: posixAccount
objectClass: shadowAccount
userPassword: {crypt}6g8fRXiMEwg0Y
uid: cwagon
uidNumber: 500
gidNumber: 500
loginShell: /bin/bash
homeDirectory: /home/cwagon
shadowLastChange: 10877
shadowMin: 0
shadowMax: 999999
shadowInactive: -1
shadowWarning: 7
shadowFlag: 0
shadowExpire: -1
(This is indetical to an example on openldap.org, however the name and account have been changed to match my site)
Here is a dump of my diretory thus far:
# ldapsearch -x -b 'dc=network,dc=com' 'objectclass=*'
# extended LDIF # # LDAPv3 # base <dc=network,dc=com> with scope subtree # filter: objectclass=* # requesting: ALL #
# network.com dn: dc=network,dc=com dc: network objectClass: top objectClass: domain
# Hosts, network.com dn: ou=Hosts,dc=network,dc=com ou: Hosts objectClass: top objectClass: organizationalUnit
# Rpc, network.com dn: ou=Rpc,dc=network,dc=com ou: Rpc objectClass: top objectClass: organizationalUnit
# Services, network.com dn: ou=Services,dc=network,dc=com ou: Services objectClass: top objectClass: organizationalUnit
# netgroup.byuser, network.com dn: nisMapName=netgroup.byuser,dc=network,dc=com nisMapName: netgroup.byuser objectClass: top objectClass: nisMap
# Mounts, network.com dn: ou=Mounts,dc=network,dc=com ou: Mounts objectClass: top objectClass: organizationalUnit
# Networks, network.com dn: ou=Networks,dc=network,dc=com ou: Networks objectClass: top objectClass: organizationalUnit
# People, network.com dn: ou=People,dc=network,dc=com ou: People objectClass: top objectClass: organizationalUnit
# Group, network.com dn: ou=Group,dc=network,dc=com ou: Group objectClass: top objectClass: organizationalUnit
# Netgroup, network.com dn: ou=Netgroup,dc=network,dc=com ou: Netgroup objectClass: top objectClass: organizationalUnit
# Protocols, network.com dn: ou=Protocols,dc=network,dc=com ou: Protocols objectClass: top objectClass: organizationalUnit
# Aliases, network.com dn: ou=Aliases,dc=network,dc=com ou: Aliases objectClass: top objectClass: organizationalUnit
# netgroup.byhost, network.com dn: nisMapName=netgroup.byhost,dc=network,dc=com nisMapName: netgroup.byhost objectClass: top objectClass: nisMap
# search result search: 2 result: 0 Success
# numResponses: 14 # numEntries: 13
When I run this command it fails:
# ldapadd -W -x -D "cn=Manager,dc=network,dc=com" -W -f cwagon.ldif Enter LDAP Password: warning: no attributes to add (entry="uid=cwagon,ou=People,dc=network,dc=com") adding new entry "uid=cwagon,ou=People,dc=network,dc=com" ldap_add: Protocol error (2) additional info: no attributes provided
Here is my slapd.conf: include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/inetorgperson.schema include /etc/openldap/schema/nis.schema
allow bind_v2
pidfile /var/run/openldap/slapd.pid argsfile /var/run/openldap/slapd.args
database bdb suffix "dc=network,dc=com" rootdn "cn=Manager,dc=network,dc=com" rootpw secret rootpw {SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
directory /var/lib/ldap
index objectClass eq,pres index ou,cn,mail,surname,givenname eq,pres,sub index uidNumber,gidNumber,loginShell eq,pres index uid,memberUid eq,pres,sub index nisMapName,nisMapEntry eq,pres,sub
Anyone have any ideas what I'm doing wrong? I've followed the docs on openldap.org and I'm trying to insert a record identical in format to the one listed in the docs. (only the text strings have been changed)
Thanks /CC
Chuck wrote:
I am trying to add the following record stored in cwagon.ldif:
dn: uid=cwagon,ou=People,dc =network,dc=com
cn: Chuck Wagon
sn: Wagon
[..]
# ldapadd -W -x -D "cn=Manager,dc=network,dc=com" -W -f cwagon.ldif Enter LDAP Password: warning: no attributes to add (entry="uid=cwagon,ou=People,dc=network,dc=com") adding new entry "uid=cwagon,ou=People,dc=network,dc=com" ldap_add: Protocol error (2) additional info: no attributes provided
Maybe I'm wrong because your HTML e-mail formatting might have added this. But it seems to me your file cwagon.ldif contains extra empty lines. Note that an empty line is the separator between records in a LDIF file. So your entry uid=cwagon,ou=People,dc=network,dc=com seems to be empty since an empty line follows the line starting with dn:.
Ciao, Michael.
On 10/21/07, Michael Ströder michael@stroeder.com wrote:
Chuck wrote:
I am trying to add the following record stored in cwagon.ldif:
dn: uid=cwagon,ou=People,dc =network,dc=com
cn: Chuck Wagon
sn: Wagon
[..]
# ldapadd -W -x -D "cn=Manager,dc=network,dc=com" -W -f cwagon.ldif Enter LDAP Password: warning: no attributes to add (entry="uid=cwagon,ou=People,dc=network,dc=com") adding new entry "uid=cwagon,ou=People,dc=network,dc=com" ldap_add: Protocol error (2) additional info: no attributes provided
Maybe I'm wrong because your HTML e-mail formatting might have added this. But it seems to me your file cwagon.ldif contains extra empty lines. Note that an empty line is the separator between records in a LDIF file. So your entry uid=cwagon,ou=People,dc=network,dc=com seems to be empty since an empty line follows the line starting with dn:.
Ciao, Michael.
Cool, it wasn't blank lines but actual whitespace preceeding each line.... I did not know about ldif files and how white space is treated.
Thanks!
Chuck wrote:
On 10/21/07, *Michael Ströder* <michael@stroeder.com mailto:michael@stroeder.com> wrote:
Chuck wrote: > I am trying to add the following record stored in cwagon.ldif: > > dn: uid=cwagon,ou=People,dc > =network,dc=com > > cn: Chuck Wagon > > sn: Wagon [..] > # ldapadd -W -x -D "cn=Manager,dc=network,dc=com" -W -f cwagon.ldif > Enter LDAP Password: > warning: no attributes to add > (entry="uid=cwagon,ou=People,dc=network,dc=com") > adding new entry "uid=cwagon,ou=People,dc=network,dc=com" > ldap_add: Protocol error (2) > additional info: no attributes provided Maybe I'm wrong because your HTML e-mail formatting might have added this. But it seems to me your file cwagon.ldif contains extra empty lines. Note that an empty line is the separator between records in a LDIF file. So your entry uid=cwagon,ou=People,dc=network,dc=com seems to be empty since an empty line follows the line starting with dn:. Ciao, Michael.
Cool, it wasn't blank lines but actual whitespace preceeding each line.... I did not know about ldif files and how white space is treated.
Thanks!
It's in the spec for LDIF and mentioned many times in our docs and FAQ ;-)
openldap-software@openldap.org