Perl and LDAP

Thread Tools Search this Thread
Top Forums Programming Perl and LDAP
# 1  
Old 11-06-2013
Perl and LDAP

Hi Perl Guys

I am in need of your knowledge as i am a complete newbie and perl

I need to do pull all the groups from LDAP , and then look at the GID's and if they are not set check for the next available ( i,e increment ) and apply it

I have done this so far that prints out all the gorups and their Gud
but i am unsure of what to do next?


use strict;
use warnings;
use Data::Dumper;
use Net::LDAP;
use DBI;

# get list of job groups from AD, create array @ldapgroups
my $ldap = Net::LDAP->new('') or die "$@";
my $mesg = $ldap->bind;
my $result = $ldap->search( base => "ou=Groups,dc=ad,dc=spa,dc=com", 
	                           filter => "cn=*",
                               attr  => ['DisplayName,gidNumber']);

my @entries = $result->entries;

my $previous_gid = -1;

my $entr;
foreach $entr ( @entries ) {
print "DN: ", $entr->dn, "\n";
my $attr;
  foreach (qw/ name gidNumber / ) {
     print "  $_ : ", $entr->get_value ( $_ ) ,"\n";
  print "#-------------------------------\n";

# 2  
Old 11-07-2013
Run it through sort -r = reverse and line to get the max ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

PERL: In a perl-scripttTrying to execute another perl-script that SETS SOME VARIABLES !

I have reviewed many examples on-line about running another process (either PERL or shell command or a program), but do not find any usefull for my needs way. (Reviewed and not useful the system(), 'back ticks', exec() and open()) I would like to run another PERL-script from first one, not... (1 Reply)
Discussion started by: alex_5161
1 Replies

2. Solaris

LDAP Client not connecting to LDAP server

I have very limited knowledge on LDAP configuration and have been trying fix one issue, but unsuccessful. The server, I am working on, is Solaris-10 zone. sudoers is configured on LDAP (its not on local server). I have access to login directly on server with root, but somehow sudo is not working... (9 Replies)
Discussion started by: solaris_1977
9 Replies

3. Shell Programming and Scripting

perl - return an object from subroutine - Net::LDAP

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 line 256, <DATA> line 466. Here's the perl code... sub ldap_new{ $nl = Net::LDAP->new( "$_" ) or... (3 Replies)
Discussion started by: jtollefson
3 Replies

4. UNIX for Advanced & Expert Users

something like LDAP Administrator 2011.1 "LDAP-SQL" but for the CLI

Hi I am searching a tool like "LDAP Administrator 2011.1"/ "LDAP-SQL" but for the CLI. Wish to use LDAP-SQL in scripts (non Windows GUI environment) Softerra LDAP Administrator 2011.1 - What's New OS is... (2 Replies)
Discussion started by: slashdotweenie
2 Replies

5. OS X (Apple)

Apple Perl and LDAP

We have come across some strange and rather annoying behaviour of Apple's implementation of Perl and LDAP. I am part of a small scientific software company that provides specialist software for life sciences. Our internal network is driven by linux servers, but we also have a number of intel... (1 Reply)
Discussion started by: superstructure
1 Replies

6. Shell Programming and Scripting

Perl and Net::LDAP, objects and arrays query

Hi 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... (3 Replies)
Discussion started by: mikie
3 Replies

7. Solaris

help with LDAP

Hi, i'm trying to import LDAP database to a new system and i need help with that. I've got a LDAP schema and a ldif file with all data, so how should i proceed with creating new schema and how to import data. tnx in advance :) (5 Replies)
Discussion started by: n00b
5 Replies

8. UNIX for Dummies Questions & Answers

LDAP help

Folks; I need to install/configure LDAP on Solaris 10 Help please (0 Replies)
Discussion started by: Katkota
0 Replies

9. Solaris

New to Perl-LDAP

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)
Discussion started by: kaushi
10 Replies

10. UNIX for Advanced & Expert Users


I have just installed openldap on solaris 8 machine and would like to configure ldap to store users username and password, so that users can get authenticate by ldap. How do I configure ldap to store username and password. Any suggestion would be appreciated Thanks in Advance (1 Reply)
Discussion started by: hassan2
1 Replies
Login or Register to Ask a Question