[debian-edu-commits] r82070 - in branches/wheezy/debian-edu-config: bin debian
pere at alioth.debian.org
pere at alioth.debian.org
Sat Aug 17 05:34:36 UTC 2013
Author: pere
Date: 2013-08-17 05:34:36 +0000 (Sat, 17 Aug 2013)
New Revision: 82070
Modified:
branches/wheezy/debian-edu-config/bin/debian-edu-ldapserver
branches/wheezy/debian-edu-config/debian/changelog
Log:
Make debian-edu-ldapserver more robust, and make sure it fall back
to looking in /etc/resolv.conf if dnsdomainname do not return a
sensible value.
Modified: branches/wheezy/debian-edu-config/bin/debian-edu-ldapserver
===================================================================
--- branches/wheezy/debian-edu-config/bin/debian-edu-ldapserver 2013-08-17 04:47:53 UTC (rev 82069)
+++ branches/wheezy/debian-edu-config/bin/debian-edu-ldapserver 2013-08-17 05:34:36 UTC (rev 82070)
@@ -55,9 +55,15 @@
my $hostname = `hostname`;
chomp $hostname;
if ("localhost" ne $hostname) {
- $dnsdomain = `dnsdomainname`;
+ $dnsdomain = `LC_ALL=C dnsdomainname 2>/dev/null`;
chomp $dnsdomain;
+ if ("" eq $dnsdomain) {
+ # Fall back to fetching from /etc/resolv.conf
+ $dnsdomain = dns_resolv_domain();
+ print STDERR "warning: no DNS name from dnsdomainname call. using $dnsdomain from /etc/resolv.conf.\n" if $opts{d};
+ }
$ldapserver = $opts{s} || find_ldap_server($dnsdomain);
+ print STDERR "info: found ldap server $ldapserver\n" if $opts{d};
$krbserver = find_kerberos_server($dnsdomain);
}
}
@@ -111,6 +117,18 @@
exit 0;
+sub dns_resolv_domain {
+ my $retval;
+ if (open(my $fh, "<", "/etc/resolv.conf")) {
+ while (<$fh>) {
+ chomp;
+ $retval = $1 if (m/search\s+(\S+)/);
+ }
+ close $fh;
+ }
+ return $retval;
+}
+
sub on_main_server {
my $retval = 0;
if (open(my $fh, "<", "/etc/debian-edu/config")) {
Modified: branches/wheezy/debian-edu-config/debian/changelog
===================================================================
--- branches/wheezy/debian-edu-config/debian/changelog 2013-08-17 04:47:53 UTC (rev 82069)
+++ branches/wheezy/debian-edu-config/debian/changelog 2013-08-17 05:34:36 UTC (rev 82070)
@@ -1,3 +1,12 @@
+debian-edu-config (1.712~svn82057) UNRELEASED; urgency=low
+
+ [ Petter Reinholdtsen ]
+ * Make debian-edu-ldapserver more robust, and make sure it fall back
+ to looking in /etc/resolv.conf if dnsdomainname do not return a
+ sensible value.
+
+ -- Petter Reinholdtsen <pere at debian.org> Sat, 17 Aug 2013 07:34:16 +0200
+
debian-edu-config (1.712~svn82056) wheezy-test; urgency=low
[ Mike Gabriel ]
More information about the debian-edu-commits
mailing list