Show real version on main page
authorJamie Cameron <jcameron@webmin.com>
Wed, 6 Jan 2010 19:18:00 +0000 (11:18 -0800)
committerJamie Cameron <jcameron@webmin.com>
Wed, 6 Jan 2010 19:18:00 +0000 (11:18 -0800)
samba/CHANGELOG
samba/index.cgi
samba/samba-lib.pl

index 543c876..81a64f2 100644 (file)
@@ -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.
index 9cd179a..84ed68d 100755 (executable)
@@ -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"),"<p>\n";
+       print &text('error_version', $config{'samba_server'},
+                   "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
        print "<pre>$out</pre>\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})) {
index 21840be..99f2262 100755 (executable)
@@ -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";
                }
        }