Closed Bug 441503 Opened 16 years ago Closed 16 years ago

Need update on contrib/syncLDAP.pl

Categories

(Bugzilla :: User Accounts, defect)

3.1.4
defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: himorin, Assigned: himorin)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch for syncLDAP.pl (obsolete) — Splinter Review
current contrib/syncLDAP.pl causes an error when we use uri schema on LDAPserver parameter. (It's ok with normal localhost:389 type, but fails on ldap://localhost:389)

I think it might be better to patch this script.
Attachment #326447 - Flags: review?(mkanat)
In contrib/syncLDAP, we have :

my $LDAPport = "389";  # default LDAP port
if($LDAPserver =~ /:/) {
    ($LDAPserver, $LDAPport) = split(":",$LDAPserver);
}

If you submit an URI, you get $LDAPserver which contains "ldap" and $LDAPport which contains "localhost:389" (or whatever your ldap server is set to in params).
Status: UNCONFIRMED → NEW
Ever confirmed: true
After reading the documentation for Net::LDAP, I'm not sure separating the LDAPserver param into host and port parts is necessary.

You can just pass $LDAPserver as host, "389" as port to Net::LDAP's new function and things work fine.
(In reply to comment #2)
> After reading the documentation for Net::LDAP, I'm not sure separating the
> LDAPserver param into host and port parts is necessary.

Sorry, i forgot about that. You're definitely true.
So, problem is not from uri scheme but the port number tweak in syncLDAP.pl code.
i'll update my patch.
update
Attachment #326447 - Attachment is obsolete: true
Attachment #326506 - Flags: review?
Attachment #326447 - Flags: review?(mkanat)
With the second version of the patch, anyone who uses just a hostname (ie. localhost) as $LDAPserver will not be able to connect.

Again, I'm pretty sure that you only need to remove these three lines from the syncLDAP script :

if($LDAPserver =~ /:/) {
    ($LDAPserver, $LDAPport) = split(":",$LDAPserver);
}

and everything should work fine.
(In reply to comment #5)
> Again, I'm pretty sure that you only need to remove these three lines from the
> syncLDAP script :

i've tried once, but failed with ldaps:// uri. removing port setting, it works.
# It seems against to the Net::LDAP documentation,,,
(In reply to comment #6)
>
> i've tried once, but failed with ldaps:// uri. removing port setting, it works.

This shouldn't happen. Net::LDAP contains this line of code :
  $host =~ s/^([^:]+|\[.*\]):(\d+)$/$1/ and $port = $2;

so it should be doing your job for you.
I'll see if I can test this today.
himorin, ask manu specifically for review so that he sees this patch in his review queue (or manu: feel free to set the review flag after testing).
Assignee: user-accounts → shimono
Attachment #326506 - Flags: review? → review?(eseyman)
i've tested @
$ perl -MNet::LDAP -e 'print Net::LDAP->VERSION'
0.34
Comment on attachment 326506 [details] [diff] [review]
patch v2 for syncLDAP.pl


>+if($LDAPserver =~ /\:\/\//) {

Nitpick: ':' isn't a special caracter in regexps and there's no need to escape it.
This could be fixed on checkin, I guess.
I've put this patch through the paces and it checks out fine.
r+ from me.
Attachment #326506 - Flags: review?(eseyman) → review+
Could you (either manu or himorin) request approval for affected branches?
Status: NEW → ASSIGNED
target code block of this exists on file version 1.1 (@cvs)
Flags: approval3.2?
Flags: approval3.0?
Flags: approval2.22?
Flags: approval2.20?
Flags: approval2.22?
Flags: approval2.20?
2.x are restricted to security fixes.
Flags: approval3.2?
Flags: approval3.2+
Flags: approval3.0?
Flags: approval3.0+
Flags: approval+
Target Milestone: --- → Bugzilla 3.0
3.0:

Checking in contrib/syncLDAP.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/syncLDAP.pl,v  <--  syncLDAP.pl
new revision: 1.9.2.2; previous revision: 1.9.2.1
done

3.2:

Checking in contrib/syncLDAP.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/syncLDAP.pl,v  <--  syncLDAP.pl
new revision: 1.12.2.1; previous revision: 1.12
done

tip:

Checking in contrib/syncLDAP.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/syncLDAP.pl,v  <--  syncLDAP.pl
new revision: 1.13; previous revision: 1.12
done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
And, of course, I forgot to correct the nitpick before committing.

3.0:

Checking in contrib/syncLDAP.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/syncLDAP.pl,v  <--  syncLDAP.pl
new revision: 1.9.2.3; previous revision: 1.9.2.2
done

3.2:

Checking in contrib/syncLDAP.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/syncLDAP.pl,v  <--  syncLDAP.pl
new revision: 1.12.2.2; previous revision: 1.12.2.1
done

tip:

Checking in contrib/syncLDAP.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/syncLDAP.pl,v  <--  syncLDAP.pl
new revision: 1.14; previous revision: 1.13
done
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: