mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
cliquota: factor out fs quota parsing
This code will be reused by SMB2 code. Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
e0e500258a
commit
0ed8b49faf
@ -168,6 +168,39 @@ NTSTATUS parse_user_quota_list(const uint8_t *curdata,
|
||||
return status;
|
||||
}
|
||||
|
||||
NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
|
||||
unsigned int rdata_count,
|
||||
SMB_NTQUOTA_STRUCT *pqt)
|
||||
{
|
||||
SMB_NTQUOTA_STRUCT qt;
|
||||
|
||||
ZERO_STRUCT(qt);
|
||||
|
||||
if (rdata_count < 48) {
|
||||
/* minimum length is not enforced by SMB2 client.
|
||||
*/
|
||||
DEBUG(1, ("small returned fs quota buffer\n"));
|
||||
return NT_STATUS_INVALID_NETWORK_RESPONSE;
|
||||
}
|
||||
|
||||
/* unknown_1 24 NULL bytes in pdata*/
|
||||
|
||||
/* the soft quotas 8 bytes (uint64_t)*/
|
||||
qt.softlim = BVAL(rdata, 24);
|
||||
|
||||
/* the hard quotas 8 bytes (uint64_t)*/
|
||||
qt.hardlim = BVAL(rdata, 32);
|
||||
|
||||
/* quota_flags 2 bytes **/
|
||||
qt.qflags = SVAL(rdata, 40);
|
||||
|
||||
qt.qtype = SMB_USER_FS_QUOTA_TYPE;
|
||||
|
||||
*pqt = qt;
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
|
||||
SMB_NTQUOTA_STRUCT *pqt)
|
||||
{
|
||||
@ -376,11 +409,8 @@ NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
|
||||
uint8_t param[2];
|
||||
uint8_t *rdata=NULL;
|
||||
uint32_t rdata_count=0;
|
||||
SMB_NTQUOTA_STRUCT qt;
|
||||
NTSTATUS status;
|
||||
|
||||
ZERO_STRUCT(qt);
|
||||
|
||||
if (!cli||!pqt) {
|
||||
smb_panic("cli_get_fs_quota_info() called with NULL Pointer!");
|
||||
}
|
||||
@ -406,20 +436,7 @@ NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
|
||||
return status;
|
||||
}
|
||||
|
||||
/* unknown_1 24 NULL bytes in pdata*/
|
||||
|
||||
/* the soft quotas 8 bytes (uint64_t)*/
|
||||
qt.softlim = BVAL(rdata,24);
|
||||
|
||||
/* the hard quotas 8 bytes (uint64_t)*/
|
||||
qt.hardlim = BVAL(rdata,32);
|
||||
|
||||
/* quota_flags 2 bytes **/
|
||||
qt.qflags = SVAL(rdata,40);
|
||||
|
||||
qt.qtype = SMB_USER_FS_QUOTA_TYPE;
|
||||
|
||||
*pqt = qt;
|
||||
status = parse_fs_quota_buffer(rdata, rdata_count, pqt);
|
||||
|
||||
TALLOC_FREE(rdata);
|
||||
return status;
|
||||
|
@ -770,6 +770,9 @@ NTSTATUS parse_user_quota_list(const uint8_t *curdata,
|
||||
uint32_t curdata_size,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
SMB_NTQUOTA_LIST **pqt_list);
|
||||
NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
|
||||
unsigned int rdata_count,
|
||||
SMB_NTQUOTA_STRUCT *pqt);
|
||||
NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
|
||||
SMB_NTQUOTA_STRUCT *pqt);
|
||||
NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
|
||||
|
Loading…
Reference in New Issue
Block a user