diff options
author | Uri Simchoni <uri@samba.org> | 2016-09-21 19:35:39 +0300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-10-04 02:00:23 +0200 |
commit | fba19ad9dc6b776d068344f592aa0e06c0747d7d (patch) | |
tree | 41ca4de800da1cab716b4b4f2f1141ea692c20bc /source3/libsmb/cli_smb2_fnum.c | |
parent | 5e9b1f77add716168283b3557d0ddc0cf175b6d7 (diff) | |
download | samba-fba19ad9dc6b776d068344f592aa0e06c0747d7d.tar.gz |
cliquota: support setting user 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 | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index 1be93812df9..9ee4daed13d 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -2559,6 +2559,55 @@ cleanup: return status; } +/*************************************************************** + Wrapper that allows SMB2 to set user quota. + Synchronous only. +***************************************************************/ + +NTSTATUS cli_smb2_set_user_quota(struct cli_state *cli, + int quota_fnum, + SMB_NTQUOTA_LIST *qtl) +{ + 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_user_quota_buffer(qtl, 0, talloc_tos(), &inbuf, NULL); + if (!NT_STATUS_IS_OK(status)) { + goto cleanup; + } + + status = smb2cli_set_info(cli->conn, cli->timeout, cli->smb2.session, + cli->smb2.tcon, 4, /* in_info_type */ + 0, /* 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; |