From: Jim H. <ha...@us...> - 2002-04-12 14:43:15
|
Sorry, I typed in haste. Delete the ++ at the start of line 64 and chenge $entryct to %entryct in 66. Also, there is a typo on 68. It should be $entrydn, not $entrycdn. --Jim On Fri, 12 Apr 2002 CZa...@wi... wrote: > > I ran the script with the suggestion below and I get this error: > > <Can't modify preincrement in concatenation at ldap_dup.pl line 64, near > ");" > Type of arg 1 to keys must be hash (not scalar deref) at ldif_parse.pl line > 66, near "$entryct) "> > > > > Jim Harle > <harle@usna.ed To: CZa...@wi... > u> cc: per...@li... > Subject: Re: Checking for duplicate entries > 04/11/2002 > 05:33 PM > > > > > > > I assume that you consider a duplicate entry something with the same > first and last name? In the strict LDAP sense of things, there are no > duplicate entries returned from a given query. I think that what you want > to do is something like: > %seen = (); > $mesg = $ldap->search( > base => "o=base", > scope => "subtree", > filter => "sn=*", > attrs => ["givenname"] > ); > > foreach $entry ($mesg->entries) { > $given = get_value("givenname"); > $sn = get_value("sn"); > ++$entryct{"$sn, $givenname}; > ++$entrydn{"$sn, $givenname} .= ($entry->dn . "\n"); > } > foreach $nameset (keys $entryct) { > next unless $entryct{$nameset} > 1; > print "$entrycdn{$nameset}\n"; > } > > > On Thu, 11 Apr 2002 CZa...@wi... wrote: > > > > > I am try to detect any duplicate entries in my LDAP Service directory and > > print to STDOUT or, to a file. But, I first wanted to see if it would > pass > > back all duplicates. > > > > > > > > > > Jim Harle > > <harle@usna.ed To: CZa...@wi... > > u> cc: > per...@li... > > Subject: Re: Checking for > duplicate entries > > 04/11/2002 > > 05:03 PM > > > > > > > > > > > > > > Please be more precise about what you are trying to do. The code you > > included works fine if I use > > > > $var1 = 'John'; > > $var2 = 'Smith'; > > > > on my server, I get the 2 entries just fine. I would change > > unless $seen{$entry} > > to > > unless $seen{$entry->dn} > > but I don't think that will do anything in this case. > > > > Are you trying to find all sn/givenname combinationss where more than one > > match? > > > > --Jim > > > > On Thu, 11 Apr 2002 CZa...@wi... wrote: > > > > > Hello, can anyone help on this. I am trying to display duplicate > enties > > > that are in > > > the ldap service. > > > > > > %seen = (); > > > $mesg = $ldap->search( > > > base => "o=base", > > > scope => "subtree", > > > filter => "(&(givenname=$var1) (sn > > =$var2))" > > > ); > > > > > > foreach $entry ($mesg->entries) { > > > printf "%s \n", $entry->dn unless $seen{$entry}++ > > > } > > > > > > > > > > > > > > > > > > > > > > > > |