473,378 Members | 1,617 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

LDAP objectGUID problem

107 100+
Hey,

Im creating an intranet and when a user logs on I use the Active Directory to validate their logon, then store the objectGUID in a session variable, which I first convert to hex using bin2hex()

My question is, how do I then use it to query the active directory for group membership etc, I dont seem to be able to get it in the correct format to use something like:

Expand|Select|Wrap|Line Numbers
  1. $filter = "objectguid=$objectguid";
so after i've converted to hex i have a guid that looks something like this:

4e7c7075e7ace444af00b1162839257b

Apparently the data type is a 128bit octal string. (16 bytes)... whatever that is!
I've tried using unpack(), but im not sure that even if i manage to convert it into binary I can even use this kind of data with ldap_search()


Any help appreciated!

Thanks

Andy
Aug 12 '08 #1
1 9671
theS70RM
107 100+
ok, for anyone interested I found how to do this.

All you need to do when retrieving the objectguid is convert it to hex with

Expand|Select|Wrap|Line Numbers
  1. $hex_guid = bin2hex($binary_guid);
then to get it into a format to query the active directory there needs to be an escape character every 2 characters like:

4e\7c\70\75\e7\ac\e4\44\af\00\b1\16\28\39\25\7b

heres the function i use:

Expand|Select|Wrap|Line Numbers
  1. function FormatGUID($hexGUID){
  2.  
  3.         $hexGUID = str_replace("-", "", $hexGUID);
  4.  
  5.         for ($i = 0; $i <= strlen($hexGUID)-2; $i = $i+2){
  6.  
  7.             $output .=  "\\".substr($hexGUID, $i, 2);
  8.  
  9.  
  10.         }
  11.  
  12.         return $output;
  13.  
  14.     }
  15.  
I've not tested this very much yet though, so beware!


Cheers
Sep 3 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sacs | last post by:
Hi all, this is _really_ bugging me, and the Google God has failed me: Doing an ldap_search of a Wink2k Active Directory trying to get the objectGUID. This is a unique id within AD and is meant...
0
by: jiing | last post by:
<?php $ldapServer="ldap://192.168.1.211"; $ldapPort="389"; $ldapconn=ldap_connect($ldapServer,$ldapPort); $ldaprdn="uid=root, ou=People, dc=aitc, dc=com, dc=tw"; $ldappass="abcd"; ...
0
by: Ammar | last post by:
I don't want to extend the AD schema but need the hierarchical info on some groups (objectGuids that maintain the group). So I need to store the objectGuid of groups and accounts into the...
7
by: Amar | last post by:
I am trying to connect to my college LDAP directory using ASP.NET. This LDap does not have security as it returns only user demographic information. i do not need to bind with a username or...
5
by: Bryan | last post by:
Hello, I have a asp.net app working with directory services on my Windows XP development machine. However when I moved the application over to our production server (Win 2000 Server) it no longer...
0
by: rumich | last post by:
Hi, I have the following problem when trying to retrieve Windows 2003 AD entry (objectclass=person). <?php $ad = ldap_connect($ADhost,$ADldap_port) or die( "Could not connect!" ); $set =...
2
by: jo3c | last post by:
Hi.. Im trying to get some information out of a windows sever 2003 chinese active directory system so let's say encoding is probably big5 or utf-8 what im doing is simliar to ldapsearch in...
0
by: theS70RM | last post by:
Hey Peeps =) I have a function that returns an active directory users group membership as an array. This code is part of a bigger object, but something like: function...
1
by: theS70RM | last post by:
Hi, I have a php script to retrieve data about a user from the active directory using ldap. Here's a cut down version: $domainName = "domain.com"; $serverName = "server";...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.