mirror of
https://github.com/samba-team/samba.git
synced 2025-03-09 08:58:35 +03:00
smbd: pass translated_path as const to stat_cache_add()
Prepares for doing more stuff with the translated_path in a subsequent commit. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
1130c64f49
commit
28763125cf
@ -1168,7 +1168,7 @@ ssize_t message_push_string(uint8_t **outbuf, const char *str, int flags);
|
||||
/* The following definitions come from smbd/statcache.c */
|
||||
|
||||
void stat_cache_add( const char *full_orig_name,
|
||||
char *translated_path,
|
||||
const char *translated_path,
|
||||
bool case_sensitive);
|
||||
bool stat_cache_lookup(connection_struct *conn,
|
||||
bool posix_paths,
|
||||
|
@ -45,13 +45,13 @@
|
||||
*/
|
||||
|
||||
void stat_cache_add( const char *full_orig_name,
|
||||
char *translated_path,
|
||||
const char *translated_path_in,
|
||||
bool case_sensitive)
|
||||
{
|
||||
size_t translated_path_length;
|
||||
char *translated_path = NULL;
|
||||
char *original_path;
|
||||
size_t original_path_length;
|
||||
char saved_char;
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
|
||||
if (!lp_stat_cache()) {
|
||||
@ -67,6 +67,11 @@ void stat_cache_add( const char *full_orig_name,
|
||||
return;
|
||||
}
|
||||
|
||||
translated_path = talloc_strdup(ctx, translated_path_in);
|
||||
if (translated_path == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are in case insentive mode, we don't need to
|
||||
* store names that need no translation - else, it
|
||||
@ -74,6 +79,7 @@ void stat_cache_add( const char *full_orig_name,
|
||||
*/
|
||||
|
||||
if (!case_sensitive && (strcmp(full_orig_name, translated_path) == 0)) {
|
||||
TALLOC_FREE(translated_path);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -95,6 +101,7 @@ void stat_cache_add( const char *full_orig_name,
|
||||
}
|
||||
|
||||
if (!original_path) {
|
||||
TALLOC_FREE(translated_path);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -114,6 +121,7 @@ void stat_cache_add( const char *full_orig_name,
|
||||
translated_path,
|
||||
(unsigned long)translated_path_length));
|
||||
TALLOC_FREE(original_path);
|
||||
TALLOC_FREE(translated_path);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -125,7 +133,6 @@ void stat_cache_add( const char *full_orig_name,
|
||||
}
|
||||
|
||||
/* Ensure we're null terminated. */
|
||||
saved_char = translated_path[translated_path_length];
|
||||
translated_path[translated_path_length] = '\0';
|
||||
|
||||
/*
|
||||
@ -143,8 +150,8 @@ void stat_cache_add( const char *full_orig_name,
|
||||
original_path,
|
||||
translated_path));
|
||||
|
||||
translated_path[translated_path_length] = saved_char;
|
||||
TALLOC_FREE(original_path);
|
||||
TALLOC_FREE(translated_path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user