LDAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesLDAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 19th, 2004, 04:38 AM
abir abir is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 6 abir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
can't add to ldap, when run slapd returns an error

HI ,
i cant resolve some problems,i work with openldap-2.1.29 , mandrake 9.2, i really need your help.
These are my slap.con ,ldif files an error messages that appears when runnig slapd,and when typng the search an add commands

slapd.conf:
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
pidfile /var/run/slapd.pid
argsfile /var/run/slapd.args
####################################################################
# ldbm database definitions
#######################################################################
database bdb
suffix "dc=example,dc=com"
rootdn "cn=root,dc=example,dc=com"
rootpw secret
directory /usr/local/var/openldap-data
# Indices to maintain
index objectClass eq

file ex.ldif:
dn: dc=example,dc=com
objectclass: dcObject
objectclass: organization
o: example
dc: example.com

dn: ou=app,dc=example,dc=com
objectclass: organizationalUnit
ou: app

dn: cn=barbara jensen,ou=app,dc=example,dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: barbara jensen
sn: jensen
title: madame
description: employee du departement app

ldapsearch:
[root@localhost rc.d]# ldapsearch -x -b "dc=example,dc=com" "(objectclass=*)"
# extended LDIF
#
# LDAPv3
# base <dc=example,dc=com> with scope sub
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

# numResponses: 1

SERVER:
[root@localhost root]# /usr/local/libexec/slapd -d 256
daemon: socket() failed errno=97 (Address family not supported by protocol)
bdb_initialize: Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002)
bdb_db_init: Initializing BDB database
slapd starting

AFTER TYPING LDAPSEARCH:
conn=0 fd=12 ACCEPT from IP=127.0.0.1:1190 (IP=0.0.0.0:389)
conn=0 op=0 BIND dn="" method=128
conn=0 op=0 RESULT tag=97 err=0 text=
conn=0 op=1 SRCH base="dc=example,dc=com" scope=2 filter="(objectClass=*)"
conn=0 op=1 RESULT tag=101 err=32 text=
conn=0 op=2 UNBIND
conn=0 fd=12 closed

LDAPADD:
[root@localhost rc.d]# ldapadd -x -D "cn=root,dc=example,dc=com" -W -f ex.ldif
Enter LDAP Password:
adding new entry "dc=example,dc=com"
ldapadd: update failed: dc=example,dc=com
ldap_add: Naming violation (64)
additional info: value of naming attribute 'dc' is not present in entry

SERVER AFTER TYPING LDAPADD:
conn=1 fd=12 ACCEPT from IP=127.0.0.1:1191 (IP=0.0.0.0:389)
conn=1 op=0 BIND dn="cn=root,dc=example,dc=com" method=128
conn=1 op=0 BIND dn="cn=root,dc=example,dc=com" mech=SIMPLE ssf=0
conn=1 op=0 RESULT tag=97 err=0 text=
conn=1 op=1 ADD dn="dc=example,dc=com"
conn=1 op=1 RESULT tag=105 err=64 text=value of naming attribute 'dc' is not present in entry
conn=1 op=1 RESULT tag=105 err=64 text=value of naming attribute 'dc' is not present in entry
conn=1 op=2 UNBIND
conn=1 fd=12 closed

i'm waiting for your help!

Reply With Quote
  #2  
Old April 19th, 2004, 11:56 AM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,791 Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 4 Weeks 21 h 14 m 2 sec
Reputation Power: 437
First please please post a valid subject otherwise we have no idea of what the post is about.

Quote:
Originally Posted by abir
SERVER:
[root@localhost root]# /usr/local/libexec/slapd -d 256
daemon: socket() failed errno=97 (Address family not supported by protocol)


try /usr/local/libexec/slapd -d 255 (255 instead of 256)

Quote:
Originally Posted by abir
ldapsearch:
[root@localhost rc.d]# ldapsearch -x -b "dc=example,dc=com" "(objectclass=*)"
# extended LDIF
#
# LDAPv3
# base <dc=example,dc=com> with scope sub
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

# numResponses: 1


It appears your dn isn't correct
change from -b "dc=example,dc=com" to
-b "dc=example.com,dc=com"

Quote:
Originally Posted by abir
LDAPADD:
[root@localhost rc.d]# ldapadd -x -D "cn=root,dc=example,dc=com" -W -f ex.ldif
Enter LDAP Password:
adding new entry "dc=example,dc=com"
ldapadd: update failed: dc=example,dc=com
ldap_add: Naming violation (64)
additional info: value of naming attribute 'dc' is not present in entry


