svn commit: samba r21049 - in branches: SAMBA_3_0/source/smbd
SAMBA_3_0_24/source/smbd
jra at samba.org
jra at samba.org
Tue Jan 30 01:14:50 GMT 2007
Author: jra
Date: 2007-01-30 01:14:48 +0000 (Tue, 30 Jan 2007)
New Revision: 21049
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21049
Log:
Start to refactor some of the setpath set code
into separate functions (tridge mailed me a fresh
batch) to make it easier to add the POSIX open we'll
need soon.
Jeremy.
Modified:
branches/SAMBA_3_0/source/smbd/trans2.c
branches/SAMBA_3_0_24/source/smbd/trans2.c
Changeset:
Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/trans2.c 2007-01-30 00:09:33 UTC (rev 21048)
+++ branches/SAMBA_3_0/source/smbd/trans2.c 2007-01-30 01:14:48 UTC (rev 21049)
@@ -3742,9 +3742,71 @@
}
/****************************************************************************
- Reply to a TRANS2_SETFILEINFO (set file info by fileid).
+ Deal with SMB_INFO_SET_EA.
****************************************************************************/
+static int smb_info_set_ea(connection_struct *conn,
+ char *outbuf,
+ int bufsize,
+ char *params,
+ int total_params,
+ char *pdata,
+ int total_data,
+ unsigned int max_data_bytes,
+ files_struct *fsp,
+ const char *fname)
+{
+ struct ea_list *ea_list = NULL;
+ TALLOC_CTX *ctx = NULL;
+ NTSTATUS status = NT_STATUS_OK;
+
+ if (total_data < 10) {
+
+ /* OS/2 workplace shell seems to send SET_EA requests of "null"
+ length. They seem to have no effect. Bug #3212. JRA */
+
+ if ((total_data == 4) && (IVAL(pdata,0) == 4)) {
+ /* We're done. We only get EA info in this call. */
+ SSVAL(params,0,0);
+ send_trans2_replies(outbuf, bufsize, params, 2, pdata, 0, max_data_bytes);
+ return -1;
+ }
+
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+
+ if (IVAL(pdata,0) > total_data) {
+ DEBUG(10,("smb_info_set_ea: bad total data size (%u) > %u\n",
+ IVAL(pdata,0), (unsigned int)total_data));
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+
+ ctx = talloc_init("SMB_INFO_SET_EA");
+ if (!ctx) {
+ return ERROR_NT(NT_STATUS_NO_MEMORY);
+ }
+ ea_list = read_ea_list(ctx, pdata + 4, total_data - 4);
+ if (!ea_list) {
+ talloc_destroy(ctx);
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+ status = set_ea(conn, fsp, fname, ea_list);
+ talloc_destroy(ctx);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return ERROR_NT(status);
+ }
+
+ /* We're done. We only get EA info in this call. */
+ SSVAL(params,0,0);
+ send_trans2_replies(outbuf, bufsize, params, 2, pdata, 0, max_data_bytes);
+ return -1;
+}
+
+/****************************************************************************
+ Reply to a TRANS2_SETFILEINFO (set file info by fileid or pathname).
+****************************************************************************/
+
static int call_trans2setfilepathinfo(connection_struct *conn, char *inbuf, char *outbuf, int length, int bufsize,
unsigned int tran_call,
char **pparams, int total_params, char **ppdata, int total_data,
@@ -3901,80 +3963,17 @@
}
case SMB_INFO_SET_EA:
- {
- struct ea_list *ea_list = NULL;
- TALLOC_CTX *ctx = NULL;
+ return smb_info_set_ea(conn,
+ outbuf,
+ bufsize,
+ params,
+ total_params,
+ *ppdata,
+ total_data,
+ max_data_bytes,
+ fsp,
+ fname);
- if (total_data < 10) {
-
- /* OS/2 workplace shell seems to send SET_EA requests of "null"
- length. They seem to have no effect. Bug #3212. JRA */
-
- if ((total_data == 4) && (IVAL(pdata,0) == 4)) {
- /* We're done. We only get EA info in this call. */
- SSVAL(params,0,0);
- send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0, max_data_bytes);
- return(-1);
- }
-
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
- }
-
- if (IVAL(pdata,0) > total_data) {
- DEBUG(10,("call_trans2setfilepathinfo: bad total data size (%u) > %u\n",
- IVAL(pdata,0), (unsigned int)total_data));
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
- }
-
- ctx = talloc_init("SMB_INFO_SET_EA");
- if (!ctx) {
- return ERROR_NT(NT_STATUS_NO_MEMORY);
- }
- ea_list = read_ea_list(ctx, pdata + 4, total_data - 4);
- if (!ea_list) {
- talloc_destroy(ctx);
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
- }
- status = set_ea(conn, fsp, fname, ea_list);
- talloc_destroy(ctx);
-
- if (!NT_STATUS_IS_OK(status)) {
- return ERROR_NT(status);
- }
-
- /* We're done. We only get EA info in this call. */
- SSVAL(params,0,0);
- send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0, max_data_bytes);
- return(-1);
- }
-
-#if 0
- /* The following 2 info levels are only valid on query, not set. Remove them. JRA. */
- /* XXXX um, i don't think this is right.
- it's also not in the cifs6.txt spec.
- */
- case SMB_INFO_QUERY_EAS_FROM_LIST:
- if (total_data < 28)
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
-
- tvs.actime = make_unix_date2(pdata+8);
- tvs.modtime = make_unix_date2(pdata+12);
- size = IVAL(pdata,16);
- dosmode = IVAL(pdata,24);
- break;
-
- /* XXXX nor this. not in cifs6.txt, either. */
- case SMB_INFO_QUERY_ALL_EAS:
- if (total_data < 28)
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
-
- tvs.actime = make_unix_date2(pdata+8);
- tvs.modtime = make_unix_date2(pdata+12);
- size = IVAL(pdata,16);
- dosmode = IVAL(pdata,24);
- break;
-#endif
-
case SMB_SET_FILE_BASIC_INFO:
case SMB_FILE_BASIC_INFORMATION:
{
Modified: branches/SAMBA_3_0_24/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/trans2.c 2007-01-30 00:09:33 UTC (rev 21048)
+++ branches/SAMBA_3_0_24/source/smbd/trans2.c 2007-01-30 01:14:48 UTC (rev 21049)
@@ -3742,9 +3742,71 @@
}
/****************************************************************************
- Reply to a TRANS2_SETFILEINFO (set file info by fileid).
+ Deal with SMB_INFO_SET_EA.
****************************************************************************/
+static int smb_info_set_ea(connection_struct *conn,
+ char *outbuf,
+ int bufsize,
+ char *params,
+ int total_params,
+ char *pdata,
+ int total_data,
+ unsigned int max_data_bytes,
+ files_struct *fsp,
+ const char *fname)
+{
+ struct ea_list *ea_list = NULL;
+ TALLOC_CTX *ctx = NULL;
+ NTSTATUS status = NT_STATUS_OK;
+
+ if (total_data < 10) {
+
+ /* OS/2 workplace shell seems to send SET_EA requests of "null"
+ length. They seem to have no effect. Bug #3212. JRA */
+
+ if ((total_data == 4) && (IVAL(pdata,0) == 4)) {
+ /* We're done. We only get EA info in this call. */
+ SSVAL(params,0,0);
+ send_trans2_replies(outbuf, bufsize, params, 2, pdata, 0, max_data_bytes);
+ return -1;
+ }
+
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+
+ if (IVAL(pdata,0) > total_data) {
+ DEBUG(10,("smb_info_set_ea: bad total data size (%u) > %u\n",
+ IVAL(pdata,0), (unsigned int)total_data));
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+
+ ctx = talloc_init("SMB_INFO_SET_EA");
+ if (!ctx) {
+ return ERROR_NT(NT_STATUS_NO_MEMORY);
+ }
+ ea_list = read_ea_list(ctx, pdata + 4, total_data - 4);
+ if (!ea_list) {
+ talloc_destroy(ctx);
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+ status = set_ea(conn, fsp, fname, ea_list);
+ talloc_destroy(ctx);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return ERROR_NT(status);
+ }
+
+ /* We're done. We only get EA info in this call. */
+ SSVAL(params,0,0);
+ send_trans2_replies(outbuf, bufsize, params, 2, pdata, 0, max_data_bytes);
+ return -1;
+}
+
+/****************************************************************************
+ Reply to a TRANS2_SETFILEINFO (set file info by fileid or pathname).
+****************************************************************************/
+
static int call_trans2setfilepathinfo(connection_struct *conn, char *inbuf, char *outbuf, int length, int bufsize,
unsigned int tran_call,
char **pparams, int total_params, char **ppdata, int total_data,
@@ -3901,80 +3963,17 @@
}
case SMB_INFO_SET_EA:
- {
- struct ea_list *ea_list = NULL;
- TALLOC_CTX *ctx = NULL;
+ return smb_info_set_ea(conn,
+ outbuf,
+ bufsize,
+ params,
+ total_params,
+ *ppdata,
+ total_data,
+ max_data_bytes,
+ fsp,
+ fname);
- if (total_data < 10) {
-
- /* OS/2 workplace shell seems to send SET_EA requests of "null"
- length. They seem to have no effect. Bug #3212. JRA */
-
- if ((total_data == 4) && (IVAL(pdata,0) == 4)) {
- /* We're done. We only get EA info in this call. */
- SSVAL(params,0,0);
- send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0, max_data_bytes);
- return(-1);
- }
-
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
- }
-
- if (IVAL(pdata,0) > total_data) {
- DEBUG(10,("call_trans2setfilepathinfo: bad total data size (%u) > %u\n",
- IVAL(pdata,0), (unsigned int)total_data));
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
- }
-
- ctx = talloc_init("SMB_INFO_SET_EA");
- if (!ctx) {
- return ERROR_NT(NT_STATUS_NO_MEMORY);
- }
- ea_list = read_ea_list(ctx, pdata + 4, total_data - 4);
- if (!ea_list) {
- talloc_destroy(ctx);
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
- }
- status = set_ea(conn, fsp, fname, ea_list);
- talloc_destroy(ctx);
-
- if (!NT_STATUS_IS_OK(status)) {
- return ERROR_NT(status);
- }
-
- /* We're done. We only get EA info in this call. */
- SSVAL(params,0,0);
- send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0, max_data_bytes);
- return(-1);
- }
-
-#if 0
- /* The following 2 info levels are only valid on query, not set. Remove them. JRA. */
- /* XXXX um, i don't think this is right.
- it's also not in the cifs6.txt spec.
- */
- case SMB_INFO_QUERY_EAS_FROM_LIST:
- if (total_data < 28)
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
-
- tvs.actime = make_unix_date2(pdata+8);
- tvs.modtime = make_unix_date2(pdata+12);
- size = IVAL(pdata,16);
- dosmode = IVAL(pdata,24);
- break;
-
- /* XXXX nor this. not in cifs6.txt, either. */
- case SMB_INFO_QUERY_ALL_EAS:
- if (total_data < 28)
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
-
- tvs.actime = make_unix_date2(pdata+8);
- tvs.modtime = make_unix_date2(pdata+12);
- size = IVAL(pdata,16);
- dosmode = IVAL(pdata,24);
- break;
-#endif
-
case SMB_SET_FILE_BASIC_INFO:
case SMB_FILE_BASIC_INFORMATION:
{
More information about the samba-cvs
mailing list