# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. 97,98c97,102 < static const char* SUB_DIRNAME = "1"; < static const size_t SUB_DIRNAME_LEN = 1; --- > static const char* MDB_FILENAME = "msmMMOB.mdb"; > static const size_t MDB_FILENAME_LEN = 11; > static const char* PMR_FILENAME = "msmFMID.pmr"; > static const size_t PMR_FILENAME_LEN = 11; > static const char* CREATING_DIRNAME = "Creating"; > static const size_t CREATING_DIRNAME_LEN = 8; 117c121,123 < char *clientSubDirname; --- > char *clientMDBFilename; > char *clientPMRFilename; > char *clientCreatingDirname; 121c127 < /* Add "_.01" suffix to path or filename. --- > /* Add "__" suffix to path or filename. 144c150 < * frees original 'path' memory so we don't have to --- > * frees original 'path' memory so we don't have to. 146,147c152,154 < *path = talloc_asprintf_append(*path, "_%s.01", < raddr); --- > *path = talloc_asprintf_append(*path, "_%s_%s", > raddr, > handle->conn->session_info->unix_info->sanitized_username); 326c333,379 < /* Add client suffix to path SUB_SUBDIRNAME. --- > /* Identifies MDB and PMR files at end of path. */ > static bool is_avid_database( > char *path, > size_t path_len, > const char *avid_db_filename, > const size_t avid_db_filename_len) > { > bool ret = False; > > DEBUG(MH_INFO_DEBUG, ("Entering with path '%s', " > "avid_db_filename '%s', " > "path_len '%i', " > "avid_db_filename_len '%i'\n", > path, avid_db_filename, > (int)path_len, (int)avid_db_filename_len)); > > if ( > path_len > avid_db_filename_len > && > strcmp(&path[path_len - avid_db_filename_len], > avid_db_filename) == 0 > && > ( > path[path_len - avid_db_filename_len - 1] == '/' > || > path_len > avid_db_filename_len > + APPLE_DOUBLE_PREFIX_LEN > && > path[path_len - avid_db_filename_len > - APPLE_DOUBLE_PREFIX_LEN - 1] == '/' > && > is_apple_double(&path[path_len > - avid_db_filename_len > - APPLE_DOUBLE_PREFIX_LEN]) > ) > ) > { > ret = True; > } > DEBUG(MH_INFO_DEBUG, ("Leaving with ret '%s'\n", > ret == True ? "True" : "False")); > return ret; > } > > > /* Add client suffix to paths to MDB_FILENAME, PMR_FILENAME and > * CREATING_SUBDIRNAME. 338,339c391,392 < /* replace /1/ or /._1/ < * directory in path --- > /* replace /CREATING_DIRNAME/ or /._CREATING_DIRNAME/ > * directory in path - potentially in middle of path 346a400 > 357,358c411 < /*strstr returns pointer */ < (pathPtr = strstr(path, SUB_DIRNAME)) != NULL --- > (pathPtr = strstr(path, CREATING_DIRNAME)) != NULL 361c414 < *(pathPtr + SUB_DIRNAME_LEN) == '\0' --- > *(pathPtr + CREATING_DIRNAME_LEN) == '\0' 363c416 < *(pathPtr + SUB_DIRNAME_LEN) == '/' --- > *(pathPtr + CREATING_DIRNAME_LEN) == '/' 380c433 < (*newPath)[pathPtr - path + SUB_DIRNAME_LEN] = '\0'; --- > (*newPath)[pathPtr - path + CREATING_DIRNAME_LEN] = '\0'; 390c443 < pathPtr + SUB_DIRNAME_LEN); --- > pathPtr + CREATING_DIRNAME_LEN); 400a454,473 > > /* replace /MDB_FILENAME or /PMR_FILENAME or /._MDB_FILENAME > * or /._PMR_FILENAME at newPath end with suffixed name. > */ > intermPathLen = strlen(*newPath); > if ( > is_avid_database(*newPath, intermPathLen, > MDB_FILENAME, MDB_FILENAME_LEN) > || > is_avid_database(*newPath, intermPathLen, > PMR_FILENAME, PMR_FILENAME_LEN) > ) > { > DEBUG(MH_INFO_DEBUG, ("newPath #5 %s\n", *newPath)); > if ((status = alloc_append_client_suffix(handle, newPath))) > { > goto out; > } > DEBUG(MH_INFO_DEBUG, ("newPath #6 %s\n", *newPath)); > } 473a547 > 474a549,551 > * Replace mtime on clientFname with mtime from client-suffixed > * equivalent, if it exists. > * 477a555,636 > static int set_fake_mtime(vfs_handle_struct *handle, > TALLOC_CTX *ctx, > struct smb_filename **clientFname, > int (*statFn)(const char *, SMB_STRUCT_STAT *, bool)) > { > int status = 0; > char *statPath; > SMB_STRUCT_STAT fakeStat; > int copy_len; > > DEBUG(MH_INFO_DEBUG, ("Entering with (*clientFname)->base_name " > "'%s', (*clientFname)->st.st_ex_mtime %s", > (*clientFname)->base_name, > ctime(&((*clientFname)->st.st_ex_mtime.tv_sec)))); > > if ( > depth_from_media_dir(AVID_MXF_DIRNAME, > AVID_MXF_DIRNAME_LEN, > (*clientFname)->base_name) > != 1 > && > depth_from_media_dir(OMFI_MEDIAFILES_DIRNAME, > OMFI_MEDIAFILES_DIRNAME_LEN, > (*clientFname)->base_name) > != 0 > ) > { > goto out; > } > > copy_len = strlen((*clientFname)->base_name); > > /* Hack to deal with occasional "Avid MediaFiles/MXF/1/." paths. > * We know we're under a media dir, so paths are at least 2 chars > * long. > */ > if ((*clientFname)->base_name[copy_len - 1] == '.' && > (*clientFname)->base_name[copy_len - 2] == '/') > { > copy_len -= 2; > } > > if (((statPath = talloc_strndup(ctx, > (*clientFname)->base_name, copy_len)) == NULL)) > { > errno = ENOMEM; > status = -1; > goto err; > } > if ((status = alloc_append_client_suffix(handle, &statPath))) > { > goto err; > } > > DEBUG(MH_INFO_DEBUG, ("Fake stat'ing '%s'\n", statPath)); > if (statFn(statPath, &fakeStat, > lp_fake_dir_create_times(SNUM(handle->conn)))) > { > /* This can fail for legitimate reasons - i.e. the > * fakeStat directory doesn't exist, which is okay > * - so we don't set status. But if it does fail, > * we need to skip over the mtime assignment. > */ > goto err; > } > > DEBUG(MH_INFO_DEBUG, ("Setting fake mtime from '%s'\n", statPath)); > (*clientFname)->st.st_ex_mtime = fakeStat.st_ex_mtime; > err: > TALLOC_FREE(statPath); > out: > DEBUG(MH_INFO_DEBUG, ("Leaving with (*clientFname)->base_name " > "'%s', (*clientFname)->st.st_ex_mtime %s", > (*clientFname)->base_name, > ctime(&((*clientFname)->st.st_ex_mtime.tv_sec)))); > return status; > } > > /* > * Success: return 0 > * Failure: set errno, return -1 > */ 537c696,698 < (*dirInfo)->clientSubDirname = NULL; --- > (*dirInfo)->clientMDBFilename = NULL; > (*dirInfo)->clientPMRFilename = NULL; > (*dirInfo)->clientCreatingDirname = NULL; 546,547c707,708 < &((*dirInfo)->clientSubDirname), < SUB_DIRNAME)) --- > &((*dirInfo)->clientMDBFilename), > MDB_FILENAME)) 551a713,728 > if (alloc_set_client_dirinfo_path(handle, > *dirInfo, > &((*dirInfo)->clientPMRFilename), > PMR_FILENAME)) > { > goto err; > } > > if (alloc_set_client_dirinfo_path(handle, > *dirInfo, > &((*dirInfo)->clientCreatingDirname), > CREATING_DIRNAME)) > { > goto err; > } > 657a835,839 > if (set_fake_mtime(handle, fsp, &(fsp->fsp_name), sys_stat)) > { > goto err; > } > 676,677c858,862 < * skip own SUB_DIRNAME directory < * replace own SUB_DIRNAME directory with non suffixed. --- > * skip MDB_FILENAME and PMR_FILENAME filenames and CREATING_DIRNAME > * directory, skip other client's suffixed MDB_FILENAME and PMR_FILENAME > * filenames and CREATING_DIRNAME directory, replace this client's > * suffixed MDB_FILENAME and PMR_FILENAME filenames and CREATING_DIRNAME > * directory with non suffixed. 696c881,883 < "dirInfo->clientSubDirname '%s'\n", --- > "dirInfo->clientMDBFilename '%s', " > "dirInfo->clientPMRFilename '%s', " > "dirInfo->clientCreatingDirname '%s'\n", 700c887,889 < dirInfo->clientSubDirname)); --- > dirInfo->clientMDBFilename, > dirInfo->clientPMRFilename, > dirInfo->clientCreatingDirname)); 733c922 < /* ? skip "/1/ subdirectory with no client suffix */ --- > /* skip Avid-special files with no client suffix */ 735c924,928 < strcmp(dname, SUB_DIRNAME) == 0 --- > strcmp(dname, MDB_FILENAME) == 0 > || > strcmp(dname, PMR_FILENAME) == 0 > || > strcmp(dname, CREATING_DIRNAME) == 0 741c934,958 < else if (strcmp(dname, dirInfo->clientSubDirname) --- > else if (strcmp(dname, dirInfo->clientMDBFilename) == 0) > { > if (isAppleDouble) > { > d->d_name[MDB_FILENAME_LEN > + APPLE_DOUBLE_PREFIX_LEN] = '\0'; > } > else > { > d->d_name[MDB_FILENAME_LEN] = '\0'; > } > } > else if (strcmp(dname, dirInfo->clientPMRFilename) == 0) > { > if (isAppleDouble) > { > d->d_name[PMR_FILENAME_LEN > + APPLE_DOUBLE_PREFIX_LEN] = '\0'; > } > else > { > d->d_name[PMR_FILENAME_LEN] = '\0'; > } > } > else if (strcmp(dname, dirInfo->clientCreatingDirname) 746c963 < d->d_name[SUB_DIRNAME_LEN --- > d->d_name[CREATING_DIRNAME_LEN 751c968 < d->d_name[SUB_DIRNAME_LEN] = '\0'; --- > d->d_name[CREATING_DIRNAME_LEN] = '\0'; 755c972,975 < * Set to False to see another clients subdirectories --- > * Anything that starts as an Avid-special file > * that's made it this far should be skipped. This > * is different from the original behaviour, which > * only skipped other client's suffixed files. 758,759c978,985 < strncmp(SUB_DIRNAME, dname, < SUB_DIRNAME_LEN) == 0 --- > strncmp(MDB_FILENAME, dname, > MDB_FILENAME_LEN) == 0 > || > strncmp(PMR_FILENAME, dname, > PMR_FILENAME_LEN) == 0 > || > strncmp(CREATING_DIRNAME, dname, > CREATING_DIRNAME_LEN) == 0 762c988 < skip = False; --- > skip = True; 1163a1390,1393 > if ((status = set_fake_mtime(handle, ctx, &clientFname, sys_stat))) > { > goto err; > } 1214a1445,1448 > if ((status = set_fake_mtime(handle, ctx, &clientFname, sys_lstat))) > { > goto err; > }