Fix list of shares, don't show duplicate files

This commit is contained in:
Jamie Cameron
2010-02-08 14:27:02 -08:00
parent 7102775ae8
commit 33dfbdc5ab
3 changed files with 15 additions and 2 deletions

View File

@@ -23,3 +23,4 @@ The 'Password never expires' flag can be set for user accounts, thanks to a patc
Allow the server description to be set to explicitly nothing.
---- Changes since 1.500 ----
Show the real Samba version number on the main page.
Fix list of users for a share to show open files correctly, and not show the same file multiple times on different shares.

View File

@@ -222,10 +222,15 @@ sub list_locks
{
local($l, $started, @rv);
local $out;
&execute_command("$config{samba_status_program} -L", undef, \$out, undef);
&execute_command("LANG=C $config{samba_status_program} -L", undef, \$out, undef);
foreach $l (split(/\n/, $out)) {
if ($l =~ /^----/) { $started = 1; }
if ($started && $l =~ /^(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)/) {
if ($started && $l =~ /^(\d+)\s+(\d+)\s+(\S+)\s+(0x\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S.*)\s\s((Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s.*)/i) {
# New-style line
push(@rv, [ $1, $3, $5, $6, $7.'/'.$8, $9 ]);
}
elsif ($started && $l =~ /^(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)/) {
# Old-style line
push(@rv, [ $1, $2, $3, $4, $5, $6 ]);
}
}

View File

@@ -61,12 +61,19 @@ if (@cons) {
if (!$in{'share'}) {
push(@cols, &html_escape($c->[0]));
}
$p = undef;
&get_share($c->[0]);
$p = &getval("path");
push(@cols, &html_escape($c->[1]));
push(@cols, &html_escape($c->[2]));
push(@cols, &html_escape($c->[4]));
push(@cols, &html_escape($c->[5]));
local $ulocks;
@ulocks = grep { $_->[0] == $c->[3] } @locks;
if ($p) {
# Limit to files under share
@ulocks = grep { $_->[4] =~ /^\Q$p\E\// } @ulocks;
}
foreach $l (@ulocks) {
$ulocks .= &html_escape($l->[4])." (".
&html_escape($l->[1]).")<br>\n";