mirror of
https://github.com/samba-team/samba.git
synced 2025-12-14 20:23:54 +03:00
Makefile: Added AIX targets from Ole Holm Nielsen <Ole.H.Nielsen@uni-c.dk>
chgpasswd.c: Added Samba/GPL notice (for obvious reasons). clitar.c: Updated Copyright date to include 1997 (for obvious reasons). getsmbpass.c: Updated Copyright date to include 1997 (for obvious reasons). includes.h: Added stropts for solaris. loadparm.c: Changed comment for hide files option. nameconf.c: Updated Copyright date to include 1997 (for obvious reasons). nmbd.c: Updated Copyright date to include 1997 (for obvious reasons). pcap.c: Updated Copyright date to include 1997 (for obvious reasons). proto.h: Re-added accidentaly deleted smb_shm_ calls. quotas.c: Added AIX quota patch from Ole Holm Nielsen <ohnielse@fysik.dtu.dk> server.c: Optimization on calling is_hidden_path. Updated Copyrights. smb.h: Changed DEFAULT_FILES_TO_HIDE from "*/.*" to ".*". smbpass.c: Updated Copyright date to include 1997 (for obvious reasons). ufc.c: Updated Copyright date to include 1997 (for obvious reasons). util.c: Added last component code to is_in_path(). Jeremy (jallison@whistle.com)
This commit is contained in:
@@ -3432,32 +3432,33 @@ char *readdirname(void *p)
|
||||
return(dname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility function used by is_hidden_path() and is_vetoed_name()
|
||||
* to decide if the last component of a path matches a (possibly
|
||||
* wildcarded) entry in a namelist.
|
||||
*/
|
||||
|
||||
BOOL is_hidden_path(int snum, char *name)
|
||||
static BOOL is_in_path(char *name, char *namelist)
|
||||
{
|
||||
return is_in_path(name, lp_hide_files(snum));
|
||||
}
|
||||
|
||||
BOOL is_vetoed_name(int snum, char *name)
|
||||
{
|
||||
return is_in_path(name, lp_veto_files(snum));
|
||||
}
|
||||
|
||||
BOOL is_in_path(char *name, char *namelist)
|
||||
{
|
||||
|
||||
pstring last_component;
|
||||
char *p;
|
||||
char *nameptr = namelist;
|
||||
char *name_end;
|
||||
|
||||
DEBUG(5, ("is_in_path: %s list: %s\n", name, namelist));
|
||||
|
||||
/* if we have no list it's obviously not in the path */
|
||||
if((nameptr == NULL ) || (*nameptr == '\0'))
|
||||
if((nameptr == NULL ) || ((nameptr != NULL) && (*nameptr == '\0')))
|
||||
{
|
||||
DEBUG(5,("is_in_path: no name list. return False\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
/* Get the last component of the unix name. */
|
||||
p = strrchr(name, '/');
|
||||
strncpy(last_component, p ? p : name, sizeof(last_component)-1);
|
||||
last_component[sizeof(last_component)-1] = '\0';
|
||||
|
||||
/* now, we need to find the names one by one and check them
|
||||
they can contain spaces and all sorts of stuff so we
|
||||
separate them with of all things '\' which can never be in a filename
|
||||
@@ -3470,9 +3471,6 @@ BOOL is_in_path(char *name, char *namelist)
|
||||
that unix_convert is called before check_path and dos_mode.
|
||||
unix_convert changes, in the path, all dos '\'s to unix '/'s.
|
||||
|
||||
therefore, users might want to match against '/'s in the path,
|
||||
and therefore '\' must be used as the separator.
|
||||
|
||||
the alternatives are:
|
||||
|
||||
1) move all check_path and dos_mode calls to before the
|
||||
@@ -3502,7 +3500,7 @@ BOOL is_in_path(char *name, char *namelist)
|
||||
}
|
||||
|
||||
/* look for a match. */
|
||||
if (mask_match(name, nameptr, case_sensitive, False))
|
||||
if (mask_match(last_component, nameptr, case_sensitive, False))
|
||||
{
|
||||
DEBUG(5,("is_in_path: mask match succeeded\n"));
|
||||
return True;
|
||||
@@ -3524,6 +3522,16 @@ BOOL is_in_path(char *name, char *namelist)
|
||||
return False;
|
||||
}
|
||||
|
||||
BOOL is_hidden_path(int snum, char *name)
|
||||
{
|
||||
return is_in_path(name, lp_hide_files(snum));
|
||||
}
|
||||
|
||||
BOOL is_vetoed_name(int snum, char *name)
|
||||
{
|
||||
return is_in_path(name, lp_veto_files(snum));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
routine to do file locking
|
||||
****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user