samba/samba-3.0.23-smbldaptools-rootbinddn.patch

58 lines
1.8 KiB
Diff
Raw Permalink Normal View History

--- samba-3.0.23/examples/LDAP/smbldap-tools-0.9.2/smbldap_tools.pm 2006-01-03 11:57:41.000000000 +0100
+++ samba-3.0.23/examples/LDAP/smbldap-tools-0.9.2/smbldap_tools.pm.fix 2006-10-10 10:12:42.000000000 +0200
@@ -32,15 +32,15 @@
# ugly funcs using global variables and spawning openldap clients
my $smbldap_conf;
-if (-e "/etc/smbldap-tools/smbldap.conf") {
- $smbldap_conf="/etc/smbldap-tools/smbldap.conf";
+if (-e "/etc/samba/smbldap-tools/smbldap.conf") {
+ $smbldap_conf="/etc/samba/smbldap-tools/smbldap.conf";
} else {
$smbldap_conf="/etc/opt/IDEALX/smbldap-tools/smbldap.conf";
}
my $smbldap_bind_conf;
-if (-e "/etc/smbldap-tools/smbldap_bind.conf") {
- $smbldap_bind_conf="/etc/smbldap-tools/smbldap_bind.conf";
+if (-e "/etc/samba/smbldap-tools/smbldap_bind.conf") {
+ $smbldap_bind_conf="/etc/samba/smbldap-tools/smbldap_bind.conf";
} else {
$smbldap_bind_conf="/etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf";
}
@@ -51,6 +51,10 @@
$samba_conf="/usr/local/samba/lib/smb.conf";
}
+# system-wide LDAP configuration files
+my $ldap_conf="/etc/ldap.conf";
+my $ldap_secret="/etc/ldap.secret";
+
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use Exporter;
$VERSION = 1.00;
@@ -168,7 +172,22 @@
$conf{$parameter}=$value;
}
close (CONFIGFILE);
- } else {
+
+ if (open (CONFIGFILE, "$ldap_secret")) {
+ $conf{masterPw} = <CONFIGFILE>;
+ chomp($conf{masterPw});
+ close (CONFIGFILE);
+
+ open (CONFIGFILE, "$ldap_conf") || die "Unable to open $ldap_conf for reading !\n";
+ while (<CONFIGFILE>) {
+ chomp($_);
+ next if ( ! /^\s*rootbinddn\s*.*/ );
+ $_ =~ s/^\s*rootbinddn\s*(.*)$/$1/;
+ $conf{masterDN}=$_;
+ }
+ close (CONFIGFILE);
+ }
+ } else {
$conf{slaveDN}=$conf{slavePw}=$conf{masterDN}=$conf{masterPw}="";
}
# automatically find SID