The branch, master has been updated
       via  d924da9 docs/vfs_catia: rework man page
       via  8ac17ff docs/vfs_catia: remove space-char mapping recommendation
       via  8d75965 vfs_catia: use translate direction enum instead of int
       via  4cd7e1d vfs_streams_xattr: Do not attempt to write empty attribute 
twice
      from  9f25ad4 librpc: Shorten dcerpc_binding_handle_call a bit

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d924da9bc82bbb9f088eb15ac58377e2a1ae3a58
Author: David Disseldorp <dd...@samba.org>
Date:   Mon Jun 17 19:43:34 2013 +0200

    docs/vfs_catia: rework man page
    
    The vfs_catia man page refers to two configuration variants, one
    applying to Samba <= 3.4.x and one referring to Samba >= 3.5.x.
    This change removes all information specific to Samba <= 3.4.x, as such
    versions have been discontinued.
    
    This change also improves formatting and nomenclature: configuration
    parameters, examples and caveats are split into separate sections, and
    server-side/client-side terms replace the ambiguous use of Unix and
    Windows.
    
    Signed-off-by: David Disseldorp <dd...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Mon Jun 17 23:23:57 CEST 2013 on sn-devel-104

commit 8ac17fff8008eaed82ea788c7aaae4c4b5b604eb
Author: David Disseldorp <dd...@samba.org>
Date:   Mon Jun 17 19:43:33 2013 +0200

    docs/vfs_catia: remove space-char mapping recommendation
    
    The vfs_catia man page currently recommends the mapping of server-side
    space-characters (0x20) to client-side plus-minus characters (0xb1).
    
    This recommendation should not be made, as 0x20 is a valid filename
    component on both system character sets.
    
    Signed-off-by: David Disseldorp <dd...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 8d759658a0a6bbe7454fc46621dd6e1428835849
Author: David Disseldorp <dd...@samba.org>
Date:   Mon Jun 17 19:43:32 2013 +0200

    vfs_catia: use translate direction enum instead of int
    
    Signed-off-by: David Disseldorp <dd...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 4cd7e1d283f060e794023d5b0a48a7ec97d33820
Author: Christof Schmitt <christof.schm...@us.ibm.com>
Date:   Wed Jun 12 14:55:15 2013 -0700

    vfs_streams_xattr: Do not attempt to write empty attribute twice
    
    The create disposition FILE_OVERWRITE_IF is mapped to the flags
    O_CREAT|O_TRUNC. In vfs_streams_xattr, this triggers two calls to
    SMB_VFS_SETXATTR. The second can fail if O_EXCL is also set, resulting
    in an unnecessary error.
    
    Merge the identical code to handle O_CREAT and O_TRUNC to avoid setting
    an empty attribute twice. Also add the flags parameter to the debug
    message.
    
    Signed-off-by: Christof Schmitt <christof.schm...@us.ibm.com>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/manpages/vfs_catia.8.xml   |   77 +++++++++++++++++++----------------
 source3/modules/vfs_catia.c         |    2 +-
 source3/modules/vfs_streams_xattr.c |   42 +++++--------------
 3 files changed, 54 insertions(+), 67 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_catia.8.xml 
b/docs-xml/manpages/vfs_catia.8.xml
index b18dc48..02a9473 100644
--- a/docs-xml/manpages/vfs_catia.8.xml
+++ b/docs-xml/manpages/vfs_catia.8.xml
@@ -37,35 +37,38 @@
 
        <para>This module is stackable.</para>
 
-       <para>Up to samba version 3.4.x a fixed character mapping was used.
-       The invalid windows characters  \ / : * ? " &lt; &gt; | and the blank
-       character were mapped in a hardcoded way.
+       <para>The parameter "catia:mappings" specifies the mapping on a
+       per-character basis, see below.
        </para>
+</refsect1>
 
