summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-07-12 00:42:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:28:34 -0500
commit6b0e3194e38d1a9aa6cda892251c6a716e42c974 (patch)
treeabf8169339d5d54f52cadec502d6c32ed184107b
parentb114d3dc70a631f41c9d6e0e05b0ed98baa9d815 (diff)
downloadsamba-6b0e3194e38d1a9aa6cda892251c6a716e42c974.tar.gz
samba-6b0e3194e38d1a9aa6cda892251c6a716e42c974.tar.bz2
samba-6b0e3194e38d1a9aa6cda892251c6a716e42c974.zip
r23847: As Dr. Volker says, "A pstring a day....".
Jeremy. (This used to be commit 8adf81696aee99c5090e1b827ceb14929ec4aeda)
-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 = ".";