summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakTermServ
diff options
context:
space:
mode:
authorStew Benedict <stewb@mandriva.org>2004-02-11 01:07:31 +0000
committerStew Benedict <stewb@mandriva.org>2004-02-11 01:07:31 +0000
commit4cb368577f1d801d3aaa25be3aaf87a57625cf6c (patch)
tree86fe9bad5086b9dd38d72c0c024413a36fe59ddb /perl-install/standalone/drakTermServ
parentfcfdee020d19568c9b1b3fd2e55ab36d5b532596 (diff)
downloaddrakx-4cb368577f1d801d3aaa25be3aaf87a57625cf6c.tar
drakx-4cb368577f1d801d3aaa25be3aaf87a57625cf6c.tar.gz
drakx-4cb368577f1d801d3aaa25be3aaf87a57625cf6c.tar.bz2
drakx-4cb368577f1d801d3aaa25be3aaf87a57625cf6c.tar.xz
drakx-4cb368577f1d801d3aaa25be3aaf87a57625cf6c.zip
Disable title banner for now (Bugzilla 7564).
Don't assume eth0, rework subnet/netmask for hosts.allow (jmdault).
Diffstat (limited to 'perl-install/standalone/drakTermServ')
-rwxr-xr-xperl-install/standalone/drakTermServ35
1 files changed, 25 insertions, 10 deletions
diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ
index 863259a1e..712e33452 100755
--- a/perl-install/standalone/drakTermServ
+++ b/perl-install/standalone/drakTermServ
@@ -52,6 +52,7 @@ my $nfs_mask;
my $thin_clients = 0;
my $cfg_dir = "/etc/drakxtools/draktermserv/";
my $cfg_file = $cfg_dir . "draktermserv.conf";
+my $interface = get_net_interface();
my $server_ip = get_ip_from_sys();
my $changes_made = 0;
my $client_cfg = "/etc/dhcpd.conf.etherboot.clients";
@@ -229,7 +230,7 @@ sub interactive_mode() {
$window1 = ugtk2->new('drakTermServ');
$window1->{rwindow}->signal_connect(delete_event => sub { ugtk2->exit(0) });
- unless ($::isEmbedded) {
+ unless (0 == 0) {
$window1->{rwindow}->set_position('center');
$window1->{rwindow}->set_title(N("Terminal Server Configuration"));
my $pixbuf_icon = gtkcreate_pixbuf("ic82-network-40");
@@ -238,7 +239,7 @@ sub interactive_mode() {
$darea->modify_font(Gtk2::Pango::FontDescription->from_string('Sans Italic 24'));
my $layout = $darea->create_pango_layout(N("DrakTermServ"));
$darea->signal_connect(realize => sub {
- set_back_pixbuf($darea, gtkcreate_pixbuf('title-tile'))
+ set_back_pixbuf($darea, gtkcreate_pixbuf('title-tile'))
});
$darea->signal_connect(expose_event => sub {
my (undef, undef, $dx, $dy) = $darea->allocation->values;
@@ -1228,10 +1229,24 @@ sub dhcpd_config() {
$dhcpd_box->show_all;
}
+sub get_net_interface() {
+ my @interfaces = `/sbin/route | grep -v lo | tail +3 | awk '{print \$8}' | uniq`;
+ chop @interfaces;
+ my $count = @interfaces;
+ if ($count == 1) {
+ return @interfaces[0];
+ } else {
+ foreach (@interfaces) {
+ my $is_default = `/sbin/route | grep $_ | grep default`;
+ return $_ if !$is_default;
+ }
+ }
+}
+
sub get_mask_from_sys() {
my %netconfig;
- if (-e "/etc/sysconfig/network-scripts/ifcfg-eth0") {
- %netconfig = getVarsFromSh("/etc/sysconfig/network-scripts/ifcfg-eth0");
+ if (-e "/etc/sysconfig/network-scripts/ifcfg-$interface") {
+ %netconfig = getVarsFromSh("/etc/sysconfig/network-scripts/ifcfg-$interface");
$netconfig{NETMASK};
}
}
@@ -1254,14 +1269,14 @@ sub get_subnet_from_sys {
}
sub get_broadcast_from_sys() {
- my @ifconfig = grep { /inet/ } `/sbin/ifconfig eth0`;
+ my @ifconfig = grep { /inet/ } `/sbin/ifconfig $interface`;
my @ifvalues = split(/[: \t]+/, $ifconfig[0]);
$ifvalues[5];
}
sub get_ip_from_sys() {
- my @ifconfig = grep { /inet/ } `/sbin/ifconfig eth0`;
+ my @ifconfig = grep { /inet/ } `/sbin/ifconfig $interface`;
my @ifvalues = split(/[: \t]+/, $ifconfig[0]);
$ifvalues[3];
@@ -1691,9 +1706,9 @@ sub change_gdm_xdmcp {
sub update_hosts_allow {
my ($mode) = @_;
- my $ip = get_ip_from_sys();
- my @values = split(/\./, $ip);
- my $subnet = $values[0] . "." . $values[1] . "." . $values[2] . ".";
+ my $mask = get_mask_from_sys();
+ my $subnet = `/sbin/ip route list dev $interface scope link | cut -f1 -d"/"`;
+ chop $subnet;
my $i;
if ($mode eq "enable") {
my $has_all = `grep ALL /etc/hosts.allow`;
@@ -1703,7 +1718,7 @@ sub update_hosts_allow {
}
if (!$has_all) {
log::explanations("Modified file /etc/hosts.allow");
- append_to_file("/etc/hosts.allow", "ALL:\t$subnet\n");
+ append_to_file("/etc/hosts.allow", "ALL:\t$subnet/$mask 127.0.0.1\n");
}
$has_all = `grep ALL /etc/hosts.deny`;
if (!$has_all) {