-       <para>Starting with samba-3.5.0 a more flexible mapping was introduced.
-       The new parameter "catia:mappings" now specifies the mapping on a char 
by char
-       basis using the notation: unix hex char 0x.. : windows hex char 0x..
-       Multiple character mappings are separated by a comma.
-       </para>
 
 
+<refsect1>
+        <title>OPTIONS</title>
+        <variablelist>
+               <varlistentry>
+               <term>catia:mappings = SERVER_HEX_CHAR:CLIENT_HEX_CHAR
+               </term>
+               <listitem>
+               <para>SERVER_HEX_CHAR specifies a 0x prefixed hexedecimal
+               character code that, when included in a Samba server-side
+               filename, will be mapped to CLIENT_HEX_CHAR for the CIFS
+               client.</para>
+               <para>The same mapping occurs in the opposite direction.
+               Multiple character mappings are separated by a comma.</para>
+               </listitem>
+               </varlistentry>
+       </variablelist>
 </refsect1>
 
 
+
 <refsect1>
        <title>EXAMPLES</title>
 
-       <para>Samba versions up to 3.4.x:</para>
-       <para>Map Catia filenames on the [CAD] share:</para>
-
-<programlisting>
-        <smbconfsection name="[CAD]"/>
-       <smbconfoption name="path">/data/cad</smbconfoption>
-       <smbconfoption name="vfs objects">catia</smbconfoption>
-</programlisting>
-
-       <para>Samba versions 3.5.0 and later:</para>
-       <para>Map Catia filenames on the [CAD] share:</para>
+       <para>Map server-side quotation-marks (") to client-side diaeresis
+       (&#x00a8;) on filenames in the [CAD] share:</para>
 
 <programlisting>
         <smbconfsection name="[CAD]"/>
@@ -74,25 +77,29 @@
        <smbconfoption name="catia:mappings">0x22:0xa8</smbconfoption>
 </programlisting>
 
-        <para>To get the full formerly fixed mappings:</para>
+        <para>Perform comprehensive mapping of common Catia filename 
characters:</para>
 <programlisting>
         <smbconfsection name="[CAD]"/>
        <smbconfoption name="path">/data/cad</smbconfoption>
        <smbconfoption name="vfs objects">catia</smbconfoption>
-       <smbconfoption 
name="catia:mappings">0x22:0xa8,0x2a:0xa4,0x2f:0xf8,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6,0x20:0xb1</smbconfoption>
+       <smbconfoption 
name="catia:mappings">0x22:0xa8,0x2a:0xa4,0x2f:0xf8,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6</smbconfoption>
 </programlisting>
 
-        <para>Unix filename to be translated (Note that the path delimiter "/" 
is not used here):
+        <para>Server-side filename to be translated (Note that the path 
delimiter "/" is not used here):
        </para>
-       <para>a\a:a*a?a"a&lt;a&gt;a|a a</para>
+       <para>a\a:a*a?a"a&lt;a&gt;a|a</para>
 
-       <para>Resulting windows filename:</para>
+       <para>Resulting filename, as seen by the client:</para>
 
-       
<para>a&#x00ff;a&#x00f7;a&#x00a4;a&#x00bf;a&#x00a8;a&#x00ab;a&#x00bb;a&#x00a6;a&#x00b1;a
+       
<para>a&#x00ff;a&#x00f7;a&#x00a4;a&#x00bf;a&#x00a8;a&#x00ab;a&#x00bb;a&#x00a6;a
        </para>
+</refsect1>
 
-        <para>Note that the character mapping must work in BOTH directions
-       (unix -&gt; windows and windows -&gt; unix) to get unique and existing 
file names!
+<refsect1>
+       <title>CAVEATS</title>
+
+       <para>Character mapping must work in BOTH directions (server -&gt;
+       client and client -&gt; server) to get unique and existing file names!
        </para>
 
        <para>A NOT working example:</para>
@@ -104,20 +111,20 @@
        <smbconfoption name="catia:mappings">0x3a:0x5f</smbconfoption>
 </programlisting>
 
-         <para>Here the colon ":" is mapped to the underscore "_".</para>
-        <para>Assuming a unix filename "a:should_work", which is well 
translated
-        to windows as "a_should_work".</para>
-        <para>BUT the reverse mapping from windows "a_should_work" to unix
-        will result in "a:should:work" - something like "file not found"
-        will be returned.
-        </para>
+       <para>Here the colon ":" is mapped to the underscore "_".</para>
+       <para>Assuming a server-side filename "a:should_work", which is
+       translated to "a_should_work" for the client.</para>
+       <para>BUT the reverse mapping from client "a_should_work" to server
+       will result in "a:should:work" - something like "file not found"
+       will be returned.
+       </para>
 
 </refsect1>
 
 <refsect1>
        <title>VERSION</title>
 
-       <para>This man page is correct for all versions up to 4.0.3 of the 
Samba suite.
+       <para>This man page is correct for Samba versions from 3.5.0 to 4.0.6.
        </para>
 </refsect1>
 
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 73b45b3..1a37dd2 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -222,7 +222,7 @@ static bool init_mappings(connection_struct *conn,
 static NTSTATUS catia_string_replace_allocate(connection_struct *conn,
                                              const char *name_in,
                                              char **mapped_name,
-                                             int direction)
+                                       enum vfs_translate_direction direction)
 {
        static smb_ucs2_t *tmpbuf = NULL;
        smb_ucs2_t *ptr;
diff --git a/source3/modules/vfs_streams_xattr.c 
b/source3/modules/vfs_streams_xattr.c
index 82e2dd8..11a3cc6 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -364,8 +364,8 @@ static int streams_xattr_open(vfs_handle_struct *handle,
        int baseflags;
        int hostfd = -1;
 
-       DEBUG(10, ("streams_xattr_open called for %s\n",
-                  smb_fname_str_dbg(smb_fname)));
+       DEBUG(10, ("streams_xattr_open called for %s with flags 0x%x\n",
+                  smb_fname_str_dbg(smb_fname), flags));
 
        if (!is_ntfs_stream_smb_fname(smb_fname)) {
                return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
@@ -447,40 +447,20 @@ static int streams_xattr_open(vfs_handle_struct *handle,
                goto fail;
        }
 
-       if (!NT_STATUS_IS_OK(status)) {
+       if ((!NT_STATUS_IS_OK(status) && (flags & O_CREAT)) ||
+           (flags & O_TRUNC)) {
                /*
-                * The attribute does not exist
+                * The attribute does not exist or needs to be truncated
                 */
 
-                if (flags & O_CREAT) {
-                       /*
-                        * Darn, xattrs need at least 1 byte
-                        */
-                        char null = '\0';
+               /*
+                * Darn, xattrs need at least 1 byte
+                */
+               char null = '\0';
 
-                       DEBUG(10, ("creating attribute %s on file %s\n",
-                                  xattr_name, smb_fname->base_name));
+               DEBUG(10, ("creating or truncating attribute %s on file %s\n",
+                          xattr_name, smb_fname->base_name));
 
-                       if (fsp->base_fsp->fh->fd != -1) {
-                               if (SMB_VFS_FSETXATTR(
-                                       fsp->base_fsp, xattr_name,
-                                       &null, sizeof(null),
-                                       flags & O_EXCL ? XATTR_CREATE : 0) == 
-1) {
-                                       goto fail;
-                               }
-                       } else {
-                               if (SMB_VFS_SETXATTR(
-                                       handle->conn, smb_fname->base_name,
-                                       xattr_name, &null, sizeof(null),
-                                       flags & O_EXCL ? XATTR_CREATE : 0) == 
-1) {
-                                       goto fail;
-                               }
-                       }
-               }
-       }
-
-       if (flags & O_TRUNC) {
-               char null = '\0';
                if (fsp->base_fsp->fh->fd != -1) {
                        if (SMB_VFS_FSETXATTR(
                                        fsp->base_fsp, xattr_name,


-- 
Samba Shared Repository

Reply via email to