again your auth dn wouldn't exist (unless it already does)
-D "cn=root,dc=example,dc=com"
try chaning to -D "cn=root,dc=com" (or whatever is the correct one)

This may not be the case and it could be something different but I tried your ldiff file and it worked fine for me no naming violation
__________________
Miscellaneous Software
Viper_SB
Developershed E-Support


Anyone else play chess?
Challenge me

Reply With Quote
  #3  
Old April 21st, 2004, 03:37 PM
abir abir is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 6 abir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
code php_ldap problem

Hi all,
i can't execute any php script,if anyone can help me i'll be greetful,these are he script and results i got:
Script PHP:
<?
// Fichier de configuration pour l'interface PHP
// de notre annuaire LDAP
$server = "localhost";
$port = "389";
$racine = "dc=telecom, dc=tn";
$rootdn = "cn=root,dc=telecom, dc=tn";
$rootpw = "secret";
echo "Connexion...<br>";

$ds=ldap_connect($server);
if ($ds==1)
{ // on s'authentifie en tant que super-utilisateur, ici, ldap_admin
$r=ldap_bind($ds,$rootdn,$rootpw);
// Ici les opérations à effectuer
echo "Déconnexion...<br>";
ldap_close($ds);
}
else {
echo "Impossible de se connecter au serveur LDAP";
}
?>

[root@localhost root]# php /usr/local/connect.php -a
Content-type: text/html
X-Powered-By: PHP/4.3.5
Connexion...<br><br />
<b>Warning</b>: ldap_bind(): Unable to bind to server: Protocol error in <b>/usr/local/connect.php</b> on line <b>31</b><br />
Déconnexion...<br>

server:

[root@localhost root]# /usr/local/libexec/slapd -f /etc/openldap/slapd.conf -d 256
daemon: socket() failed errno=97 (Address family not supported by protocol)
bdb_initialize: Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002)
bdb_db_init: Initializing BDB database
slapd starting
conn=0 fd=12 ACCEPT from IP=127.0.0.1:1040 (IP=0.0.0.0:389)
conn=0 op=0 BIND dn="cn=root,dc=telecom,dc=tn" method=128
conn=0 op=0 RESULT tag=97 err=2 text=requested protocol version not allowed
conn=0 op=1 UNBIND
conn=0 fd=12 closed

is the problem with socket ,(error when starting ldap) and how can i deal with
i'm waiting for yor help(php4.3.5)

Reply With Quote
  #4  
Old April 21st, 2004, 04:33 PM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,791 Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 4 Weeks 21 h 14 m 2 sec
Reputation Power: 437
try this /usr/local/libexec/slapd -d 255 I said this in my previous post try it first then let me know if it doesn't work

as far as php if you can connect to your ldap with another program (like ldapsearch or ldapadmin) then php can connect otherwise it's an ldap problem

Reply With Quote
  #5  
Old April 22nd, 2004, 04:06 AM
abir abir is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 6 abir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i changed my ldif file and (ldapsearch,ldapadd..)work.only the php scripts does'nt work is it a dns problem? have to configure the dns or what? thx

Reply With Quote
  #6  
Old April 22nd, 2004, 10:40 AM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,791 Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 4 Weeks 21 h 14 m 2 sec
Reputation Power: 437
try this out and post what it says
Code:
<?php
$host = 'localhost';
$port = 389;

$link = ldap_connect($host, $port);

ldap_bind($link);
if (ldap_error($link) == "Can't contact LDAP server") {
	print "Could not connect to LDAP server '".$host."' on port '".$port."'");
}
if (ldap_bind($link, $userdn, $password) === false) {
	print "ldap error: ".ldap_error($link)."<br>";
}
?>

Reply With Quote
  #7  
Old April 24th, 2004, 05:07 AM
abir abir is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 6 abir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
programme php

I Try this code:
<br />
<b>Warning</b>: ldap_bind(): Unable to bind to server: Can't contact LDAP server in <b>/root/dev.php</b> on line <b>7</b><br />
Could not connect to LDAP server 'localhoast' on port '389'<br />
<b>Warning</b>: ldap_bind(): Unable to bind to server: Can't contact LDAP server in <b>/root/dev.php</b> on line <b>11</b><br />
ldap error: Can't contact LDAP server<br>

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesLDAP Programming > can't add to ldap, when run slapd returns an error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway