diff options
author | Volker Lendecke <vl@samba.org> | 2010-02-07 12:08:39 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-02-07 12:29:25 +0100 |
commit | 6e510b49c03be9caba4f587f3f6cec547841b0d7 (patch) | |
tree | 2f8e6dda074a0e30e0fcb2dbb55ff11cdbf750e8 /source3 | |
parent | c73ffb728099e453110ffeb0e665811b9fcec34d (diff) | |
download | samba-6e510b49c03be9caba4f587f3f6cec547841b0d7.tar.gz samba-6e510b49c03be9caba4f587f3f6cec547841b0d7.tar.xz samba-6e510b49c03be9caba4f587f3f6cec547841b0d7.zip |
s3: Make cli_get_fs_volume_info() use cli_trans()
Diffstat (limited to 'source3')
-rw-r--r-- | source3/client/client.c | 7 | ||||
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/libsmb/clifsinfo.c | 59 |
3 files changed, 28 insertions, 41 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index f177129dc78..1ceb3ab6396 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -3376,9 +3376,12 @@ static int cmd_volume(void) fstring volname; uint32 serial_num; time_t create_date; + NTSTATUS status; - if (!cli_get_fs_volume_info(cli, volname, &serial_num, &create_date)) { - d_printf("Errr %s getting volume info\n",cli_errstr(cli)); + status = cli_get_fs_volume_info(cli, volname, &serial_num, + &create_date); + if (!NT_STATUS_IS_OK(status)) { + d_printf("Error %s getting volume info\n", nt_errstr(status)); return 1; } diff --git a/source3/include/proto.h b/source3/include/proto.h index 0660e77c732..0db536d7b90 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2708,7 +2708,8 @@ struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx, struct cli_state *cli); NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr); NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr); -bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate); +NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, + uint32 *pserial_number, time_t *pdate); bool cli_get_fs_full_size_info(struct cli_state *cli, uint64_t *total_allocation_units, uint64_t *caller_allocation_units, diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c index 08c0252eb83..b3c9d5f6e7f 100644 --- a/source3/libsmb/clifsinfo.c +++ b/source3/libsmb/clifsinfo.c @@ -348,48 +348,34 @@ fail: return status; } -bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate) +NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, + uint32 *pserial_number, time_t *pdate) { - bool ret = False; - uint16 setup; - char param[2]; - char *rparam=NULL, *rdata=NULL; - unsigned int rparam_count=0, rdata_count=0; + NTSTATUS status; + uint16 setup[1]; + uint8_t param[2]; + uint8_t *rdata; + uint32_t rdata_count; unsigned int nlen; - setup = TRANSACT2_QFSINFO; - + SSVAL(setup, 0, TRANSACT2_QFSINFO); SSVAL(param,0,SMB_QUERY_FS_VOLUME_INFO); - if (!cli_send_trans(cli, SMBtrans2, - NULL, - 0, 0, - &setup, 1, 0, - param, 2, 0, - NULL, 0, 560)) { - goto cleanup; - } - - if (!cli_receive_trans(cli, SMBtrans2, - &rparam, &rparam_count, - &rdata, &rdata_count)) { - goto cleanup; - } - - if (cli_is_error(cli)) { - ret = False; - goto cleanup; - } else { - ret = True; - } - - if (rdata_count < 19) { - goto cleanup; + status = cli_trans(talloc_tos(), cli, SMBtrans2, + NULL, 0, 0, 0, + setup, 1, 0, + param, 2, 0, + NULL, 0, 560, + NULL, 0, NULL, + NULL, 0, NULL, + &rdata, 10, &rdata_count); + if (!NT_STATUS_IS_OK(status)) { + return status; } if (pdate) { struct timespec ts; - ts = interpret_long_date(rdata); + ts = interpret_long_date((char *)rdata); *pdate = ts.tv_sec; } if (pserial_number) { @@ -403,11 +389,8 @@ bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 * * return the other stuff */ -cleanup: - SAFE_FREE(rparam); - SAFE_FREE(rdata); - - return ret; + TALLOC_FREE(rdata); + return NT_STATUS_OK; } bool cli_get_fs_full_size_info(struct cli_state *cli, |