Re: [PHP] PHP and OpenLDAP

2002-01-07 Thread Stig Venaas

On Thu, Jan 03, 2002 at 10:42:30AM -0700, Quinn Perkins wrote:
 I have installed OpenLDAP 2.x on an OS X Server 10.1.2 box. Everything 
 seems to be fine. I have written a simple PHP front end to modify LDAP 
 values. I can modify values in the core.schema without any problem, but 
 if I try to modify anything in cosine.schema or inetorgperson.schema, I 
 get an error (Warning: LDAP: modify operation could not be completed. in 
 ldapeditor.b2.php on line 247)
 
 This ONLY happens when I try and modify a value in a schema other than 
 core.schema. The project I am working on will require use of cosine and 
 inetorgperson schemas. This is a test page to make sure I can read/write 
 values.

I see you don't modify the object class, does the current object class
allow the new attributes. If say the current class is person, you will
get an error.

You could also try to look at your slapd log. You could also get a
lot of useful info from slapd by starting it in debug mode (-d7) or
some other number than 7 perhaps.

Stig

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP and OpenLDAP

2002-01-03 Thread Quinn Perkins

I have installed OpenLDAP 2.x on an OS X Server 10.1.2 box. Everything 
seems to be fine. I have written a simple PHP front end to modify LDAP 
values. I can modify values in the core.schema without any problem, but 
if I try to modify anything in cosine.schema or inetorgperson.schema, I 
get an error (Warning: LDAP: modify operation could not be completed. in 
ldapeditor.b2.php on line 247)

This ONLY happens when I try and modify a value in a schema other than 
core.schema. The project I am working on will require use of cosine and 
inetorgperson schemas. This is a test page to make sure I can read/write 
values.

Any help would be tremendously appreciated!

My PHP code looks like this:

?php

$ds=ldap_connect(coloradobiz.net:389);

if ($ds) {

$dn=cn=Manager,o=portalware;
$r=ldap_bind($ds, $dn, secret);

$xuser= cn=. $cn .;
$sr=ldap_search($ds, o=portalware,$xuser);
$info=ldap_get_entries($ds,$sr);

$moduser = $info[0][dn];

// core.schema entries
$newinfo[givenname]=$givenname;
$newinfo[sn]=$sn;
$newinfo[mail]=$mail;

// cosine.schema entries
$newinfo[comment]=$comment;
$newinfo[networklocurl]=$networklocurl;
$newinfo[facsimileTelephoneNumber]=$facsimileTelephoneNumber;
$newinfo[aliasdata]=$aliasdata;
$newinfo[homeTelephoneNumber]=$homeTelephoneNumber;
$newinfo[shell]=$shell;
$newinfo[otherMailbox]=$otherMailbox;

ldap_modify($r, $moduser, $newinfo);

$sr=ldap_search($ds,o=portalware,$xuser);

$info = ldap_get_entries($ds, $sr);

echo script;

echo document.forms[0].elements[0].value='. 
$info[0][givenname][0] .';;
echo document.forms[0].elements[2].value='. $info[0][sn][0] .';;
echo document.forms[0].elements[5].value='. $info[0][mail][0] .';;
echo document.forms[0].elements[22].value='. 
$info[0][networklocurl][0] .';;
echo document.forms[0].elements[23].value='. 
$info[0][facsimileTelephoneNumber][0] .';;
echo document.forms[0].elements[24].value='. 
$info[0][aliasdata][0] .';;
echo document.forms[0].elements[25].value='. 
$info[0][homeTelephoneNumber][0] .';;
echo document.forms[0].elements[26].value='. 
$info[0][shell][0] .';;
echo document.forms[0].elements[27].value='. 
$info[0][otherMailbox][0] .';;

echo /script;

ldap_close($ds);

} else {
echo h4Unable to connect to LDAP server/h4;
}
?

My slapd.conf file looks like:

# $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.8.8.6 2001/04/20 
23:32:43 kurt Exp $
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
# include schema
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema

# Define global ACLs to disable default read access.
# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org

pidfile /usr/local/var/slapd.pid
argsfile /usr/local/var/slapd.args

# Load dynamic backend modules:
# modulepath /usr/local/libexec/openldap
# moduleload back_ldap.la
# moduleload back_ldbm.la
# moduleload back_passwd.la
# moduleload back_shell.la

###
# ldbm database definitions
###

database ldbm
suffix dc=coloradobiz,dc=net
suffix o=portalware
rootdn cn=Manager,o=portalware
#rootdn cn=Manager,o=My Organization Name,c=US
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw secret
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd/tools. Mode 700 recommended.
directory /usr/local/var/openldap-ldbm
# Indices to maintain
index objectClass eq


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]