summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-23 16:32:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:38 -0500
commit1ddcc5c06aa88638ec89bb75cc7e4d3feb74efd0 (patch)
tree5c9ee81321dce4b8c78384ebb508dd73ae1b1773 /source3/smbd
parent992fac30a5f2715fa79cbdacf5e505fbd87ea5c6 (diff)
downloadsamba-1ddcc5c06aa88638ec89bb75cc7e4d3feb74efd0.tar.gz
samba-1ddcc5c06aa88638ec89bb75cc7e4d3feb74efd0.tar.bz2
samba-1ddcc5c06aa88638ec89bb75cc7e4d3feb74efd0.zip
r22490: Fix a couple of bugs found whist investigating CSC Vista issues.
Ensure we correctly NULL out allocation size fields. Allow QFILEINFO on pipes (Vista bug ?). Jerry - don't automatically merge for 3.0.25. Jeremy. (This used to be commit a27577815201101de4ca5c8375b7f768b6127fb2)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/trans2.c96
1 files changed, 92 insertions, 4 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 12a9e19301..84bbc3b0dd 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2235,6 +2235,12 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
return(-1);
}
+unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16])
+{
+ E_md4hash(lp_servicename(SNUM(conn)),objid);
+ return objid;
+}
+
/****************************************************************************
Reply to a TRANS2_QFSINFO (query filesystem info).
****************************************************************************/
@@ -2342,6 +2348,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsi
SIVAL(pdata,0,FILE_CASE_PRESERVED_NAMES|FILE_CASE_SENSITIVE_SEARCH|
(lp_nt_acl_support(SNUM(conn)) ? FILE_PERSISTENT_ACLS : 0)|
+ FILE_SUPPORTS_OBJECT_IDS|
+ FILE_UNICODE_ON_DISK|
quota_flag); /* FS ATTRIBUTES */
SIVAL(pdata,4,255); /* Max filename component length */
@@ -2523,8 +2531,12 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
}
#endif /* HAVE_SYS_QUOTAS */
case SMB_FS_OBJECTID_INFORMATION:
+ {
+ unsigned char objid[16];
+ memcpy(pdata,create_volume_objectid(conn, objid),16);
data_len = 64;
break;
+ }
/*
* Query the version and capabilities of the CIFS UNIX extensions
@@ -3194,6 +3206,68 @@ static char *store_file_unix_basic_info2(connection_struct *conn,
}
/****************************************************************************
+ Reply to a TRANSACT2_QFILEINFO on a PIPE !
+****************************************************************************/
+
+static int call_trans2qpipeinfo(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,
+ unsigned int max_data_bytes)
+{
+ char *params = *pparams;
+ char *pdata = *ppdata;
+ unsigned int data_size = 0;
+ unsigned int param_size = 2;
+ uint16 info_level;
+ smb_np_struct *p_pipe = NULL;
+
+ if (!params) {
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+
+ if (total_params < 4) {
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+
+ p_pipe = get_rpc_pipe_p(params,0);
+ if (p_pipe == NULL) {
+ return ERROR_NT(NT_STATUS_INVALID_HANDLE);
+ }
+
+ info_level = SVAL(params,2);
+
+ *pparams = (char *)SMB_REALLOC(*pparams,2);
+ if (*pparams == NULL) {
+ return ERROR_NT(NT_STATUS_NO_MEMORY);
+ }
+ params = *pparams;
+ SSVAL(params,0,0);
+ data_size = max_data_bytes + DIR_ENTRY_SAFETY_MARGIN;
+ *ppdata = (char *)SMB_REALLOC(*ppdata, data_size);
+ if (*ppdata == NULL ) {
+ return ERROR_NT(NT_STATUS_NO_MEMORY);
+ }
+ pdata = *ppdata;
+
+ switch (info_level) {
+ case SMB_FILE_STANDARD_INFORMATION:
+ memset(pdata,24,0);
+ SOFF_T(pdata,0,4096LL);
+ SIVAL(pdata,16,1);
+ SIVAL(pdata,20,1);
+ data_size = 24;
+ break;
+
+ default:
+ return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ }
+
+ send_trans2_replies(outbuf, bufsize, params, param_size, *ppdata, data_size, max_data_bytes);
+
+ return(-1);
+}
+
+/****************************************************************************
Reply to a TRANS2_QFILEPATHINFO or TRANSACT2_QFILEINFO (query file info by
file name or file id).
****************************************************************************/
@@ -3238,6 +3312,20 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char *
return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
}
+ if (IS_IPC(conn)) {
+ return call_trans2qpipeinfo(conn,
+ inbuf,
+ outbuf,
+ length,
+ bufsize,
+ tran_call,
+ pparams,
+ total_params,
+ ppdata,
+ total_data,
+ max_data_bytes);
+ }
+
fsp = file_fsp(params,0);
info_level = SVAL(params,2);
@@ -3769,8 +3857,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
SIVAL(pdata,0,0); /* ??? */
SIVAL(pdata,4,byte_len); /* Byte length of unicode string ::$DATA */
SOFF_T(pdata,8,file_size);
- SIVAL(pdata,16,allocation_size);
- SIVAL(pdata,20,0); /* ??? */
+ SOFF_T(pdata,16,allocation_size);
data_size = 24 + byte_len;
}
break;
@@ -3790,7 +3877,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
put_long_date_timespec(pdata+8,atime_ts);
put_long_date_timespec(pdata+16,mtime_ts); /* write time */
put_long_date_timespec(pdata+24,mtime_ts); /* change time */
- SIVAL(pdata,32,allocation_size);
+ SOFF_T(pdata,32,allocation_size);
SOFF_T(pdata,40,file_size);
SIVAL(pdata,48,mode);
SIVAL(pdata,52,0); /* ??? */
@@ -6525,7 +6612,8 @@ int reply_trans2(connection_struct *conn, char *inbuf,char *outbuf,
}
if (IS_IPC(conn) && (tran_call != TRANSACT2_OPEN)
- && (tran_call != TRANSACT2_GET_DFS_REFERRAL)) {
+ && (tran_call != TRANSACT2_GET_DFS_REFERRAL)
+ && (tran_call != TRANSACT2_QFILEINFO)) {
END_PROFILE(SMBtrans2);
return ERROR_DOS(ERRSRV,ERRaccess);
}