The Samba-Bugzilla – Attachment 11957 Details for
Bug 11819
The info type SMB2_SETINFO_FS is not been handled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
attached the patch to handle the SMB2_SETFS_INFO info type
quota_setinfo_3.patch (text/plain), 4.70 KB, created by
Partha
on 2016-03-31 20:56:43 UTC
(
hide
)
Description:
attached the patch to handle the SMB2_SETFS_INFO info type
Filename:
MIME Type:
Creator:
Partha
Created:
2016-03-31 20:56:43 UTC
Size:
4.70 KB
patch
obsolete
>diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h >index 35a3ee9..98eec74 100644 >--- a/source3/smbd/globals.h >+++ b/source3/smbd/globals.h >@@ -143,6 +143,15 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, > char **ppdata, > unsigned int *pdata_size); > >+NTSTATUS smbd_do_setfsinfo(connection_struct *conn, >+ struct smb_request *req, >+ TALLOC_CTX *mem_ctx, >+ uint16_t info_level, >+ files_struct *fsp, >+ struct smb_filename *smb_fname, >+ char **ppdata, size_t total_data, >+ size_t *ret_data_size); >+ > NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn, > struct smb_request *req, > TALLOC_CTX *mem_ctx, >diff --git a/source3/smbd/smb2_setinfo.c b/source3/smbd/smb2_setinfo.c >index 9361aea..f8b4a81 100644 >--- a/source3/smbd/smb2_setinfo.c >+++ b/source3/smbd/smb2_setinfo.c >@@ -530,6 +530,42 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx, > break; > } > >+ case 0x02:/* SMB2_SETINFO_FS */ >+ { >+ uint16_t file_info_level; >+ char *data; >+ size_t data_size; >+ size_t ret_size = 0; >+ >+ >+ file_info_level = in_file_info_class + 1000; >+ data = NULL; >+ data_size = in_input_buffer.length; >+ if (data_size > 0) { >+ data = (char *)SMB_MALLOC_ARRAY(char, data_size); >+ if (tevent_req_nomem(data, req)) { >+ return tevent_req_post(req, ev); >+ } >+ memcpy(data, in_input_buffer.data, data_size); >+ } >+ status = smbd_do_setfsinfo(conn, smbreq, state, >+ file_info_level, >+ fsp, >+ fsp->fsp_name, >+ &data, >+ data_size, >+ &ret_size); >+ SAFE_FREE(data); >+ if (!NT_STATUS_IS_OK(status)) { >+ if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_LEVEL)) { >+ status = NT_STATUS_INVALID_INFO_CLASS; >+ } >+ tevent_req_nterror(req, status); >+ return tevent_req_post(req, ev); >+ } >+ break; >+ } >+ > case 0x03:/* SMB2_SETINFO_SECURITY */ > { > if (!CAN_WRITE(conn)) { >diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c >index d5a38d4..3734316 100644 >--- a/source3/smbd/trans2.c >+++ b/source3/smbd/trans2.c >@@ -8026,6 +8026,87 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn, > return close_file(req, fsp, NORMAL_CLOSE); > } > >+NTSTATUS smbd_do_setfsinfo(connection_struct *conn, >+ struct smb_request *req, >+ TALLOC_CTX *mem_ctx, >+ uint16_t info_level, >+ files_struct *fsp, >+ struct smb_filename *smb_fname, >+ char **ppdata, size_t total_data, >+ size_t *ret_data_size) >+{ >+ char *pdata = *ppdata; >+ NTSTATUS status = NT_STATUS_OK; >+ size_t data_return_size = 0; >+ >+ *ret_data_size = 0; >+ >+ switch (info_level) { >+ case SMB_FS_QUOTA_INFORMATION: >+ { >+ SMB_NTQUOTA_STRUCT quotas; >+ >+ ZERO_STRUCT(quotas); >+ >+ /* access check */ >+ if ((get_current_uid(conn) != 0) || !CAN_WRITE(conn)) { >+ DEBUG(0,("set_user_quota: access_denied service [%s] user [%s]\n", >+ lp_servicename(talloc_tos(), SNUM(conn)), >+ conn->session_info->unix_info->unix_name)); >+ return NT_STATUS_ACCESS_DENIED; >+ } >+ >+ /* note: normally there're 48 bytes, >+ * but we didn't use the last 6 bytes for now >+ * --metze >+ */ >+ if (!check_fsp_ntquota_handle(conn, req, >+ fsp)) { >+ DEBUG(3,("TRANSACT_GET_USER_QUOTA: no valid QUOTA HANDLE\n")); >+ return NT_STATUS_INVALID_HANDLE; >+ } >+ >+ if (total_data < 42) { >+ DEBUG(0,("call_trans2setfsinfo: SET_FS_QUOTA: requires total_data(%d) >= 42 bytes!\n", >+ total_data)); >+ return NT_STATUS_INVALID_PARAMETER; >+ } >+ >+ /* unknown_1 24 NULL bytes in pdata*/ >+ >+ /* the soft quotas 8 bytes (uint64_t)*/ >+ quotas.softlim = BVAL(pdata,24); >+ >+ /* the hard quotas 8 bytes (uint64_t)*/ >+ quotas.hardlim = BVAL(pdata,32); >+ >+ /* quota_flags 2 bytes **/ >+ quotas.qflags = SVAL(pdata,40); >+ >+ /* unknown_2 6 NULL bytes follow*/ >+ >+ /* now set the quotas */ >+ if (vfs_set_ntquota(fsp, SMB_USER_FS_QUOTA_TYPE, NULL, "as)!=0) { >+ DEBUG(0,("vfs_set_ntquota() failed for service [%s]\n",lp_servicename(talloc_tos(), SNUM(conn)))); >+ status = map_nt_error_from_unix(errno); >+ } else { >+ status = NT_STATUS_OK; >+ } >+ >+ break; >+ } >+ default: >+ return NT_STATUS_INVALID_LEVEL; >+ } >+ >+ if (!NT_STATUS_IS_OK(status)) { >+ return status; >+ } >+ >+ *ret_data_size = data_return_size; >+ return NT_STATUS_OK; >+} >+ > NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn, > struct smb_request *req, > TALLOC_CTX *mem_ctx,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11819
:
11957
|
12002
|
12022
|
12031
|
12048