2 Unix SMB/CIFS implementation.
4 Copyright (C) Stefan (metze) Metzmacher 2003
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 /****************************************************************************
23 Get UNIX extensions version info.
24 ****************************************************************************/
26 bool cli_unix_extensions_version(struct cli_state
*cli
, uint16
*pmajor
, uint16
*pminor
,
27 uint32
*pcaplow
, uint32
*pcaphigh
)
32 char *rparam
=NULL
, *rdata
=NULL
;
33 unsigned int rparam_count
=0, rdata_count
=0;
35 setup
= TRANSACT2_QFSINFO
;
37 SSVAL(param
,0,SMB_QUERY_CIFS_UNIX_INFO
);
39 if (!cli_send_trans(cli
, SMBtrans2
,
48 if (!cli_receive_trans(cli
, SMBtrans2
,
49 &rparam
, &rparam_count
,
50 &rdata
, &rdata_count
)) {
54 if (cli_is_error(cli
)) {
61 if (rdata_count
< 12) {
65 *pmajor
= SVAL(rdata
,0);
66 *pminor
= SVAL(rdata
,2);
67 cli
->posix_capabilities
= *pcaplow
= IVAL(rdata
,4);
68 *pcaphigh
= IVAL(rdata
,8);
70 /* todo: but not yet needed
71 * return the other stuff
81 /****************************************************************************
82 Set UNIX extensions capabilities.
83 ****************************************************************************/
85 bool cli_set_unix_extensions_capabilities(struct cli_state
*cli
, uint16 major
, uint16 minor
,
86 uint32 caplow
, uint32 caphigh
)
92 char *rparam
=NULL
, *rdata
=NULL
;
93 unsigned int rparam_count
=0, rdata_count
=0;
95 setup
= TRANSACT2_SETFSINFO
;
98 SSVAL(param
,2,SMB_SET_CIFS_UNIX_INFO
);
102 SIVAL(data
,4,caplow
);
103 SIVAL(data
,8,caphigh
);
105 if (!cli_send_trans(cli
, SMBtrans2
,
114 if (!cli_receive_trans(cli
, SMBtrans2
,
115 &rparam
, &rparam_count
,
116 &rdata
, &rdata_count
)) {
120 if (cli_is_error(cli
)) {
134 bool cli_get_fs_attr_info(struct cli_state
*cli
, uint32
*fs_attr
)
139 char *rparam
=NULL
, *rdata
=NULL
;
140 unsigned int rparam_count
=0, rdata_count
=0;
143 smb_panic("cli_get_fs_attr_info() called with NULL Pionter!");
145 setup
= TRANSACT2_QFSINFO
;
147 SSVAL(param
,0,SMB_QUERY_FS_ATTRIBUTE_INFO
);
149 if (!cli_send_trans(cli
, SMBtrans2
,
158 if (!cli_receive_trans(cli
, SMBtrans2
,
159 &rparam
, &rparam_count
,
160 &rdata
, &rdata_count
)) {
164 if (cli_is_error(cli
)) {
171 if (rdata_count
< 12) {
175 *fs_attr
= IVAL(rdata
,0);
177 /* todo: but not yet needed
178 * return the other stuff
188 bool cli_get_fs_volume_info_old(struct cli_state
*cli
, fstring volume_name
, uint32
*pserial_number
)
193 char *rparam
=NULL
, *rdata
=NULL
;
194 unsigned int rparam_count
=0, rdata_count
=0;
197 setup
= TRANSACT2_QFSINFO
;
199 SSVAL(param
,0,SMB_INFO_VOLUME
);
201 if (!cli_send_trans(cli
, SMBtrans2
,
210 if (!cli_receive_trans(cli
, SMBtrans2
,
211 &rparam
, &rparam_count
,
212 &rdata
, &rdata_count
)) {
216 if (cli_is_error(cli
)) {
223 if (rdata_count
< 5) {
227 if (pserial_number
) {
228 *pserial_number
= IVAL(rdata
,0);
230 nlen
= CVAL(rdata
,l2_vol_cch
);
231 clistr_pull(cli
, volume_name
, rdata
+ l2_vol_szVolLabel
, sizeof(fstring
), nlen
, STR_NOALIGN
);
233 /* todo: but not yet needed
234 * return the other stuff
244 bool cli_get_fs_volume_info(struct cli_state
*cli
, fstring volume_name
, uint32
*pserial_number
, time_t *pdate
)
249 char *rparam
=NULL
, *rdata
=NULL
;
250 unsigned int rparam_count
=0, rdata_count
=0;
253 setup
= TRANSACT2_QFSINFO
;
255 SSVAL(param
,0,SMB_QUERY_FS_VOLUME_INFO
);
257 if (!cli_send_trans(cli
, SMBtrans2
,
266 if (!cli_receive_trans(cli
, SMBtrans2
,
267 &rparam
, &rparam_count
,
268 &rdata
, &rdata_count
)) {
272 if (cli_is_error(cli
)) {
279 if (rdata_count
< 19) {
285 ts
= interpret_long_date(rdata
);
288 if (pserial_number
) {
289 *pserial_number
= IVAL(rdata
,8);
291 nlen
= IVAL(rdata
,12);
292 clistr_pull(cli
, volume_name
, rdata
+ 18, sizeof(fstring
), nlen
, STR_UNICODE
);
294 /* todo: but not yet needed
295 * return the other stuff