diff options
author | Samba Release Account <samba-bugs@samba.org> | 1997-07-08 16:54:44 +0000 |
---|---|---|
committer | Samba Release Account <samba-bugs@samba.org> | 1997-07-08 16:54:44 +0000 |
commit | 25eae02948b40667495fbb021dd130180180a05e (patch) | |
tree | d0dffa4caed0faf7473d162528551c850c9a914b /source3/lib | |
parent | a67a697b3624c51d38cacd4aea134286a372b756 (diff) | |
download | samba-25eae02948b40667495fbb021dd130180180a05e.tar.gz samba-25eae02948b40667495fbb021dd130180180a05e.tar.bz2 samba-25eae02948b40667495fbb021dd130180180a05e.zip |
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 used to be commit 9385ae1005f13c8ed51f1319e3949b5c8571e62d)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/getsmbpass.c | 2 | ||||
-rw-r--r-- | source3/lib/ufc.c | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 42 |
3 files changed, 27 insertions, 19 deletions
diff --git a/source3/lib/getsmbpass.c b/source3/lib/getsmbpass.c index 7ee8c18788..9008d40f91 100644 --- a/source3/lib/getsmbpass.c +++ b/source3/lib/getsmbpass.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1992-1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/source3/lib/ufc.c b/source3/lib/ufc.c index 67b0c6920a..0fa5cfd3a0 100644 --- a/source3/lib/ufc.c +++ b/source3/lib/ufc.c @@ -21,7 +21,7 @@ /* * UFC-crypt: ultra fast crypt(3) implementation * - * Copyright (C) 1991, 1992, Free Software Foundation, Inc. + * Copyright (C) 1991-1997, Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff --git a/source3/lib/util.c b/source3/lib/util.c index 0ee6947d09..f31ae390aa 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -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) -{ - 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) +static 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 ****************************************************************************/ |