summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-06-21 17:22:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:14 -0500
commit1ff99ba12d9603dd527be5b65f883d13beeed18e (patch)
tree0d8a25bc2c2f26da552ce1eed32b1df42774f02c /source4/smb_server/smb
parentf8dc3bbf9f1f5073c9d6a5992371feb60ebfd811 (diff)
downloadsamba-1ff99ba12d9603dd527be5b65f883d13beeed18e.tar.gz
samba-1ff99ba12d9603dd527be5b65f883d13beeed18e.tar.bz2
samba-1ff99ba12d9603dd527be5b65f883d13beeed18e.zip
r16440: split out passthru level into a new functions,
so they can we reused for smb2 later metze (This used to be commit 42324c1f63e2f16b27c43bf17b434c644244b931)
Diffstat (limited to 'source4/smb_server/smb')
-rw-r--r--source4/smb_server/smb/trans2.c187
1 files changed, 116 insertions, 71 deletions
diff --git a/source4/smb_server/smb/trans2.c b/source4/smb_server/smb/trans2.c
index 2860e33c5b..4a39cad69a 100644
--- a/source4/smb_server/smb/trans2.c
+++ b/source4/smb_server/smb/trans2.c
@@ -576,24 +576,15 @@ static NTSTATUS trans2_mkdir(struct smbsrv_request *req, struct trans_op *op)
return ntvfs_mkdir(req->ntvfs, io);
}
-static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
- TALLOC_CTX *mem_ctx,
- DATA_BLOB *blob,
- union smb_fileinfo *st,
- int default_str_flags)
+static NTSTATUS trans2_push_passthru_fileinfo(TALLOC_CTX *mem_ctx,
+ DATA_BLOB *blob,
+ enum smb_fileinfo_level level,
+ union smb_fileinfo *st,
+ int default_str_flags)
{
uint_t i;
- uint32_t list_size;
- switch (st->generic.level) {
- case RAW_FILEINFO_GENERIC:
- case RAW_FILEINFO_GETATTR:
- case RAW_FILEINFO_GETATTRE:
- case RAW_FILEINFO_SEC_DESC:
- /* handled elsewhere */
- return NT_STATUS_INVALID_LEVEL;
-
- case RAW_FILEINFO_BASIC_INFO:
+ switch (level) {
case RAW_FILEINFO_BASIC_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 40));
@@ -605,29 +596,6 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
SIVAL(blob->data, 36, 0); /* padding */
return NT_STATUS_OK;
- case RAW_FILEINFO_STANDARD:
- TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 22));
-
- srv_push_dos_date2(smb_conn, blob->data, 0, st->standard.out.create_time);
- srv_push_dos_date2(smb_conn, blob->data, 4, st->standard.out.access_time);
- srv_push_dos_date2(smb_conn, blob->data, 8, st->standard.out.write_time);
- SIVAL(blob->data, 12, st->standard.out.size);
- SIVAL(blob->data, 16, st->standard.out.alloc_size);
- SSVAL(blob->data, 20, st->standard.out.attrib);
- return NT_STATUS_OK;
-
- case RAW_FILEINFO_EA_SIZE:
- TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 26));
-
- srv_push_dos_date2(smb_conn, blob->data, 0, st->ea_size.out.create_time);
- srv_push_dos_date2(smb_conn, blob->data, 4, st->ea_size.out.access_time);
- srv_push_dos_date2(smb_conn, blob->data, 8, st->ea_size.out.write_time);
- SIVAL(blob->data, 12, st->ea_size.out.size);
- SIVAL(blob->data, 16, st->ea_size.out.alloc_size);
- SSVAL(blob->data, 20, st->ea_size.out.attrib);
- SIVAL(blob->data, 22, st->ea_size.out.ea_size);
- return NT_STATUS_OK;
-
case RAW_FILEINFO_NETWORK_OPEN_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 56));
@@ -641,7 +609,6 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
SIVAL(blob->data, 52, 0); /* padding */
return NT_STATUS_OK;
- case RAW_FILEINFO_STANDARD_INFO:
case RAW_FILEINFO_STANDARD_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 24));
@@ -660,7 +627,6 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
SIVAL(blob->data, 4, st->attribute_tag_information.out.reparse_tag);
return NT_STATUS_OK;
- case RAW_FILEINFO_EA_INFO:
case RAW_FILEINFO_EA_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 4));
@@ -680,24 +646,6 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
st->alignment_information.out.alignment_requirement);
return NT_STATUS_OK;
- case RAW_FILEINFO_EA_LIST:
- list_size = ea_list_size(st->ea_list.out.num_eas,
- st->ea_list.out.eas);
- TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, list_size));
-
- ea_put_list(blob->data,
- st->ea_list.out.num_eas, st->ea_list.out.eas);
- return NT_STATUS_OK;
-
- case RAW_FILEINFO_ALL_EAS:
- list_size = ea_list_size(st->all_eas.out.num_eas,
- st->all_eas.out.eas);
- TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, list_size));
-
- ea_put_list(blob->data,
- st->all_eas.out.num_eas, st->all_eas.out.eas);
- return NT_STATUS_OK;
-
case RAW_FILEINFO_ACCESS_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 4));
@@ -710,7 +658,6 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
SBVAL(blob->data, 0, st->position_information.out.position);
return NT_STATUS_OK;
- case RAW_FILEINFO_COMPRESSION_INFO:
case RAW_FILEINFO_COMPRESSION_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 16));
@@ -723,16 +670,12 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
SCVAL(blob->data, 15, 0);
return NT_STATUS_OK;
- case RAW_FILEINFO_IS_NAME_VALID:
- return NT_STATUS_OK;
-
case RAW_FILEINFO_INTERNAL_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 8));
SBVAL(blob->data, 0, st->internal_information.out.file_id);
return NT_STATUS_OK;
- case RAW_FILEINFO_ALL_INFO:
case RAW_FILEINFO_ALL_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 72));
@@ -741,7 +684,7 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
push_nttime(blob->data, 16, st->all_info.out.write_time);
push_nttime(blob->data, 24, st->all_info.out.change_time);
SIVAL(blob->data, 32, st->all_info.out.attrib);
- SIVAL(blob->data, 36, 0);
+ SIVAL(blob->data, 36, 0); /* padding */
SBVAL(blob->data, 40, st->all_info.out.alloc_size);
SBVAL(blob->data, 48, st->all_info.out.size);
SIVAL(blob->data, 56, st->all_info.out.nlink);
@@ -755,7 +698,6 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
STR_UNICODE));
return NT_STATUS_OK;
- case RAW_FILEINFO_NAME_INFO:
case RAW_FILEINFO_NAME_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 4));
@@ -765,7 +707,6 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
STR_UNICODE));
return NT_STATUS_OK;
- case RAW_FILEINFO_ALT_NAME_INFO:
case RAW_FILEINFO_ALT_NAME_INFORMATION:
TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 4));
@@ -775,7 +716,6 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
STR_UNICODE));
return NT_STATUS_OK;
- case RAW_FILEINFO_STREAM_INFO:
case RAW_FILEINFO_STREAM_INFORMATION:
for (i=0;i<st->stream_info.out.num_streams;i++) {
uint32_t data_size = blob->length;
@@ -798,17 +738,122 @@ static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
}
}
return NT_STATUS_OK;
-
- case RAW_FILEINFO_UNIX_BASIC:
- case RAW_FILEINFO_UNIX_LINK:
+
+ default:
return NT_STATUS_INVALID_LEVEL;
+ }
+
+ return NT_STATUS_INVALID_LEVEL;
+}
+
+static NTSTATUS trans2_push_fileinfo(struct smbsrv_connection *smb_conn,
+ TALLOC_CTX *mem_ctx,
+ DATA_BLOB *blob,
+ union smb_fileinfo *st,
+ int default_str_flags)
+{
+ uint32_t list_size;
+ enum smb_fileinfo_level passthru_level;
+ switch (st->generic.level) {
+ case RAW_FILEINFO_GENERIC:
+ case RAW_FILEINFO_GETATTR:
+ case RAW_FILEINFO_GETATTRE:
+ case RAW_FILEINFO_SEC_DESC:
case RAW_FILEINFO_SMB2_ALL_EAS:
case RAW_FILEINFO_SMB2_ALL_INFORMATION:
+ /* handled elsewhere */
+ return NT_STATUS_INVALID_LEVEL;
+
+ case RAW_FILEINFO_UNIX_BASIC:
+ case RAW_FILEINFO_UNIX_LINK:
+ /* not implemented yet */
return NT_STATUS_INVALID_LEVEL;
+
+ case RAW_FILEINFO_STANDARD:
+ TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 22));
+
+ srv_push_dos_date2(smb_conn, blob->data, 0, st->standard.out.create_time);
+ srv_push_dos_date2(smb_conn, blob->data, 4, st->standard.out.access_time);
+ srv_push_dos_date2(smb_conn, blob->data, 8, st->standard.out.write_time);
+ SIVAL(blob->data, 12, st->standard.out.size);
+ SIVAL(blob->data, 16, st->standard.out.alloc_size);
+ SSVAL(blob->data, 20, st->standard.out.attrib);
+ return NT_STATUS_OK;
+
+ case RAW_FILEINFO_EA_SIZE:
+ TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, 26));
+
+ srv_push_dos_date2(smb_conn, blob->data, 0, st->ea_size.out.create_time);
+ srv_push_dos_date2(smb_conn, blob->data, 4, st->ea_size.out.access_time);
+ srv_push_dos_date2(smb_conn, blob->data, 8, st->ea_size.out.write_time);
+ SIVAL(blob->data, 12, st->ea_size.out.size);
+ SIVAL(blob->data, 16, st->ea_size.out.alloc_size);
+ SSVAL(blob->data, 20, st->ea_size.out.attrib);
+ SIVAL(blob->data, 22, st->ea_size.out.ea_size);
+ return NT_STATUS_OK;
+
+ case RAW_FILEINFO_EA_LIST:
+ list_size = ea_list_size(st->ea_list.out.num_eas,
+ st->ea_list.out.eas);
+ TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, list_size));
+
+ ea_put_list(blob->data,
+ st->ea_list.out.num_eas, st->ea_list.out.eas);
+ return NT_STATUS_OK;
+
+ case RAW_FILEINFO_ALL_EAS:
+ list_size = ea_list_size(st->all_eas.out.num_eas,
+ st->all_eas.out.eas);
+ TRANS2_CHECK(trans2_grow_data(mem_ctx, blob, list_size));
+
+ ea_put_list(blob->data,
+ st->all_eas.out.num_eas, st->all_eas.out.eas);
+ return NT_STATUS_OK;
+
+ case RAW_FILEINFO_IS_NAME_VALID:
+ return NT_STATUS_OK;
+
+ case RAW_FILEINFO_BASIC_INFO:
+ passthru_level = RAW_FILEINFO_BASIC_INFORMATION;
+ break;
+
+ case RAW_FILEINFO_STANDARD_INFO:
+ passthru_level = RAW_FILEINFO_STANDARD_INFORMATION;
+ break;
+
+ case RAW_FILEINFO_EA_INFO:
+ passthru_level = RAW_FILEINFO_EA_INFORMATION;
+ break;
+
+ case RAW_FILEINFO_COMPRESSION_INFO:
+ passthru_level = RAW_FILEINFO_COMPRESSION_INFORMATION;
+ break;
+
+ case RAW_FILEINFO_ALL_INFO:
+ passthru_level = RAW_FILEINFO_ALL_INFORMATION;
+ break;
+
+ case RAW_FILEINFO_NAME_INFO:
+ passthru_level = RAW_FILEINFO_NAME_INFORMATION;
+ break;
+
+ case RAW_FILEINFO_ALT_NAME_INFO:
+ passthru_level = RAW_FILEINFO_ALT_NAME_INFORMATION;
+ break;
+
+ case RAW_FILEINFO_STREAM_INFO:
+ passthru_level = RAW_FILEINFO_STREAM_INFORMATION;
+ break;
+
+ default:
+ passthru_level = st->generic.level;
+ break;
}
- return NT_STATUS_INVALID_LEVEL;
+ return trans2_push_passthru_fileinfo(mem_ctx, blob,
+ passthru_level, st,
+ default_str_flags);
}
/*