^samba3.vfs.fruit streams_depot.OS X AppleDouble file conversion\(nt4_dc\)
^samba3.vfs.fruit streams_depot.OS X AppleDouble file conversion without embedded xattr\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.copyfile\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.resource fork IO\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.SMB2/CREATE context AAPL\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.truncate resource fork to 0 bytes\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.opening and creating resource fork\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.create delete-on-close AFP_AfpResource\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.setinfo delete-on-close AFP_AfpResource\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.delete\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.read open rsrc after rename\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.readdir_attr with names with illegal ntfs characters\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.copy-chunk streams\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.empty_stream\(nt4_dc\)
-^samba3.vfs.fruit fruit_delete_empty_adfiles.setinfo eof AFP_AfpResource\(nt4_dc\)
* @return -1 in case an error occurred, 0 if no conversion was done, 1
* otherwise
**/
-static int ad_convert(struct adouble *ad,
+static int ad_convert(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname)
{
+ struct adouble *ad = NULL;
bool ok;
bool converted_xattr = false;
bool blank;
+ int ret;
+
+ ad = ad_get(talloc_tos(), handle, smb_fname, ADOUBLE_RSRC);
+ if (ad == NULL) {
+ return 0;
+ }
ok = ad_convert_xattr(ad, smb_fname, &converted_xattr);
if (!ok) {
- return -1;
+ ret = -1;
+ goto done;
}
ok = ad_convert_blank_rfork(ad, &blank);
if (!ok) {
- return -1;
+ ret = -1;
+ goto done;
}
if (converted_xattr || blank) {
ok = ad_convert_truncate(ad, smb_fname);
if (!ok) {
- return -1;
+ ret = -1;
+ goto done;
}
}
if (!ok) {
DBG_ERR("Failed to convert [%s]\n",
smb_fname_str_dbg(smb_fname));
- return -1;
+ ret = -1;
+ goto done;
}
ok = ad_convert_delete_adfile(ad, smb_fname);
if (!ok) {
- return -1;
+ ret = -1;
+ goto done;
}
- return 0;
+ ret = 0;
+done:
+ TALLOC_FREE(ad);
+ return ret;
}
/**
return -1;
}
- /*
- * Try to fixup AppleDouble files created by OS X with xattrs
- * appended to the ADEID_FINDERI entry.
- */
-
- ret = ad_convert(ad, smb_fname);
- if (ret != 0) {
- DBG_WARNING("Failed to convert [%s]\n", smb_fname->base_name);
- return len;
- }
-
return len;
}
}
/**
- * Test whether stream is an Apple stream, not used atm
+ * Test whether stream is an Apple stream.
**/
-#if 0
static bool is_apple_stream(const struct smb_filename *smb_fname)
{
if (is_afpinfo_stream(smb_fname)) {
}
return false;
}
-#endif
/**
* Initialize config struct from our smb.conf config parameters
struct fruit_config_data *config = NULL;
files_struct *fsp = NULL;
struct fio *fio = NULL;
+ bool internal_open = (oplock_request & INTERNAL_OPEN_ONLY);
+ int ret;
status = check_aapl(handle, req, in_context_blobs, out_context_blobs);
if (!NT_STATUS_IS_OK(status)) {
SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data,
return NT_STATUS_UNSUCCESSFUL);
+ if (is_apple_stream(smb_fname) && !internal_open) {
+ ret = ad_convert(handle, smb_fname);
+ if (ret != 0) {
+ DBG_ERR("ad_convert() failed\n");
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ }
+
status = SMB_VFS_NEXT_CREATE_FILE(
handle, req, root_dir_fid, smb_fname,
access_mask, share_access,
struct fruit_config_data *config = NULL;
struct readdir_attr_data *attr_data;
NTSTATUS status;
+ int ret;
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct fruit_config_data,
DEBUG(10, ("fruit_readdir_attr %s\n", fname->base_name));
+ ret = ad_convert(handle, fname);
+ if (ret != 0) {
+ DBG_ERR("ad_convert() failed\n");
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
*pattr_data = talloc_zero(mem_ctx, struct readdir_attr_data);
if (*pattr_data == NULL) {
return NT_STATUS_UNSUCCESSFUL;