summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-01-16 11:33:35 +0100
committerVolker Lendecke <vl@samba.org>2011-01-17 08:03:41 +0100
commiteb7db50f60b96433c62ac7755b8ff771d4aa48ce (patch)
tree1d5e532270f3cbf57835b34864c0fce236e960ef
parente2a96711d708dd6df32bc68883a5bb0ef908a639 (diff)
downloadsamba-eb7db50f60b96433c62ac7755b8ff771d4aa48ce.tar.gz
samba-eb7db50f60b96433c62ac7755b8ff771d4aa48ce.tar.bz2
samba-eb7db50f60b96433c62ac7755b8ff771d4aa48ce.zip
s3: Convert cli_set_user_quota to cli_trans
-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(