summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/libsmb/cliquota.c58
-rw-r--r--source3/utils/smbcquotas.c7
3 files changed, 30 insertions, 38 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c3535cd37c..cdde6d7176 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2256,7 +2256,8 @@ NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
SMB_NTQUOTA_STRUCT *pqt);
-bool cli_set_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,
+ SMB_NTQUOTA_STRUCT *pqt);
bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list);
bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c
index 046426740e..3a267d76a1 100644
--- a/source3/libsmb/cliquota.c
+++ b/source3/libsmb/cliquota.c
@@ -185,22 +185,22 @@ NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
return status;
}
-bool cli_set_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,
+ SMB_NTQUOTA_STRUCT *pqt)
{
- bool ret = False;
- uint16 setup;
- char params[2];
- char data[112];
- char *rparam=NULL, *rdata=NULL;
- unsigned int rparam_count=0, rdata_count=0;
+ uint16_t setup[1];
+ uint8_t params[2];
+ uint8_t data[112];
unsigned int sid_len;
+ NTSTATUS status;
+
memset(data,'\0',112);
if (!cli||!pqt) {
smb_panic("cli_set_user_quota() called with NULL Pointer!");
}
- setup = NT_TRANSACT_SET_USER_QUOTA;
+ SSVAL(setup + 0, 0, NT_TRANSACT_SET_USER_QUOTA);
SSVAL(params,0,quota_fnum);
@@ -211,37 +211,25 @@ bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC
SBIG_UINT(data,16,pqt->usedspace);
SBIG_UINT(data,24,pqt->softlim);
SBIG_UINT(data,32,pqt->hardlim);
- sid_linearize(data+40, sid_len, &pqt->sid);
+ sid_linearize((char *)data+40, sid_len, &pqt->sid);
- if (!cli_send_nt_trans(cli,
- NT_TRANSACT_SET_USER_QUOTA,
- 0,
- &setup, 1, 0,
- params, 2, 0,
- data, 112, 0)) {
- DEBUG(1,("Failed to send NT_TRANSACT_SET_USER_QUOTA\n"));
- goto cleanup;
- }
-
-
- if (!cli_receive_nt_trans(cli,
- &rparam, &rparam_count,
- &rdata, &rdata_count)) {
- DEBUG(1,("NT_TRANSACT_SET_USER_QUOTA failed\n"));
- goto cleanup;
- }
+ 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 */
- if (cli_is_error(cli)) {
- ret = False;
- goto cleanup;
- } else {
- ret = True;
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("NT_TRANSACT_SET_USER_QUOTA failed: %s\n",
+ nt_errstr(status)));
}
- cleanup:
- SAFE_FREE(rparam);
- SAFE_FREE(rdata);
- return ret;
+ return status;
}
bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list)
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index 9c64781d83..985b9d7e32 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -283,9 +283,12 @@ static int do_quota(struct cli_state *cli,
break;
case QUOTA_SETLIM:
pqt->sid = qt.sid;
- if (!cli_set_user_quota(cli, quota_fnum, pqt)) {
+ status = cli_set_user_quota(
+ cli, quota_fnum, pqt);
+ if (!NT_STATUS_IS_OK(status)) {
d_printf("%s cli_set_user_quota %s\n",
- cli_errstr(cli),username_str);
+ nt_errstr(status),
+ username_str);
return -1;
}
status = cli_get_user_quota(