summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/util.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 2fafee23c9..5d583f25c3 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1856,8 +1856,7 @@ const char *readdirname(SMB_STRUCT_DIR *p)
BOOL is_in_path(const char *name, name_compare_entry *namelist, BOOL case_sensitive)
{
- pstring last_component;
- char *p;
+ const char *last_component;
/* if we have no list it's obviously not in the path */
if((namelist == NULL ) || ((namelist != NULL) && (namelist[0].name == NULL))) {
@@ -1867,8 +1866,12 @@ BOOL is_in_path(const char *name, name_compare_entry *namelist, BOOL case_sensit
DEBUG(8, ("is_in_path: %s\n", name));
/* Get the last component of the unix name. */
- p = strrchr_m(name, '/');
- pstrcpy(last_component, p ? ++p : name);
+ last_component = strrchr_m(name, '/');
+ if (!last_component) {
+ last_component = name;
+ } else {
+ last_component++; /* Go past '/' */
+ }
for(; namelist->name != NULL; namelist++) {
if(namelist->is_wild) {
@@ -1885,7 +1888,6 @@ BOOL is_in_path(const char *name, name_compare_entry *namelist, BOOL case_sensit
}
}
DEBUG(8,("is_in_path: match not found\n"));
-
return False;
}
@@ -2774,7 +2776,7 @@ BOOL ms_has_wild_w(const smb_ucs2_t *s)
of the ".." name.
*******************************************************************/
-BOOL mask_match(const char *string, char *pattern, BOOL is_case_sensitive)
+BOOL mask_match(const char *string, const char *pattern, BOOL is_case_sensitive)
{
if (strcmp(string,"..") == 0)
string = ".";
@@ -2790,7 +2792,7 @@ BOOL mask_match(const char *string, char *pattern, BOOL is_case_sensitive)
pattern translation.
*******************************************************************/
-BOOL mask_match_search(const char *string, char *pattern, BOOL is_case_sensitive)
+BOOL mask_match_search(const char *string, const char *pattern, BOOL is_case_sensitive)
{
if (strcmp(string,"..") == 0)
string = ".";