X-Git-Url: http://git.samba.org/?p=samba.git;a=blobdiff_plain;f=source3%2Fmodules%2Fvfs_media_harmony.c;h=594db83f311ac0a37831d3579a046ae8e52be2de;hp=bba98052e0056207b3eb32e7db32a44df4487d22;hb=873df9a8a5508a3a4f51dfe447a5ffcdf18bab09;hpb=f4414d63cdd4d276f66433c6868c9efe8567f28c diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index bba98052e00..594db83f311 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -93,7 +93,6 @@ #define MH_INFO_DEBUG 10 #define MH_ERR_DEBUG 0 -static const char* MH_MODULE_NAME = "media_harmony"; static const char* MDB_FILENAME = "msmMMOB.mdb"; static const size_t MDB_FILENAME_LEN = 11; static const char* PMR_FILENAME = "msmFMID.pmr"; @@ -190,7 +189,7 @@ static bool starts_with_media_dir(const char* media_dirname, size_t media_dirname_len, const char* path) { bool ret = False; - char* path_start; + const char *path_start; DEBUG(MH_INFO_DEBUG, ("Entering with media_dirname '%s' " "path '%s'\n", media_dirname, path)); @@ -265,8 +264,8 @@ static int depth_from_media_dir(const char* media_dirname, size_t media_dirname_len, const char* path) { int transition_count = 0; - char* path_start; - char* pathPtr; + const char *path_start; + const char *pathPtr; DEBUG(MH_INFO_DEBUG, ("Entering with media_dirname '%s' " "path '%s'\n", media_dirname, path)); @@ -355,7 +354,7 @@ static bool is_avid_database( ( path[path_len - avid_db_filename_len - 1] == '/' || - path_len > avid_db_filename_len + (path_len > avid_db_filename_len + APPLE_DOUBLE_PREFIX_LEN && path[path_len - avid_db_filename_len @@ -363,7 +362,7 @@ static bool is_avid_database( && is_apple_double(&path[path_len - avid_db_filename_len - - APPLE_DOUBLE_PREFIX_LEN]) + - APPLE_DOUBLE_PREFIX_LEN])) ) ) { @@ -417,15 +416,15 @@ static int alloc_get_client_path(vfs_handle_struct *handle, ) && ( - pathPtr - path > 0 + (pathPtr - path > 0 && - *(pathPtr - 1) == '/' + *(pathPtr - 1) == '/') || - pathPtr - path > APPLE_DOUBLE_PREFIX_LEN + (pathPtr - path > APPLE_DOUBLE_PREFIX_LEN && *(pathPtr - APPLE_DOUBLE_PREFIX_LEN - 1) == '/' && - is_apple_double(pathPtr - APPLE_DOUBLE_PREFIX_LEN) + is_apple_double(pathPtr - APPLE_DOUBLE_PREFIX_LEN)) ) ) { @@ -487,13 +486,12 @@ static int alloc_get_client_smb_fname(struct vfs_handle_struct *handle, struct smb_filename **clientFname) { int status = 0; - NTSTATUS copystatus; DEBUG(MH_INFO_DEBUG, ("Entering with smb_fname->base_name '%s'\n", smb_fname->base_name)); - clientFname = cp_smb_filename(ctx, smb_fname); - if (clientFname == NULL) { + *clientFname = cp_smb_filename(ctx, smb_fname); + if ((*clientFname) == NULL) { DEBUG(MH_ERR_DEBUG, ("alloc_get_client_smb_fname " "NTERR\n")); errno = ENOMEM; @@ -764,7 +762,7 @@ err: static DIR *mh_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, - uint32 attr) + uint32_t attr) { struct mh_dirinfo_struct *dirInfo; @@ -788,7 +786,6 @@ static DIR *mh_opendir(vfs_handle_struct *handle, goto err; } -out: /* Success is freed in closedir. */ DEBUG(MH_INFO_DEBUG, ("Leaving with dirInfo->dirpath '%s', " "dirInfo->clientPath '%s'\n", @@ -805,7 +802,7 @@ err: static DIR *mh_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, - uint32 attr) + uint32_t attr) { struct mh_dirinfo_struct *dirInfo = NULL; DIR *dirstream; @@ -1036,35 +1033,32 @@ static void mh_rewinddir(vfs_handle_struct *handle, * Failure: set errno, return -1 */ static int mh_mkdir(vfs_handle_struct *handle, - const char *path, + const struct smb_filename *smb_fname, mode_t mode) { int status; - char *clientPath; - TALLOC_CTX *ctx; - + struct smb_filename *clientFname = NULL; + const char *path = smb_fname->base_name; DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path)); if (!is_in_media_files(path)) { - status = SMB_VFS_NEXT_MKDIR(handle, path, mode); + status = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode); goto out; } - clientPath = NULL; - ctx = talloc_tos(); - - if ((status = alloc_get_client_path(handle, ctx, - path, - &clientPath))) - { + status = alloc_get_client_smb_fname(handle, + talloc_tos(), + smb_fname, + &clientFname); + if (status != 0) { goto err; } - status = SMB_VFS_NEXT_MKDIR(handle, clientPath, mode); + status = SMB_VFS_NEXT_MKDIR(handle, clientFname, mode); err: - TALLOC_FREE(clientPath); + TALLOC_FREE(clientFname); out: DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path)); return status; @@ -1207,12 +1201,15 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, struct ea_list *ea_list, files_struct **result_fsp, - int *pinfo) + int *pinfo, + const struct smb2_create_blobs *in_context_blobs, + struct smb2_create_blobs *out_context_blobs) { NTSTATUS status; struct smb_filename *clientFname; @@ -1234,12 +1231,15 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, create_options, file_attributes, oplock_request, + lease, allocation_size, private_flags, sd, ea_list, result_fsp, - pinfo); + pinfo, + in_context_blobs, + out_context_blobs); goto out; } @@ -1270,12 +1270,15 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, create_options, file_attributes, oplock_request, + lease, allocation_size, private_flags, sd, ea_list, result_fsp, - pinfo); + pinfo, + in_context_blobs, + out_context_blobs); err: TALLOC_FREE(clientFname); out: @@ -2010,19 +2013,20 @@ out: * In this case, "name" is a path. */ static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle, - const char *name, - uint32 security_info, + const struct smb_filename *smb_fname, + uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) { NTSTATUS status; char *clientPath; + struct smb_filename *client_smb_fname = NULL; TALLOC_CTX *ctx; DEBUG(MH_INFO_DEBUG, ("Entering mh_get_nt_acl\n")); - if (!is_in_media_files(name)) + if (!is_in_media_files(smb_fname->base_name)) { - status = SMB_VFS_NEXT_GET_NT_ACL(handle, name, + status = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info, mem_ctx, ppdesc); goto out; @@ -2032,18 +2036,28 @@ static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle, ctx = talloc_tos(); if (alloc_get_client_path(handle, ctx, - name, + smb_fname->base_name, &clientPath)) { status = map_nt_error_from_unix(errno); goto err; } - status = SMB_VFS_NEXT_GET_NT_ACL(handle, clientPath, + client_smb_fname = synthetic_smb_fname(talloc_tos(), + clientPath, + NULL, + NULL); + if (client_smb_fname == NULL) { + TALLOC_FREE(clientPath); + return NT_STATUS_NO_MEMORY; + } + + status = SMB_VFS_NEXT_GET_NT_ACL(handle, client_smb_fname, security_info, mem_ctx, ppdesc); err: TALLOC_FREE(clientPath); + TALLOC_FREE(client_smb_fname); out: return status; }