2003-04-12 03:32:00 +04:00
/*
Unix SMB / CIFS implementation .
client quota functions
Copyright ( C ) Stefan ( metze ) Metzmacher 2003
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-09 23:25:36 +04:00
the Free Software Foundation ; either version 3 of the License , or
2003-04-12 03:32:00 +04:00
( at your option ) any later version .
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
You should have received a copy of the GNU General Public License
2007-07-10 04:52:41 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2003-04-12 03:32:00 +04:00
*/
# include "includes.h"
2011-05-06 13:47:43 +04:00
# include "libsmb/libsmb.h"
2010-05-28 04:19:32 +04:00
# include "../librpc/gen_ndr/ndr_security.h"
2010-08-18 18:44:47 +04:00
# include "fake_file.h"
2010-10-12 08:27:50 +04:00
# include "../libcli/security/security.h"
2011-02-25 02:03:01 +03:00
# include "trans2.h"
2003-04-12 03:32:00 +04:00
2009-05-01 02:26:43 +04:00
NTSTATUS cli_get_quota_handle ( struct cli_state * cli , uint16_t * quota_fnum )
2003-04-12 03:32:00 +04:00
{
2009-05-01 02:26:43 +04:00
return cli_ntcreate ( cli , FAKE_FILE_NAME_QUOTA_WIN32 ,
2003-04-12 03:32:00 +04:00
0x00000016 , DESIRED_ACCESS_PIPE ,
0x00000000 , FILE_SHARE_READ | FILE_SHARE_WRITE ,
2009-05-01 02:26:43 +04:00
FILE_OPEN , 0x00000000 , 0x03 , quota_fnum ) ;
2003-04-12 03:32:00 +04:00
}
void free_ntquota_list ( SMB_NTQUOTA_LIST * * qt_list )
{
if ( ! qt_list )
return ;
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
if ( ( * qt_list ) - > mem_ctx )
talloc_destroy ( ( * qt_list ) - > mem_ctx ) ;
( * qt_list ) = NULL ;
return ;
}
2011-01-16 10:34:58 +03:00
static bool parse_user_quota_record ( const uint8_t * rdata ,
unsigned int rdata_count ,
unsigned int * offset ,
SMB_NTQUOTA_STRUCT * pqt )
2003-04-12 03:32:00 +04:00
{
int sid_len ;
SMB_NTQUOTA_STRUCT qt ;
ZERO_STRUCT ( qt ) ;
2007-06-16 01:58:49 +04:00
if ( ! rdata | | ! offset | | ! pqt ) {
smb_panic ( " parse_quota_record: called with NULL POINTER! " ) ;
}
2003-04-12 03:32:00 +04:00
if ( rdata_count < 40 ) {
return False ;
}
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
/* offset to next quota record.
* 4 bytes IVAL ( rdata , 0 )
* unused here . . .
*/
* offset = IVAL ( rdata , 0 ) ;
/* sid len */
sid_len = IVAL ( rdata , 4 ) ;
if ( rdata_count < 40 + sid_len ) {
return False ;
}
/* unknown 8 bytes in pdata
* maybe its the change time in NTTIME
*/
2008-10-14 03:59:36 +04:00
/* the used space 8 bytes (uint64_t)*/
2011-04-23 12:22:32 +04:00
qt . usedspace = BVAL ( rdata , 16 ) ;
2003-04-12 03:32:00 +04:00
2008-10-14 03:59:36 +04:00
/* the soft quotas 8 bytes (uint64_t)*/
2011-04-23 12:22:32 +04:00
qt . softlim = BVAL ( rdata , 24 ) ;
2003-04-12 03:32:00 +04:00
2008-10-14 03:59:36 +04:00
/* the hard quotas 8 bytes (uint64_t)*/
2011-04-23 12:22:32 +04:00
qt . hardlim = BVAL ( rdata , 32 ) ;
2008-10-05 18:14:27 +04:00
2011-05-06 00:42:05 +04:00
if ( ! sid_parse ( ( const char * ) rdata + 40 , sid_len , & qt . sid ) ) {
2010-09-16 02:40:15 +04:00
return false ;
}
2003-04-12 03:32:00 +04:00
qt . qtype = SMB_USER_QUOTA_TYPE ;
* pqt = qt ;
return True ;
}
2011-01-16 10:34:58 +03:00
NTSTATUS cli_get_user_quota ( struct cli_state * cli , int quota_fnum ,
SMB_NTQUOTA_STRUCT * pqt )
2003-04-12 03:32:00 +04:00
{
2011-01-16 10:34:58 +03:00
uint16_t setup [ 1 ] ;
uint8_t params [ 16 ] ;
2003-04-12 03:32:00 +04:00
unsigned int data_len ;
2011-01-16 10:34:58 +03:00
uint8_t data [ SID_MAX_SIZE + 8 ] ;
uint8_t * rparam , * rdata ;
uint32_t rparam_count , rdata_count ;
2003-04-12 03:32:00 +04:00
unsigned int sid_len ;
unsigned int offset ;
2011-01-16 10:34:58 +03:00
NTSTATUS status ;
2003-04-12 03:32:00 +04:00
2007-06-16 01:58:49 +04:00
if ( ! cli | | ! pqt ) {
2003-04-12 03:32:00 +04:00
smb_panic ( " cli_get_user_quota() called with NULL Pointer! " ) ;
2007-06-16 01:58:49 +04:00
}
2003-04-12 03:32:00 +04:00
2011-01-16 10:34:58 +03:00
SSVAL ( setup + 0 , 0 , NT_TRANSACT_GET_USER_QUOTA ) ;
2003-04-12 03:32:00 +04:00
SSVAL ( params , 0 , quota_fnum ) ;
SSVAL ( params , 2 , TRANSACT_GET_USER_QUOTA_FOR_SID ) ;
SIVAL ( params , 4 , 0x00000024 ) ;
SIVAL ( params , 8 , 0x00000000 ) ;
SIVAL ( params , 12 , 0x00000024 ) ;
2008-10-05 18:14:27 +04:00
2010-05-10 02:42:06 +04:00
sid_len = ndr_size_dom_sid ( & pqt - > sid , 0 ) ;
2003-04-12 03:32:00 +04:00
data_len = sid_len + 8 ;
SIVAL ( data , 0 , 0x00000000 ) ;
SIVAL ( data , 4 , sid_len ) ;
2011-01-16 10:34:58 +03:00
sid_linearize ( ( char * ) data + 8 , sid_len , & pqt - > sid ) ;
status = cli_trans ( talloc_tos ( ) , cli , SMBnttrans ,
NULL , - 1 , /* name, fid */
NT_TRANSACT_GET_USER_QUOTA , 0 ,
setup , 1 , 0 , /* setup */
params , 16 , 4 , /* params */
data , data_len , 112 , /* data */
NULL , /* recv_flags2 */
NULL , 0 , NULL , /* rsetup */
& rparam , 4 , & rparam_count ,
& rdata , 8 , & rdata_count ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 1 , ( " NT_TRANSACT_GET_USER_QUOTA failed: %s \n " ,
nt_errstr ( status ) ) ) ;
return status ;
2003-04-12 03:32:00 +04:00
}
2011-01-16 10:34:58 +03:00
if ( ! parse_user_quota_record ( rdata , rdata_count , & offset , pqt ) ) {
status = NT_STATUS_INVALID_NETWORK_RESPONSE ;
2003-04-12 03:32:00 +04:00
DEBUG ( 0 , ( " Got INVALID NT_TRANSACT_GET_USER_QUOTA reply. \n " ) ) ;
}
2011-01-16 10:34:58 +03:00
TALLOC_FREE ( rparam ) ;
TALLOC_FREE ( rdata ) ;
return status ;
2003-04-12 03:32:00 +04:00
}
2011-01-16 13:33:35 +03:00
NTSTATUS cli_set_user_quota ( struct cli_state * cli , int quota_fnum ,
SMB_NTQUOTA_STRUCT * pqt )
2003-04-12 03:32:00 +04:00
{
2011-01-16 13:33:35 +03:00
uint16_t setup [ 1 ] ;
uint8_t params [ 2 ] ;
uint8_t data [ 112 ] ;
2003-04-12 03:32:00 +04:00
unsigned int sid_len ;
2011-01-16 13:33:35 +03:00
NTSTATUS status ;
2003-04-12 03:32:00 +04:00
memset ( data , ' \0 ' , 112 ) ;
2008-10-05 18:14:27 +04:00
2007-06-16 01:58:49 +04:00
if ( ! cli | | ! pqt ) {
2003-04-12 03:32:00 +04:00
smb_panic ( " cli_set_user_quota() called with NULL Pointer! " ) ;
2007-06-16 01:58:49 +04:00
}
2003-04-12 03:32:00 +04:00
2011-01-16 13:33:35 +03:00
SSVAL ( setup + 0 , 0 , NT_TRANSACT_SET_USER_QUOTA ) ;
2003-04-12 03:32:00 +04:00
SSVAL ( params , 0 , quota_fnum ) ;
2010-05-10 02:42:06 +04:00
sid_len = ndr_size_dom_sid ( & pqt - > sid , 0 ) ;
2003-04-12 03:32:00 +04:00
SIVAL ( data , 0 , 0 ) ;
SIVAL ( data , 4 , sid_len ) ;
2008-10-14 03:59:36 +04:00
SBIG_UINT ( data , 8 , ( uint64_t ) 0 ) ;
2003-04-12 03:32:00 +04:00
SBIG_UINT ( data , 16 , pqt - > usedspace ) ;
SBIG_UINT ( data , 24 , pqt - > softlim ) ;
SBIG_UINT ( data , 32 , pqt - > hardlim ) ;
2011-01-16 13:33:35 +03:00
sid_linearize ( ( char * ) data + 40 , sid_len , & pqt - > sid ) ;
2003-04-12 03:32:00 +04:00
2011-01-16 13:33:35 +03:00
status = cli_trans ( talloc_tos ( ) , cli , SMBnttrans ,
NULL , - 1 , /* name, fid */
NT_TRANSACT_SET_USER_QUOTA , 0 ,
setup , 1 , 0 , /* setup */
params , 2 , 0 , /* params */
data , 112 , 0 , /* data */
NULL , /* recv_flags2 */
NULL , 0 , NULL , /* rsetup */
NULL , 0 , NULL , /* rparams */
NULL , 0 , NULL ) ; /* rdata */
2003-04-12 03:32:00 +04:00
2011-01-16 13:33:35 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 1 , ( " NT_TRANSACT_SET_USER_QUOTA failed: %s \n " ,
nt_errstr ( status ) ) ) ;
2003-04-12 03:32:00 +04:00
}
2011-01-16 13:33:35 +03:00
return status ;
2003-04-12 03:32:00 +04:00
}
2011-01-16 13:53:03 +03:00
NTSTATUS cli_list_user_quota ( struct cli_state * cli , int quota_fnum ,
SMB_NTQUOTA_LIST * * pqt_list )
2003-04-12 03:32:00 +04:00
{
2011-01-16 13:53:03 +03:00
uint16_t setup [ 1 ] ;
uint8_t params [ 16 ] ;
uint8_t * rparam = NULL , * rdata = NULL ;
uint32_t rparam_count = 0 , rdata_count = 0 ;
2003-04-12 03:32:00 +04:00
unsigned int offset ;
2011-01-16 13:53:03 +03:00
const uint8_t * curdata = NULL ;
2003-04-12 03:32:00 +04:00
unsigned int curdata_count = 0 ;
TALLOC_CTX * mem_ctx = NULL ;
SMB_NTQUOTA_STRUCT qt ;
SMB_NTQUOTA_LIST * tmp_list_ent ;
2011-01-16 13:53:03 +03:00
NTSTATUS status ;
2003-04-12 03:32:00 +04:00
2007-06-16 01:58:49 +04:00
if ( ! cli | | ! pqt_list ) {
2003-04-12 03:32:00 +04:00
smb_panic ( " cli_list_user_quota() called with NULL Pointer! " ) ;
2007-06-16 01:58:49 +04:00
}
2003-04-12 03:32:00 +04:00
2011-01-16 13:53:03 +03:00
SSVAL ( setup + 0 , 0 , NT_TRANSACT_GET_USER_QUOTA ) ;
2003-04-12 03:32:00 +04:00
SSVAL ( params , 0 , quota_fnum ) ;
SSVAL ( params , 2 , TRANSACT_GET_USER_QUOTA_LIST_START ) ;
SIVAL ( params , 4 , 0x00000000 ) ;
SIVAL ( params , 8 , 0x00000000 ) ;
SIVAL ( params , 12 , 0x00000000 ) ;
2008-10-05 18:14:27 +04:00
2011-01-16 13:53:03 +03:00
status = cli_trans ( talloc_tos ( ) , cli , SMBnttrans ,
NULL , - 1 , /* name, fid */
NT_TRANSACT_GET_USER_QUOTA , 0 ,
setup , 1 , 0 , /* setup */
params , 16 , 4 , /* params */
NULL , 0 , 2048 , /* data */
NULL , /* recv_flags2 */
NULL , 0 , NULL , /* rsetup */
& rparam , 0 , & rparam_count ,
& rdata , 0 , & rdata_count ) ;
2003-04-12 03:32:00 +04:00
2011-01-16 13:53:03 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 1 , ( " NT_TRANSACT_GET_USER_QUOTA failed: %s \n " ,
nt_errstr ( status ) ) ) ;
2003-04-12 03:32:00 +04:00
goto cleanup ;
}
if ( rdata_count = = 0 ) {
* pqt_list = NULL ;
2011-01-16 13:53:03 +03:00
return NT_STATUS_OK ;
2003-04-12 03:32:00 +04:00
}
if ( ( mem_ctx = talloc_init ( " SMB_USER_QUOTA_LIST " ) ) = = NULL ) {
DEBUG ( 0 , ( " talloc_init() failed \n " ) ) ;
2011-01-16 13:53:03 +03:00
return NT_STATUS_NO_MEMORY ;
2003-04-12 03:32:00 +04:00
}
offset = 1 ;
for ( curdata = rdata , curdata_count = rdata_count ;
( ( curdata ) & & ( curdata_count > = 8 ) & & ( offset > 0 ) ) ;
curdata + = offset , curdata_count - = offset ) {
ZERO_STRUCT ( qt ) ;
2011-05-06 00:42:05 +04:00
if ( ! parse_user_quota_record ( ( const uint8_t * ) curdata , curdata_count ,
2011-01-16 10:34:58 +03:00
& offset , & qt ) ) {
2003-04-12 03:32:00 +04:00
DEBUG ( 1 , ( " Failed to parse the quota record \n " ) ) ;
goto cleanup ;
}
2004-12-07 21:25:53 +03:00
if ( ( tmp_list_ent = TALLOC_ZERO_P ( mem_ctx , SMB_NTQUOTA_LIST ) ) = = NULL ) {
2007-04-28 03:18:41 +04:00
DEBUG ( 0 , ( " TALLOC_ZERO() failed \n " ) ) ;
2007-03-01 05:43:33 +03:00
talloc_destroy ( mem_ctx ) ;
2011-01-16 13:53:03 +03:00
return NT_STATUS_NO_MEMORY ;
2003-04-12 03:32:00 +04:00
}
2004-12-07 21:25:53 +03:00
if ( ( tmp_list_ent - > quotas = TALLOC_ZERO_P ( mem_ctx , SMB_NTQUOTA_STRUCT ) ) = = NULL ) {
2007-04-28 03:18:41 +04:00
DEBUG ( 0 , ( " TALLOC_ZERO() failed \n " ) ) ;
2007-03-01 05:43:33 +03:00
talloc_destroy ( mem_ctx ) ;
2011-01-16 13:53:03 +03:00
return NT_STATUS_NO_MEMORY ;
2003-04-12 03:32:00 +04:00
}
memcpy ( tmp_list_ent - > quotas , & qt , sizeof ( qt ) ) ;
tmp_list_ent - > mem_ctx = mem_ctx ;
DLIST_ADD ( ( * pqt_list ) , tmp_list_ent ) ;
}
SSVAL ( params , 2 , TRANSACT_GET_USER_QUOTA_LIST_CONTINUE ) ;
while ( 1 ) {
2011-01-16 13:53:03 +03:00
TALLOC_FREE ( rparam ) ;
TALLOC_FREE ( rdata ) ;
status = cli_trans ( talloc_tos ( ) , cli , SMBnttrans ,
NULL , - 1 , /* name, fid */
NT_TRANSACT_GET_USER_QUOTA , 0 ,
setup , 1 , 0 , /* setup */
params , 16 , 4 , /* params */
NULL , 0 , 2048 , /* data */
NULL , /* recv_flags2 */
NULL , 0 , NULL , /* rsetup */
& rparam , 0 , & rparam_count ,
& rdata , 0 , & rdata_count ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 1 , ( " NT_TRANSACT_GET_USER_QUOTA failed: %s \n " ,
nt_errstr ( status ) ) ) ;
2003-04-12 03:32:00 +04:00
goto cleanup ;
}
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
if ( rdata_count = = 0 ) {
2011-01-16 13:53:03 +03:00
break ;
2003-04-12 03:32:00 +04:00
}
offset = 1 ;
for ( curdata = rdata , curdata_count = rdata_count ;
( ( curdata ) & & ( curdata_count > = 8 ) & & ( offset > 0 ) ) ;
curdata + = offset , curdata_count - = offset ) {
ZERO_STRUCT ( qt ) ;
2011-05-06 00:42:05 +04:00
if ( ! parse_user_quota_record ( ( const uint8_t * ) curdata ,
2011-01-16 10:34:58 +03:00
curdata_count , & offset ,
& qt ) ) {
2003-04-12 03:32:00 +04:00
DEBUG ( 1 , ( " Failed to parse the quota record \n " ) ) ;
goto cleanup ;
}
2004-12-07 21:25:53 +03:00
if ( ( tmp_list_ent = TALLOC_ZERO_P ( mem_ctx , SMB_NTQUOTA_LIST ) ) = = NULL ) {
2007-04-28 03:18:41 +04:00
DEBUG ( 0 , ( " TALLOC_ZERO() failed \n " ) ) ;
2003-04-12 03:32:00 +04:00
talloc_destroy ( mem_ctx ) ;
goto cleanup ;
}
2008-10-05 18:14:27 +04:00
2004-12-07 21:25:53 +03:00
if ( ( tmp_list_ent - > quotas = TALLOC_ZERO_P ( mem_ctx , SMB_NTQUOTA_STRUCT ) ) = = NULL ) {
2007-04-28 03:18:41 +04:00
DEBUG ( 0 , ( " TALLOC_ZERO() failed \n " ) ) ;
2003-04-12 03:32:00 +04:00
talloc_destroy ( mem_ctx ) ;
goto cleanup ;
}
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
memcpy ( tmp_list_ent - > quotas , & qt , sizeof ( qt ) ) ;
tmp_list_ent - > mem_ctx = mem_ctx ;
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
DLIST_ADD ( ( * pqt_list ) , tmp_list_ent ) ;
}
}
cleanup :
2011-01-16 13:53:03 +03:00
TALLOC_FREE ( rparam ) ;
TALLOC_FREE ( rdata ) ;
2008-10-05 18:14:27 +04:00
2011-01-16 13:53:03 +03:00
return status ;
2003-04-12 03:32:00 +04:00
}
2011-01-16 14:03:07 +03:00
NTSTATUS cli_get_fs_quota_info ( struct cli_state * cli , int quota_fnum ,
SMB_NTQUOTA_STRUCT * pqt )
2003-04-12 03:32:00 +04:00
{
2011-01-16 14:03:07 +03:00
uint16_t setup [ 1 ] ;
uint8_t param [ 2 ] ;
uint8_t * rdata = NULL ;
uint32_t rdata_count = 0 ;
2003-04-12 03:32:00 +04:00
SMB_NTQUOTA_STRUCT qt ;
2011-01-16 14:03:07 +03:00
NTSTATUS status ;
2003-04-12 03:32:00 +04:00
ZERO_STRUCT ( qt ) ;
2007-06-16 01:58:49 +04:00
if ( ! cli | | ! pqt ) {
2003-04-12 03:32:00 +04:00
smb_panic ( " cli_get_fs_quota_info() called with NULL Pointer! " ) ;
2007-06-16 01:58:49 +04:00
}
2003-04-12 03:32:00 +04:00
2011-01-16 14:03:07 +03:00
SSVAL ( setup + 0 , 0 , TRANSACT2_QFSINFO ) ;
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
SSVAL ( param , 0 , SMB_FS_QUOTA_INFORMATION ) ;
2008-10-05 18:14:27 +04:00
2011-01-16 14:03:07 +03:00
status = cli_trans ( talloc_tos ( ) , cli , SMBtrans2 ,
NULL , - 1 , /* name, fid */
0 , 0 , /* function, flags */
setup , 1 , 0 , /* setup */
param , 2 , 0 , /* param */
NULL , 0 , 560 , /* data */
NULL , /* recv_flags2 */
NULL , 0 , NULL , /* rsetup */
NULL , 0 , NULL , /* rparam */
& rdata , 48 , & rdata_count ) ;
2003-04-12 03:32:00 +04:00
2011-01-16 14:03:07 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 1 , ( " SMB_FS_QUOTA_INFORMATION failed: %s \n " ,
nt_errstr ( status ) ) ) ;
return status ;
2003-04-12 03:32:00 +04:00
}
2008-10-05 18:14:27 +04:00
2003-04-12 03:32:00 +04:00
/* unknown_1 24 NULL bytes in pdata*/
2008-10-14 03:59:36 +04:00
/* the soft quotas 8 bytes (uint64_t)*/
2011-04-23 12:22:32 +04:00
qt . softlim = BVAL ( rdata , 24 ) ;
2003-04-12 03:32:00 +04:00
2008-10-14 03:59:36 +04:00
/* the hard quotas 8 bytes (uint64_t)*/
2011-04-23 12:22:32 +04:00
qt . hardlim = BVAL ( rdata , 32 ) ;
2003-04-12 03:32:00 +04:00
/* quota_flags 2 bytes **/
qt . qflags = SVAL ( rdata , 40 ) ;
qt . qtype = SMB_USER_FS_QUOTA_TYPE ;
* pqt = qt ;
2011-01-16 14:03:07 +03:00
TALLOC_FREE ( rdata ) ;
return status ;
2003-04-12 03:32:00 +04:00
}
2011-01-16 14:14:26 +03:00
NTSTATUS cli_set_fs_quota_info ( struct cli_state * cli , int quota_fnum ,
SMB_NTQUOTA_STRUCT * pqt )
2003-04-12 03:32:00 +04:00
{
2011-01-16 14:14:26 +03:00
uint16_t setup [ 1 ] ;
uint8_t param [ 4 ] ;
uint8_t data [ 48 ] ;
2003-04-12 03:32:00 +04:00
SMB_NTQUOTA_STRUCT qt ;
2011-01-16 14:14:26 +03:00
NTSTATUS status ;
2003-04-12 03:32:00 +04:00
ZERO_STRUCT ( qt ) ;
memset ( data , ' \0 ' , 48 ) ;
2007-06-16 01:58:49 +04:00
if ( ! cli | | ! pqt ) {
2003-04-12 03:32:00 +04:00
smb_panic ( " cli_set_fs_quota_info() called with NULL Pointer! " ) ;
2007-06-16 01:58:49 +04:00
}
2003-04-12 03:32:00 +04:00
2011-01-16 14:14:26 +03:00
SSVAL ( setup + 0 , 0 , TRANSACT2_SETFSINFO ) ;
2003-04-12 03:32:00 +04:00
SSVAL ( param , 0 , quota_fnum ) ;
SSVAL ( param , 2 , SMB_FS_QUOTA_INFORMATION ) ;
/* Unknown1 24 NULL bytes*/
/* Default Soft Quota 8 bytes */
SBIG_UINT ( data , 24 , pqt - > softlim ) ;
/* Default Hard Quota 8 bytes */
SBIG_UINT ( data , 32 , pqt - > hardlim ) ;
/* Quota flag 2 bytes */
SSVAL ( data , 40 , pqt - > qflags ) ;
/* Unknown3 6 NULL bytes */
2011-01-16 14:14:26 +03:00
status = cli_trans ( talloc_tos ( ) , cli , SMBtrans2 ,
NULL , - 1 , /* name, fid */
0 , 0 , /* function, flags */
setup , 1 , 0 , /* setup */
param , 8 , 0 , /* param */
data , 48 , 0 , /* data */
NULL , /* recv_flags2 */
NULL , 0 , NULL , /* rsetup */
NULL , 0 , NULL , /* rparam */
NULL , 0 , NULL ) ; /* rdata */
2003-04-12 03:32:00 +04:00
2011-01-16 14:14:26 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 1 , ( " SMB_FS_QUOTA_INFORMATION failed: %s \n " ,
nt_errstr ( status ) ) ) ;
2003-04-12 03:32:00 +04:00
}
2011-01-16 14:14:26 +03:00
return status ;
2003-04-12 03:32:00 +04:00
}