diff options
author | Uri Simchoni <uri@samba.org> | 2016-09-22 01:03:41 +0300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-10-04 02:00:23 +0200 |
commit | f596bbff3046a38aa9cd9ce77072ba3542dfc403 (patch) | |
tree | 6041cd27e2108ed1afffaba170b313a99c5152fe /source3/libsmb/cli_smb2_fnum.c | |
parent | d82f0e99b0d3e1685e35c377c2f6e8f138d8973f (diff) | |
download | samba-f596bbff3046a38aa9cd9ce77072ba3542dfc403.tar.gz |
cliquota: support setting file system quota via SMB2
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libsmb/cli_smb2_fnum.c')
-rw-r--r-- | source3/libsmb/cli_smb2_fnum.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index 9ee4daed13d..cf00f60ae99 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -2608,6 +2608,50 @@ cleanup: return status; } +NTSTATUS cli_smb2_set_fs_quota_info(struct cli_state *cli, + int quota_fnum, + SMB_NTQUOTA_STRUCT *pqt) +{ + NTSTATUS status; + DATA_BLOB inbuf = data_blob_null; + struct smb2_hnd *ph = NULL; + TALLOC_CTX *frame = talloc_stackframe(); + + if (smbXcli_conn_has_async_calls(cli->conn)) { + /* + * Can't use sync call while an async call is in flight + */ + status = NT_STATUS_INVALID_PARAMETER; + goto cleanup; + } + + if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_SMB2_02) { + status = NT_STATUS_INVALID_PARAMETER; + goto cleanup; + } + + status = map_fnum_to_smb2_handle(cli, quota_fnum, &ph); + if (!NT_STATUS_IS_OK(status)) { + goto cleanup; + } + + status = build_fs_quota_buffer(talloc_tos(), pqt, &inbuf, 0); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + status = smb2cli_set_info( + cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tcon, + 2, /* in_info_type */ + SMB_FS_QUOTA_INFORMATION - 1000, /* in_file_info_class */ + &inbuf, /* in_input_buffer */ + 0, /* in_additional_info */ + ph->fid_persistent, ph->fid_volatile); +cleanup: + TALLOC_FREE(frame); + return status; +} + struct cli_smb2_read_state { struct tevent_context *ev; struct cli_state *cli; |