The Samba-Bugzilla – Attachment 627 Details for
Bug 1674
still problems when follow symlinks = no
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
I think this fixes it.
look (text/plain), 2.86 KB, created by
Jeremy Allison
on 2004-08-31 15:52:11 UTC
(
hide
)
Description:
I think this fixes it.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2004-08-31 15:52:11 UTC
Size:
2.86 KB
patch
obsolete
>Index: smbd/vfs.c >=================================================================== >--- smbd/vfs.c (revision 2148) >+++ smbd/vfs.c (working copy) >@@ -909,7 +909,8 @@ > return False; > } > >- if (strncmp(conn->connectpath, resolved_name, con_path_len) != 0) { >+ /* Check for widelinks allowed. */ >+ if (!lp_widelinks(SNUM(conn)) && (strncmp(conn->connectpath, resolved_name, con_path_len) != 0)) { > DEBUG(2, ("reduce_name: Bad access attempt: %s is a symlink outside the share path", fname)); > if (free_resolved_name) > SAFE_FREE(resolved_name); >@@ -917,29 +918,24 @@ > return False; > } > >- /* Move path the connect path to the last part of the filename. */ >- p = resolved_name + con_path_len; >- if (*p == '/') { >- p++; >- } >+ /* Check if we are allowing users to follow symlinks */ >+ /* Patch from David Clerc <David.Clerc@cui.unige.ch> >+ University of Geneva */ >+ >+#ifdef S_ISLNK >+ if (!lp_symlinks(SNUM(conn))) { >+ SMB_STRUCT_STAT statbuf; >+ if ( (SMB_VFS_LSTAT(conn,fname,&statbuf) != -1) && >+ (S_ISLNK(statbuf.st_mode)) ) { >+ if (free_resolved_name) >+ SAFE_FREE(resolved_name); >+ DEBUG(3,("reduce_name: denied: file path name %s is a symlink\n",resolved_name)); >+ errno = EACCES; >+ return False; >+ } >+ } >+#endif > >- if (!*p) { >- if (fname[0] == '.' && fname[1] == '/' && fname[2] == '\0') { >- pstrcpy(resolved_name, "./"); >- } else { >- pstrcpy(resolved_name, "."); >- } >- p = resolved_name; >- } >- >- if (!lp_symlinks(SNUM(conn)) && (strcmp(fname, p)!=0)) { >- DEBUG(3,("reduce_name: denied: file path name %s is a symlink\n",fname)); >- if (free_resolved_name) >- SAFE_FREE(resolved_name); >- errno = EACCES; >- return False; >- } >- > DEBUG(3,("reduce_name: %s reduced to %s\n", fname, p)); > if (free_resolved_name) > SAFE_FREE(resolved_name); >Index: smbd/filename.c >=================================================================== >--- smbd/filename.c (revision 2148) >+++ smbd/filename.c (working copy) >@@ -414,26 +414,10 @@ > } > } > >- if (!lp_widelinks(SNUM(conn))) { >+ if (!lp_widelinks(SNUM(conn)) || !lp_symlinks(SNUM(conn))) { > ret = reduce_name(conn,name); > } > >- /* Check if we are allowing users to follow symlinks */ >- /* Patch from David Clerc <David.Clerc@cui.unige.ch> >- University of Geneva */ >- >-#ifdef S_ISLNK >- if (!lp_symlinks(SNUM(conn))) { >- SMB_STRUCT_STAT statbuf; >- if ( (SMB_VFS_LSTAT(conn,name,&statbuf) != -1) && >- (S_ISLNK(statbuf.st_mode)) ) { >- DEBUG(3,("check_name: denied: file path name %s is a symlink\n",name)); >- errno = EACCES; >- ret = False; >- } >- } >-#endif >- > if (!ret) { > DEBUG(5,("check_name on %s failed\n",name)); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1674
: 627