From f522b71e5c4e8545151e558c9e2452844aa809ef Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Wed, 6 Jan 2010 11:18:00 -0800 Subject: [PATCH] Show real version on main page --- samba/CHANGELOG | 2 ++ samba/index.cgi | 7 ++++--- samba/samba-lib.pl | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/samba/CHANGELOG b/samba/CHANGELOG index 543c87628..81a64f2c6 100644 --- a/samba/CHANGELOG +++ b/samba/CHANGELOG @@ -21,3 +21,5 @@ Added fields to set the permissions and group ownership of new shared directorie ---- Changes since 1.430 ---- The 'Password never expires' flag can be set for user accounts, thanks to a patch from Juan Miguel Corral. Allow the server description to be set to explicitly nothing. +---- Changes since 1.500 ---- +Show the real Samba version number on the main page. diff --git a/samba/index.cgi b/samba/index.cgi index 9cd179a94..84ed68d23 100755 --- a/samba/index.cgi +++ b/samba/index.cgi @@ -21,7 +21,7 @@ if (!-x $config{'samba_server'}) { } # Check the samba version -if ($samba_version = &get_samba_version(\$out)) { +if ($samba_version = &get_samba_version(\$out, 0)) { # Save version number &open_tempfile(VERSION, ">$module_config_directory/version"); &print_tempfile(VERSION, $samba_version,"\n"); @@ -30,14 +30,15 @@ if ($samba_version = &get_samba_version(\$out)) { else { &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link("samba", "man", "doc", "google")); - print &text('error_version', $config{'samba_server'}, "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; + print &text('error_version', $config{'samba_server'}, + "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; print "

$out
\n"; &ui_print_footer("/", $text{'index'}); exit; } &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link("samba", "man", "doc", "google"), undef, undef, - &text('index_version', $samba_version)); + &text('index_version', &get_samba_version(\$out, 1))); @empty = &list_shares(); if (!@empty && (-r $config{alt_smb_conf})) { diff --git a/samba/samba-lib.pl b/samba/samba-lib.pl index 21840be07..99f2262c3 100755 --- a/samba/samba-lib.pl +++ b/samba/samba-lib.pl @@ -879,7 +879,8 @@ else { } } -# get_samba_version(&out) +# get_samba_version(&out, [keep-original-format]) +# Returns the Samba version sub get_samba_version { local $flag; @@ -888,7 +889,9 @@ foreach $flag ("-V", "-v") { if (${$_[0]} =~ /(Version|Samba)\s+(CVS\s+)?[^0-9 ]*(\d+)\.(\S+)/i) { local $v1 = $3; local $v2 = $4; - $v2 =~ s/[^0-9]//g; + if (!$_[1]) { + $v2 =~ s/[^0-9]//g; + } return "$v1.$v2"; } }