Re: [PHP] ldap_add - Server is unwilling to peform

2011-01-27 Thread CHARLES HUNT
I finally got it to create the user.  I had to remove the memberOf 
attributes. 
 
Apparently you have to add the User to the Group rather than the Group to the 
User. 
Now I need to figure out how to enable the user and set the password. 
As well as adding the User to the desired Groups.


- Original Message 
From: Daniel Brown danbr...@php.net
To: CHARLES HUNT ch5...@yahoo.com
Cc: php-general@lists.php.net
Sent: Wed, January 26, 2011 9:39:32 AM
Subject: Re: [PHP] ldap_add - Server is unwilling to peform

On Wed, Jan 26, 2011 at 10:17, CHARLES HUNT ch5...@yahoo.com wrote:
 Hello-
 I am trying to add create a user account with the ldap_add function.  However 
I
 get the error below when it is invoked.  Does anyone have ideas what may be
 causing this error?  What I can look into?  Anything would be helpful.

 Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform
 in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

What LDAP server are you using (Active Directory, openLDAP,
iPlanet, eDirectory, et cetera)?  You may want to try swapping out
ldap_add() for ldap_mod_add().

http://php.net/ldap_mod_add


-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ldap_add - Server is unwilling to peform

2011-01-26 Thread CHARLES HUNT
Hello-
I am trying to add create a user account with the ldap_add function.  However I 
get the error below when it is invoked.  Does anyone have ideas what may be 
causing this error?  What I can look into?  Anything would be helpful.

Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform 
in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

Line 354 is the actual call to ldap_add().  

Thanks-
Chuck

function al_ldap_add_user($Fname,$Lname,$Aname,$UPname,$Hdir,$MemberOf,$Admin)
{
session_start();
$info = array();
$user = $_SESSION['username'].@dh2.pub.com;
$password = $_SESSION['password'];
$iv = $_SESSION['iv'];//for decryption
$key = $_SESSION['key'];//for decryption
//$dn_ending = ,OU=Lab Associates,OU=Accounts,DC=DH2,DC=pub,DC=com;
$dn_ending = ,OU=Testing,OU=Accounts,DC=DH2,DC=pub,DC=com;
$obj_cat = CN=Person,CN=Schema,CN=Configuration,DC=DH2,DC=pub,DC=com;
$decryptedpw = al_decrypt($password,$iv,$key);//call decryption function to get 
the plain text password
$FullName = $Fname .. $Lname;
$DN = CN= . $FullName . $dn_ending;
$ds=ldap_connect($_SESSION['ldap_addr']);  // must be a valid LDAP server!
if ($ds) 
{ 
$r=ldap_bind($ds,$user,$decryptedpw); 
// prepare data
$info[sAMAccountName] = $Aname;
$info[sAMAccountType] = 805306368;
$info[cn] = $FullName;
$info[displayName] = $FullName;
$info[name] = $FullName;
$info[sn] = $Lname;
$info[givenName] = $Fname;
$info[userPrincipalName] = $UPname;
$info[homeDirectory] = $Hdir;
$info[homeDrive] = U:;
$info[objectCategory] = $obj_cat;
$info[objectClass][0] = top;
$info[objectClass][1] = person;
$info[objectClass][2] = organizationalPerson;
$info[objectClass][3] = user;
if( $Admin)
$info[adminCount] = 1;
$N = count($MemberOf);
for($i=0; $i  $N; $i++)
{
  $info[memberOf][$i] = str_replace(',,$MemberOf[$i]);
}

// add data to directory
var_dump($info);
$ad = ldap_add($ds, $DN, $info);
if($ad)
return true;
else
{
echo h4Unable to create user/h4;
return false;
}
} else {
echo h4Unable to connect to LDAP server/h4;
}

}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ldap_add - Server is unwilling to peform

2011-01-26 Thread CHARLES HUNT
Win 2000 Active Directory.

I'll give ldap_mod_add a shot.


- Original Message 
From: Daniel Brown danbr...@php.net
To: CHARLES HUNT ch5...@yahoo.com
Cc: php-general@lists.php.net
Sent: Wed, January 26, 2011 9:39:32 AM
Subject: Re: [PHP] ldap_add - Server is unwilling to peform

On Wed, Jan 26, 2011 at 10:17, CHARLES HUNT ch5...@yahoo.com wrote:
 Hello-
 I am trying to add create a user account with the ldap_add function.  However 
I
 get the error below when it is invoked.  Does anyone have ideas what may be
 causing this error?  What I can look into?  Anything would be helpful.

 Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform
 in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

What LDAP server are you using (Active Directory, openLDAP,
iPlanet, eDirectory, et cetera)?  You may want to try swapping out
ldap_add() for ldap_mod_add().

http://php.net/ldap_mod_add


-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ldap_add - Server is unwilling to peform

2011-01-26 Thread CHARLES HUNT
It seems ldap_mod_add is for adding attributes to a dn that is already there.  
I 
get the error: Modify: No such object in...


- Original Message 
From: Daniel Brown danbr...@php.net
To: CHARLES HUNT ch5...@yahoo.com
Cc: php-general@lists.php.net
Sent: Wed, January 26, 2011 9:39:32 AM
Subject: Re: [PHP] ldap_add - Server is unwilling to peform

On Wed, Jan 26, 2011 at 10:17, CHARLES HUNT ch5...@yahoo.com wrote:
 Hello-
 I am trying to add create a user account with the ldap_add function.  However 
I
 get the error below when it is invoked.  Does anyone have ideas what may be
 causing this error?  What I can look into?  Anything would be helpful.

 Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform
 in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

What LDAP server are you using (Active Directory, openLDAP,
iPlanet, eDirectory, et cetera)?  You may want to try swapping out
ldap_add() for ldap_mod_add().

http://php.net/ldap_mod_add


-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ldap_add - Server is unwilling to peform

2011-01-26 Thread CHARLES HUNT
Do I need to be using SSL?  Not sure how to implement that.  (if you can't tell 
I'm pretty new to PHP)


- Original Message 
From: Daniel Brown danbr...@php.net
To: CHARLES HUNT ch5...@yahoo.com
Cc: php-general@lists.php.net
Sent: Wed, January 26, 2011 9:39:32 AM
Subject: Re: [PHP] ldap_add - Server is unwilling to peform

On Wed, Jan 26, 2011 at 10:17, CHARLES HUNT ch5...@yahoo.com wrote:
 Hello-
 I am trying to add create a user account with the ldap_add function.  However 
I
 get the error below when it is invoked.  Does anyone have ideas what may be
 causing this error?  What I can look into?  Anything would be helpful.

 Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform
 in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

What LDAP server are you using (Active Directory, openLDAP,
iPlanet, eDirectory, et cetera)?  You may want to try swapping out
ldap_add() for ldap_mod_add().

http://php.net/ldap_mod_add


-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php