The branch, v3-6-test has been updated via 17113c3 vfs_catia: new version of the manual page for samba-3.6.x via ddb98ca vfs_catia: add my copyright via ad8fe62 vfs_catia: fix the translation to "vfs_translate_to_windows" via 58ac0d3 vfs_catia: add debug class for that module from 797c7ff selftest: Skip tests failing on ext4 fs.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test - Log ----------------------------------------------------------------- commit 17113c33a77a257560f33dbb35286ae20250a8f5 Author: Guenter Kukkukk <ku...@samba.org> Date: Sat Mar 9 04:45:15 2013 +0100 vfs_catia: new version of the manual page for samba-3.6.x well, i was not aware of the change ./docs-xml/manpages-3/ ./docs-xml/manpages/ in samba-4.0.x Signed-off-by: Guenter Kukkukk <ku...@samba.org> The last 4 patches address bug #9701 - vfs_catia is not working anymore (due to a former regression). commit ddb98cae501020e2fc02523b4083d16dc44d8908 Author: Guenter Kukkukk <ku...@samba.org> Date: Fri Mar 1 00:58:05 2013 +0100 vfs_catia: add my copyright Signed-off-by: Guenter Kukkukk <ku...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ad8fe6215f68d2aaf143b44888b75498cfd03e6d Author: Guenter Kukkukk <ku...@samba.org> Date: Wed Feb 27 05:50:52 2013 +0100 vfs_catia: fix the translation to "vfs_translate_to_windows" THANKS to an IRC user (Raimund ?) who asked for a char mapping possibility. I suggested vfs_catia - but it did not work! Hopefully now it will. :-) Signed-off-by: Guenter Kukkukk <ku...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 58ac0d30aba4a0c0aab2a358b42e17d8c0e896ca Author: Guenter Kukkukk <ku...@samba.org> Date: Wed Feb 27 05:34:05 2013 +0100 vfs_catia: add debug class for that module Signed-off-by: Guenter Kukkukk <ku...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: docs-xml/manpages-3/vfs_catia.8.xml | 66 +++++++++++++++++++++++++++++++++- source3/modules/vfs_catia.c | 35 ++++++++++++++++--- 2 files changed, 94 insertions(+), 7 deletions(-) Changeset truncated at 500 lines: diff --git a/docs-xml/manpages-3/vfs_catia.8.xml b/docs-xml/manpages-3/vfs_catia.8.xml index f1368a0..a786ecd 100644 --- a/docs-xml/manpages-3/vfs_catia.8.xml +++ b/docs-xml/manpages-3/vfs_catia.8.xml @@ -31,18 +31,31 @@ <para>The Catia CAD package commonly creates filenames that use characters that are illegal in CIFS filenames. The - <command>vfs_catia</command> VFS module implements a fixed character + <command>vfs_catia</command> VFS module implements a character mapping so that these files can be shared with CIFS clients. </para> <para>This module is stackable.</para> + <para>Up to samba version 3.4.x a fixed character mapping was used. + The invalid windows characters \ / : * ? " < > | and the blank + character were mapped in a hardcoded way. + </para> + + <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> <refsect1> <title>EXAMPLES</title> + <para>Samba versions up to 3.4.x:</para> <para>Map Catia filenames on the [CAD] share:</para> <programlisting> @@ -51,12 +64,60 @@ <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> + +<programlisting> + <smbconfsection name="[CAD]"/> + <smbconfoption name="path">/data/cad</smbconfoption> + <smbconfoption name="vfs objects">catia</smbconfoption> + <smbconfoption name="catia:mappings">0x22:0xa8</smbconfoption> +</programlisting> + + <para>To get the full formerly fixed mappings:</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> +</programlisting> + + <para>Unix filename to be translated (Note that the path delimiter "/" is not used here): + </para> + <para>a\a:a*a?a"a<a>a|a a</para> + + <para>Resulting windows filename:</para> + + <para>aÿa÷a¤a¿a¨a«a»a¦a±a + </para> + + <para>Note that the character mapping must work in BOTH directions + (unix -> windows and windows -> unix) to get unique and existing file names! + </para> + + <para>A NOT working example:</para> + +<programlisting> + <smbconfsection name="[CAD]"/> + <smbconfoption name="path">/data/cad</smbconfoption> + <smbconfoption name="vfs objects">catia</smbconfoption> + <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> + </refsect1> <refsect1> <title>VERSION</title> - <para>This man page is correct for version 3.0.25 of the Samba suite. + <para>This man page is correct for all versions up to 4.0.3 of the Samba suite. </para> </refsect1> @@ -67,6 +128,7 @@ were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed.</para> + <para>New version written by Guenter Kukkukk ku...@samba.org</para> </refsect1> diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 31b9f18..c0bb5ef 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -10,6 +10,7 @@ * * Copyright (C) Volker Lendecke, 2005 * Copyright (C) Aravind Srinivasan, 2009 + * Copyright (C) Guenter Kukkukk, 2013 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,6 +30,11 @@ #include "includes.h" #include "smbd/smbd.h" +static int vfs_catia_debug_level = DBGC_VFS; + +#undef DBGC_CLASS +#define DBGC_CLASS vfs_catia_debug_level + #define GLOBAL_SNUM 0xFFFFFFF #define MAP_SIZE 0xFF #define MAP_NUM 0x101 /* max unicode charval / MAP_SIZE */ @@ -295,7 +301,7 @@ static NTSTATUS catia_translate_name(struct vfs_handle_struct *handle, { char *name = NULL; char *mapped_name; - NTSTATUS ret; + NTSTATUS status, ret; /* * Copy the supplied name and free the memory for mapped_name, @@ -308,12 +314,12 @@ static NTSTATUS catia_translate_name(struct vfs_handle_struct *handle, errno = ENOMEM; return NT_STATUS_NO_MEMORY; } - ret = catia_string_replace_allocate(handle->conn, name, + status = catia_string_replace_allocate(handle->conn, name, &mapped_name, direction); TALLOC_FREE(name); - if (!NT_STATUS_IS_OK(ret)) { - return ret; + if (!NT_STATUS_IS_OK(status)) { + return status; } ret = SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction, @@ -321,6 +327,8 @@ static NTSTATUS catia_translate_name(struct vfs_handle_struct *handle, if (NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) { *pmapped_name = talloc_move(mem_ctx, &mapped_name); + /* we need to return the former translation result here */ + ret = status; } else { TALLOC_FREE(mapped_name); } @@ -1020,6 +1028,23 @@ static struct vfs_fn_pointers vfs_catia_fns = { NTSTATUS vfs_catia_init(void) { - return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "catia", + NTSTATUS ret; + + ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "catia", &vfs_catia_fns); + if (!NT_STATUS_IS_OK(ret)) + return ret; + + vfs_catia_debug_level = debug_add_class("catia"); + if (vfs_catia_debug_level == -1) { + vfs_catia_debug_level = DBGC_VFS; + DEBUG(0, ("vfs_catia: Couldn't register custom debugging " + "class!\n")); + } else { + DEBUG(10, ("vfs_catia: Debug class number of " + "'catia': %d\n", vfs_catia_debug_level)); + } + + return ret; + } -- Samba Shared Repository