summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-07-09 15:50:47 -0700
committerAndrew Bartlett <abartlet@samba.org>2013-07-19 17:52:32 +1000
commit1766f9e3878a8ee64104a7a1c0874a7a0c6a2417 (patch)
treedbeb22433549ed8a914e9ce7695fef1328241635 /source3/lib
parent51c68c28b27cd1644187af32cc4f630a7471cd28 (diff)
downloadsamba-1766f9e3878a8ee64104a7a1c0874a7a0c6a2417.tar.gz
samba-1766f9e3878a8ee64104a7a1c0874a7a0c6a2417.tar.bz2
samba-1766f9e3878a8ee64104a7a1c0874a7a0c6a2417.zip
Add ea_list_has_invalid_name() function.
Invalid character list probed from Windows Server 2012. Bug 9992: Windows error 0x800700FE when copying files with xattr names containing ":" Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/filename_util.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c
index 656dd2abce..19ffcc3638 100644
--- a/source3/lib/filename_util.c
+++ b/source3/lib/filename_util.c
@@ -224,3 +224,37 @@ bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname)
return strcasecmp_m(smb_fname->stream_name, "::$DATA") == 0;
}
+
+/****************************************************************************
+ Filter out Windows invalid EA names (list probed from Windows 2012).
+****************************************************************************/
+
+static char bad_ea_name_chars[] = "\"*+,/:;<=>?[\\]|";
+
+bool is_invalid_windows_ea_name(const char *name)
+{
+ int i;
+ /* EA name is pulled as ascii so we can examine
+ individual bytes here. */
+ for (i = 0; name[i] != 0; i++) {
+ int val = (name[i] & 0xff);
+ if (val < ' ' || strchr(bad_ea_name_chars, val)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool ea_list_has_invalid_name(struct ea_list *ea_list)
+{
+ if (lp_posix_pathnames()) {
+ return false;
+ }
+
+ for (;ea_list; ea_list = ea_list->next) {
+ if (is_invalid_windows_ea_name(ea_list->ea.name)) {
+ return true;
+ }
+ }
+ return false;
+}