I'm not a programmer but am muddling through as best I can. I am trying to set up a PostSearchHook for Radiator (RADIUS server), that carries out an LDAP lookup, and, based on the
string returned ("staff" or "student") in the "businessCategory" attribute, will set the $role to be either 40 or 20 (a VLAN ID).
There can however be multiple attributes for "businessCategory" (I for example, have "staff" and "imageportaladmin"), but the only string values needed are "staff" or "student", a
nd if both are returned, then "staff" must take precedent.
The code I have so far:
What I'm not clear on is how I retrieve the data in the $mesg object. If I add the following code above the unbind() method:
I get:
However, I need to be able to query this data for the correct strings (that I mentioned earlier). I know that dump() is method of Net::LDAP, but it shows that the query result is
correct.
If I add the following lines so that I can get a count, I only get the result of "1":
Is that because it is "1" object returned (as opposed to items in a scalar list)?
Phew, it's been quite some time since I last played with Net::LDAP.
And as far as I can remember it took quite a bit of reading the POD beforehand.
So I would suggest you revisit the POD because it is all explained there how you access the returned objref of Net::LDAP::Search.
Because I have forgotten almost all I just have had a quick glance at it on search.cpan.org, Net::LDAP::Search - Object returned by Net::LDAP search method - search.cpan.org
This class offers several accessor methods to fetch the result set.
As you went for the entries() method, this it says returns an array of Net::LDAP::Entry objrefs.
So you would have to look at this class' POD as well to know how to access the data Net::LDAP::Entry - An LDAP entry object - search.cpan.org
Just from my very superficial exposure to the POD right now I would probably try something like this
(please, note this is a mere wild guess since I haven't even Net::LDAP installed on my surf laptop)
But please, this is a wild untested guess which probably is horribly wrong.
You just will have to consult the POD.
What I usually do to get a quick view of the deeply nested data structures I am not yet clear about
is to run my code in the Perl debugger (just invoke your script with preceeding perl -d
Then I continue (c) to the line where the result is fetched and view it in my pager by
This is most of the times far quicker to grasp then perusing the whole POD.
Thanks for the effort. I've been scouring the POD all day Like, I say, I'm not a programmer so this is all tough to take in but I guess that is half the fun.
Thanks for the tip on the Perl debugger; that's very helpful and I'll give that a try together with the POD and maybe I'll come up trumps with it.
Well, I figured it out (I think), so this is the code I'm using and it seems to work. Am fully open to someone checking it out and pointing out better ways of achieving the same thing though:
I have an in interesting dilemna that I am trying to address. I have some ldap queries that I use to retrieve user information to perform access validations on a quarterly/annual basis. I can successfully pull the local users, and I can use ldapsearch to pull back all the users from the DN as well.... (7 Replies)
I need to write LDAP group query where I need to find if a particular user is a member of a 2 specific Groups. This is LDAP Novell edirectory implementation.
Below are the details -
================
LDIF entry for OndotAPI group
dn: cn=OndotAPI,ou=Groups,o=CNS
changetype: add ... (0 Replies)
Hi Friends,
I have below scenarios .
dom1.test.com - LDAP
dom2.test.com - AD
Requirement is establish a trust relation between LDAP and AD server in such a way that if any user login on LDAP managed authentication server with
dom1\username -> get authenticated by LDAP host
... (2 Replies)
Hi All,
I have a existing Ldap query which take a HOME as variable and gives the result where i grep for a particular line.
ldapsearch -h server_domain_name -p 389 -D "uid=user,ou=appadm,o=ent" -w PaB -b "ou=roles,o=ent" "cidx=$HOME" | grep -w "ent: xyz"
Now i have 330K Homes in a... (1 Reply)
Hi all,
I'm not even sure a person can do this in perl, seems like you should be able to though.
Here's the error
IO::Socket::INET: connect: Operation now in progress at server_search.pl line 256, <DATA> line 466.
Here's the perl code...
sub ldap_new{
$nl = Net::LDAP->new( "$_" ) or... (3 Replies)
Hello again,
I have example config file with two arrays:
tab1="name1 surname1"
tab1="name2 surname2"
tab1="name3 surname3"
tab2="First"
tab2="Second"and csv file:
"aaaaa","surname1","name1","ddddd,eeeee","ffffff","ggggg","3","2012/02/22 12:25:21","2012/02/22... (7 Replies)
looking to replace parameters within a string with an external answer - with multiple replacements within a string %% will be used to wrap the objects to be replaced
i.e. hello %%title%% %%user%% from %%address%% you last %%action%% on %%object%%
the params will be used to make calls to a... (1 Reply)
Hi everyone,
I'm configuring Net-SNMP v5.4 on Solaris 10, sending traps to OpenNMS 1.2.9-0.20061212.0. I'm setting up disk monitoring (% of space free) for 5 directories. Here's what I'm working with:
(snmpd.conf - disk and monitoring portions)
#
# Disk Usage monitoring:
#
disk / 20%... (0 Replies)
I would like to do an ldap search which looks for entries which do not actually have a certain attribute. Not that the attribute is Null, but where the attribute does not exist.
Is this possible using ldapsearch? (3 Replies)
Hi all
I am new to perl-ldap. Trying to install DBD module on sun solaris which has the iplanet51 ldap already installed.
I have got the DBD-LDAP-0.03.tar file , and un packed it.
From the dir DBD-LDAP-0.03 - i tried to do
$ perl Makefile.PL and i got the... (10 Replies)