Return True if we translated (and did a scuccessful stat on) the entire name.
*****************************************************************************/
-static BOOL stat_cache_lookup( char *name, char *dirpath, char **start, SMB_STRUCT_STAT *pst)
+static BOOL stat_cache_lookup(struct connection_struct *conn, char *name,
+ char *dirpath, char **start,
+ SMB_STRUCT_STAT *pst)
{
stat_cache_entry *scp;
stat_cache_entry *longest_hit = NULL;
* and then promote it to the top.
*/
- if(dos_stat( longest_hit->translated_name, pst) != 0) {
+ if(conn->vfs_ops.stat(longest_hit->translated_name, pst) != 0) {
/*
* Discard this entry.
*/
trim_string(name,"/","/");
+ /*
+ * If we trimmed down to a single '\0' character
+ * then we should use the "." directory to avoid
+ * searching the cache, but not if we are in a
+ * printing share.
+ */
+
+ if (!*name && (!conn -> printer)) {
+ name[0] = '.';
+ name[1] = '\0';
+ }
+
/*
* Ensure saved_last_component is valid even if file exists.
*/
for (s=name2 ; *s ; s++)
if (!issafe(*s)) *s = '_';
- pstrcpy(name,(char *)mktemp(name2));
+ pstrcpy(name,(char *)mktemp(name2));
}
return(True);
}
pstrcpy(orig_path, name);
- if(stat_cache_lookup( name, dirpath, &start, &st)) {
+ if(stat_cache_lookup(conn, name, dirpath, &start, &st)) {
if(pst)
*pst = st;
return True;
* stat the name - if it exists then we are all done!
*/
- if (dos_stat(name,&st) == 0) {
+ if (conn->vfs_ops.stat(name,&st) == 0) {
stat_cache_add(orig_path, name);
DEBUG(5,("conversion finished %s -> %s\n",orig_path, name));
if(pst)
/*
* Check if the name exists up to this point.
*/
- if (dos_stat(name, &st) == 0) {
+
+ if (conn->vfs_ops.stat(name, &st) == 0) {
/*
* It exists. it must either be a directory or this must be
* the last part of the path for it to be OK.
if (!lp_symlinks(SNUM(conn)))
{
SMB_STRUCT_STAT statbuf;
- if ( (dos_lstat(name,&statbuf) != -1) &&
+ if ( (conn->vfs_ops.lstat(dos_to_unix(name,False),&statbuf) != -1) &&
(S_ISLNK(statbuf.st_mode)) )
{
DEBUG(3,("check_name: denied: file path name %s is a symlink\n",name));