svn commit: samba r23087 - in branches: SAMBA_3_0/source/smbd
SAMBA_3_0_25/source/smbd SAMBA_3_0_26/source/smbd
jra at samba.org
jra at samba.org
Tue May 22 22:35:15 GMT 2007
Author: jra
Date: 2007-05-22 22:35:13 +0000 (Tue, 22 May 2007)
New Revision: 23087
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23087
Log:
Fix POSIX setfilepathinfo to use lstat, not stat.
Still missing lchown (will add this for 3.0.26).
Don't merge for 3.0.25a - possibly 3.0.25b (if it
exists).
Jeremy.
Modified:
branches/SAMBA_3_0/source/smbd/open.c
branches/SAMBA_3_0/source/smbd/trans2.c
branches/SAMBA_3_0_25/source/smbd/open.c
branches/SAMBA_3_0_25/source/smbd/trans2.c
branches/SAMBA_3_0_26/source/smbd/open.c
branches/SAMBA_3_0_26/source/smbd/trans2.c
Changeset:
Modified: branches/SAMBA_3_0/source/smbd/open.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/open.c 2007-05-22 22:07:56 UTC (rev 23086)
+++ branches/SAMBA_3_0/source/smbd/open.c 2007-05-22 22:35:13 UTC (rev 23087)
@@ -47,7 +47,12 @@
NTSTATUS status = NT_STATUS_OK;
#ifdef O_NOFOLLOW
- if (!lp_symlinks(SNUM(conn))) {
+ /*
+ * Never follow symlinks on a POSIX client. The
+ * client should be doing this.
+ */
+
+ if (fsp->posix_open || !lp_symlinks(SNUM(conn))) {
flags |= O_NOFOLLOW;
}
#endif
Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/trans2.c 2007-05-22 22:07:56 UTC (rev 23086)
+++ branches/SAMBA_3_0/source/smbd/trans2.c 2007-05-22 22:35:13 UTC (rev 23087)
@@ -5777,9 +5777,17 @@
* to do this call. JRA.
*/
pstrcpy(fname, fsp->fsp_name);
- if (SMB_VFS_STAT(conn,fname,&sbuf) != 0) {
- DEBUG(3,("call_trans2setfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS,ERRbadpath);
+ if (INFO_LEVEL_IS_UNIX(info_level)) {
+ /* Always do lstat for UNIX calls. */
+ if (SMB_VFS_LSTAT(conn,fname,&sbuf)) {
+ DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",fname,strerror(errno)));
+ return UNIXERROR(ERRDOS,ERRbadpath);
+ }
+ } else {
+ if (SMB_VFS_STAT(conn,fname,&sbuf) != 0) {
+ DEBUG(3,("call_trans2setfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
+ return UNIXERROR(ERRDOS,ERRbadpath);
+ }
}
} else if (fsp && fsp->print_file) {
/*
@@ -5838,14 +5846,18 @@
return ERROR_NT(status);
}
- /*
- * For CIFS UNIX extensions the target name may not exist.
- */
+ if (INFO_LEVEL_IS_UNIX(info_level)) {
+ /*
+ * For CIFS UNIX extensions the target name may not exist.
+ */
- if(!VALID_STAT(sbuf) && !INFO_LEVEL_IS_UNIX(info_level)) {
- DEBUG(3,("call_trans2setfilepathinfo: stat of %s failed (%s)\n", fname, strerror(errno)));
+ /* Always do lstat for UNIX calls. */
+ SMB_VFS_LSTAT(conn,fname,&sbuf);
+
+ } else if (!VALID_STAT(sbuf) && SMB_VFS_STAT(conn,fname,&sbuf)) {
+ DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_STAT of %s failed (%s)\n",fname,strerror(errno)));
return UNIXERROR(ERRDOS,ERRbadpath);
- }
+ }
}
if (!CAN_WRITE(conn)) {
Modified: branches/SAMBA_3_0_25/source/smbd/open.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/open.c 2007-05-22 22:07:56 UTC (rev 23086)
+++ branches/SAMBA_3_0_25/source/smbd/open.c 2007-05-22 22:35:13 UTC (rev 23087)
@@ -47,7 +47,12 @@
NTSTATUS status = NT_STATUS_OK;
#ifdef O_NOFOLLOW
- if (!lp_symlinks(SNUM(conn))) {
+ /*
+ * Never follow symlinks on a POSIX client. The
+ * client should be doing this.
+ */
+
+ if (fsp->posix_open || !lp_symlinks(SNUM(conn))) {
flags |= O_NOFOLLOW;
}
#endif
Modified: branches/SAMBA_3_0_25/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/trans2.c 2007-05-22 22:07:56 UTC (rev 23086)
+++ branches/SAMBA_3_0_25/source/smbd/trans2.c 2007-05-22 22:35:13 UTC (rev 23087)
@@ -5632,9 +5632,17 @@
* to do this call. JRA.
*/
pstrcpy(fname, fsp->fsp_name);
- if (SMB_VFS_STAT(conn,fname,&sbuf) != 0) {
- DEBUG(3,("call_trans2setfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS,ERRbadpath);
+ if (INFO_LEVEL_IS_UNIX(info_level)) {
+ /* Always do lstat for UNIX calls. */
+ if (SMB_VFS_LSTAT(conn,fname,&sbuf)) {
+ DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",fname,strerror(errno)));
+ return UNIXERROR(ERRDOS,ERRbadpath);
+ }
+ } else {
+ if (SMB_VFS_STAT(conn,fname,&sbuf) != 0) {
+ DEBUG(3,("call_trans2setfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
+ return UNIXERROR(ERRDOS,ERRbadpath);
+ }
}
} else if (fsp && fsp->print_file) {
/*
@@ -5693,14 +5701,18 @@
return ERROR_NT(status);
}
- /*
- * For CIFS UNIX extensions the target name may not exist.
- */
+ if (INFO_LEVEL_IS_UNIX(info_level)) {
+ /*
+ * For CIFS UNIX extensions the target name may not exist.
+ */
- if(!VALID_STAT(sbuf) && !INFO_LEVEL_IS_UNIX(info_level)) {
- DEBUG(3,("call_trans2setfilepathinfo: stat of %s failed (%s)\n", fname, strerror(errno)));
+ /* Always do lstat for UNIX calls. */
+ SMB_VFS_LSTAT(conn,fname,&sbuf);
+
+ } else if (!VALID_STAT(sbuf) && SMB_VFS_STAT(conn,fname,&sbuf)) {
+ DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_STAT of %s failed (%s)\n",fname,strerror(errno)));
return UNIXERROR(ERRDOS,ERRbadpath);
- }
+ }
}
if (!CAN_WRITE(conn)) {
Modified: branches/SAMBA_3_0_26/source/smbd/open.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/open.c 2007-05-22 22:07:56 UTC (rev 23086)
+++ branches/SAMBA_3_0_26/source/smbd/open.c 2007-05-22 22:35:13 UTC (rev 23087)
@@ -47,7 +47,12 @@
NTSTATUS status = NT_STATUS_OK;
#ifdef O_NOFOLLOW
- if (!lp_symlinks(SNUM(conn))) {
+ /*
+ * Never follow symlinks on a POSIX client. The
+ * client should be doing this.
+ */
+
+ if (fsp->posix_open || !lp_symlinks(SNUM(conn))) {
flags |= O_NOFOLLOW;
}
#endif
Modified: branches/SAMBA_3_0_26/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/trans2.c 2007-05-22 22:07:56 UTC (rev 23086)
+++ branches/SAMBA_3_0_26/source/smbd/trans2.c 2007-05-22 22:35:13 UTC (rev 23087)
@@ -5723,9 +5723,17 @@
* to do this call. JRA.
*/
pstrcpy(fname, fsp->fsp_name);
- if (SMB_VFS_STAT(conn,fname,&sbuf) != 0) {
- DEBUG(3,("call_trans2setfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS,ERRbadpath);
+ if (INFO_LEVEL_IS_UNIX(info_level)) {
+ /* Always do lstat for UNIX calls. */
+ if (SMB_VFS_LSTAT(conn,fname,&sbuf)) {
+ DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",fname,strerror(errno)));
+ return UNIXERROR(ERRDOS,ERRbadpath);
+ }
+ } else {
+ if (SMB_VFS_STAT(conn,fname,&sbuf) != 0) {
+ DEBUG(3,("call_trans2setfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
+ return UNIXERROR(ERRDOS,ERRbadpath);
+ }
}
} else if (fsp && fsp->print_file) {
/*
@@ -5784,14 +5792,18 @@
return ERROR_NT(status);
}
- /*
- * For CIFS UNIX extensions the target name may not exist.
- */
+ if (INFO_LEVEL_IS_UNIX(info_level)) {
+ /*
+ * For CIFS UNIX extensions the target name may not exist.
+ */
- if(!VALID_STAT(sbuf) && !INFO_LEVEL_IS_UNIX(info_level)) {
- DEBUG(3,("call_trans2setfilepathinfo: stat of %s failed (%s)\n", fname, strerror(errno)));
+ /* Always do lstat for UNIX calls. */
+ SMB_VFS_LSTAT(conn,fname,&sbuf);
+
+ } else if (!VALID_STAT(sbuf) && SMB_VFS_STAT(conn,fname,&sbuf)) {
+ DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_STAT of %s failed (%s)\n",fname,strerror(errno)));
return UNIXERROR(ERRDOS,ERRbadpath);
- }
+ }
}
if (!CAN_WRITE(conn)) {
More information about the samba-cvs
mailing list