Perl and LDAP


 
Thread Tools Search this Thread
Top Forums Programming Perl and LDAP
Prev   Next
# 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?


Code:
#!/usr/bin/perl


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('ad.dneg.com') 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";
 };

Thanks
 
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 server_search.pl 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) http://ldapadministrator.com/resources/english/2011.1/images/sqlquery_large.png 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

ldap

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
Net::LDAP::Intermediate::SyncInfo(3)			User Contributed Perl Documentation		      Net::LDAP::Intermediate::SyncInfo(3)

NAME
Net::LDAP::Intermediate::SyncInfo - LDAPv3 Sync Info Message object SYNOPSIS
See Net::LDAP::Control::SyncRequest DESCRIPTION
"Net::LDAP::Intermediate::SyncInfo" provides an interface for the creation and manipulation of objects that represent the "Sync Info Message" as described by RFC 4533. CONSTRUCTOR ARGUMENTS
In addition to the constructor arguments described in Net::LDAP::Intermediate the following are provided. TODO METHODS
As with Net::LDAP::Intermediate each constructor argument described above is also available as a method on the object which will return the current value for the attribute if called without an argument, and set a new value for the attribute if called with an argument. SEE ALSO
Net::LDAP, Net::LDAP::Intermediate, Net::LDAP::Control, Net::LDAP::Control::SyncRequest, Net::LDAP::Control::SyncState, http://www.ietf.org/rfc/rfc4533.txt AUTHOR
Mathieu Parent <math.parent@gmail.com> Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org> COPYRIGHT
Copyright (c) 2008 Mathieu Parent. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-07-21 Net::LDAP::Intermediate::SyncInfo(3)