line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# SMB Perl library, Copyright (C) 2014-2018 Mikhael Goikhman, migo@cpan.org |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify |
4
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
5
|
|
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or |
6
|
|
|
|
|
|
|
# (at your option) any later version. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
9
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11
|
|
|
|
|
|
|
# GNU General Public License for more details. |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
14
|
|
|
|
|
|
|
# along with this program. If not, see . |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
package SMB::v2::Command::QueryInfo; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
2010
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
19
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
4
|
use parent 'SMB::v2::Command'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use constant { |
24
|
1
|
|
|
|
|
1058
|
TYPE_FILE => 1, |
25
|
|
|
|
|
|
|
TYPE_FILESYSTEM => 2, |
26
|
|
|
|
|
|
|
TYPE_SECURITY => 3, |
27
|
|
|
|
|
|
|
TYPE_QUOTA => 4, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
FILE_LEVEL_DIRECTORY => 1, |
30
|
|
|
|
|
|
|
FILE_LEVEL_FULLDIRECTORY => 2, |
31
|
|
|
|
|
|
|
FILE_LEVEL_BOTHDIRECTORY => 3, |
32
|
|
|
|
|
|
|
FILE_LEVEL_BASIC => 4, |
33
|
|
|
|
|
|
|
FILE_LEVEL_STANDARD => 5, |
34
|
|
|
|
|
|
|
FILE_LEVEL_INTERNAL => 6, |
35
|
|
|
|
|
|
|
FILE_LEVEL_EA => 7, |
36
|
|
|
|
|
|
|
FILE_LEVEL_ACCESS => 8, |
37
|
|
|
|
|
|
|
FILE_LEVEL_NAMES => 12, |
38
|
|
|
|
|
|
|
FILE_LEVEL_POSITION => 14, |
39
|
|
|
|
|
|
|
FILE_LEVEL_FULLEA => 15, |
40
|
|
|
|
|
|
|
FILE_LEVEL_MODE => 16, |
41
|
|
|
|
|
|
|
FILE_LEVEL_ALIGNMENT => 17, |
42
|
|
|
|
|
|
|
FILE_LEVEL_ALL => 18, |
43
|
|
|
|
|
|
|
FILE_LEVEL_ALTERNATENAME => 21, |
44
|
|
|
|
|
|
|
FILE_LEVEL_STREAM => 22, |
45
|
|
|
|
|
|
|
FILE_LEVEL_PIPE => 23, |
46
|
|
|
|
|
|
|
FILE_LEVEL_PIPELOCAL => 24, |
47
|
|
|
|
|
|
|
FILE_LEVEL_PIPEREMOTE => 25, |
48
|
|
|
|
|
|
|
FILE_LEVEL_COMPRESSION => 28, |
49
|
|
|
|
|
|
|
FILE_LEVEL_QUOTA => 32, |
50
|
|
|
|
|
|
|
FILE_LEVEL_NETWORKOPEN => 34, |
51
|
|
|
|
|
|
|
FILE_LEVEL_ATTRIBUTETAG => 35, |
52
|
|
|
|
|
|
|
FILE_LEVEL_IDBOTHDIRECTORY => 37, |
53
|
|
|
|
|
|
|
FILE_LEVEL_IDFULLDIRECTORY => 38, |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
FS_LEVEL_VOLUMEINFORMATION => 1, |
56
|
|
|
|
|
|
|
FS_LEVEL_SIZEINFORMATION => 3, |
57
|
|
|
|
|
|
|
FS_LEVEL_DEVICEINFORMATION => 4, |
58
|
|
|
|
|
|
|
FS_LEVEL_ATTRIBUTEINFORMATION => 5, |
59
|
|
|
|
|
|
|
FS_LEVEL_CONTROLINFORMATION => 6, |
60
|
|
|
|
|
|
|
FS_LEVEL_FULLSIZEINFORMATION => 7, |
61
|
|
|
|
|
|
|
FS_LEVEL_OBJECTIDINFORMATION => 8, |
62
|
|
|
|
|
|
|
FS_LEVEL_SECTORSIZEINFORMATION => 11, |
63
|
1
|
|
|
1
|
|
98
|
}; |
|
1
|
|
|
|
|
1
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub init ($) { |
66
|
0
|
|
|
0
|
0
|
|
$_[0]->set( |
67
|
|
|
|
|
|
|
type => 0, |
68
|
|
|
|
|
|
|
level => 0, |
69
|
|
|
|
|
|
|
max_length => 65536, |
70
|
|
|
|
|
|
|
additional => 0, |
71
|
|
|
|
|
|
|
flags => 0, |
72
|
|
|
|
|
|
|
buffer => undef, |
73
|
|
|
|
|
|
|
fid => 0, |
74
|
|
|
|
|
|
|
openfile => undef, |
75
|
|
|
|
|
|
|
files => undef, |
76
|
|
|
|
|
|
|
) |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub parse ($$) { |
80
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
81
|
0
|
|
|
|
|
|
my $parser = shift; |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if ($self->is_response) { |
84
|
0
|
|
|
|
|
|
my $offset = $parser->uint16; |
85
|
0
|
|
|
|
|
|
my $length = $parser->uint32; |
86
|
0
|
|
|
|
|
|
$self->buffer($parser->bytes($length)); |
87
|
|
|
|
|
|
|
} else { |
88
|
0
|
|
|
|
|
|
$self->type($parser->uint8); |
89
|
0
|
|
|
|
|
|
$self->level($parser->uint8); |
90
|
0
|
|
|
|
|
|
$self->max_length($parser->uint32); |
91
|
0
|
|
|
|
|
|
my $offset = $parser->uint16; |
92
|
0
|
|
|
|
|
|
$parser->skip(2); # reserved |
93
|
0
|
|
|
|
|
|
my $length = $parser->uint32; |
94
|
0
|
|
|
|
|
|
$self->additional($parser->uint32); |
95
|
0
|
|
|
|
|
|
$self->flags($parser->uint32); |
96
|
0
|
|
|
|
|
|
$self->fid($parser->fid2); |
97
|
0
|
|
|
|
|
|
$self->buffer($parser->bytes($length)); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
return $self; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub pack ($$) { |
104
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
105
|
0
|
|
|
|
|
|
my $packer = shift; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $buffer = $self->buffer; |
108
|
|
|
|
|
|
|
|
109
|
0
|
0
|
|
|
|
|
if ($self->is_response) { |
110
|
0
|
0
|
0
|
|
|
|
$packer |
111
|
|
|
|
|
|
|
->uint16($packer->diff('smb-header') + 6) |
112
|
|
|
|
|
|
|
->uint32(defined $buffer ? length($buffer) : 0) |
113
|
|
|
|
|
|
|
->bytes($buffer // '') |
114
|
|
|
|
|
|
|
; |
115
|
|
|
|
|
|
|
} else { |
116
|
0
|
0
|
0
|
|
|
|
$packer |
|
|
|
0
|
|
|
|
|
117
|
|
|
|
|
|
|
->uint8($self->type) |
118
|
|
|
|
|
|
|
->uint8($self->level) |
119
|
|
|
|
|
|
|
->uint32($self->max_length) |
120
|
|
|
|
|
|
|
->uint16($packer->diff('smb-header') + 32) |
121
|
|
|
|
|
|
|
->uint16(0) # reserved |
122
|
|
|
|
|
|
|
->uint32(defined $buffer ? length($buffer) : 0) |
123
|
|
|
|
|
|
|
->uint32($self->additional) |
124
|
|
|
|
|
|
|
->uint32($self->flags) |
125
|
|
|
|
|
|
|
->fid2($self->fid || die "No fid set") |
126
|
|
|
|
|
|
|
->bytes($buffer // '') |
127
|
|
|
|
|
|
|
; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |