summaryrefslogtreecommitdiffstats
path: root/source3/modules
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
commit6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch)
tree850c71039563c16a5d563c47e7ba2ab645baf198 /source3/modules
parent6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff)
parent2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff)
downloadsamba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz
samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.xz
samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16samba-4.0.0alpha16
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/CP437.c135
-rw-r--r--source3/modules/CP850.c121
-rw-r--r--source3/modules/charset_macosxfs.c604
-rw-r--r--source3/modules/gpfs.c19
-rw-r--r--source3/modules/nfs4_acls.c74
-rw-r--r--source3/modules/nfs4_acls.h3
-rw-r--r--source3/modules/onefs_acl.c2
-rw-r--r--source3/modules/onefs_cbrl.c2
-rw-r--r--source3/modules/onefs_open.c14
-rw-r--r--source3/modules/onefs_streams.c4
-rw-r--r--source3/modules/vfs_acl_common.c33
-rw-r--r--source3/modules/vfs_acl_tdb.c3
-rw-r--r--source3/modules/vfs_acl_xattr.c2
-rw-r--r--source3/modules/vfs_afsacl.c20
-rw-r--r--source3/modules/vfs_aio_fork.c10
-rw-r--r--source3/modules/vfs_audit.c6
-rw-r--r--source3/modules/vfs_cap.c6
-rw-r--r--source3/modules/vfs_default.c13
-rw-r--r--source3/modules/vfs_dirsort.c2
-rw-r--r--source3/modules/vfs_expand_msdfs.c2
-rw-r--r--source3/modules/vfs_extd_audit.c6
-rw-r--r--source3/modules/vfs_fileid.c4
-rw-r--r--source3/modules/vfs_full_audit.c21
-rw-r--r--source3/modules/vfs_gpfs.c55
-rw-r--r--source3/modules/vfs_gpfs.h12
-rw-r--r--source3/modules/vfs_gpfs_hsm_notify.c110
-rw-r--r--source3/modules/vfs_hpuxacl.c8
-rw-r--r--source3/modules/vfs_notify_fam.c2
-rw-r--r--source3/modules/vfs_preopen.c10
-rw-r--r--source3/modules/vfs_recycle.c32
-rw-r--r--source3/modules/vfs_scannedonly.c47
-rw-r--r--source3/modules/vfs_shadow_copy.c7
-rw-r--r--source3/modules/vfs_shadow_copy2.c1811
-rw-r--r--source3/modules/vfs_smb_traffic_analyzer.c30
-rw-r--r--source3/modules/vfs_smb_traffic_analyzer.h2
-rw-r--r--source3/modules/vfs_streams_depot.c4
-rw-r--r--source3/modules/vfs_streams_xattr.c12
-rw-r--r--source3/modules/vfs_time_audit.c12
-rw-r--r--source3/modules/vfs_tsmsm.c2
-rw-r--r--source3/modules/vfs_xattr_tdb.c11
-rw-r--r--source3/modules/weird.c134
-rw-r--r--source3/modules/wscript_build86
42 files changed, 1671 insertions, 1822 deletions
diff --git a/source3/modules/CP437.c b/source3/modules/CP437.c
deleted file mode 100644
index 96d14b1f023..00000000000
--- a/source3/modules/CP437.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Conversion table for CP437 charset also known as IBM437
- *
- * Copyright (C) Alexander Bokovoy 2003
- *
- * Conversion tables are generated using GNU libc 2.2.5's
- * localedata/charmaps/IBM437 table and source/script/gen-8bit-gap.sh script
- *
- * 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
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-
-static const uint16 to_ucs2[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
- 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
- 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
- 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
- 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
- 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
- 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
- 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
- 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
- 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
- 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
- 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
- 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
- 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4,
- 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
- 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248,
- 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static const struct charset_gap_table from_idx[] = {
- { 0x0000, 0x007f, 0 },
- { 0x00a0, 0x00c9, -32 },
- { 0x00d1, 0x00ff, -39 },
- { 0x0192, 0x0192, -185 },
- { 0x0393, 0x0398, -697 },
- { 0x03a3, 0x03a9, -707 },
- { 0x03b1, 0x03b5, -714 },
- { 0x03c0, 0x03c6, -724 },
- { 0x207f, 0x207f, -8076 },
- { 0x20a7, 0x20a7, -8115 },
- { 0x2219, 0x221e, -8484 },
- { 0x2229, 0x2229, -8494 },
- { 0x2248, 0x2248, -8524 },
- { 0x2261, 0x2265, -8548 },
- { 0x2310, 0x2310, -8718 },
- { 0x2320, 0x2321, -8733 },
- { 0x2500, 0x2502, -9211 },
- { 0x250c, 0x251c, -9220 },
- { 0x2524, 0x2524, -9227 },
- { 0x252c, 0x252c, -9234 },
- { 0x2534, 0x2534, -9241 },
- { 0x253c, 0x253c, -9248 },
- { 0x2550, 0x256c, -9267 },
- { 0x2580, 0x2593, -9286 },
- { 0x25a0, 0x25a0, -9298 },
- { 0xffff, 0xffff, 0 }
-};
-
-static const unsigned char from_ucs2[] = {
-
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0xff, 0xad, 0x9b, 0x9c, 0x00, 0x9d, 0x00, 0x00,
- 0x00, 0x00, 0xa6, 0xae, 0xaa, 0x00, 0x00, 0x00,
- 0xf8, 0xf1, 0xfd, 0x00, 0x00, 0xe6, 0x00, 0xfa,
- 0x00, 0x00, 0xa7, 0xaf, 0xac, 0xab, 0x00, 0xa8,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8f, 0x92, 0x80,
- 0x00, 0x90, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x99,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00,
- 0xe1, 0x85, 0xa0, 0x83, 0x00, 0x84, 0x86, 0x91,
- 0x87, 0x8a, 0x82, 0x88, 0x89, 0x8d, 0xa1, 0x8c,
- 0x8b, 0x00, 0xa4, 0x95, 0xa2, 0x93, 0x00, 0x94,
- 0xf6, 0x00, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00,
- 0x98, 0x9f, 0xe2, 0x00, 0x00, 0x00, 0x00, 0xe9,
- 0xe4, 0x00, 0x00, 0xe8, 0x00, 0x00, 0xea, 0xe0,
- 0x00, 0x00, 0xeb, 0xee, 0xe3, 0x00, 0x00, 0xe5,
- 0xe7, 0x00, 0xed, 0xfc, 0x9e, 0xf9, 0xfb, 0x00,
- 0x00, 0x00, 0xec, 0xef, 0xf7, 0xf0, 0x00, 0x00,
- 0xf3, 0xf2, 0xa9, 0xf4, 0xf5, 0xc4, 0x00, 0xb3,
- 0xda, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00,
- 0xc0, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00,
- 0xc3, 0xb4, 0xc2, 0xc1, 0xc5, 0xcd, 0xba, 0xd5,
- 0xd6, 0xc9, 0xb8, 0xb7, 0xbb, 0xd4, 0xd3, 0xc8,
- 0xbe, 0xbd, 0xbc, 0xc6, 0xc7, 0xcc, 0xb5, 0xb6,
- 0xb9, 0xd1, 0xd2, 0xcb, 0xcf, 0xd0, 0xca, 0xd8,
- 0xd7, 0xce, 0xdf, 0x00, 0x00, 0x00, 0xdc, 0x00,
- 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0xdd, 0x00,
- 0x00, 0x00, 0xde, 0xb0, 0xb1, 0xb2, 0xfe,
-};
-
-SMB_GENERATE_CHARSET_MODULE_8_BIT_GAP(CP437)
diff --git a/source3/modules/CP850.c b/source3/modules/CP850.c
deleted file mode 100644
index 40730c0d8d6..00000000000
--- a/source3/modules/CP850.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Conversion table for CP850 charset also known as IBM850.
- *
- * Copyright (C) Alexander Bokovoy 2003
- *
- * Conversion tables are generated using GNU libc 2.2.5's
- * localedata/charmaps/IBM850 table and source/script/gen-8bit-gap.sh script
- *
- * 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
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-
-static const uint16 to_ucs2[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
- 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
- 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
- 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
- 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
- 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
- 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
- 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0,
- 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
- 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3,
- 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
- 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE,
- 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
- 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE,
- 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
- 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8,
- 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static const struct charset_gap_table from_idx[] = {
- /* start, end, idx */
- { 0x0000, 0x007f, 0 },
- { 0x00a0, 0x00ff, -32 },
- { 0x0131, 0x0131, -81 },
- { 0x0192, 0x0192, -177 },
- { 0x2017, 0x2017, -7989 },
- { 0x2500, 0x2502, -9245 },
- { 0x250c, 0x251c, -9254 },
- { 0x2524, 0x2524, -9261 },
- { 0x252c, 0x252c, -9268 },
- { 0x2534, 0x2534, -9275 },
- { 0x253c, 0x253c, -9282 },
- { 0x2550, 0x256c, -9301 },
- { 0x2580, 0x2588, -9320 },
- { 0x2591, 0x2593, -9328 },
- { 0x25a0, 0x25a0, -9340 },
- { 0xffff, 0xffff, 0 }
-};
-static const unsigned char from_ucs2[] = {
-
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0xff, 0xad, 0xbd, 0x9c, 0xcf, 0xbe, 0xdd, 0xf5,
- 0xf9, 0xb8, 0xa6, 0xae, 0xaa, 0xf0, 0xa9, 0xee,
- 0xf8, 0xf1, 0xfd, 0xfc, 0xef, 0xe6, 0xf4, 0xfa,
- 0xf7, 0xfb, 0xa7, 0xaf, 0xac, 0xab, 0xf3, 0xa8,
- 0xb7, 0xb5, 0xb6, 0xc7, 0x8e, 0x8f, 0x92, 0x80,
- 0xd4, 0x90, 0xd2, 0xd3, 0xde, 0xd6, 0xd7, 0xd8,
- 0xd1, 0xa5, 0xe3, 0xe0, 0xe2, 0xe5, 0x99, 0x9e,
- 0x9d, 0xeb, 0xe9, 0xea, 0x9a, 0xed, 0xe8, 0xe1,
- 0x85, 0xa0, 0x83, 0xc6, 0x84, 0x86, 0x91, 0x87,
- 0x8a, 0x82, 0x88, 0x89, 0x8d, 0xa1, 0x8c, 0x8b,
- 0xd0, 0xa4, 0x95, 0xa2, 0x93, 0xe4, 0x94, 0xf6,
- 0x9b, 0x97, 0xa3, 0x96, 0x81, 0xec, 0xe7, 0x98,
- 0xd5, 0x9f, 0xf2, 0xc4, 0x00, 0xb3, 0xda, 0x00,
- 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00,
- 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0xc3, 0xb4,
- 0xc2, 0xc1, 0xc5, 0xcd, 0xba, 0x00, 0x00, 0xc9,
- 0x00, 0x00, 0xbb, 0x00, 0x00, 0xc8, 0x00, 0x00,
- 0xbc, 0x00, 0x00, 0xcc, 0x00, 0x00, 0xb9, 0x00,
- 0x00, 0xcb, 0x00, 0x00, 0xca, 0x00, 0x00, 0xce,
- 0xdf, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00,
- 0xdb, 0xb0, 0xb1, 0xb2, 0xfe,
-};
-
-SMB_GENERATE_CHARSET_MODULE_8_BIT_GAP(CP850)
-
diff --git a/source3/modules/charset_macosxfs.c b/source3/modules/charset_macosxfs.c
deleted file mode 100644
index 8c2fdc7776b..00000000000
--- a/source3/modules/charset_macosxfs.c
+++ /dev/null
@@ -1,604 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba charset module for Mac OS X/Darwin
- Copyright (C) Benjamin Riefenstahl 2003
-
- 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
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
- * modules/charset_macosxfs.c
- *
- * A Samba charset module to use on Mac OS X/Darwin as the filesystem
- * and display encoding.
- *
- * Actually two implementations are provided here. The default
- * implementation is based on the official CFString API. The other is
- * based on internal CFString APIs as defined in the OpenDarwin
- * source.
- */
-
-#include "includes.h"
-
-/*
- * Include OS frameworks. These are only needed in this module.
- */
-#include <CoreFoundation/CFString.h>
-
-/*
- * See if autoconf has found us the internal headers in some form.
- */
-#if HAVE_COREFOUNDATION_CFSTRINGENCODINGCONVERTER_H
-# include <CoreFoundation/CFStringEncodingConverter.h>
-# include <CoreFoundation/CFUnicodePrecomposition.h>
-# define USE_INTERNAL_API 1
-#elif HAVE_CFSTRINGENCODINGCONVERTER_H
-# include <CFStringEncodingConverter.h>
-# include <CFUnicodePrecomposition.h>
-# define USE_INTERNAL_API 1
-#endif
-
-/*
- * Compile time configuration: Do we want debug output?
- */
-/* #define DEBUG_STRINGS 1 */
-
-/*
- * A simple, but efficient memory provider for our buffers.
- */
-static inline void *resize_buffer (void *buffer, size_t *size, size_t newsize)
-{
- if (newsize > *size) {
- *size = newsize + 128;
- buffer = SMB_REALLOC(buffer, *size);
- }
- return buffer;
-}
-
-/*
- * While there is a version of OpenDarwin for intel, the usual case is
- * big-endian PPC. So we need byte swapping to handle the
- * little-endian byte order of the network protocol. We also need an
- * additional dynamic buffer to do this work for incoming data blocks,
- * because we have to consider the original data as constant.
- *
- * We abstract the differences away by providing a simple facade with
- * these functions/macros:
- *
- * le_to_native(dst,src,len)
- * native_to_le(cp,len)
- * set_ucbuffer_with_le(buffer,bufsize,data,size)
- * set_ucbuffer_with_le_copy(buffer,bufsize,data,size,reserve)
- */
-#ifdef WORDS_BIGENDIAN
-
-static inline void swap_bytes (char * dst, const char * src, size_t len)
-{
- const char *srcend = src + len;
- while (src < srcend) {
- dst[0] = src[1];
- dst[1] = src[0];
- dst += 2;
- src += 2;
- }
-}
-static inline void swap_bytes_inplace (char * cp, size_t len)
-{
- char temp;
- char *end = cp + len;
- while (cp < end) {
- temp = cp[1];
- cp[1] = cp[0];
- cp[0] = temp;
- cp += 2;
- }
-}
-
-#define le_to_native(dst,src,len) swap_bytes(dst,src,len)
-#define native_to_le(cp,len) swap_bytes_inplace(cp,len)
-#define set_ucbuffer_with_le(buffer,bufsize,data,size) \
- set_ucbuffer_with_le_copy(buffer,bufsize,data,size,0)
-
-#else /* ! WORDS_BIGENDIAN */
-
-#define le_to_native(dst,src,len) memcpy(dst,src,len)
-#define native_to_le(cp,len) /* nothing */
-#define set_ucbuffer_with_le(buffer,bufsize,data,size) \
- (((void)(bufsize)),(UniChar*)(data))
-
-#endif
-
-static inline UniChar *set_ucbuffer_with_le_copy (
- UniChar *buffer, size_t *bufsize,
- const void *data, size_t size, size_t reserve)
-{
- buffer = resize_buffer(buffer, bufsize, size+reserve);
- le_to_native((char*)buffer,data,size);
- return buffer;
-}
-
-
-/*
- * A simple hexdump function for debugging error conditions.
- */
-#define debug_out(s) DEBUG(0,(s))
-
-#ifdef DEBUG_STRINGS
-
-static void hexdump( const char * label, const char * s, size_t len )
-{
- size_t restlen = len;
- debug_out("<<<<<<<\n");
- debug_out(label);
- debug_out("\n");
- while (restlen > 0) {
- char line[100];
- size_t i, j;
- char * d = line;
-#undef sprintf
- d += sprintf(d, "%04X ", (unsigned)(len-restlen));
- *d++ = ' ';
- for( i = 0; i<restlen && i<8; ++i ) {
- d += sprintf(d, "%02X ", ((unsigned)s[i]) & 0xFF);
- }
- for( j = i; j<8; ++j ) {
- d += sprintf(d, " ");
- }
- *d++ = ' ';
- for( i = 8; i<restlen && i<16; ++i ) {
- d += sprintf(d, "%02X ", ((unsigned)s[i]) & 0xFF);
- }
- for( j = i; j<16; ++j ) {
- d += sprintf(d, " ");
- }
- *d++ = ' ';
- for( i = 0; i<restlen && i<16; ++i ) {
- if(s[i] < ' ' || s[i] >= 0x7F || !isprint(s[i]))
- *d++ = '.';
- else
- *d++ = s[i];
- }
- *d++ = '\n';
- *d = 0;
- restlen -= i;
- s += i;
- debug_out(line);
- }
- debug_out(">>>>>>>\n");
-}
-
-#else /* !DEBUG_STRINGS */
-
-#define hexdump(label,s,len) /* nothing */
-
-#endif
-
-
-#if !USE_INTERNAL_API
-
-/*
- * An implementation based on documented Mac OS X APIs.
- *
- * This does a certain amount of memory management, creating and
- * manipulating CFString objects. We try to minimize the impact by
- * keeping those objects around and re-using them. We also use
- * external backing store for the CFStrings where this is possible and
- * benficial.
- *
- * The Unicode normalizations forms available at this level are
- * generic, not specifically for the file system. So they may not be
- * perfect fits.
- */
-static size_t macosxfs_encoding_pull(
- void *cd, /* Encoder handle */
- char **inbuf, size_t *inbytesleft, /* Script string */
- char **outbuf, size_t *outbytesleft) /* UTF-16-LE string */
-{
- static const int script_code = kCFStringEncodingUTF8;
- static CFMutableStringRef cfstring = NULL;
- size_t outsize;
- CFRange range;
-
- (void) cd; /* UNUSED */
-
- if (0 == *inbytesleft) {
- return 0;
- }
-
- if (NULL == cfstring) {
- /*
- * A version with an external backing store as in the
- * push function should have been more efficient, but
- * testing shows, that it is actually slower (!).
- * Maybe kCFAllocatorDefault gets shortcut evaluation
- * internally, while kCFAllocatorNull doesn't.
- */
- cfstring = CFStringCreateMutable(kCFAllocatorDefault,0);
- }
-
- /*
- * Three methods of appending to a CFString, choose the most
- * efficient.
- */
- if (0 == (*inbuf)[*inbytesleft-1]) {
- CFStringAppendCString(cfstring, *inbuf, script_code);
- } else if (*inbytesleft <= 255) {
- Str255 buffer;
- buffer[0] = *inbytesleft;
- memcpy(buffer+1, *inbuf, buffer[0]);
- CFStringAppendPascalString(cfstring, buffer, script_code);
- } else {
- /*
- * We would like to use a fixed buffer and a loop
- * here, but than we can't garantee that the input is
- * well-formed UTF-8, as we are supposed to do.
- */
- static char *buffer = NULL;
- static size_t buflen = 0;
- buffer = resize_buffer(buffer, &buflen, *inbytesleft+1);
- memcpy(buffer, *inbuf, *inbytesleft);
- buffer[*inbytesleft] = 0;
- CFStringAppendCString(cfstring, *inbuf, script_code);
- }
-
- /*
- * Compose characters, using the non-canonical composition
- * form.
- */
- CFStringNormalize(cfstring, kCFStringNormalizationFormC);
-
- outsize = CFStringGetLength(cfstring);
- range = CFRangeMake(0,outsize);
-
- if (outsize == 0) {
- /*
- * HACK: smbd/mangle_hash2.c:is_legal_name() expects
- * errors here. That function will always pass 2
- * characters. smbd/open.c:check_for_pipe() cuts a
- * patchname to 10 characters blindly. Suppress the
- * debug output in those cases.
- */
- if(2 != *inbytesleft && 10 != *inbytesleft) {
- debug_out("String conversion: "
- "An unknown error occurred\n");
- hexdump("UTF8->UTF16LE (old) input",
- *inbuf, *inbytesleft);
- }
- errno = EILSEQ; /* Not sure, but this is what we have
- * actually seen. */
- return -1;
- }
- if (outsize*2 > *outbytesleft) {
- CFStringDelete(cfstring, range);
- debug_out("String conversion: "
- "Output buffer too small\n");
- hexdump("UTF8->UTF16LE (old) input",
- *inbuf, *inbytesleft);
- errno = E2BIG;
- return -1;
- }
-
- CFStringGetCharacters(cfstring, range, (UniChar*)*outbuf);
- CFStringDelete(cfstring, range);
-
- native_to_le(*outbuf, outsize*2);
-
- /*
- * Add a converted null byte, if the CFString conversions
- * prevented that until now.
- */
- if (0 == (*inbuf)[*inbytesleft-1] &&
- (0 != (*outbuf)[outsize*2-1] || 0 != (*outbuf)[outsize*2-2])) {
-
- if ((outsize*2+2) > *outbytesleft) {
- debug_out("String conversion: "
- "Output buffer too small\n");
- hexdump("UTF8->UTF16LE (old) input",
- *inbuf, *inbytesleft);
- errno = E2BIG;
- return -1;
- }
-
- (*outbuf)[outsize*2] = (*outbuf)[outsize*2+1] = 0;
- outsize += 2;
- }
-
- *inbuf += *inbytesleft;
- *inbytesleft = 0;
- *outbuf += outsize*2;
- *outbytesleft -= outsize*2;
-
- return 0;
-}
-
-static size_t macosxfs_encoding_push(
- void *cd, /* Encoder handle */
- char **inbuf, size_t *inbytesleft, /* UTF-16-LE string */
- char **outbuf, size_t *outbytesleft) /* Script string */
-{
- static const int script_code = kCFStringEncodingUTF8;
- static CFMutableStringRef cfstring = NULL;
- static UniChar *buffer = NULL;
- static size_t buflen = 0;
- CFIndex outsize, cfsize, charsconverted;
-
- (void) cd; /* UNUSED */
-
- if (0 == *inbytesleft) {
- return 0;
- }
-
- /*
- * We need a buffer that can hold 4 times the original data,
- * because that is the theoretical maximum that decomposition
- * can create currently (in Unicode 4.0).
- */
- buffer = set_ucbuffer_with_le_copy(
- buffer, &buflen, *inbuf, *inbytesleft, 3 * *inbytesleft);
-
- if (NULL == cfstring) {
- cfstring = CFStringCreateMutableWithExternalCharactersNoCopy(
- kCFAllocatorDefault,
- buffer, *inbytesleft/2, buflen/2,
- kCFAllocatorNull);
- } else {
- CFStringSetExternalCharactersNoCopy(
- cfstring,
- buffer, *inbytesleft/2, buflen/2);
- }
-
- /*
- * Decompose characters, using the non-canonical decomposition
- * form.
- *
- * NB: This isn't exactly what HFS+ wants (see note on
- * kCFStringEncodingUseHFSPlusCanonical in
- * CFStringEncodingConverter.h), but AFAIK it's the best that
- * the official API can do.
- */
- CFStringNormalize(cfstring, kCFStringNormalizationFormD);
-
- cfsize = CFStringGetLength(cfstring);
- charsconverted = CFStringGetBytes(
- cfstring, CFRangeMake(0,cfsize),
- script_code, 0, False,
- *outbuf, *outbytesleft, &outsize);
-
- if (0 == charsconverted) {
- debug_out("String conversion: "
- "Buffer too small or not convertable\n");
- hexdump("UTF16LE->UTF8 (old) input",
- *inbuf, *inbytesleft);
- errno = EILSEQ; /* Probably more likely. */
- return -1;
- }
-
- /*
- * Add a converted null byte, if the CFString conversions
- * prevented that until now.
- */
- if (0 == (*inbuf)[*inbytesleft-1] && 0 == (*inbuf)[*inbytesleft-2] &&
- (0 != (*outbuf)[outsize-1])) {
-
- if (((size_t)outsize+1) > *outbytesleft) {
- debug_out("String conversion: "
- "Output buffer too small\n");
- hexdump("UTF16LE->UTF8 (old) input",
- *inbuf, *inbytesleft);
- errno = E2BIG;
- return -1;
- }
-
- (*outbuf)[outsize] = 0;
- ++outsize;
- }
-
- *inbuf += *inbytesleft;
- *inbytesleft = 0;
- *outbuf += outsize;
- *outbytesleft -= outsize;
-
- return 0;
-}
-
-#else /* USE_INTERNAL_API */
-
-/*
- * An implementation based on internal code as known from the
- * OpenDarwin CVS.
- *
- * This code doesn't need much memory management because it uses
- * functions that operate on the raw memory directly.
- *
- * The push routine here is faster and more compatible with HFS+ than
- * the other implementation above. The pull routine is only faster
- * for some strings, slightly slower for others. The pull routine
- * looses because it has to iterate over the data twice, once to
- * decode UTF-8 and than to do the character composition required by
- * Windows.
- */
-static size_t macosxfs_encoding_pull(
- void *cd, /* Encoder handle */
- char **inbuf, size_t *inbytesleft, /* Script string */
- char **outbuf, size_t *outbytesleft) /* UTF-16-LE string */
-{
- static const int script_code = kCFStringEncodingUTF8;
- UInt32 srcCharsUsed = 0;
- UInt32 dstCharsUsed = 0;
- UInt32 result;
- uint32_t dstDecomposedUsed = 0;
- uint32_t dstPrecomposedUsed = 0;
-
- (void) cd; /* UNUSED */
-
- if (0 == *inbytesleft) {
- return 0;
- }
-
- result = CFStringEncodingBytesToUnicode(
- script_code, kCFStringEncodingComposeCombinings,
- *inbuf, *inbytesleft, &srcCharsUsed,
- (UniChar*)*outbuf, *outbytesleft, &dstCharsUsed);
-
- switch(result) {
- case kCFStringEncodingConversionSuccess:
- if (*inbytesleft == srcCharsUsed)
- break;
- else
- ; /*fall through*/
- case kCFStringEncodingInsufficientOutputBufferLength:
- debug_out("String conversion: "
- "Output buffer too small\n");
- hexdump("UTF8->UTF16LE (new) input",
- *inbuf, *inbytesleft);
- errno = E2BIG;
- return -1;
- case kCFStringEncodingInvalidInputStream:
- /*
- * HACK: smbd/mangle_hash2.c:is_legal_name() expects
- * errors here. That function will always pass 2
- * characters. smbd/open.c:check_for_pipe() cuts a
- * patchname to 10 characters blindly. Suppress the
- * debug output in those cases.
- */
- if(2 != *inbytesleft && 10 != *inbytesleft) {
- debug_out("String conversion: "
- "Invalid input sequence\n");
- hexdump("UTF8->UTF16LE (new) input",
- *inbuf, *inbytesleft);
- }
- errno = EILSEQ;
- return -1;
- case kCFStringEncodingConverterUnavailable:
- debug_out("String conversion: "
- "Unknown encoding\n");
- hexdump("UTF8->UTF16LE (new) input",
- *inbuf, *inbytesleft);
- errno = EINVAL;
- return -1;
- }
-
- /*
- * It doesn't look like CFStringEncodingBytesToUnicode() can
- * produce precomposed characters (flags=ComposeCombinings
- * doesn't do it), so we need another pass over the data here.
- * We can do this in-place, as the string can only get
- * shorter.
- *
- * (Actually in theory there should be an internal
- * decomposition and reordering before the actual composition
- * step. But we should be able to rely on that we always get
- * fully decomposed strings for input, so this can't create
- * problems in reality.)
- */
- CFUniCharPrecompose(
- (const UTF16Char *)*outbuf, dstCharsUsed, &dstDecomposedUsed,
- (UTF16Char *)*outbuf, dstCharsUsed, &dstPrecomposedUsed);
-
- native_to_le(*outbuf, dstPrecomposedUsed*2);
-
- *inbuf += srcCharsUsed;
- *inbytesleft -= srcCharsUsed;
- *outbuf += dstPrecomposedUsed*2;
- *outbytesleft -= dstPrecomposedUsed*2;
-
- return 0;
-}
-
-static size_t macosxfs_encoding_push(
- void *cd, /* Encoder handle */
- char **inbuf, size_t *inbytesleft, /* UTF-16-LE string */
- char **outbuf, size_t *outbytesleft) /* Script string */
-{
- static const int script_code = kCFStringEncodingUTF8;
- static UniChar *buffer = NULL;
- static size_t buflen = 0;
- UInt32 srcCharsUsed=0, dstCharsUsed=0, result;
-
- (void) cd; /* UNUSED */
-
- if (0 == *inbytesleft) {
- return 0;
- }
-
- buffer = set_ucbuffer_with_le(
- buffer, &buflen, *inbuf, *inbytesleft);
-
- result = CFStringEncodingUnicodeToBytes(
- script_code, kCFStringEncodingUseHFSPlusCanonical,
- buffer, *inbytesleft/2, &srcCharsUsed,
- *outbuf, *outbytesleft, &dstCharsUsed);
-
- switch(result) {
- case kCFStringEncodingConversionSuccess:
- if (*inbytesleft/2 == srcCharsUsed)
- break;
- else
- ; /*fall through*/
- case kCFStringEncodingInsufficientOutputBufferLength:
- debug_out("String conversion: "
- "Output buffer too small\n");
- hexdump("UTF16LE->UTF8 (new) input",
- *inbuf, *inbytesleft);
- errno = E2BIG;
- return -1;
- case kCFStringEncodingInvalidInputStream:
- /*
- * HACK: smbd/open.c:check_for_pipe():is_legal_name()
- * cuts a pathname to 10 characters blindly. Suppress
- * the debug output in those cases.
- */
- if(10 != *inbytesleft) {
- debug_out("String conversion: "
- "Invalid input sequence\n");
- hexdump("UTF16LE->UTF8 (new) input",
- *inbuf, *inbytesleft);
- }
- errno = EILSEQ;
- return -1;
- case kCFStringEncodingConverterUnavailable:
- debug_out("String conversion: "
- "Unknown encoding\n");
- hexdump("UTF16LE->UTF8 (new) input",
- *inbuf, *inbytesleft);
- errno = EINVAL;
- return -1;
- }
-
- *inbuf += srcCharsUsed*2;
- *inbytesleft -= srcCharsUsed*2;
- *outbuf += dstCharsUsed;
- *outbytesleft -= dstCharsUsed;
-
- return 0;
-}
-
-#endif /* USE_INTERNAL_API */
-
-/*
- * For initialization, actually install the encoding as "macosxfs".
- */
-static struct charset_functions macosxfs_encoding_functions = {
- "MACOSXFS", macosxfs_encoding_pull, macosxfs_encoding_push
-};
-
-NTSTATUS charset_macosxfs_init(void)
-{
- if (!smb_register_charset(&macosxfs_encoding_functions)) {
- return NT_STATUS_INTERNAL_ERROR;
- }
- return NT_STATUS_OK;
-}
-
-/* eof */
diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c
index ef770995483..d2832ba9dc3 100644
--- a/source3/modules/gpfs.c
+++ b/source3/modules/gpfs.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "system/filesys.h"
#include "smbd/smbd.h"
#ifdef HAVE_GPFS
@@ -40,6 +41,7 @@ static int (*gpfs_set_winattrs_path_fn)(char *pathname, int flags, struct gpfs_w
static int (*gpfs_get_winattrs_path_fn)(char *pathname, struct gpfs_winattr *attrs);
static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs);
static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length);
+static int (*gpfs_lib_init_fn)(int flags);
bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
uint32 share_access)
@@ -189,6 +191,17 @@ int set_gpfs_winattrs(char *pathname,int flags,struct gpfs_winattr *attrs)
return gpfs_set_winattrs_path_fn(pathname,flags, attrs);
}
+void smbd_gpfs_lib_init()
+{
+ if (gpfs_lib_init_fn) {
+ int rc = gpfs_lib_init_fn(0);
+ DEBUG(10, ("gpfs_lib_init() finished with rc %d "
+ "and errno %d\n", rc, errno));
+ } else {
+ DEBUG(10, ("libgpfs lacks gpfs_lib_init\n"));
+ }
+}
+
static bool init_gpfs_function_lib(void *plibhandle_pointer,
const char *libname,
void *pfn_pointer, const char *fn_name)
@@ -251,6 +264,7 @@ void init_gpfs(void)
init_gpfs_function(&gpfs_set_winattrs_path_fn,"gpfs_set_winattrs_path");
init_gpfs_function(&gpfs_get_winattrs_fn,"gpfs_get_winattrs");
init_gpfs_function(&gpfs_ftruncate_fn, "gpfs_ftruncate");
+ init_gpfs_function(&gpfs_lib_init_fn,"gpfs_lib_init");
gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename",
True);
@@ -311,6 +325,11 @@ int get_gpfs_winattrs(char *pathname,struct gpfs_winattr *attrs)
return -1;
}
+void smbd_gpfs_lib_init()
+{
+ return;
+}
+
void init_gpfs(void)
{
return;
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 14d464451fa..dbfa36e6c2a 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -26,6 +26,7 @@
#include "include/dbwrap.h"
#include "system/filesys.h"
#include "passdb/lookup_sid.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_ACLS
@@ -51,6 +52,57 @@ typedef struct _SMB_ACL4_INT_T
SMB_ACE4_INT_T *last;
} SMB_ACL4_INT_T;
+/************************************************
+ Split the ACE flag mapping between nfs4 and Windows
+ into two separate functions rather than trying to do
+ it inline. Allows us to carefully control what flags
+ are mapped to what in one place.
+************************************************/
+
+static uint32_t map_nfs4_ace_flags_to_windows_ace_flags(uint32_t nfs4_ace_flags)
+{
+ uint32_t win_ace_flags = 0;
+
+ /* The nfs4 flags <= 0xf map perfectly. */
+ win_ace_flags = nfs4_ace_flags & (SEC_ACE_FLAG_OBJECT_INHERIT|
+ SEC_ACE_FLAG_CONTAINER_INHERIT|
+ SEC_ACE_FLAG_NO_PROPAGATE_INHERIT|
+ SEC_ACE_FLAG_INHERIT_ONLY);
+
+ /* flags greater than 0xf have diverged :-(. */
+ /* See the nfs4 ace flag definitions here:
+ http://www.ietf.org/rfc/rfc3530.txt.
+ And the Windows ace flag definitions here:
+ librpc/idl/security.idl. */
+ if (nfs4_ace_flags & SMB_ACE4_INHERITED_ACE) {
+ win_ace_flags |= SEC_ACE_FLAG_INHERITED_ACE;
+ }
+
+ return win_ace_flags;
+}
+
+static uint32_t map_windows_ace_flags_to_nfs4_ace_flags(uint32_t win_ace_flags)
+{
+ uint32_t nfs4_ace_flags = 0;
+
+ /* The windows flags <= 0xf map perfectly. */
+ nfs4_ace_flags = win_ace_flags & (SMB_ACE4_FILE_INHERIT_ACE|
+ SMB_ACE4_DIRECTORY_INHERIT_ACE|
+ SMB_ACE4_NO_PROPAGATE_INHERIT_ACE|
+ SMB_ACE4_INHERIT_ONLY_ACE);
+
+ /* flags greater than 0xf have diverged :-(. */
+ /* See the nfs4 ace flag definitions here:
+ http://www.ietf.org/rfc/rfc3530.txt.
+ And the Windows ace flag definitions here:
+ librpc/idl/security.idl. */
+ if (win_ace_flags & SEC_ACE_FLAG_INHERITED_ACE) {
+ nfs4_ace_flags |= SMB_ACE4_INHERITED_ACE;
+ }
+
+ return nfs4_ace_flags;
+}
+
static SMB_ACL4_INT_T *get_validated_aclint(SMB4ACL_T *theacl)
{
SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)theacl;
@@ -233,7 +285,7 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *theacl, /* in */
uint32_t mask;
struct dom_sid sid;
SMB_ACE4PROP_T *ace = &aceint->prop;
- uint32_t mapped_ace_flags;
+ uint32_t win_ace_flags;
DEBUG(10, ("magic: 0x%x, type: %d, iflags: %x, flags: %x, mask: %x, "
"who: %d\n", aceint->magic, ace->aceType, ace->flags,
@@ -270,25 +322,25 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *theacl, /* in */
ace->aceMask |= SMB_ACE4_DELETE_CHILD;
}
- mapped_ace_flags = ace->aceFlags & 0xf;
- if (!is_directory && (mapped_ace_flags & (SMB_ACE4_FILE_INHERIT_ACE|SMB_ACE4_DIRECTORY_INHERIT_ACE))) {
+ win_ace_flags = map_nfs4_ace_flags_to_windows_ace_flags(ace->aceFlags);
+ if (!is_directory && (win_ace_flags & (SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT))) {
/*
* GPFS sets inherits dir_inhert and file_inherit flags
* to files, too, which confuses windows, and seems to
* be wrong anyways. ==> Map these bits away for files.
*/
DEBUG(10, ("removing inherit flags from nfs4 ace\n"));
- mapped_ace_flags &= ~(SMB_ACE4_FILE_INHERIT_ACE|SMB_ACE4_DIRECTORY_INHERIT_ACE);
+ win_ace_flags &= ~(SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT);
}
- DEBUG(10, ("mapped ace flags: 0x%x => 0x%x\n",
- ace->aceFlags, mapped_ace_flags));
+ DEBUG(10, ("Windows mapped ace flags: 0x%x => 0x%x\n",
+ ace->aceFlags, win_ace_flags));
/* Windows clients expect SYNC on acls to
correctly allow rename. See bug #7909. */
mask = ace->aceMask | SMB_ACE4_SYNCHRONIZE;
init_sec_ace(&nt_ace_list[good_aces++], &sid,
ace->aceType, mask,
- mapped_ace_flags);
+ win_ace_flags);
}
*ppnt_ace_list = nt_ace_list;
@@ -397,13 +449,15 @@ static int smbacl4_get_vfs_params(
{
static const struct enum_list enum_smbacl4_modes[] = {
{ e_simple, "simple" },
- { e_special, "special" }
+ { e_special, "special" },
+ { -1 , NULL }
};
static const struct enum_list enum_smbacl4_acedups[] = {
{ e_dontcare, "dontcare" },
{ e_reject, "reject" },
{ e_ignore, "ignore" },
{ e_merge, "merge" },
+ { -1 , NULL }
};
memset(params, 0, sizeof(smbacl4_vfs_params));
@@ -520,7 +574,7 @@ static bool nfs4_map_sid(smbacl4_vfs_params *params, const struct dom_sid *src,
if (mapping_db->fetch(mapping_db, NULL,
string_term_tdb_data(sid_string_tos(src)),
- &data) == -1) {
+ &data) != 0) {
DEBUG(10, ("could not find mapping for SID %s\n",
sid_string_dbg(src)));
return False;
@@ -560,7 +614,7 @@ static bool smbacl4_fill_ace4(
memset(ace_v4, 0, sizeof(SMB_ACE4PROP_T));
ace_v4->aceType = ace_nt->type; /* only ACCESS|DENY supported right now */
- ace_v4->aceFlags = ace_nt->flags & SEC_ACE_FLAG_VALID_INHERIT;
+ ace_v4->aceFlags = map_windows_ace_flags_to_nfs4_ace_flags(ace_nt->flags);
ace_v4->aceMask = ace_nt->access_mask &
(SEC_STD_ALL | SEC_FILE_ALL);
diff --git a/source3/modules/nfs4_acls.h b/source3/modules/nfs4_acls.h
index f4576b0c137..fcab6359154 100644
--- a/source3/modules/nfs4_acls.h
+++ b/source3/modules/nfs4_acls.h
@@ -76,9 +76,10 @@ typedef struct _SMB_ACE4PROP_T {
#define SMB_ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
#define SMB_ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
#define SMB_ACE4_IDENTIFIER_GROUP 0x00000040
+#define SMB_ACE4_INHERITED_ACE 0x00000080
#define SMB_ACE4_ALL_FLAGS ( SMB_ACE4_FILE_INHERIT_ACE | SMB_ACE4_DIRECTORY_INHERIT_ACE \
| SMB_ACE4_NO_PROPAGATE_INHERIT_ACE | SMB_ACE4_INHERIT_ONLY_ACE | SMB_ACE4_SUCCESSFUL_ACCESS_ACE_FLAG \
-| SMB_ACE4_FAILED_ACCESS_ACE_FLAG | SMB_ACE4_IDENTIFIER_GROUP )
+| SMB_ACE4_FAILED_ACCESS_ACE_FLAG | SMB_ACE4_IDENTIFIER_GROUP | SMB_ACE4_INHERITED_ACE)
uint32 aceMask; /* Access rights */
/*The bitmask constants used for the access mask field are as follows: */
diff --git a/source3/modules/onefs_acl.c b/source3/modules/onefs_acl.c
index e986b2a9789..f78d1f0e2e6 100644
--- a/source3/modules/onefs_acl.c
+++ b/source3/modules/onefs_acl.c
@@ -554,7 +554,7 @@ static bool add_sfs_aces(files_struct *fsp, struct ifs_security_descriptor *sd)
/* Use existing samba logic to derive the mode bits. */
file_mode = unix_mode(fsp->conn, 0, fsp->fsp_name, NULL);
- dir_mode = unix_mode(fsp->conn, aDIR, fsp->fsp_name, NULL);
+ dir_mode = unix_mode(fsp->conn, FILE_ATTRIBUTE_DIRECTORY, fsp->fsp_name, NULL);
/* Initialize ACEs. */
new_aces[0] = onefs_init_ace(fsp->conn, file_mode, false, USR);
diff --git a/source3/modules/onefs_cbrl.c b/source3/modules/onefs_cbrl.c
index 5c69bec566c..2f20d04ddb6 100644
--- a/source3/modules/onefs_cbrl.c
+++ b/source3/modules/onefs_cbrl.c
@@ -251,7 +251,7 @@ static void onefs_init_cbrl(void)
DEBUG(10, ("cbrl_event_fd = %d\n", cbrl_event_fd));
/* Register the CBRL event_fd with samba's event system */
- cbrl_fde = event_add_fd(smbd_event_context(),
+ cbrl_fde = event_add_fd(server_event_context(),
NULL,
cbrl_event_fd,
EVENT_FD_READ,
diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c
index 80f799ca6f6..101dc5bc6e2 100644
--- a/source3/modules/onefs_open.c
+++ b/source3/modules/onefs_open.c
@@ -498,9 +498,9 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
unx_mode = (mode_t)(new_dos_attributes & ~FILE_FLAG_POSIX_SEMANTICS);
new_dos_attributes = 0;
} else {
- /* We add aARCH to this as this mode is only used if the file is
+ /* We add FILE_ATTRIBUTE_ARCHIVE to this as this mode is only used if the file is
* created new. */
- unx_mode = unix_mode(conn, new_dos_attributes | aARCH,
+ unx_mode = unix_mode(conn, new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE,
smb_fname, parent_dir);
}
@@ -587,7 +587,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
/* Setup dos_attributes to be set by ifs_createfile */
if (lp_store_dos_attributes(SNUM(conn))) {
- createfile_attributes = (new_dos_attributes | aARCH) &
+ createfile_attributes = (new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE) &
~(FILE_ATTRIBUTE_NONINDEXED | FILE_ATTRIBUTE_COMPRESSED);
}
@@ -1310,7 +1310,8 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
new_file_created = True;
}
- set_share_mode(lck, fsp, get_current_uid(conn), 0,
+ set_share_mode(lck, fsp, get_current_uid(conn),
+ req ? req->mid : 0,
fsp->oplock_type);
/* Handle strange delete on close create semantics. */
@@ -1482,7 +1483,7 @@ static NTSTATUS onefs_open_directory(connection_struct *conn,
mode = (mode_t)(file_attributes & ~FILE_FLAG_POSIX_SEMANTICS);
file_attributes = 0;
} else {
- mode = unix_mode(conn, aDIR, smb_dname, parent_dir);
+ mode = unix_mode(conn, FILE_ATTRIBUTE_DIRECTORY, smb_dname, parent_dir);
}
/*
@@ -1666,7 +1667,8 @@ static NTSTATUS onefs_open_directory(connection_struct *conn,
return NT_STATUS_DELETE_PENDING;
}
- set_share_mode(lck, fsp, get_current_uid(conn), 0, NO_OPLOCK);
+ set_share_mode(lck, fsp, get_current_uid(conn),
+ req ? req->mid : 0, NO_OPLOCK);
/*
* For directories the delete on close bit at open time seems
diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c
index 85ab25683f3..78230bcad67 100644
--- a/source3/modules/onefs_streams.c
+++ b/source3/modules/onefs_streams.c
@@ -56,7 +56,7 @@ NTSTATUS onefs_stream_prep_smb_fname(TALLOC_CTX *ctx,
/* Strip off the :$DATA if one exists. */
str_tmp = strrchr_m(stream_name, ':');
if (str_tmp) {
- if (StrCaseCmp(str_tmp, ":$DATA") != 0) {
+ if (strcasecmp_m(str_tmp, ":$DATA") != 0) {
return NT_STATUS_INVALID_PARAMETER;
}
str_tmp[0] = '\0';
@@ -552,7 +552,7 @@ static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
{
struct stream_struct *tmp;
- tmp = TALLOC_REALLOC_ARRAY(mem_ctx, *streams, struct stream_struct,
+ tmp = talloc_realloc(mem_ctx, *streams, struct stream_struct,
(*num_streams)+1);
if (tmp == NULL) {
return false;
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index 6c57acb13dd..bee7966dfc9 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -144,7 +144,7 @@ static NTSTATUS create_acl_blob(const struct security_descriptor *psd,
xacl.version = 3;
xacl.info.sd_hs3 = &sd_hs3;
- xacl.info.sd_hs3->sd = CONST_DISCARD(struct security_descriptor *, psd);
+ xacl.info.sd_hs3->sd = discard_const_p(struct security_descriptor, psd);
xacl.info.sd_hs3->hash_type = hash_type;
memcpy(&xacl.info.sd_hs3->hash[0], hash, XATTR_SD_HASH_SIZE);
@@ -179,7 +179,7 @@ static void add_directory_inheritable_components(vfs_handle_struct *handle,
mode_t dir_mode;
mode_t file_mode;
mode_t mode;
- struct security_ace *new_ace_list = TALLOC_ZERO_ARRAY(talloc_tos(),
+ struct security_ace *new_ace_list = talloc_zero_array(talloc_tos(),
struct security_ace,
num_aces + 3);
@@ -190,7 +190,7 @@ static void add_directory_inheritable_components(vfs_handle_struct *handle,
/* Fake a quick smb_filename. */
ZERO_STRUCT(smb_fname);
smb_fname.st = *psbuf;
- smb_fname.base_name = CONST_DISCARD(char *, name);
+ smb_fname.base_name = discard_const_p(char, name);
dir_mode = unix_mode(conn,
FILE_ATTRIBUTE_DIRECTORY, &smb_fname, NULL);
@@ -448,10 +448,14 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
struct security_descriptor *psd = NULL;
struct dom_sid *owner_sid = NULL;
struct dom_sid *group_sid = NULL;
+ uint32_t security_info_sent = (SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL);
bool inherit_owner = lp_inherit_owner(SNUM(handle->conn));
+ bool inheritable_components = sd_has_inheritable_components(parent_desc,
+ is_directory);
size_t size;
- if (!sd_has_inheritable_components(parent_desc, is_directory)) {
+ if (!inheritable_components && !inherit_owner) {
+ /* Nothing to inherit and not setting owner. */
return NT_STATUS_OK;
}
@@ -487,6 +491,17 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
return status;
}
+ /* If inheritable_components == false,
+ se_create_child_secdesc()
+ creates a security desriptor with a NULL dacl
+ entry, but with SEC_DESC_DACL_PRESENT. We need
+ to remove that flag. */
+
+ if (!inheritable_components) {
+ security_info_sent &= ~SECINFO_DACL;
+ psd->type &= ~SEC_DESC_DACL_PRESENT;
+ }
+
if (DEBUGLEVEL >= 10) {
DEBUG(10,("inherit_new_acl: child acl for %s is:\n",
fsp_str_dbg(fsp) ));
@@ -498,9 +513,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
become_root();
}
status = SMB_VFS_FSET_NT_ACL(fsp,
- (SECINFO_OWNER |
- SECINFO_GROUP |
- SECINFO_DACL),
+ security_info_sent,
psd);
if (inherit_owner) {
unbecome_root();
@@ -729,7 +742,7 @@ static NTSTATUS fset_nt_acl_common(vfs_handle_struct *handle, files_struct *fsp,
DEBUG(10,("fset_nt_acl_xattr: incoming sd for file %s\n",
fsp_str_dbg(fsp)));
NDR_PRINT_DEBUG(security_descriptor,
- CONST_DISCARD(struct security_descriptor *,orig_psd));
+ discard_const_p(struct security_descriptor, orig_psd));
}
status = get_nt_acl_internal(handle, fsp,
@@ -784,7 +797,7 @@ static NTSTATUS fset_nt_acl_common(vfs_handle_struct *handle, files_struct *fsp,
DEBUG(10,("fset_nt_acl_xattr: storing xattr sd for file %s\n",
fsp_str_dbg(fsp)));
NDR_PRINT_DEBUG(security_descriptor,
- CONST_DISCARD(struct security_descriptor *,psd));
+ discard_const_p(struct security_descriptor, psd));
}
create_acl_blob(psd, &blob, XATTR_SD_HASH_TYPE_SHA256, hash);
store_acl_blob_fsp(handle, fsp, &blob);
@@ -836,7 +849,7 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
}
ZERO_STRUCT(local_fname);
- local_fname.base_name = CONST_DISCARD(char *,final_component);
+ local_fname.base_name = discard_const_p(char, final_component);
/* Must use lstat here. */
ret = SMB_VFS_LSTAT(conn, &local_fname);
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index f2e04152936..0b03896dd90 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -28,6 +28,7 @@
#include "../lib/crypto/crypto.h"
#include "dbwrap.h"
#include "auth.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
@@ -176,7 +177,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
if (db->fetch(db,
ctx,
make_tdb_data(id_buf, sizeof(id_buf)),
- &data) == -1) {
+ &data) != 0) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
index 2a83430fa94..70e979b71b0 100644
--- a/source3/modules/vfs_acl_xattr.c
+++ b/source3/modules/vfs_acl_xattr.c
@@ -55,7 +55,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
again:
- tmp = TALLOC_REALLOC_ARRAY(ctx, val, uint8_t, size);
+ tmp = talloc_realloc(ctx, val, uint8_t, size);
if (tmp == NULL) {
TALLOC_FREE(val);
return NT_STATUS_NO_MEMORY;
diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c
index 06ce6f5f8d8..2ef6adf953d 100644
--- a/source3/modules/vfs_afsacl.c
+++ b/source3/modules/vfs_afsacl.c
@@ -30,7 +30,7 @@
#include <afs/venus.h>
#include <afs/prs_fs.h>
-#define MAXSIZE 2048
+#define MAXSIZE 2049
extern const struct dom_sid global_sid_World;
extern const struct dom_sid global_sid_Builtin_Administrators;
@@ -89,7 +89,7 @@ static void free_afs_acl(struct afs_acl *acl)
static struct afs_ace *clone_afs_ace(TALLOC_CTX *mem_ctx, struct afs_ace *ace)
{
- struct afs_ace *result = TALLOC_P(mem_ctx, struct afs_ace);
+ struct afs_ace *result = talloc(mem_ctx, struct afs_ace);
if (result == NULL)
return NULL;
@@ -167,7 +167,7 @@ static struct afs_ace *new_afs_ace(TALLOC_CTX *mem_ctx,
}
}
- result = TALLOC_P(mem_ctx, struct afs_ace);
+ result = talloc(mem_ctx, struct afs_ace);
if (result == NULL) {
DEBUG(0, ("Could not talloc AFS ace\n"));
@@ -234,10 +234,10 @@ static bool parse_afs_acl(struct afs_acl *acl, const char *acl_str)
int nplus, nminus;
int aces;
- char str[MAXSIZE+1];
+ char str[MAXSIZE];
char *p = str;
- strncpy(str, acl_str, MAXSIZE);
+ strlcpy(str, acl_str, MAXSIZE);
if (sscanf(p, "%d", &nplus) != 1)
return False;
@@ -313,16 +313,16 @@ static bool unparse_afs_acl(struct afs_acl *acl, char *acl_str)
}
fstr_sprintf(line, "%d\n", positives);
- safe_strcat(acl_str, line, MAXSIZE);
+ strlcat(acl_str, line, MAXSIZE);
fstr_sprintf(line, "%d\n", negatives);
- safe_strcat(acl_str, line, MAXSIZE);
+ strlcat(acl_str, line, MAXSIZE);
ace = acl->acelist;
while (ace != NULL) {
fstr_sprintf(line, "%s\t%d\n", ace->name, ace->rights);
- safe_strcat(acl_str, line, MAXSIZE);
+ strlcat(acl_str, line, MAXSIZE);
ace = ace->next;
}
return True;
@@ -605,7 +605,7 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
gid_to_sid(&group_sid, psbuf->st_ex_gid);
if (afs_acl->num_aces) {
- nt_ace_list = TALLOC_ARRAY(mem_ctx, struct security_ace, afs_acl->num_aces);
+ nt_ace_list = talloc_array(mem_ctx, struct security_ace, afs_acl->num_aces);
if (nt_ace_list == NULL)
return 0;
@@ -897,7 +897,7 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
{
struct afs_acl old_afs_acl, new_afs_acl;
struct afs_acl dir_acl, file_acl;
- char acl_string[2049];
+ char acl_string[MAXSIZE];
struct afs_iob iob;
int ret = -1;
char *name = NULL;
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 41b5a89dd29..961efd85de2 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -260,7 +260,7 @@ static void aio_child_cleanup(struct event_context *event_ctx,
/*
* Re-schedule the next cleanup round
*/
- list->cleanup_event = event_add_timed(smbd_event_context(), list,
+ list->cleanup_event = event_add_timed(server_event_context(), list,
timeval_add(&now, 30, 0),
aio_child_cleanup, list);
@@ -277,7 +277,7 @@ static struct aio_child_list *init_aio_children(struct vfs_handle_struct *handle
}
if (data == NULL) {
- data = TALLOC_ZERO_P(NULL, struct aio_child_list);
+ data = talloc_zero(NULL, struct aio_child_list);
if (data == NULL) {
return NULL;
}
@@ -290,7 +290,7 @@ static struct aio_child_list *init_aio_children(struct vfs_handle_struct *handle
*/
if (data->cleanup_event == NULL) {
- data->cleanup_event = event_add_timed(smbd_event_context(), data,
+ data->cleanup_event = event_add_timed(server_event_context(), data,
timeval_current_ofs(30, 0),
aio_child_cleanup, data);
if (data->cleanup_event == NULL) {
@@ -481,7 +481,7 @@ static NTSTATUS create_aio_child(struct smbd_server_connection *sconn,
fdpair[0] = fdpair[1] = -1;
- result = TALLOC_ZERO_P(children, struct aio_child);
+ result = talloc_zero(children, struct aio_child);
NT_STATUS_HAVE_NO_MEMORY(result);
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) == -1) {
@@ -519,7 +519,7 @@ static NTSTATUS create_aio_child(struct smbd_server_connection *sconn,
result->sockfd = fdpair[0];
close(fdpair[1]);
- result->sock_event = event_add_fd(smbd_event_context(), result,
+ result->sock_event = event_add_fd(server_event_context(), result,
result->sockfd, EVENT_FD_READ,
handle_aio_completion,
result);
diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c
index 349600fc43f..8213bafa1cb 100644
--- a/source3/modules/vfs_audit.c
+++ b/source3/modules/vfs_audit.c
@@ -40,7 +40,8 @@ static int audit_syslog_facility(vfs_handle_struct *handle)
{ LOG_LOCAL4, "LOCAL4" },
{ LOG_LOCAL5, "LOCAL5" },
{ LOG_LOCAL6, "LOCAL6" },
- { LOG_LOCAL7, "LOCAL7" }
+ { LOG_LOCAL7, "LOCAL7" },
+ { -1, NULL}
};
int facility;
@@ -61,7 +62,8 @@ static int audit_syslog_priority(vfs_handle_struct *handle)
{ LOG_WARNING, "WARNING" },
{ LOG_NOTICE, "NOTICE" },
{ LOG_INFO, "INFO" },
- { LOG_DEBUG, "DEBUG" }
+ { LOG_DEBUG, "DEBUG" },
+ { -1, NULL}
};
int priority;
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 7aab6c3973b..15bebf6fea0 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -75,7 +75,7 @@ static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle,
}
DEBUG(3,("cap: cap_readdir: %s\n", newname));
newnamelen = strlen(newname)+1;
- newdirent = (SMB_STRUCT_DIRENT *)TALLOC_ARRAY(talloc_tos(),
+ newdirent = (SMB_STRUCT_DIRENT *)talloc_array(talloc_tos(),
char,
sizeof(SMB_STRUCT_DIRENT)+
newnamelen);
@@ -663,7 +663,7 @@ static char *capencode(TALLOC_CTX *ctx, const char *from)
}
len++;
- to = TALLOC_ARRAY(ctx, char, len);
+ to = talloc_array(ctx, char, len);
if (!to) {
return NULL;
}
@@ -704,7 +704,7 @@ static char *capdecode(TALLOC_CTX *ctx, const char *from)
}
len++;
- to = TALLOC_ARRAY(ctx, char, len);
+ to = talloc_array(ctx, char, len);
if (!to) {
return NULL;
}
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index cf6e24fca04..2dc7ec75b82 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -84,7 +84,10 @@ static int vfswrap_set_quota(struct vfs_handle_struct *handle, enum SMB_QUOTA_T
#endif
}
-static int vfswrap_get_shadow_copy_data(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels)
+static int vfswrap_get_shadow_copy_data(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ struct shadow_copy_data *shadow_copy_data,
+ bool labels)
{
errno = ENOSYS;
return -1; /* Not implemented. */
@@ -745,12 +748,12 @@ static int vfswrap_chdir(vfs_handle_struct *handle, const char *path)
return result;
}
-static char *vfswrap_getwd(vfs_handle_struct *handle, char *path)
+static char *vfswrap_getwd(vfs_handle_struct *handle)
{
char *result;
START_PROFILE(syscall_getwd);
- result = sys_getwd(path);
+ result = sys_getwd();
END_PROFILE(syscall_getwd);
return result;
}
@@ -1512,12 +1515,12 @@ static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, const char *p
return sys_listxattr(path, list, size);
}
-ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
+static ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
{
return sys_llistxattr(path, list, size);
}
-ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
+static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
{
return sys_flistxattr(fsp->fh->fd, list, size);
}
diff --git a/source3/modules/vfs_dirsort.c b/source3/modules/vfs_dirsort.c
index adeab0425d5..ba8441c2dff 100644
--- a/source3/modules/vfs_dirsort.c
+++ b/source3/modules/vfs_dirsort.c
@@ -24,7 +24,7 @@
static int compare_dirent (const SMB_STRUCT_DIRENT *da, const SMB_STRUCT_DIRENT *db)
{
- return StrCaseCmp(da->d_name, db->d_name);
+ return strcasecmp_m(da->d_name, db->d_name);
}
struct dirsort_privates {
diff --git a/source3/modules/vfs_expand_msdfs.c b/source3/modules/vfs_expand_msdfs.c
index f1f82d243ee..eb7c6fed6b5 100644
--- a/source3/modules/vfs_expand_msdfs.c
+++ b/source3/modules/vfs_expand_msdfs.c
@@ -178,7 +178,7 @@ static int expand_msdfs_readlink(struct vfs_handle_struct *handle,
{
TALLOC_CTX *ctx = talloc_tos();
int result;
- char *target = TALLOC_ARRAY(ctx, char, PATH_MAX+1);
+ char *target = talloc_array(ctx, char, PATH_MAX+1);
size_t len;
if (!target) {
diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c
index 34a43c712f8..192b0750ab1 100644
--- a/source3/modules/vfs_extd_audit.c
+++ b/source3/modules/vfs_extd_audit.c
@@ -43,7 +43,8 @@ static int audit_syslog_facility(vfs_handle_struct *handle)
{ LOG_LOCAL4, "LOCAL4" },
{ LOG_LOCAL5, "LOCAL5" },
{ LOG_LOCAL6, "LOCAL6" },
- { LOG_LOCAL7, "LOCAL7" }
+ { LOG_LOCAL7, "LOCAL7" },
+ { -1, NULL}
};
int facility;
@@ -64,7 +65,8 @@ static int audit_syslog_priority(vfs_handle_struct *handle)
{ LOG_WARNING, "WARNING" },
{ LOG_NOTICE, "NOTICE" },
{ LOG_INFO, "INFO" },
- { LOG_DEBUG, "DEBUG" }
+ { LOG_DEBUG, "DEBUG" },
+ { -1, NULL}
};
int priority;
diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c
index 4c230a0566d..1168d50cb2e 100644
--- a/source3/modules/vfs_fileid.c
+++ b/source3/modules/vfs_fileid.c
@@ -66,7 +66,7 @@ static void fileid_load_mount_entries(struct fileid_handle_data *data)
m->mnt_fsname += 5;
}
- data->mount_entries = TALLOC_REALLOC_ARRAY(data,
+ data->mount_entries = talloc_realloc(data,
data->mount_entries,
struct fileid_mount_entry,
data->num_mount_entries+1);
@@ -144,7 +144,7 @@ static uint64_t fileid_device_mapping_fsname(struct fileid_handle_data *data,
if (!m) return dev;
if (m->devid == (uint64_t)-1) {
- m->devid = fileid_uint64_hash((uint8_t *)m->mnt_fsname,
+ m->devid = fileid_uint64_hash((const uint8_t *)m->mnt_fsname,
strlen(m->mnt_fsname));
}
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index a723a0ce2d6..e8129f41436 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -355,7 +355,8 @@ static int audit_syslog_facility(vfs_handle_struct *handle)
{ LOG_LOCAL4, "LOCAL4" },
{ LOG_LOCAL5, "LOCAL5" },
{ LOG_LOCAL6, "LOCAL6" },
- { LOG_LOCAL7, "LOCAL7" }
+ { LOG_LOCAL7, "LOCAL7" },
+ { -1, NULL}
};
int facility;
@@ -375,7 +376,8 @@ static int audit_syslog_priority(vfs_handle_struct *handle)
{ LOG_WARNING, "WARNING" },
{ LOG_NOTICE, "NOTICE" },
{ LOG_INFO, "INFO" },
- { LOG_DEBUG, "DEBUG" }
+ { LOG_DEBUG, "DEBUG" },
+ { -1, NULL}
};
int priority;
@@ -609,13 +611,13 @@ static int smb_full_audit_connect(vfs_handle_struct *handle,
return result;
}
- pd = TALLOC_ZERO_P(handle, struct vfs_full_audit_private_data);
+ pd = talloc_zero(handle, struct vfs_full_audit_private_data);
if (!pd) {
SMB_VFS_NEXT_DISCONNECT(handle);
return -1;
}
-#ifndef WITH_SYSLOG
+#ifdef WITH_SYSLOG
openlog("smbd_audit", 0, audit_syslog_facility(handle));
#endif
@@ -695,7 +697,8 @@ static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- SHADOW_COPY_DATA *shadow_copy_data, bool labels)
+ struct shadow_copy_data *shadow_copy_data,
+ bool labels)
{
int result;
@@ -1205,14 +1208,14 @@ static int smb_full_audit_chdir(vfs_handle_struct *handle,
return result;
}
-static char *smb_full_audit_getwd(vfs_handle_struct *handle,
- char *path)
+static char *smb_full_audit_getwd(vfs_handle_struct *handle)
{
char *result;
- result = SMB_VFS_NEXT_GETWD(handle, path);
+ result = SMB_VFS_NEXT_GETWD(handle);
- do_log(SMB_VFS_OP_GETWD, (result != NULL), handle, "%s", path);
+ do_log(SMB_VFS_OP_GETWD, (result != NULL), handle, "%s",
+ result == NULL? "" : result);
return result;
}
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index c38d7c2337f..0a684e0d8e5 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -32,6 +32,7 @@
#include <gpfs_gpl.h>
#include "nfs4_acls.h"
#include "vfs_gpfs.h"
+#include "system/filesys.h"
struct gpfs_config_data {
bool sharemodes;
@@ -998,7 +999,7 @@ static int gpfs_set_xattr(struct vfs_handle_struct *handle, const char *path,
}
- ret = set_gpfs_winattrs(CONST_DISCARD(char *, path),
+ ret = set_gpfs_winattrs(discard_const_p(char, path),
GPFS_WINATTR_SET_ATTRS, &attrs);
if ( ret == -1){
if (errno == ENOSYS) {
@@ -1029,7 +1030,7 @@ static ssize_t gpfs_get_xattr(struct vfs_handle_struct *handle, const char *pat
return SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size);
}
- ret = get_gpfs_winattrs(CONST_DISCARD(char *, path), &attrs);
+ ret = get_gpfs_winattrs(discard_const_p(char, path), &attrs);
if ( ret == -1){
if (errno == ENOSYS) {
return SMB_VFS_NEXT_GETXATTR(handle, path, name, value,
@@ -1083,11 +1084,12 @@ static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
errno = map_errno_from_nt_status(status);
return -1;
}
- ret = get_gpfs_winattrs(CONST_DISCARD(char *, fname), &attrs);
+ ret = get_gpfs_winattrs(discard_const_p(char, fname), &attrs);
TALLOC_FREE(fname);
if (ret == 0) {
smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
+ smb_fname->st.vfs_private = attrs.winAttrs;
}
return 0;
}
@@ -1130,11 +1132,12 @@ static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
errno = map_errno_from_nt_status(status);
return -1;
}
- ret = get_gpfs_winattrs(CONST_DISCARD(char *, path), &attrs);
+ ret = get_gpfs_winattrs(discard_const_p(char, path), &attrs);
TALLOC_FREE(path);
if (ret == 0) {
smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
+ smb_fname->st.vfs_private = attrs.winAttrs;
}
return 0;
}
@@ -1170,7 +1173,7 @@ static int vfs_gpfs_ntimes(struct vfs_handle_struct *handle,
attrs.creationTime.tv_sec = ft->create_time.tv_sec;
attrs.creationTime.tv_nsec = ft->create_time.tv_nsec;
- ret = set_gpfs_winattrs(CONST_DISCARD(char *, path),
+ ret = set_gpfs_winattrs(discard_const_p(char, path),
GPFS_WINATTR_SET_CREATION_TIME, &attrs);
if(ret == -1 && errno != ENOSYS){
DEBUG(1,("vfs_gpfs_ntimes: set GPFS ntimes failed %d\n",ret));
@@ -1199,18 +1202,23 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
struct gpfs_winattr attrs;
char *path = NULL;
NTSTATUS status;
- int ret;
status = get_full_smb_filename(talloc_tos(), fname, &path);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
}
- ret = get_gpfs_winattrs(path, &attrs);
- if (ret == -1) {
- TALLOC_FREE(path);
- return false;
+ if (VALID_STAT(*sbuf)) {
+ attrs.winAttrs = sbuf->vfs_private;
+ } else {
+ int ret;
+ ret = get_gpfs_winattrs(path, &attrs);
+
+ if (ret == -1) {
+ TALLOC_FREE(path);
+ return false;
+ }
}
if ((attrs.winAttrs & GPFS_WINATTR_OFFLINE) != 0) {
DEBUG(10, ("%s is offline\n", path));
@@ -1228,10 +1236,24 @@ static bool vfs_gpfs_aio_force(struct vfs_handle_struct *handle,
return vfs_gpfs_is_offline(handle, fsp->fsp_name, &fsp->fsp_name->st);
}
+static ssize_t vfs_gpfs_sendfile(vfs_handle_struct *handle, int tofd,
+ files_struct *fsp, const DATA_BLOB *hdr,
+ SMB_OFF_T offset, size_t n)
+{
+ if ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0) {
+ errno = ENOSYS;
+ return -1;
+ }
+ return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, hdr, offset, n);
+}
+
int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
const char *user)
{
struct gpfs_config_data *config;
+
+ smbd_gpfs_lib_init();
+
int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
if (ret < 0) {
@@ -1278,6 +1300,17 @@ static uint32_t vfs_gpfs_capabilities(struct vfs_handle_struct *handle,
return next;
}
+static int vfs_gpfs_open(struct vfs_handle_struct *handle,
+ struct smb_filename *smb_fname, files_struct *fsp,
+ int flags, mode_t mode)
+{
+ if (lp_parm_bool(fsp->conn->params->service, "gpfs", "syncio",
+ false)) {
+ flags |= O_SYNC;
+ }
+ return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
+}
+
static struct vfs_fn_pointers vfs_gpfs_fns = {
.connect_fn = vfs_gpfs_connect,
@@ -1304,6 +1337,8 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
.ntimes = vfs_gpfs_ntimes,
.is_offline = vfs_gpfs_is_offline,
.aio_force = vfs_gpfs_aio_force,
+ .sendfile = vfs_gpfs_sendfile,
+ .open_fn = vfs_gpfs_open,
.ftruncate = vfs_gpfs_ftruncate
};
diff --git a/source3/modules/vfs_gpfs.h b/source3/modules/vfs_gpfs.h
index 46cfdfea0ac..4a05841feba 100644
--- a/source3/modules/vfs_gpfs.h
+++ b/source3/modules/vfs_gpfs.h
@@ -1,26 +1,25 @@
/*
Unix SMB/CIFS implementation.
Wrap gpfs calls in vfs functions.
-
+
Copyright (C) Christian Ambach <cambach1@de.ibm.com> 2006
-
+
Major code contributions by Chetan Shringarpure <chetan.sh@in.ibm.com>
and Gomati Mohanan <gomati.mohanan@in.ibm.com>
-
+
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
*/
@@ -36,3 +35,4 @@ int get_gpfs_winattrs(char * pathname,struct gpfs_winattr *attrs);
int set_gpfs_winattrs(char * pathname,int flags,struct gpfs_winattr *attrs);
int smbd_gpfs_ftruncate(int fd, gpfs_off64_t length);
void init_gpfs(void);
+void smbd_gpfs_lib_init();
diff --git a/source3/modules/vfs_gpfs_hsm_notify.c b/source3/modules/vfs_gpfs_hsm_notify.c
new file mode 100644
index 00000000000..fa24db99833
--- /dev/null
+++ b/source3/modules/vfs_gpfs_hsm_notify.c
@@ -0,0 +1,110 @@
+/*
+ Unix SMB/CIFS implementation.
+ Make sure offline->online changes are propagated by notifies
+
+ This module must come before aio_fork in the chain, because
+ aio_fork (correcly!) does not propagate the aio calls further
+
+ Copyright (C) Volker Lendecke 2011
+
+ 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "smbd/smbd.h"
+#include "librpc/gen_ndr/ndr_xattr.h"
+#include "include/smbprofile.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_VFS
+
+#include <gpfs_gpl.h>
+#include "nfs4_acls.h"
+#include "vfs_gpfs.h"
+
+static ssize_t vfs_gpfs_hsm_notify_pread(vfs_handle_struct *handle, files_struct *fsp,
+ void *data, size_t n, SMB_OFF_T offset)
+{
+ ssize_t ret;
+
+ ret = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
+
+ DEBUG(10, ("vfs_private = %x\n",
+ (unsigned int)fsp->fsp_name->st.vfs_private));
+
+ if ((ret != -1) &&
+ ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
+ fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
+ notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
+ FILE_NOTIFY_CHANGE_ATTRIBUTES,
+ fsp->fsp_name->base_name);
+ }
+
+ return ret;
+}
+
+static ssize_t vfs_gpfs_hsm_notify_pwrite(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ const void *data, size_t n, SMB_OFF_T offset)
+{
+ ssize_t ret;
+
+ ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+
+ if ((ret != -1) &&
+ ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
+ fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
+ notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
+ FILE_NOTIFY_CHANGE_ATTRIBUTES,
+ fsp->fsp_name->base_name);
+ }
+
+ return ret;
+}
+
+static ssize_t vfs_gpfs_hsm_notify_aio_return(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ SMB_STRUCT_AIOCB *aiocb)
+{
+ ssize_t ret;
+
+ ret = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
+
+ DEBUG(10, ("vfs_gpfs_hsm_notify_aio_return: vfs_private = %x\n",
+ (unsigned int)fsp->fsp_name->st.vfs_private));
+
+ if ((ret != -1) &&
+ ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
+ fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
+ DEBUG(10, ("sending notify\n"));
+ notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
+ FILE_NOTIFY_CHANGE_ATTRIBUTES,
+ fsp->fsp_name->base_name);
+ }
+
+ return ret;
+}
+
+static struct vfs_fn_pointers vfs_gpfs_hsm_notify_fns = {
+ .pread = vfs_gpfs_hsm_notify_pread,
+ .pwrite = vfs_gpfs_hsm_notify_pwrite,
+ .aio_return_fn = vfs_gpfs_hsm_notify_aio_return
+};
+
+NTSTATUS vfs_gpfs_hsm_notify_init(void);
+NTSTATUS vfs_gpfs_hsm_notify_init(void)
+{
+ return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "gpfs_hsm_notify",
+ &vfs_gpfs_hsm_notify_fns);
+}
diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c
index 2155945b95a..8a574443526 100644
--- a/source3/modules/vfs_hpuxacl.c
+++ b/source3/modules/vfs_hpuxacl.c
@@ -307,7 +307,7 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
}
DEBUG(10, ("resulting acl is valid.\n"));
- ret = acl(CONST_DISCARD(char *, smb_fname->base_name), ACL_SET, count,
+ ret = acl(discard_const_p(char, smb_fname->base_name), ACL_SET, count,
hpux_acl);
if (ret != 0) {
DEBUG(0, ("ERROR calling acl: %s\n", strerror(errno)));
@@ -394,7 +394,7 @@ int hpuxacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
DEBUG(10, ("resulting acl is not valid!\n"));
goto done;
}
- ret = acl(CONST_DISCARD(char *, path), ACL_SET, count, hpux_acl);
+ ret = acl(discard_const_p(char, path), ACL_SET, count, hpux_acl);
if (ret != 0) {
DEBUG(10, ("settinge file acl failed!\n"));
}
@@ -682,7 +682,7 @@ static bool hpux_acl_get_file(const char *name, HPUX_ACL_T *hpux_acl,
* instantiated or malloced each time this function is
* called). Btw: the count parameter does not seem to matter...
*/
- *count = acl(CONST_DISCARD(char *, name), ACL_CNT, 0, &dummy_ace);
+ *count = acl(discard_const_p(char, name), ACL_CNT, 0, &dummy_ace);
if (*count < 0) {
DEBUG(10, ("acl ACL_CNT failed: %s\n", strerror(errno)));
goto done;
@@ -692,7 +692,7 @@ static bool hpux_acl_get_file(const char *name, HPUX_ACL_T *hpux_acl,
DEBUG(10, ("error allocating memory for hpux acl...\n"));
goto done;
}
- *count = acl(CONST_DISCARD(char *, name), ACL_GET, *count, *hpux_acl);
+ *count = acl(discard_const_p(char, name), ACL_GET, *count, *hpux_acl);
if (*count < 0) {
DEBUG(10, ("acl ACL_GET failed: %s\n", strerror(errno)));
goto done;
diff --git a/source3/modules/vfs_notify_fam.c b/source3/modules/vfs_notify_fam.c
index a4e7fd1e2ba..1f76a05fc08 100644
--- a/source3/modules/vfs_notify_fam.c
+++ b/source3/modules/vfs_notify_fam.c
@@ -249,7 +249,7 @@ static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
fam_connection_initialized = True;
}
- if (!(watch = TALLOC_P(ctx, struct fam_watch_context))) {
+ if (!(watch = talloc(ctx, struct fam_watch_context))) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c
index 82969e48d6a..3d7f6c1b038 100644
--- a/source3/modules/vfs_preopen.c
+++ b/source3/modules/vfs_preopen.c
@@ -166,7 +166,7 @@ static bool preopen_helper_open_one(int sock_fd, char **pnamebuf,
nread += thistime;
if (nread == talloc_get_size(namebuf)) {
- namebuf = TALLOC_REALLOC_ARRAY(
+ namebuf = talloc_realloc(
NULL, namebuf, char,
talloc_get_size(namebuf) * 2);
if (namebuf == NULL) {
@@ -193,7 +193,7 @@ static bool preopen_helper(int fd, size_t to_read)
char *namebuf;
void *readbuf;
- namebuf = TALLOC_ARRAY(NULL, char, 1024);
+ namebuf = talloc_array(NULL, char, 1024);
if (namebuf == NULL) {
return false;
}
@@ -237,7 +237,7 @@ static NTSTATUS preopen_init_helper(struct preopen_helper *h)
}
close(fdpair[1]);
h->fd = fdpair[0];
- h->fde = event_add_fd(smbd_event_context(), h->state, h->fd,
+ h->fde = event_add_fd(server_event_context(), h->state, h->fd,
EVENT_FD_READ, preopen_helper_readable, h);
if (h->fde == NULL) {
close(h->fd);
@@ -261,7 +261,7 @@ static NTSTATUS preopen_init_helpers(TALLOC_CTX *mem_ctx, size_t to_read,
}
result->num_helpers = num_helpers;
- result->helpers = TALLOC_ARRAY(result, struct preopen_helper,
+ result->helpers = talloc_array(result, struct preopen_helper,
num_helpers);
if (result->helpers == NULL) {
TALLOC_FREE(result);
@@ -322,7 +322,7 @@ static struct preopen_state *preopen_state_get(vfs_handle_struct *handle)
return NULL;
}
- set_namearray(&state->preopen_names, (char *)namelist);
+ set_namearray(&state->preopen_names, namelist);
if (state->preopen_names == NULL) {
TALLOC_FREE(state);
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index 22f61b4b33c..5c4f8706cbf 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -35,33 +35,9 @@ static int vfs_recycle_debug_level = DBGC_VFS;
#undef DBGC_CLASS
#define DBGC_CLASS vfs_recycle_debug_level
-static int recycle_connect(vfs_handle_struct *handle, const char *service, const char *user);
-static void recycle_disconnect(vfs_handle_struct *handle);
static int recycle_unlink(vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
-static int recycle_connect(vfs_handle_struct *handle, const char *service, const char *user)
-{
- int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
-
- if (ret < 0) {
- return ret;
- }
-
- DEBUG(10,("recycle_connect() connect to service[%s] as user[%s].\n",
- service,user));
-
- return 0;
-}
-
-static void recycle_disconnect(vfs_handle_struct *handle)
-{
- DEBUG(10,("recycle_disconnect() connect to service[%s].\n",
- lp_servicename(SNUM(handle->conn))));
-
- SMB_VFS_NEXT_DISCONNECT(handle);
-}
-
static const char *recycle_repository(vfs_handle_struct *handle)
{
const char *tmp_str = NULL;
@@ -304,13 +280,13 @@ static bool recycle_create_dir(vfs_handle_struct *handle, const char *dname)
*new_dir = '\0';
if (dname[0] == '/') {
/* Absolute path. */
- safe_strcat(new_dir,"/",len);
+ strlcat(new_dir,"/",len+1);
}
/* Create directory tree if neccessary */
for(token = strtok_r(tok_str, "/", &saveptr); token;
token = strtok_r(NULL, "/", &saveptr)) {
- safe_strcat(new_dir, token, len);
+ strlcat(new_dir, token, len+1);
if (recycle_directory_exist(handle, new_dir))
DEBUG(10, ("recycle: dir %s already exists\n", new_dir));
else {
@@ -321,7 +297,7 @@ static bool recycle_create_dir(vfs_handle_struct *handle, const char *dname)
goto done;
}
}
- safe_strcat(new_dir, "/", len);
+ strlcat(new_dir, "/", len+1);
mode = recycle_subdir_mode(handle);
}
@@ -663,8 +639,6 @@ done:
}
static struct vfs_fn_pointers vfs_recycle_fns = {
- .connect_fn = recycle_connect,
- .disconnect = recycle_disconnect,
.unlink = recycle_unlink
};
diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c
index d0eba212d24..6d748c4c238 100644
--- a/source3/modules/vfs_scannedonly.c
+++ b/source3/modules/vfs_scannedonly.c
@@ -75,12 +75,12 @@ struct Tscannedonly {
bool rm_hidden_files_on_rmdir;
bool hide_nonscanned_files;
bool allow_nonscanned_files;
- char *socketname;
- char *scanhost;
- char *scanning_message;
- char *p_scanned; /* prefix for scanned files */
- char *p_virus; /* prefix for virus containing files */
- char *p_failed; /* prefix for failed to scan files */
+ const char *socketname;
+ const char *scanhost;
+ const char *scanning_message;
+ const char *p_scanned; /* prefix for scanned files */
+ const char *p_virus; /* prefix for virus containing files */
+ const char *p_failed; /* prefix for failed to scan files */
char gsendbuffer[SENDBUFFERSIZE + 1];
};
@@ -146,14 +146,15 @@ static char *cachefile_name_f_fullpath(TALLOC_CTX *ctx,
const char *p_scanned)
{
const char *base;
- char *tmp, *cachefile, *shortname;
+ char *tmp, *cachefile;
+ const char *shortname;
tmp = strrchr(fullpath, '/');
if (tmp) {
base = talloc_strndup(ctx, fullpath, (tmp - fullpath) + 1);
shortname = tmp + 1;
} else {
base = "";
- shortname = (char *)fullpath;
+ shortname = (const char *)fullpath;
}
cachefile = cachefile_name(ctx, shortname, base, p_scanned);
DEBUG(SCANNEDONLY_DEBUG,
@@ -164,7 +165,7 @@ static char *cachefile_name_f_fullpath(TALLOC_CTX *ctx,
static char *construct_full_path(TALLOC_CTX *ctx, vfs_handle_struct * handle,
const char *somepath, bool ending_slash)
{
- char *tmp;
+ const char *tmp;
if (!somepath) {
return NULL;
@@ -175,7 +176,7 @@ static char *construct_full_path(TALLOC_CTX *ctx, vfs_handle_struct * handle,
}
return talloc_strdup(ctx,somepath);
}
- tmp=(char *)somepath;
+ tmp = somepath;
if (tmp[0]=='.'&&tmp[1]=='/') {
tmp+=2;
}
@@ -308,14 +309,14 @@ static void flush_sendbuffer(vfs_handle_struct * handle)
static void notify_scanner(vfs_handle_struct * handle, const char *scanfile)
{
- char *tmp;
+ const char *tmp;
int tmplen, gsendlen;
struct Tscannedonly *so = (struct Tscannedonly *)handle->data;
TALLOC_CTX *ctx=talloc_tos();
if (scanfile[0] != '/') {
tmp = construct_full_path(ctx,handle, scanfile, false);
} else {
- tmp = (char *)scanfile;
+ tmp = (const char *)scanfile;
}
tmplen = strlen(tmp);
gsendlen = strlen(so->gsendbuffer);
@@ -515,7 +516,7 @@ static SMB_STRUCT_DIR *scannedonly_opendir(vfs_handle_struct * handle,
return NULL;
}
- sDIR = TALLOC_P(NULL, struct scannedonly_DIR);
+ sDIR = talloc(NULL, struct scannedonly_DIR);
if (fname[0] != '/') {
sDIR->base = construct_full_path(sDIR,handle, fname, true);
} else {
@@ -543,7 +544,7 @@ static SMB_STRUCT_DIR *scannedonly_fdopendir(vfs_handle_struct * handle,
fname = (const char *)fsp->fsp_name->base_name;
- sDIR = TALLOC_P(NULL, struct scannedonly_DIR);
+ sDIR = talloc(NULL, struct scannedonly_DIR);
if (fname[0] != '/') {
sDIR->base = construct_full_path(sDIR,handle, fname, true);
} else {
@@ -631,7 +632,7 @@ static SMB_STRUCT_DIRENT *scannedonly_readdir(vfs_handle_struct *handle,
ctx,"%s %s",result->d_name,
STRUCTSCANO(handle->data)->scanning_message);
namelen = strlen(notify_name);
- newdirent = (SMB_STRUCT_DIRENT *)TALLOC_ARRAY(
+ newdirent = (SMB_STRUCT_DIRENT *)talloc_array(
ctx, char, sizeof(SMB_STRUCT_DIRENT) + namelen + 1);
if (!newdirent) {
return NULL;
@@ -948,15 +949,14 @@ static int scannedonly_connect(struct vfs_handle_struct *handle,
so->domain_socket =
lp_parm_bool(SNUM(handle->conn), "scannedonly",
"domain_socket", True);
- so->socketname =
- (char *)lp_parm_const_string(SNUM(handle->conn),
+ so->socketname = lp_parm_const_string(SNUM(handle->conn),
"scannedonly", "socketname",
"/var/lib/scannedonly/scan");
+
so->portnum =
lp_parm_int(SNUM(handle->conn), "scannedonly", "portnum",
2020);
- so->scanhost =
- (char *)lp_parm_const_string(SNUM(handle->conn),
+ so->scanhost = lp_parm_const_string(SNUM(handle->conn),
"scannedonly", "scanhost",
"localhost");
@@ -972,8 +972,7 @@ static int scannedonly_connect(struct vfs_handle_struct *handle,
so->allow_nonscanned_files =
lp_parm_bool(SNUM(handle->conn), "scannedonly",
"allow_nonscanned_files", False);
- so->scanning_message =
- (char *)lp_parm_const_string(SNUM(handle->conn),
+ so->scanning_message = lp_parm_const_string(SNUM(handle->conn),
"scannedonly",
"scanning_message",
"is being scanned for viruses");
@@ -995,17 +994,17 @@ static int scannedonly_connect(struct vfs_handle_struct *handle,
"recheck_tries_readdir", 20);
so->p_scanned =
- (char *)lp_parm_const_string(SNUM(handle->conn),
+ lp_parm_const_string(SNUM(handle->conn),
"scannedonly",
"pref_scanned",
".scanned:");
so->p_virus =
- (char *)lp_parm_const_string(SNUM(handle->conn),
+ lp_parm_const_string(SNUM(handle->conn),
"scannedonly",
"pref_virus",
".virus:");
so->p_failed =
- (char *)lp_parm_const_string(SNUM(handle->conn),
+ lp_parm_const_string(SNUM(handle->conn),
"scannedonly",
"pref_failed",
".failed:");
diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c
index b93f98dedee..1db47d216be 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -216,7 +216,10 @@ static int shadow_copy_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *_dirp
return 0;
}
-static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels)
+static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
+ files_struct *fsp,
+ struct shadow_copy_data *shadow_copy_data,
+ bool labels)
{
SMB_STRUCT_DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn->connectpath,NULL,0);
@@ -250,7 +253,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, files_str
continue;
}
- tlabels = (SHADOW_COPY_LABEL *)TALLOC_REALLOC(shadow_copy_data->mem_ctx,
+ tlabels = (SHADOW_COPY_LABEL *)TALLOC_REALLOC(shadow_copy_data,
shadow_copy_data->labels,
(shadow_copy_data->num_volumes+1)*sizeof(SHADOW_COPY_LABEL));
if (tlabels == NULL) {
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index df3bde72c94..ca33b6d3444 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -1,32 +1,29 @@
-/*
- * implementation of an Shadow Copy module - version 2
+/*
+ * Third attempt at a shadow copy module
*
- * Copyright (C) Andrew Tridgell 2007
- * Copyright (C) Ed Plese 2009
+ * Copyright (C) Andrew Tridgell 2007 (portions taken from shadow_copy2)
+ * Copyright (C) Ed Plese 2009
+ * Copyright (C) Volker Lendecke 2011
+ * Copyright (C) Christian Ambach 2011
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "includes.h"
-#include "smbd/smbd.h"
-#include "system/filesys.h"
-#include "ntioctl.h"
-
/*
- This is a 2nd implemetation of a shadow copy module for exposing
+ This is a 3rd implemetation of a shadow copy module for exposing
snapshots to windows clients as shadow copies. This version has the
following features:
@@ -96,243 +93,169 @@
The following command would generate a correctly formatted directory name
for use with the default parameters:
date -u +@GMT-%Y.%m.%d-%H.%M.%S
-
*/
-static int vfs_shadow_copy2_debug_level = DBGC_VFS;
-
-#undef DBGC_CLASS
-#define DBGC_CLASS vfs_shadow_copy2_debug_level
+#include "includes.h"
+#include "system/filesys.h"
+#include "include/ntioctl.h"
+#include "smbd/proto.h"
+#include <tdb.h>
+#include "util_tdb.h"
#define GMT_NAME_LEN 24 /* length of a @GMT- name */
-#define SHADOW_COPY2_GMT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
+#define GMT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
-#define SHADOW_COPY2_DEFAULT_SORT NULL
-#define SHADOW_COPY2_DEFAULT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
-#define SHADOW_COPY2_DEFAULT_LOCALTIME false
-
-/*
- make very sure it is one of our special names
- */
-static inline bool shadow_copy2_match_name(const char *name, const char **gmt_start)
+static bool shadow_copy2_find_slashes(TALLOC_CTX *mem_ctx, const char *str,
+ size_t **poffsets,
+ unsigned *pnum_offsets)
{
- unsigned year, month, day, hr, min, sec;
+ unsigned num_offsets;
+ size_t *offsets;
const char *p;
- if (gmt_start) {
- (*gmt_start) = NULL;
- }
- p = strstr_m(name, "@GMT-");
- if (p == NULL) return false;
- if (p > name && p[-1] != '/') return False;
- if (sscanf(p, "@GMT-%04u.%02u.%02u-%02u.%02u.%02u", &year, &month,
- &day, &hr, &min, &sec) != 6) {
- return False;
- }
- if (p[24] != 0 && p[24] != '/') {
- return False;
- }
- if (gmt_start) {
- (*gmt_start) = p;
- }
- return True;
-}
-static char *shadow_copy2_snapshot_to_gmt(TALLOC_CTX *mem_ctx,
- vfs_handle_struct *handle, const char *name)
-{
- struct tm timestamp;
- time_t timestamp_t;
- char gmt[GMT_NAME_LEN + 1];
- const char *fmt;
+ num_offsets = 0;
- fmt = lp_parm_const_string(SNUM(handle->conn), "shadow",
- "format", SHADOW_COPY2_DEFAULT_FORMAT);
+ p = str;
+ while ((p = strchr(p, '/')) != NULL) {
+ num_offsets += 1;
+ p += 1;
+ }
- ZERO_STRUCT(timestamp);
- if (strptime(name, fmt, &timestamp) == NULL) {
- DEBUG(10, ("shadow_copy2_snapshot_to_gmt: no match %s: %s\n",
- fmt, name));
- return NULL;
+ offsets = talloc_array(mem_ctx, size_t, num_offsets);
+ if (offsets == NULL) {
+ return false;
}
- DEBUG(10, ("shadow_copy2_snapshot_to_gmt: match %s: %s\n", fmt, name));
- if (lp_parm_bool(SNUM(handle->conn), "shadow", "localtime",
- SHADOW_COPY2_DEFAULT_LOCALTIME))
- {
- timestamp.tm_isdst = -1;
- timestamp_t = mktime(&timestamp);
- gmtime_r(&timestamp_t, &timestamp);
+ p = str;
+ num_offsets = 0;
+ while ((p = strchr(p, '/')) != NULL) {
+ offsets[num_offsets] = p-str;
+ num_offsets += 1;
+ p += 1;
}
- strftime(gmt, sizeof(gmt), SHADOW_COPY2_GMT_FORMAT, &timestamp);
- return talloc_strdup(mem_ctx, gmt);
+ *poffsets = offsets;
+ *pnum_offsets = num_offsets;
+ return true;
}
-/*
- shadow copy paths can also come into the server in this form:
-
- /foo/bar/@GMT-XXXXX/some/file
-
- This function normalises the filename to be of the form:
-
- @GMT-XXXX/foo/bar/some/file
- */
-static const char *shadow_copy2_normalise_path(TALLOC_CTX *mem_ctx, const char *path, const char *gmt_start)
+static char *shadow_copy2_insert_string(TALLOC_CTX *mem_ctx,
+ struct vfs_handle_struct *handle,
+ time_t snapshot)
{
- char *pcopy;
- char buf[GMT_NAME_LEN];
- size_t prefix_len;
+ struct tm snap_tm;
+ fstring gmt;
+ size_t gmt_len;
- if (path == gmt_start) {
- return path;
+ if (localtime_r(&snapshot, &snap_tm) == 0) {
+ DEBUG(10, ("gmtime_r failed\n"));
+ return NULL;
}
-
- prefix_len = gmt_start - path - 1;
-
- DEBUG(10, ("path=%s, gmt_start=%s, prefix_len=%d\n", path, gmt_start,
- (int)prefix_len));
-
- /*
- * We've got a/b/c/@GMT-YYYY.MM.DD-HH.MM.SS/d/e. convert to
- * @GMT-YYYY.MM.DD-HH.MM.SS/a/b/c/d/e before further
- * processing. As many VFS calls provide a const char *,
- * unfortunately we have to make a copy.
- */
-
- pcopy = talloc_strdup(talloc_tos(), path);
- if (pcopy == NULL) {
+ gmt_len = strftime(gmt, sizeof(gmt),
+ lp_parm_const_string(SNUM(handle->conn), "shadow",
+ "format", GMT_FORMAT),
+ &snap_tm);
+ if (gmt_len == 0) {
+ DEBUG(10, ("strftime failed\n"));
return NULL;
}
-
- gmt_start = pcopy + prefix_len;
-
- /*
- * Copy away "@GMT-YYYY.MM.DD-HH.MM.SS"
- */
- memcpy(buf, gmt_start+1, GMT_NAME_LEN);
-
- /*
- * Make space for it including a trailing /
- */
- memmove(pcopy + GMT_NAME_LEN + 1, pcopy, prefix_len);
-
- /*
- * Move in "@GMT-YYYY.MM.DD-HH.MM.SS/" at the beginning again
- */
- memcpy(pcopy, buf, GMT_NAME_LEN);
- pcopy[GMT_NAME_LEN] = '/';
-
- DEBUG(10, ("shadow_copy2_normalise_path: %s -> %s\n", path, pcopy));
-
- return pcopy;
+ return talloc_asprintf(talloc_tos(), "/%s/%s",
+ lp_parm_const_string(
+ SNUM(handle->conn), "shadow", "snapdir",
+ ".snapshots"),
+ gmt);
}
-/*
- convert a name to the shadow directory
- */
-
-#define _SHADOW2_NEXT(op, args, rtype, eret, extra) do { \
- const char *name = fname; \
- const char *gmt_start; \
- if (shadow_copy2_match_name(fname, &gmt_start)) { \
- char *name2; \
- rtype ret; \
- name2 = convert_shadow2_name(handle, fname, gmt_start); \
- if (name2 == NULL) { \
- errno = EINVAL; \
- return eret; \
- } \
- name = name2; \
- ret = SMB_VFS_NEXT_ ## op args; \
- talloc_free(name2); \
- if (ret != eret) extra; \
- return ret; \
- } else { \
- return SMB_VFS_NEXT_ ## op args; \
- } \
-} while (0)
-
-#define _SHADOW2_NEXT_SMB_FNAME(op, args, rtype, eret, extra) do { \
- const char *gmt_start; \
- if (shadow_copy2_match_name(smb_fname->base_name, &gmt_start)) { \
- char *name2; \
- char *smb_base_name_tmp = NULL; \
- rtype ret; \
- name2 = convert_shadow2_name(handle, smb_fname->base_name, gmt_start); \
- if (name2 == NULL) { \
- errno = EINVAL; \
- return eret; \
- } \
- smb_base_name_tmp = smb_fname->base_name; \
- smb_fname->base_name = name2; \
- ret = SMB_VFS_NEXT_ ## op args; \
- smb_fname->base_name = smb_base_name_tmp; \
- talloc_free(name2); \
- if (ret != eret) extra; \
- return ret; \
- } else { \
- return SMB_VFS_NEXT_ ## op args; \
- } \
-} while (0)
+static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx,
+ struct vfs_handle_struct *handle,
+ const char *name,
+ time_t *ptimestamp,
+ char **pstripped)
+{
+ struct tm tm;
+ time_t timestamp;
+ const char *p;
+ char *q;
+ char *stripped;
+ size_t rest_len, dst_len;
-/*
- convert a name to the shadow directory: NTSTATUS-specific handling
- */
+ p = strstr_m(name, "@GMT-");
+ if (p == NULL) {
+ goto no_snapshot;
+ }
+ if ((p > name) && (p[-1] != '/')) {
+ goto no_snapshot;
+ }
+ q = strptime(p, GMT_FORMAT, &tm);
+ if (q == NULL) {
+ goto no_snapshot;
+ }
+ tm.tm_isdst = -1;
+ timestamp = mktime(&tm);
+ if (timestamp == (time_t)-1) {
+ goto no_snapshot;
+ }
+ if ((p == name) && (q[0] == '\0')) {
+ if (pstripped != NULL) {
+ stripped = talloc_strdup(mem_ctx, "");
+ if (stripped == NULL) {
+ return false;
+ }
+ *pstripped = stripped;
+ }
+ *ptimestamp = timestamp;
+ return true;
+ }
+ if (q[0] != '/') {
+ goto no_snapshot;
+ }
+ q += 1;
+
+ rest_len = strlen(q);
+ dst_len = (p-name) + rest_len;
+
+ if (lp_parm_bool(SNUM(handle->conn), "shadow", "snapdirseverywhere",
+ false)) {
+ char *insert;
+ bool have_insert;
+ insert = shadow_copy2_insert_string(talloc_tos(), handle,
+ timestamp);
+ if (insert == NULL) {
+ errno = ENOMEM;
+ return false;
+ }
-#define _SHADOW2_NTSTATUS_NEXT(op, args, eret, extra) do { \
- const char *name = fname; \
- const char *gmt_start; \
- if (shadow_copy2_match_name(fname, &gmt_start)) { \
- char *name2; \
- NTSTATUS ret; \
- name2 = convert_shadow2_name(handle, fname, gmt_start); \
- if (name2 == NULL) { \
- errno = EINVAL; \
- return eret; \
- } \
- name = name2; \
- ret = SMB_VFS_NEXT_ ## op args; \
- talloc_free(name2); \
- if (!NT_STATUS_EQUAL(ret, eret)) extra; \
- return ret; \
- } else { \
- return SMB_VFS_NEXT_ ## op args; \
- } \
-} while (0)
-
-#define SHADOW2_NTSTATUS_NEXT(op, args, eret) _SHADOW2_NTSTATUS_NEXT(op, args, eret, )
-
-#define SHADOW2_NEXT(op, args, rtype, eret) _SHADOW2_NEXT(op, args, rtype, eret, )
-
-#define SHADOW2_NEXT_SMB_FNAME(op, args, rtype, eret) _SHADOW2_NEXT_SMB_FNAME(op, args, rtype, eret, )
-
-#define SHADOW2_NEXT2(op, args) do { \
- const char *gmt_start1, *gmt_start2; \
- if (shadow_copy2_match_name(oldname, &gmt_start1) || \
- shadow_copy2_match_name(newname, &gmt_start2)) { \
- errno = EROFS; \
- return -1; \
- } else { \
- return SMB_VFS_NEXT_ ## op args; \
- } \
-} while (0)
-
-#define SHADOW2_NEXT2_SMB_FNAME(op, args) do { \
- const char *gmt_start1, *gmt_start2; \
- if (shadow_copy2_match_name(smb_fname_src->base_name, &gmt_start1) || \
- shadow_copy2_match_name(smb_fname_dst->base_name, &gmt_start2)) { \
- errno = EROFS; \
- return -1; \
- } else { \
- return SMB_VFS_NEXT_ ## op args; \
- } \
-} while (0)
+ have_insert = (strstr(name, insert+1) != NULL);
+ TALLOC_FREE(insert);
+ if (have_insert) {
+ goto no_snapshot;
+ }
+ }
+ if (pstripped != NULL) {
+ stripped = talloc_array(mem_ctx, char, dst_len+1);
+ if (stripped == NULL) {
+ errno = ENOMEM;
+ return false;
+ }
+ if (p > name) {
+ memcpy(stripped, name, p-name);
+ }
+ if (rest_len > 0) {
+ memcpy(stripped + (p-name), q, rest_len);
+ }
+ stripped[dst_len] = '\0';
+ *pstripped = stripped;
+ }
+ *ptimestamp = timestamp;
+ return true;
+no_snapshot:
+ *ptimestamp = 0;
+ return true;
+}
-/*
- find the mount point of a filesystem
- */
-static char *find_mount_point(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle)
+static char *shadow_copy2_find_mount_point(TALLOC_CTX *mem_ctx,
+ vfs_handle_struct *handle)
{
char *path = talloc_strdup(mem_ctx, handle->conn->connectpath);
dev_t dev;
@@ -358,164 +281,152 @@ static char *find_mount_point(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle)
}
}
- return path;
+ return path;
}
-/*
- work out the location of the snapshot for this share
- */
-static const char *shadow_copy2_find_snapdir(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle)
+static char *shadow_copy2_convert(TALLOC_CTX *mem_ctx,
+ struct vfs_handle_struct *handle,
+ const char *name, time_t timestamp)
{
- const char *snapdir;
- char *mount_point;
- const char *ret;
-
- snapdir = lp_parm_const_string(SNUM(handle->conn), "shadow", "snapdir", NULL);
- if (snapdir == NULL) {
- return NULL;
- }
- /* if its an absolute path, we're done */
- if (*snapdir == '/') {
- return snapdir;
+ struct smb_filename converted_fname;
+ char *result = NULL;
+ size_t *slashes = NULL;
+ unsigned num_slashes;
+ char *path = NULL;
+ size_t pathlen;
+ char *insert = NULL;
+ char *converted = NULL;
+ size_t insertlen;
+ int i, saved_errno;
+ size_t min_offset;
+
+ path = talloc_asprintf(mem_ctx, "%s/%s", handle->conn->connectpath,
+ name);
+ if (path == NULL) {
+ errno = ENOMEM;
+ goto fail;
}
+ pathlen = talloc_get_size(path)-1;
- /* other its relative to the filesystem mount point */
- mount_point = find_mount_point(mem_ctx, handle);
- if (mount_point == NULL) {
- return NULL;
- }
-
- ret = talloc_asprintf(mem_ctx, "%s/%s", mount_point, snapdir);
- talloc_free(mount_point);
- return ret;
-}
-
-/*
- work out the location of the base directory for snapshots of this share
- */
-static const char *shadow_copy2_find_basedir(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle)
-{
- const char *basedir = lp_parm_const_string(SNUM(handle->conn), "shadow", "basedir", NULL);
+ DEBUG(10, ("converting %s\n", path));
- /* other its the filesystem mount point */
- if (basedir == NULL) {
- basedir = find_mount_point(mem_ctx, handle);
+ if (!shadow_copy2_find_slashes(talloc_tos(), path,
+ &slashes, &num_slashes)) {
+ goto fail;
}
-
- return basedir;
-}
-
-/*
- convert a filename from a share relative path, to a path in the
- snapshot directory
- */
-static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname, const char *gmt_path)
-{
- TALLOC_CTX *tmp_ctx = talloc_new(handle->data);
- const char *snapdir, *relpath, *baseoffset, *basedir;
- size_t baselen;
- char *ret, *prefix;
-
- struct tm timestamp;
- time_t timestamp_t;
- char snapshot[MAXPATHLEN];
- const char *fmt;
-
- fmt = lp_parm_const_string(SNUM(handle->conn), "shadow",
- "format", SHADOW_COPY2_DEFAULT_FORMAT);
-
- snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle);
- if (snapdir == NULL) {
- DEBUG(2,("no snapdir found for share at %s\n", handle->conn->connectpath));
- talloc_free(tmp_ctx);
- return NULL;
+ insert = shadow_copy2_insert_string(talloc_tos(), handle, timestamp);
+ if (insert == NULL) {
+ goto fail;
}
-
- basedir = shadow_copy2_find_basedir(tmp_ctx, handle);
- if (basedir == NULL) {
- DEBUG(2,("no basedir found for share at %s\n", handle->conn->connectpath));
- talloc_free(tmp_ctx);
- return NULL;
+ insertlen = talloc_get_size(insert)-1;
+ converted = talloc_array(mem_ctx, char, pathlen + insertlen + 1);
+ if (converted == NULL) {
+ goto fail;
}
- prefix = talloc_asprintf(tmp_ctx, "%s/@GMT-", snapdir);
- if (strncmp(fname, prefix, (talloc_get_size(prefix)-1)) == 0) {
- /* this looks like as we have already normalized it, leave it untouched*/
- talloc_free(tmp_ctx);
- return talloc_strdup(handle->data, fname);
+ if (path[pathlen-1] != '/') {
+ /*
+ * Append a fake slash to find the snapshot root
+ */
+ size_t *tmp;
+ tmp = talloc_realloc(talloc_tos(), slashes,
+ size_t, num_slashes+1);
+ if (tmp == NULL) {
+ goto fail;
+ }
+ slashes = tmp;
+ slashes[num_slashes] = pathlen;
+ num_slashes += 1;
}
- if (strncmp(fname, "@GMT-", 5) != 0) {
- fname = shadow_copy2_normalise_path(tmp_ctx, fname, gmt_path);
- if (fname == NULL) {
- talloc_free(tmp_ctx);
- return NULL;
+ min_offset = 0;
+
+ if (!lp_parm_bool(SNUM(handle->conn), "shadow", "crossmountpoints",
+ false)) {
+ char *mount_point;
+
+ mount_point = shadow_copy2_find_mount_point(talloc_tos(),
+ handle);
+ if (mount_point == NULL) {
+ goto fail;
}
+ min_offset = strlen(mount_point);
+ TALLOC_FREE(mount_point);
}
- ZERO_STRUCT(timestamp);
- relpath = strptime(fname, SHADOW_COPY2_GMT_FORMAT, &timestamp);
- if (relpath == NULL) {
- talloc_free(tmp_ctx);
- return NULL;
- }
+ memcpy(converted, path, pathlen+1);
+ converted[pathlen+insertlen] = '\0';
- /* relpath is the remaining portion of the path after the @GMT-xxx */
+ ZERO_STRUCT(converted_fname);
+ converted_fname.base_name = converted;
- if (lp_parm_bool(SNUM(handle->conn), "shadow", "localtime",
- SHADOW_COPY2_DEFAULT_LOCALTIME))
- {
- timestamp_t = timegm(&timestamp);
- localtime_r(&timestamp_t, &timestamp);
- }
+ for (i = num_slashes-1; i>=0; i--) {
+ int ret;
+ size_t offset;
- strftime(snapshot, MAXPATHLEN, fmt, &timestamp);
+ offset = slashes[i];
- baselen = strlen(basedir);
- baseoffset = handle->conn->connectpath + baselen;
+ if (offset < min_offset) {
+ errno = ENOENT;
+ goto fail;
+ }
- /* some sanity checks */
- if (strncmp(basedir, handle->conn->connectpath, baselen) != 0 ||
- (handle->conn->connectpath[baselen] != 0 && handle->conn->connectpath[baselen] != '/')) {
- DEBUG(0,("convert_shadow2_name: basedir %s is not a parent of %s\n",
- basedir, handle->conn->connectpath));
- talloc_free(tmp_ctx);
- return NULL;
- }
+ memcpy(converted+offset, insert, insertlen);
- if (*relpath == '/') relpath++;
- if (*baseoffset == '/') baseoffset++;
+ offset += insertlen;
+ memcpy(converted+offset, path + slashes[i],
+ pathlen - slashes[i]);
- ret = talloc_asprintf(handle->data, "%s/%s/%s/%s",
- snapdir,
- snapshot,
- baseoffset,
- relpath);
- DEBUG(6,("convert_shadow2_name: '%s' -> '%s'\n", fname, ret));
- talloc_free(tmp_ctx);
- return ret;
-}
+ ret = SMB_VFS_NEXT_LSTAT(handle, &converted_fname);
+ DEBUG(10, ("Trying %s: %d (%s)\n", converted,
+ ret, ret == 0 ? "ok" : strerror(errno)));
+ if (ret == 0) {
+ /* success */
+ break;
+ }
+ if (errno == ENOTDIR) {
+ /*
+ * This is a valid condition: We appended the
+ * .snaphots/@GMT.. to a file name. Just try
+ * with the upper levels.
+ */
+ continue;
+ }
+ if (errno != ENOENT) {
+ /* Other problem than "not found" */
+ goto fail;
+ }
+ }
-/*
- simple string hash
- */
-static uint32 string_hash(const char *s)
-{
- uint32 n = 0;
- while (*s) {
- n = ((n << 5) + n) ^ (uint32)(*s++);
- }
- return n;
+ if (i >= 0) {
+ /*
+ * Found something
+ */
+ DEBUG(10, ("Found %s\n", converted));
+ result = converted;
+ converted = NULL;
+ } else {
+ errno = ENOENT;
+ }
+fail:
+ saved_errno = errno;
+ TALLOC_FREE(converted);
+ TALLOC_FREE(insert);
+ TALLOC_FREE(slashes);
+ TALLOC_FREE(path);
+ errno = saved_errno;
+ return result;
}
/*
modify a sbuf return to ensure that inodes in the shadow directory
are different from those in the main directory
*/
-static void convert_sbuf(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf)
+static void convert_sbuf(vfs_handle_struct *handle, const char *fname,
+ SMB_STRUCT_STAT *sbuf)
{
- if (lp_parm_bool(SNUM(handle->conn), "shadow", "fixinodes", False)) {
+ if (lp_parm_bool(SNUM(handle->conn), "shadow", "fixinodes", False)) {
/* some snapshot systems, like GPFS, return the name
device:inode for the snapshot files as the current
files. That breaks the 'restore' button in the shadow copy
@@ -526,7 +437,10 @@ static void convert_sbuf(vfs_handle_struct *handle, const char *fname, SMB_STRUC
number collision, but I can't see a better approach
without significant VFS changes
*/
- uint32_t shash = string_hash(fname) & 0xFF000000;
+ uint32_t shash;
+ TDB_DATA data = string_tdb_data(fname);
+
+ shash = tdb_jenkins_hash(&data) & 0xFF000000;
if (shash == 0) {
shash = 1;
}
@@ -534,316 +448,607 @@ static void convert_sbuf(vfs_handle_struct *handle, const char *fname, SMB_STRUC
}
}
+static SMB_STRUCT_DIR *shadow_copy2_opendir(vfs_handle_struct *handle,
+ const char *fname,
+ const char *mask,
+ uint32 attr)
+{
+ time_t timestamp;
+ char *stripped;
+ SMB_STRUCT_DIR *ret;
+ int saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return NULL;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return NULL;
+ }
+ ret = SMB_VFS_NEXT_OPENDIR(handle, conv, mask, attr);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
static int shadow_copy2_rename(vfs_handle_struct *handle,
const struct smb_filename *smb_fname_src,
const struct smb_filename *smb_fname_dst)
{
- if (shadow_copy2_match_name(smb_fname_src->base_name, NULL)) {
+ time_t timestamp_src, timestamp_dst;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ smb_fname_src->base_name,
+ &timestamp_src, NULL)) {
+ return -1;
+ }
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ smb_fname_dst->base_name,
+ &timestamp_dst, NULL)) {
+ return -1;
+ }
+ if (timestamp_src != 0) {
errno = EXDEV;
return -1;
}
- SHADOW2_NEXT2_SMB_FNAME(RENAME,
- (handle, smb_fname_src, smb_fname_dst));
+ if (timestamp_dst != 0) {
+ errno = EROFS;
+ return -1;
+ }
+ return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
}
static int shadow_copy2_symlink(vfs_handle_struct *handle,
const char *oldname, const char *newname)
{
- SHADOW2_NEXT2(SYMLINK, (handle, oldname, newname));
-}
+ time_t timestamp_old, timestamp_new;
-static int shadow_copy2_link(vfs_handle_struct *handle,
- const char *oldname, const char *newname)
-{
- SHADOW2_NEXT2(LINK, (handle, oldname, newname));
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, oldname,
+ &timestamp_old, NULL)) {
+ return -1;
+ }
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, newname,
+ &timestamp_new, NULL)) {
+ return -1;
+ }
+ if ((timestamp_old != 0) || (timestamp_new != 0)) {
+ errno = EROFS;
+ return -1;
+ }
+ return SMB_VFS_NEXT_SYMLINK(handle, oldname, newname);
}
-static int shadow_copy2_open(vfs_handle_struct *handle,
- struct smb_filename *smb_fname, files_struct *fsp,
- int flags, mode_t mode)
+static int shadow_copy2_link(vfs_handle_struct *handle,
+ const char *oldname, const char *newname)
{
- SHADOW2_NEXT_SMB_FNAME(OPEN,
- (handle, smb_fname, fsp, flags, mode),
- int, -1);
-}
+ time_t timestamp_old, timestamp_new;
-static SMB_STRUCT_DIR *shadow_copy2_opendir(vfs_handle_struct *handle,
- const char *fname, const char *mask, uint32 attr)
-{
- SHADOW2_NEXT(OPENDIR, (handle, name, mask, attr), SMB_STRUCT_DIR *, NULL);
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, oldname,
+ &timestamp_old, NULL)) {
+ return -1;
+ }
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, newname,
+ &timestamp_new, NULL)) {
+ return -1;
+ }
+ if ((timestamp_old != 0) || (timestamp_new != 0)) {
+ errno = EROFS;
+ return -1;
+ }
+ return SMB_VFS_NEXT_LINK(handle, oldname, newname);
}
static int shadow_copy2_stat(vfs_handle_struct *handle,
struct smb_filename *smb_fname)
{
- _SHADOW2_NEXT_SMB_FNAME(STAT, (handle, smb_fname), int, -1,
- convert_sbuf(handle, smb_fname->base_name,
- &smb_fname->st));
+ time_t timestamp;
+ char *stripped, *tmp;
+ int ret, saved_errno;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ smb_fname->base_name,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_STAT(handle, smb_fname);
+ }
+
+ tmp = smb_fname->base_name;
+ smb_fname->base_name = shadow_copy2_convert(
+ talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+
+ if (smb_fname->base_name == NULL) {
+ smb_fname->base_name = tmp;
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
+ saved_errno = errno;
+
+ TALLOC_FREE(smb_fname->base_name);
+ smb_fname->base_name = tmp;
+
+ if (ret == 0) {
+ convert_sbuf(handle, smb_fname->base_name, &smb_fname->st);
+ }
+ errno = saved_errno;
+ return ret;
}
static int shadow_copy2_lstat(vfs_handle_struct *handle,
struct smb_filename *smb_fname)
{
- _SHADOW2_NEXT_SMB_FNAME(LSTAT, (handle, smb_fname), int, -1,
- convert_sbuf(handle, smb_fname->base_name,
- &smb_fname->st));
+ time_t timestamp;
+ char *stripped, *tmp;
+ int ret, saved_errno;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ smb_fname->base_name,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
+ }
+
+ tmp = smb_fname->base_name;
+ smb_fname->base_name = shadow_copy2_convert(
+ talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+
+ if (smb_fname->base_name == NULL) {
+ smb_fname->base_name = tmp;
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
+ saved_errno = errno;
+
+ TALLOC_FREE(smb_fname->base_name);
+ smb_fname->base_name = tmp;
+
+ if (ret == 0) {
+ convert_sbuf(handle, smb_fname->base_name, &smb_fname->st);
+ }
+ errno = saved_errno;
+ return ret;
}
-static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
+static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp,
+ SMB_STRUCT_STAT *sbuf)
{
- int ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
- if (ret == 0 && shadow_copy2_match_name(fsp->fsp_name->base_name, NULL)) {
+ time_t timestamp;
+ int ret;
+
+ ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
+ if (ret == -1) {
+ return ret;
+ }
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ fsp->fsp_name->base_name,
+ &timestamp, NULL)) {
+ return 0;
+ }
+ if (timestamp != 0) {
convert_sbuf(handle, fsp->fsp_name->base_name, sbuf);
}
+ return 0;
+}
+
+static int shadow_copy2_open(vfs_handle_struct *handle,
+ struct smb_filename *smb_fname, files_struct *fsp,
+ int flags, mode_t mode)
+{
+ time_t timestamp;
+ char *stripped, *tmp;
+ int ret, saved_errno;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ smb_fname->base_name,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
+ }
+
+ tmp = smb_fname->base_name;
+ smb_fname->base_name = shadow_copy2_convert(
+ talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+
+ if (smb_fname->base_name == NULL) {
+ smb_fname->base_name = tmp;
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
+ saved_errno = errno;
+
+ TALLOC_FREE(smb_fname->base_name);
+ smb_fname->base_name = tmp;
+
+ errno = saved_errno;
return ret;
}
static int shadow_copy2_unlink(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname_in)
+ const struct smb_filename *smb_fname)
{
- struct smb_filename *smb_fname = NULL;
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ struct smb_filename *conv;
NTSTATUS status;
- status = copy_smb_filename(talloc_tos(), smb_fname_in, &smb_fname);
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ smb_fname->base_name,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
+ }
+ status = copy_smb_filename(talloc_tos(), smb_fname, &conv);
if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ errno = ENOMEM;
return -1;
}
-
- SHADOW2_NEXT_SMB_FNAME(UNLINK, (handle, smb_fname), int, -1);
+ conv->base_name = shadow_copy2_convert(
+ conv, handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv->base_name == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_UNLINK(handle, conv);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
}
-static int shadow_copy2_chmod(vfs_handle_struct *handle,
- const char *fname, mode_t mode)
+static int shadow_copy2_chmod(vfs_handle_struct *handle, const char *fname,
+ mode_t mode)
{
- SHADOW2_NEXT(CHMOD, (handle, name, mode), int, -1);
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_CHMOD(handle, fname, mode);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_CHMOD(handle, conv, mode);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
}
-static int shadow_copy2_chown(vfs_handle_struct *handle,
- const char *fname, uid_t uid, gid_t gid)
+static int shadow_copy2_chown(vfs_handle_struct *handle, const char *fname,
+ uid_t uid, gid_t gid)
{
- SHADOW2_NEXT(CHOWN, (handle, name, uid, gid), int, -1);
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_CHOWN(handle, fname, uid, gid);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_CHOWN(handle, conv, uid, gid);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
}
static int shadow_copy2_chdir(vfs_handle_struct *handle,
- const char *fname)
+ const char *fname)
{
- SHADOW2_NEXT(CHDIR, (handle, name), int, -1);
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_CHDIR(handle, fname);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_CHDIR(handle, conv);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
}
static int shadow_copy2_ntimes(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname_in,
+ const struct smb_filename *smb_fname,
struct smb_file_time *ft)
{
- struct smb_filename *smb_fname = NULL;
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ struct smb_filename *conv;
NTSTATUS status;
- status = copy_smb_filename(talloc_tos(), smb_fname_in, &smb_fname);
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ smb_fname->base_name,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
+ }
+ status = copy_smb_filename(talloc_tos(), smb_fname, &conv);
if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ errno = ENOMEM;
return -1;
}
-
- SHADOW2_NEXT_SMB_FNAME(NTIMES, (handle, smb_fname, ft), int, -1);
+ conv->base_name = shadow_copy2_convert(
+ conv, handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv->base_name == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_NTIMES(handle, conv, ft);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
}
static int shadow_copy2_readlink(vfs_handle_struct *handle,
const char *fname, char *buf, size_t bufsiz)
{
- SHADOW2_NEXT(READLINK, (handle, name, buf, bufsiz), int, -1);
-}
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
-static int shadow_copy2_mknod(vfs_handle_struct *handle,
- const char *fname, mode_t mode, SMB_DEV_T dev)
-{
- SHADOW2_NEXT(MKNOD, (handle, name, mode, dev), int, -1);
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_READLINK(handle, fname, buf, bufsiz);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_READLINK(handle, conv, buf, bufsiz);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
}
-static char *shadow_copy2_realpath(vfs_handle_struct *handle,
- const char *fname)
+static int shadow_copy2_mknod(vfs_handle_struct *handle,
+ const char *fname, mode_t mode, SMB_DEV_T dev)
{
- const char *gmt;
-
- if (shadow_copy2_match_name(fname, &gmt)
- && (gmt[GMT_NAME_LEN] == '\0')) {
- char *copy;
-
- copy = talloc_strdup(talloc_tos(), fname);
- if (copy == NULL) {
- errno = ENOMEM;
- return NULL;
- }
-
- copy[gmt - fname] = '.';
- copy[gmt - fname + 1] = '\0';
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
- DEBUG(10, ("calling NEXT_REALPATH with %s\n", copy));
- SHADOW2_NEXT(REALPATH, (handle, name), char *,
- NULL);
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_MKNOD(handle, fname, mode, dev);
}
- SHADOW2_NEXT(REALPATH, (handle, name), char *, NULL);
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_MKNOD(handle, conv, mode, dev);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
}
-static const char *shadow_copy2_connectpath(struct vfs_handle_struct *handle,
- const char *fname)
+static char *shadow_copy2_realpath(vfs_handle_struct *handle,
+ const char *fname)
{
- TALLOC_CTX *tmp_ctx;
- const char *snapdir, *baseoffset, *basedir, *gmt_start;
- size_t baselen;
- char *ret;
-
- DEBUG(10, ("shadow_copy2_connectpath called with %s\n", fname));
-
- if (!shadow_copy2_match_name(fname, &gmt_start)) {
- return handle->conn->connectpath;
+ time_t timestamp;
+ char *stripped = NULL;
+ char *tmp = NULL;
+ char *result = NULL;
+ char *inserted = NULL;
+ char *inserted_to, *inserted_end;
+ int saved_errno;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ goto done;
}
-
- /*
- * We have to create a real temporary context because we have
- * to put our result on talloc_tos(). Thus we can't use a
- * talloc_stackframe() here.
- */
- tmp_ctx = talloc_new(talloc_tos());
-
- fname = shadow_copy2_normalise_path(tmp_ctx, fname, gmt_start);
- if (fname == NULL) {
- TALLOC_FREE(tmp_ctx);
- return NULL;
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_REALPATH(handle, fname);
}
- snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle);
- if (snapdir == NULL) {
- DEBUG(2,("no snapdir found for share at %s\n",
- handle->conn->connectpath));
- TALLOC_FREE(tmp_ctx);
- return NULL;
+ tmp = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ if (tmp == NULL) {
+ goto done;
}
- basedir = shadow_copy2_find_basedir(tmp_ctx, handle);
- if (basedir == NULL) {
- DEBUG(2,("no basedir found for share at %s\n",
- handle->conn->connectpath));
- TALLOC_FREE(tmp_ctx);
- return NULL;
+ result = SMB_VFS_NEXT_REALPATH(handle, tmp);
+ if (result == NULL) {
+ goto done;
}
- baselen = strlen(basedir);
- baseoffset = handle->conn->connectpath + baselen;
-
- /* some sanity checks */
- if (strncmp(basedir, handle->conn->connectpath, baselen) != 0 ||
- (handle->conn->connectpath[baselen] != 0
- && handle->conn->connectpath[baselen] != '/')) {
- DEBUG(0,("shadow_copy2_connectpath: basedir %s is not a "
- "parent of %s\n", basedir,
- handle->conn->connectpath));
- TALLOC_FREE(tmp_ctx);
- return NULL;
+ /*
+ * Take away what we've inserted. This removes the @GMT-thingy
+ * completely, but will give a path under the share root.
+ */
+ inserted = shadow_copy2_insert_string(talloc_tos(), handle, timestamp);
+ if (inserted == NULL) {
+ goto done;
}
-
- if (*baseoffset == '/') baseoffset++;
-
- ret = talloc_asprintf(talloc_tos(), "%s/%.*s/%s",
- snapdir,
- GMT_NAME_LEN, fname,
- baseoffset);
- DEBUG(6,("shadow_copy2_connectpath: '%s' -> '%s'\n", fname, ret));
- TALLOC_FREE(tmp_ctx);
- return ret;
+ inserted_to = strstr_m(result, inserted);
+ if (inserted_to == NULL) {
+ DEBUG(2, ("SMB_VFS_NEXT_REALPATH removed %s\n", inserted));
+ goto done;
+ }
+ inserted_end = inserted_to + talloc_get_size(inserted) - 1;
+ memmove(inserted_to, inserted_end, strlen(inserted_end)+1);
+
+done:
+ saved_errno = errno;
+ TALLOC_FREE(inserted);
+ TALLOC_FREE(tmp);
+ TALLOC_FREE(stripped);
+ errno = saved_errno;
+ return result;
}
-static NTSTATUS shadow_copy2_get_nt_acl(vfs_handle_struct *handle,
- const char *fname, uint32 security_info,
- struct security_descriptor **ppdesc)
+static char *have_snapdir(struct vfs_handle_struct *handle,
+ const char *path)
{
- SHADOW2_NTSTATUS_NEXT(GET_NT_ACL, (handle, name, security_info, ppdesc), NT_STATUS_ACCESS_DENIED);
-}
+ struct smb_filename smb_fname;
+ int ret;
+
+ ZERO_STRUCT(smb_fname);
+ smb_fname.base_name = talloc_asprintf(
+ talloc_tos(), "%s/%s", path,
+ lp_parm_const_string(SNUM(handle->conn), "shadow", "snapdir",
+ ".snapshots"));
+ if (smb_fname.base_name == NULL) {
+ return NULL;
+ }
-static int shadow_copy2_mkdir(vfs_handle_struct *handle, const char *fname, mode_t mode)
-{
- SHADOW2_NEXT(MKDIR, (handle, name, mode), int, -1);
+ ret = SMB_VFS_NEXT_STAT(handle, &smb_fname);
+ if ((ret == 0) && (S_ISDIR(smb_fname.st.st_ex_mode))) {
+ return smb_fname.base_name;
+ }
+ TALLOC_FREE(smb_fname.base_name);
+ return NULL;
}
-static int shadow_copy2_rmdir(vfs_handle_struct *handle, const char *fname)
+static char *shadow_copy2_find_snapdir(TALLOC_CTX *mem_ctx,
+ struct vfs_handle_struct *handle,
+ struct smb_filename *smb_fname)
{
- SHADOW2_NEXT(RMDIR, (handle, name), int, -1);
-}
+ char *path, *p;
+ char *snapdir;
-static int shadow_copy2_chflags(vfs_handle_struct *handle, const char *fname,
- unsigned int flags)
-{
- SHADOW2_NEXT(CHFLAGS, (handle, name, flags), int, -1);
-}
+ path = talloc_asprintf(mem_ctx, "%s/%s",
+ handle->conn->connectpath,
+ smb_fname->base_name);
+ if (path == NULL) {
+ return NULL;
+ }
-static ssize_t shadow_copy2_getxattr(vfs_handle_struct *handle,
- const char *fname, const char *aname, void *value, size_t size)
-{
- SHADOW2_NEXT(GETXATTR, (handle, name, aname, value, size), ssize_t, -1);
-}
+ snapdir = have_snapdir(handle, path);
+ if (snapdir != NULL) {
+ TALLOC_FREE(path);
+ return snapdir;
+ }
-static ssize_t shadow_copy2_lgetxattr(vfs_handle_struct *handle,
- const char *fname, const char *aname, void *value, size_t size)
-{
- SHADOW2_NEXT(LGETXATTR, (handle, name, aname, value, size), ssize_t, -1);
-}
+ while ((p = strrchr(path, '/')) && (p > path)) {
-static ssize_t shadow_copy2_listxattr(struct vfs_handle_struct *handle, const char *fname,
- char *list, size_t size)
-{
- SHADOW2_NEXT(LISTXATTR, (handle, name, list, size), ssize_t, -1);
-}
+ p[0] = '\0';
-static int shadow_copy2_removexattr(struct vfs_handle_struct *handle, const char *fname,
- const char *aname)
-{
- SHADOW2_NEXT(REMOVEXATTR, (handle, name, aname), int, -1);
+ snapdir = have_snapdir(handle, path);
+ if (snapdir != NULL) {
+ TALLOC_FREE(path);
+ return snapdir;
+ }
+ }
+ TALLOC_FREE(path);
+ return NULL;
}
-static int shadow_copy2_lremovexattr(struct vfs_handle_struct *handle, const char *fname,
- const char *aname)
+static bool shadow_copy2_snapshot_to_gmt(TALLOC_CTX *mem_ctx,
+ vfs_handle_struct *handle,
+ const char *name,
+ char *gmt, size_t gmt_len)
{
- SHADOW2_NEXT(LREMOVEXATTR, (handle, name, aname), int, -1);
-}
+ struct tm timestamp;
+ time_t timestamp_t;
+ const char *fmt;
-static int shadow_copy2_setxattr(struct vfs_handle_struct *handle, const char *fname,
- const char *aname, const void *value, size_t size, int flags)
-{
- SHADOW2_NEXT(SETXATTR, (handle, name, aname, value, size, flags), int, -1);
-}
+ fmt = lp_parm_const_string(SNUM(handle->conn), "shadow",
+ "format", GMT_FORMAT);
-static int shadow_copy2_lsetxattr(struct vfs_handle_struct *handle, const char *fname,
- const char *aname, const void *value, size_t size, int flags)
-{
- SHADOW2_NEXT(LSETXATTR, (handle, name, aname, value, size, flags), int, -1);
-}
+ ZERO_STRUCT(timestamp);
+ if (strptime(name, fmt, &timestamp) == NULL) {
+ DEBUG(10, ("shadow_copy2_snapshot_to_gmt: no match %s: %s\n",
+ fmt, name));
+ return false;
+ }
-static int shadow_copy2_chmod_acl(vfs_handle_struct *handle,
- const char *fname, mode_t mode)
-{
- SHADOW2_NEXT(CHMOD_ACL, (handle, name, mode), int, -1);
+ DEBUG(10, ("shadow_copy2_snapshot_to_gmt: match %s: %s\n", fmt, name));
+
+ if (lp_parm_bool(SNUM(handle->conn), "shadow", "localtime", false)) {
+ timestamp.tm_isdst = -1;
+ timestamp_t = mktime(&timestamp);
+ gmtime_r(&timestamp_t, &timestamp);
+ }
+ strftime(gmt, gmt_len, GMT_FORMAT, &timestamp);
+ return true;
}
static int shadow_copy2_label_cmp_asc(const void *x, const void *y)
{
- return strncmp((char *)x, (char *)y, sizeof(SHADOW_COPY_LABEL));
+ return strncmp((const char *)x, (const char *)y, sizeof(SHADOW_COPY_LABEL));
}
static int shadow_copy2_label_cmp_desc(const void *x, const void *y)
{
- return -strncmp((char *)x, (char *)y, sizeof(SHADOW_COPY_LABEL));
+ return -strncmp((const char *)x, (const char *)y, sizeof(SHADOW_COPY_LABEL));
}
/*
sort the shadow copy data in ascending or descending order
*/
static void shadow_copy2_sort_data(vfs_handle_struct *handle,
- SHADOW_COPY_DATA *shadow_copy2_data)
+ struct shadow_copy_data *shadow_copy2_data)
{
int (*cmpfunc)(const void *, const void *);
const char *sort;
sort = lp_parm_const_string(SNUM(handle->conn), "shadow",
- "sort", SHADOW_COPY2_DEFAULT_SORT);
+ "sort", NULL);
if (sort == NULL) {
return;
}
@@ -867,18 +1072,17 @@ static void shadow_copy2_sort_data(vfs_handle_struct *handle,
return;
}
-static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle,
- files_struct *fsp,
- SHADOW_COPY_DATA *shadow_copy2_data,
- bool labels)
+static int shadow_copy2_get_shadow_copy_data(
+ vfs_handle_struct *handle, files_struct *fsp,
+ struct shadow_copy_data *shadow_copy2_data,
+ bool labels)
{
SMB_STRUCT_DIR *p;
const char *snapdir;
SMB_STRUCT_DIRENT *d;
- TALLOC_CTX *tmp_ctx = talloc_new(handle->data);
- char *snapshot;
+ TALLOC_CTX *tmp_ctx = talloc_stackframe();
- snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle);
+ snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle, fsp->fsp_name);
if (snapdir == NULL) {
DEBUG(0,("shadow:snapdir not found for %s in get_shadow_copy_data\n",
handle->conn->connectpath));
@@ -901,16 +1105,23 @@ static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle,
shadow_copy2_data->labels = NULL;
while ((d = SMB_VFS_NEXT_READDIR(handle, p, NULL))) {
+ char snapshot[GMT_NAME_LEN+1];
SHADOW_COPY_LABEL *tlabels;
- /* ignore names not of the right form in the snapshot directory */
- snapshot = shadow_copy2_snapshot_to_gmt(tmp_ctx, handle,
- d->d_name);
- DEBUG(6,("shadow_copy2_get_shadow_copy2_data: %s -> %s\n",
- d->d_name, snapshot));
- if (!snapshot) {
+ /*
+ * ignore names not of the right form in the snapshot
+ * directory
+ */
+ if (!shadow_copy2_snapshot_to_gmt(
+ tmp_ctx, handle, d->d_name,
+ snapshot, sizeof(snapshot))) {
+
+ DEBUG(6, ("shadow_copy2_get_shadow_copy_data: "
+ "ignoring %s\n", d->d_name));
continue;
}
+ DEBUG(6,("shadow_copy2_get_shadow_copy_data: %s -> %s\n",
+ d->d_name, snapshot));
if (!labels) {
/* the caller doesn't want the labels */
@@ -918,9 +1129,10 @@ static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle,
continue;
}
- tlabels = talloc_realloc(shadow_copy2_data->mem_ctx,
+ tlabels = talloc_realloc(shadow_copy2_data,
shadow_copy2_data->labels,
- SHADOW_COPY_LABEL, shadow_copy2_data->num_volumes+1);
+ SHADOW_COPY_LABEL,
+ shadow_copy2_data->num_volumes+1);
if (tlabels == NULL) {
DEBUG(0,("shadow_copy2: out of memory\n"));
SMB_VFS_NEXT_CLOSEDIR(handle, p);
@@ -930,7 +1142,6 @@ static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle,
strlcpy(tlabels[shadow_copy2_data->num_volumes], snapshot,
sizeof(*tlabels));
- talloc_free(snapshot);
shadow_copy2_data->num_volumes++;
shadow_copy2_data->labels = tlabels;
@@ -944,59 +1155,455 @@ static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle,
return 0;
}
-static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
- .opendir = shadow_copy2_opendir,
- .mkdir = shadow_copy2_mkdir,
- .rmdir = shadow_copy2_rmdir,
- .chflags = shadow_copy2_chflags,
- .getxattr = shadow_copy2_getxattr,
- .lgetxattr = shadow_copy2_lgetxattr,
- .listxattr = shadow_copy2_listxattr,
- .removexattr = shadow_copy2_removexattr,
- .lremovexattr = shadow_copy2_lremovexattr,
- .setxattr = shadow_copy2_setxattr,
- .lsetxattr = shadow_copy2_lsetxattr,
- .open_fn = shadow_copy2_open,
- .rename = shadow_copy2_rename,
- .stat = shadow_copy2_stat,
- .lstat = shadow_copy2_lstat,
- .fstat = shadow_copy2_fstat,
- .unlink = shadow_copy2_unlink,
- .chmod = shadow_copy2_chmod,
- .chown = shadow_copy2_chown,
- .chdir = shadow_copy2_chdir,
- .ntimes = shadow_copy2_ntimes,
- .symlink = shadow_copy2_symlink,
- .vfs_readlink = shadow_copy2_readlink,
- .link = shadow_copy2_link,
- .mknod = shadow_copy2_mknod,
- .realpath = shadow_copy2_realpath,
- .connectpath = shadow_copy2_connectpath,
- .get_nt_acl = shadow_copy2_get_nt_acl,
- .chmod_acl = shadow_copy2_chmod_acl,
- .get_shadow_copy_data = shadow_copy2_get_shadow_copy2_data,
-};
+static NTSTATUS shadow_copy2_fget_nt_acl(vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ uint32 security_info,
+ struct security_descriptor **ppdesc)
+{
+ time_t timestamp;
+ char *stripped;
+ NTSTATUS status;
+ char *conv;
-NTSTATUS vfs_shadow_copy2_init(void);
-NTSTATUS vfs_shadow_copy2_init(void)
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ fsp->fsp_name->base_name,
+ &timestamp, &stripped)) {
+ return map_nt_error_from_unix(errno);
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info,
+ ppdesc);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return map_nt_error_from_unix(errno);
+ }
+ status = SMB_VFS_NEXT_GET_NT_ACL(handle, conv, security_info, ppdesc);
+ TALLOC_FREE(conv);
+ return status;
+}
+
+static NTSTATUS shadow_copy2_get_nt_acl(vfs_handle_struct *handle,
+ const char *fname,
+ uint32 security_info,
+ struct security_descriptor **ppdesc)
+{
+ time_t timestamp;
+ char *stripped;
+ NTSTATUS status;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return map_nt_error_from_unix(errno);
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_GET_NT_ACL(handle, fname, security_info,
+ ppdesc);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return map_nt_error_from_unix(errno);
+ }
+ status = SMB_VFS_NEXT_GET_NT_ACL(handle, conv, security_info, ppdesc);
+ TALLOC_FREE(conv);
+ return status;
+}
+
+static int shadow_copy2_mkdir(vfs_handle_struct *handle,
+ const char *fname, mode_t mode)
{
- NTSTATUS ret;
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
- ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "shadow_copy2",
- &vfs_shadow_copy2_fns);
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_MKDIR(handle, fname, mode);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_MKDIR(handle, conv, mode);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
- if (!NT_STATUS_IS_OK(ret))
- return ret;
+static int shadow_copy2_rmdir(vfs_handle_struct *handle, const char *fname)
+{
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
- vfs_shadow_copy2_debug_level = debug_add_class("shadow_copy2");
- if (vfs_shadow_copy2_debug_level == -1) {
- vfs_shadow_copy2_debug_level = DBGC_VFS;
- DEBUG(0, ("%s: Couldn't register custom debugging class!\n",
- "vfs_shadow_copy2_init"));
- } else {
- DEBUG(10, ("%s: Debug class number of '%s': %d\n",
- "vfs_shadow_copy2_init","shadow_copy2",vfs_shadow_copy2_debug_level));
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_RMDIR(handle, fname);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_RMDIR(handle, conv);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
+static int shadow_copy2_chflags(vfs_handle_struct *handle, const char *fname,
+ unsigned int flags)
+{
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_CHFLAGS(handle, fname, flags);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_CHFLAGS(handle, conv, flags);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
+static ssize_t shadow_copy2_getxattr(vfs_handle_struct *handle,
+ const char *fname, const char *aname,
+ void *value, size_t size)
+{
+ time_t timestamp;
+ char *stripped;
+ ssize_t ret;
+ int saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_GETXATTR(handle, fname, aname, value,
+ size);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_GETXATTR(handle, conv, aname, value, size);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
+static ssize_t shadow_copy2_lgetxattr(vfs_handle_struct *handle,
+ const char *fname, const char *aname,
+ void *value, size_t size)
+{
+ time_t timestamp;
+ char *stripped;
+ ssize_t ret;
+ int saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_LGETXATTR(handle, fname, aname, value,
+ size);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_LGETXATTR(handle, conv, aname, value, size);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
+static ssize_t shadow_copy2_listxattr(struct vfs_handle_struct *handle,
+ const char *fname,
+ char *list, size_t size)
+{
+ time_t timestamp;
+ char *stripped;
+ ssize_t ret;
+ int saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_LISTXATTR(handle, fname, list, size);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_LISTXATTR(handle, conv, list, size);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
+static int shadow_copy2_removexattr(vfs_handle_struct *handle,
+ const char *fname, const char *aname)
+{
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_REMOVEXATTR(handle, fname, aname);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_REMOVEXATTR(handle, conv, aname);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
+static int shadow_copy2_lremovexattr(vfs_handle_struct *handle,
+ const char *fname, const char *aname)
+{
+ time_t timestamp;
+ char *stripped;
+ int ret, saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_LREMOVEXATTR(handle, fname, aname);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_LREMOVEXATTR(handle, conv, aname);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
+static int shadow_copy2_setxattr(struct vfs_handle_struct *handle,
+ const char *fname,
+ const char *aname, const void *value,
+ size_t size, int flags)
+{
+ time_t timestamp;
+ char *stripped;
+ ssize_t ret;
+ int saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_SETXATTR(handle, fname, aname, value, size,
+ flags);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_SETXATTR(handle, conv, aname, value, size, flags);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
+static int shadow_copy2_lsetxattr(struct vfs_handle_struct *handle,
+ const char *fname,
+ const char *aname, const void *value,
+ size_t size, int flags)
+{
+ time_t timestamp;
+ char *stripped;
+ ssize_t ret;
+ int saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_LSETXATTR(handle, fname, aname, value,
+ size, flags);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_LSETXATTR(handle, conv, aname, value, size, flags);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+
+static int shadow_copy2_chmod_acl(vfs_handle_struct *handle,
+ const char *fname, mode_t mode)
+{
+ time_t timestamp;
+ char *stripped;
+ ssize_t ret;
+ int saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
+ &timestamp, &stripped)) {
+ return -1;
}
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_CHMOD_ACL(handle, fname, mode);
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_CHMOD_ACL(handle, conv, mode);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
+ return ret;
+}
+static int shadow_copy2_get_real_filename(struct vfs_handle_struct *handle,
+ const char *path,
+ const char *name,
+ TALLOC_CTX *mem_ctx,
+ char **found_name)
+{
+ time_t timestamp;
+ char *stripped;
+ ssize_t ret;
+ int saved_errno;
+ char *conv;
+
+ if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, path,
+ &timestamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name,
+ mem_ctx, found_name);
+ }
+ if (stripped[0] == '\0') {
+ *found_name = talloc_strdup(mem_ctx, name);
+ if (*found_name == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ return 0;
+ }
+ conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
+ TALLOC_FREE(stripped);
+ if (conv == NULL) {
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, conv, name,
+ mem_ctx, found_name);
+ saved_errno = errno;
+ TALLOC_FREE(conv);
+ errno = saved_errno;
return ret;
}
+
+
+static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
+ .opendir = shadow_copy2_opendir,
+ .rename = shadow_copy2_rename,
+ .link = shadow_copy2_link,
+ .symlink = shadow_copy2_symlink,
+ .stat = shadow_copy2_stat,
+ .lstat = shadow_copy2_lstat,
+ .fstat = shadow_copy2_fstat,
+ .open_fn = shadow_copy2_open,
+ .unlink = shadow_copy2_unlink,
+ .chmod = shadow_copy2_chmod,
+ .chown = shadow_copy2_chown,
+ .chdir = shadow_copy2_chdir,
+ .ntimes = shadow_copy2_ntimes,
+ .vfs_readlink = shadow_copy2_readlink,
+ .mknod = shadow_copy2_mknod,
+ .realpath = shadow_copy2_realpath,
+ .get_nt_acl = shadow_copy2_get_nt_acl,
+ .fget_nt_acl = shadow_copy2_fget_nt_acl,
+ .get_shadow_copy_data = shadow_copy2_get_shadow_copy_data,
+ .mkdir = shadow_copy2_mkdir,
+ .rmdir = shadow_copy2_rmdir,
+ .getxattr = shadow_copy2_getxattr,
+ .lgetxattr = shadow_copy2_lgetxattr,
+ .listxattr = shadow_copy2_listxattr,
+ .removexattr = shadow_copy2_removexattr,
+ .lremovexattr = shadow_copy2_lremovexattr,
+ .setxattr = shadow_copy2_setxattr,
+ .lsetxattr = shadow_copy2_lsetxattr,
+ .chmod_acl = shadow_copy2_chmod_acl,
+ .chflags = shadow_copy2_chflags,
+ .get_real_filename = shadow_copy2_get_real_filename,
+};
+
+NTSTATUS vfs_shadow_copy2_init(void);
+NTSTATUS vfs_shadow_copy2_init(void)
+{
+ return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
+ "shadow_copy2", &vfs_shadow_copy2_fns);
+}
diff --git a/source3/modules/vfs_smb_traffic_analyzer.c b/source3/modules/vfs_smb_traffic_analyzer.c
index e8aa385d69c..ddce7e7dc5e 100644
--- a/source3/modules/vfs_smb_traffic_analyzer.c
+++ b/source3/modules/vfs_smb_traffic_analyzer.c
@@ -174,7 +174,7 @@ static char *smb_traffic_analyzer_encrypt( TALLOC_CTX *ctx,
char *output;
unsigned char crypted[18];
if (akey == NULL) return NULL;
- samba_AES_set_encrypt_key((unsigned char *) akey, 128, &key);
+ samba_AES_set_encrypt_key((const unsigned char *) akey, 128, &key);
s1 = strlen(str) / 16;
s2 = strlen(str) % 16;
for (h = 0; h < s2; h++) *(filler+h)=*(str+(s1*16)+h);
@@ -183,10 +183,10 @@ static char *smb_traffic_analyzer_encrypt( TALLOC_CTX *ctx,
output = talloc_array(ctx, char, (s1*16)+17 );
d=0;
for (h = 0; h < s1; h++) {
- samba_AES_encrypt((unsigned char *) str+(16*h), crypted, &key);
+ samba_AES_encrypt((const unsigned char *) str+(16*h), crypted, &key);
for (d = 0; d<16; d++) output[d+(16*h)]=crypted[d];
}
- samba_AES_encrypt( (unsigned char *) str+(16*h), filler, &key );
+ samba_AES_encrypt( (const unsigned char *) str+(16*h), filler, &key );
for (d = 0;d < 16; d++) output[d+(16*h)]=*(filler+d);
*len = (s1*16)+16;
return output;
@@ -417,6 +417,17 @@ static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
*/
char state_flags[9] = "000000\0";
+ /**
+ * The first byte of the state flag string represents
+ * the modules protocol subversion number, defined
+ * in smb_traffic_analyzer.h. smbtatools/smbtad are designed
+ * to handle not yet implemented protocol enhancements
+ * by ignoring them. By recognizing the SMBTA_SUBRELEASE
+ * smbtatools can tell the user to update the client
+ * software.
+ */
+ state_flags[0] = SMBTA_SUBRELEASE;
+
SMB_VFS_HANDLE_GET_DATA(handle, rf_sock, struct refcounted_sock, return);
if (rf_sock == NULL || rf_sock->sock == -1) {
@@ -452,7 +463,7 @@ static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
"protocol_version", NULL );
- if ( protocol_version == NULL || strcmp( protocol_version,"V1") == 0) {
+ if (protocol_version != NULL && strcmp(protocol_version,"V1") == 0) {
struct rw_data *s_data = (struct rw_data *) data;
@@ -489,7 +500,10 @@ static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
return;
}
- } else if ( strcmp( protocol_version, "V2") == 0) {
+ } else {
+ /**
+ * Protocol 2 is used by default.
+ */
switch( vfs_operation ) {
case vfs_id_open: ;
@@ -557,10 +571,6 @@ static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
return;
}
- } else {
- DEBUG(1, ("smb_traffic_analyzer_send_data_socket: "
- "error, unknown protocol given!\n"));
- return;
}
if (!str) {
@@ -656,7 +666,7 @@ static int smb_traffic_analyzer_connect(struct vfs_handle_struct *handle,
rf_sock->ref_count++;
} else {
/* New connection. */
- rf_sock = TALLOC_ZERO_P(NULL, struct refcounted_sock);
+ rf_sock = talloc_zero(NULL, struct refcounted_sock);
if (rf_sock == NULL) {
SMB_VFS_NEXT_DISCONNECT(handle);
errno = ENOMEM;
diff --git a/source3/modules/vfs_smb_traffic_analyzer.h b/source3/modules/vfs_smb_traffic_analyzer.h
index bfc0614132d..817ffd83d12 100644
--- a/source3/modules/vfs_smb_traffic_analyzer.h
+++ b/source3/modules/vfs_smb_traffic_analyzer.h
@@ -77,7 +77,7 @@
*/
/* Protocol subrelease number */
-#define SMBTA_SUBRELEASE 0
+#define SMBTA_SUBRELEASE '0'
/*
* Every data block sends a number of blocks sending common data
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index 01851cd2f83..3569405da30 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -324,7 +324,7 @@ static NTSTATUS stream_smb_fname(vfs_handle_struct *handle,
stype = strchr_m(smb_fname->stream_name + 1, ':');
if (stype) {
- if (StrCaseCmp(stype, ":$DATA") != 0) {
+ if (strcasecmp_m(stype, ":$DATA") != 0) {
return NT_STATUS_INVALID_PARAMETER;
}
}
@@ -716,7 +716,7 @@ static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
{
struct stream_struct *tmp;
- tmp = TALLOC_REALLOC_ARRAY(mem_ctx, *streams, struct stream_struct,
+ tmp = talloc_realloc(mem_ctx, *streams, struct stream_struct,
(*num_streams)+1);
if (tmp == NULL) {
return false;
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 34e01b0b5f2..2772c96c4d8 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -52,9 +52,9 @@ static SMB_INO_T stream_inode(const SMB_STRUCT_STAT *sbuf, const char *sname)
SMB_ASSERT(upper_sname != NULL);
MD5Init(&ctx);
- MD5Update(&ctx, (unsigned char *)&(sbuf->st_ex_dev),
+ MD5Update(&ctx, (const unsigned char *)&(sbuf->st_ex_dev),
sizeof(sbuf->st_ex_dev));
- MD5Update(&ctx, (unsigned char *)&(sbuf->st_ex_ino),
+ MD5Update(&ctx, (const unsigned char *)&(sbuf->st_ex_ino),
sizeof(sbuf->st_ex_ino));
MD5Update(&ctx, (unsigned char *)upper_sname,
talloc_get_size(upper_sname)-1);
@@ -614,7 +614,7 @@ static int streams_xattr_rename(vfs_handle_struct *handle,
}
/* Don't rename if the streams are identical. */
- if (StrCaseCmp(smb_fname_src->stream_name,
+ if (strcasecmp_m(smb_fname_src->stream_name,
smb_fname_dst->stream_name) == 0) {
goto done;
}
@@ -731,7 +731,7 @@ static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
{
struct stream_struct *tmp;
- tmp = TALLOC_REALLOC_ARRAY(mem_ctx, *streams, struct stream_struct,
+ tmp = talloc_realloc(mem_ctx, *streams, struct stream_struct,
(*num_streams)+1);
if (tmp == NULL) {
return false;
@@ -880,7 +880,7 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
if ((offset + n) > ea.value.length-1) {
uint8 *tmp;
- tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), ea.value.data, uint8,
+ tmp = talloc_realloc(talloc_tos(), ea.value.data, uint8,
offset + n + 1);
if (tmp == NULL) {
@@ -986,7 +986,7 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle,
return -1;
}
- tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), ea.value.data, uint8,
+ tmp = talloc_realloc(talloc_tos(), ea.value.data, uint8,
offset + 1);
if (tmp == NULL) {
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 37fe1c6e35b..25332e4e038 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -144,7 +144,7 @@ static int smb_time_audit_set_quota(struct vfs_handle_struct *handle,
static int smb_time_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- SHADOW_COPY_DATA *shadow_copy_data,
+ struct shadow_copy_data *shadow_copy_data,
bool labels)
{
int result;
@@ -564,7 +564,7 @@ static SMB_OFF_T smb_time_audit_lseek(vfs_handle_struct *handle,
files_struct *fsp,
SMB_OFF_T offset, int whence)
{
- ssize_t result;
+ SMB_OFF_T result;
struct timespec ts1,ts2;
double timediff;
@@ -721,7 +721,7 @@ static uint64_t smb_time_audit_get_alloc_size(vfs_handle_struct *handle,
files_struct *fsp,
const SMB_STRUCT_STAT *sbuf)
{
- int result;
+ uint64_t result;
struct timespec ts1,ts2;
double timediff;
@@ -869,14 +869,14 @@ static int smb_time_audit_chdir(vfs_handle_struct *handle, const char *path)
return result;
}
-static char *smb_time_audit_getwd(vfs_handle_struct *handle, char *path)
+static char *smb_time_audit_getwd(vfs_handle_struct *handle)
{
char *result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_GETWD(handle, path);
+ result = SMB_VFS_NEXT_GETWD(handle);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
@@ -2216,7 +2216,7 @@ static ssize_t smb_time_audit_aio_return(struct vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_STRUCT_AIOCB *aiocb)
{
- int result;
+ ssize_t result;
struct timespec ts1,ts2;
double timediff;
diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c
index d53d2918322..e9fd83bfea7 100644
--- a/source3/modules/vfs_tsmsm.c
+++ b/source3/modules/vfs_tsmsm.c
@@ -97,7 +97,7 @@ static int tsmsm_connect(struct vfs_handle_struct *handle,
return ret;
}
- tsmd = TALLOC_ZERO_P(handle, struct tsmsm_struct);
+ tsmd = talloc_zero(handle, struct tsmsm_struct);
if (!tsmd) {
SMB_VFS_NEXT_DISCONNECT(handle);
DEBUG(0,("tsmsm_connect: out of memory!\n"));
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index 5b62565d62f..40ccf06dd95 100644
--- a/source3/modules/vfs_xattr_tdb.c
+++ b/source3/modules/vfs_xattr_tdb.c
@@ -24,6 +24,7 @@
#include "librpc/gen_ndr/ndr_xattr.h"
#include "../librpc/gen_ndr/ndr_netlogon.h"
#include "dbwrap.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
@@ -40,7 +41,7 @@ static NTSTATUS xattr_tdb_pull_attrs(TALLOC_CTX *mem_ctx,
enum ndr_err_code ndr_err;
struct tdb_xattrs *result;
- if (!(result = TALLOC_ZERO_P(mem_ctx, struct tdb_xattrs))) {
+ if (!(result = talloc_zero(mem_ctx, struct tdb_xattrs))) {
return NT_STATUS_NO_MEMORY;
}
@@ -107,7 +108,7 @@ static NTSTATUS xattr_tdb_load_attrs(TALLOC_CTX *mem_ctx,
if (db_ctx->fetch(db_ctx, mem_ctx,
make_tdb_data(id_buf, sizeof(id_buf)),
- &data) == -1) {
+ &data) != 0) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@@ -298,12 +299,12 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
return -1;
}
- tmp = TALLOC_REALLOC_ARRAY(
+ tmp = talloc_realloc(
attribs, attribs->eas, struct xattr_EA,
attribs->num_eas+ 1);
if (tmp == NULL) {
- DEBUG(0, ("TALLOC_REALLOC_ARRAY failed\n"));
+ DEBUG(0, ("talloc_realloc failed\n"));
TALLOC_FREE(rec);
errno = ENOMEM;
return -1;
@@ -314,7 +315,7 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
}
attribs->eas[i].name = name;
- attribs->eas[i].value.data = CONST_DISCARD(uint8 *, value);
+ attribs->eas[i].value.data = discard_const_p(uint8, value);
attribs->eas[i].value.length = size;
status = xattr_tdb_save_attrs(rec, attribs);
diff --git a/source3/modules/weird.c b/source3/modules/weird.c
deleted file mode 100644
index 5db8cdcecd1..00000000000
--- a/source3/modules/weird.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba module with developer tools
- Copyright (C) Andrew Tridgell 2001
- Copyright (C) Jelmer Vernooij 2002
-
- 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
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-
-static struct {
- char from;
- const char *to;
- int len;
-} weird_table[] = {
- {'q', "^q^", 3},
- {'Q', "^Q^", 3},
- {0, NULL}
-};
-
-static size_t weird_pull(void *cd, const char **inbuf, size_t *inbytesleft,
- char **outbuf, size_t *outbytesleft)
-{
- while (*inbytesleft >= 1 && *outbytesleft >= 2) {
- int i;
- int done = 0;
- for (i=0;weird_table[i].from;i++) {
- if (strncmp((*inbuf),
- weird_table[i].to,
- weird_table[i].len) == 0) {
- if (*inbytesleft < weird_table[i].len) {
- DEBUG(0,("ERROR: truncated weird string\n"));
- /* smb_panic("weird_pull"); */
-
- } else {
- (*outbuf)[0] = weird_table[i].from;
- (*outbuf)[1] = 0;
- (*inbytesleft) -= weird_table[i].len;
- (*outbytesleft) -= 2;
- (*inbuf) += weird_table[i].len;
- (*outbuf) += 2;
- done = 1;
- break;
- }
- }
- }
- if (done) continue;
- (*outbuf)[0] = (*inbuf)[0];
- (*outbuf)[1] = 0;
- (*inbytesleft) -= 1;
- (*outbytesleft) -= 2;
- (*inbuf) += 1;
- (*outbuf) += 2;
- }
-
- if (*inbytesleft > 0) {
- errno = E2BIG;
- return -1;
- }
-
- return 0;
-}
-
-static size_t weird_push(void *cd, const char **inbuf, size_t *inbytesleft,
- char **outbuf, size_t *outbytesleft)
-{
- int ir_count=0;
-
- while (*inbytesleft >= 2 && *outbytesleft >= 1) {
- int i;
- int done=0;
- for (i=0;weird_table[i].from;i++) {
- if ((*inbuf)[0] == weird_table[i].from &&
- (*inbuf)[1] == 0) {
- if (*outbytesleft < weird_table[i].len) {
- DEBUG(0,("No room for weird character\n"));
- /* smb_panic("weird_push"); */
- } else {
- memcpy(*outbuf, weird_table[i].to,
- weird_table[i].len);
- (*inbytesleft) -= 2;
- (*outbytesleft) -= weird_table[i].len;
- (*inbuf) += 2;
- (*outbuf) += weird_table[i].len;
- done = 1;
- break;
- }
- }
- }
- if (done) continue;
-
- (*outbuf)[0] = (*inbuf)[0];
- if ((*inbuf)[1]) ir_count++;
- (*inbytesleft) -= 2;
- (*outbytesleft) -= 1;
- (*inbuf) += 2;
- (*outbuf) += 1;
- }
-
- if (*inbytesleft == 1) {
- errno = EINVAL;
- return -1;
- }
-
- if (*inbytesleft > 1) {
- errno = E2BIG;
- return -1;
- }
-
- return ir_count;
-}
-
-struct charset_functions weird_functions = {"WEIRD", weird_pull, weird_push};
-
-NTSTATUS charset_weird_init(void);
-NTSTATUS charset_weird_init(void)
-{
- if (!smb_register_charset(&weird_functions)) {
- return NT_STATUS_INTERNAL_ERROR;
- }
- return NT_STATUS_OK;
-}
diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build
index 201610e8a29..8ccc4cac875 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -30,6 +30,7 @@ VFS_CACHEPRIME_SRC = 'vfs_cacheprime.c'
VFS_PREALLOC_SRC = 'vfs_prealloc.c'
VFS_COMMIT_SRC = 'vfs_commit.c'
VFS_GPFS_SRC = 'vfs_gpfs.c gpfs.c'
+VFS_GPFS_HSM_NOTIFY_SRC = 'vfs_gpfs_hsm_notify.c'
VFS_NOTIFY_FAM_SRC = 'vfs_notify_fam.c'
VFS_READAHEAD_SRC = 'vfs_readahead.c'
VFS_TSMSM_SRC = 'vfs_tsmsm.c'
@@ -52,7 +53,8 @@ VFS_TIME_AUDIT_SRC = 'vfs_time_audit.c'
bld.SAMBA3_SUBSYSTEM('NFS4_ACLS',
- source='nfs4_acls.c')
+ source='nfs4_acls.c',
+ deps='samba-util')
bld.SAMBA3_SUBSYSTEM('VFS_AIXACL_UTIL',
source='vfs_aixacl_util.c',
@@ -66,6 +68,7 @@ bld.SAMBA3_SUBSYSTEM('vfs',
bld.SAMBA3_MODULE('vfs_default',
subsystem='vfs',
source=VFS_DEFAULT_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_default'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_default'))
@@ -73,6 +76,7 @@ bld.SAMBA3_MODULE('vfs_default',
bld.SAMBA3_MODULE('vfs_audit',
subsystem='vfs',
source=VFS_AUDIT_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_audit'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_audit'))
@@ -80,6 +84,7 @@ bld.SAMBA3_MODULE('vfs_audit',
bld.SAMBA3_MODULE('vfs_extd_audit',
subsystem='vfs',
source=VFS_EXTD_AUDIT_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_extd_audit'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_extd_audit'))
@@ -87,6 +92,7 @@ bld.SAMBA3_MODULE('vfs_extd_audit',
bld.SAMBA3_MODULE('vfs_full_audit',
subsystem='vfs',
source=VFS_FULL_AUDIT_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_full_audit'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_full_audit'))
@@ -94,7 +100,7 @@ bld.SAMBA3_MODULE('vfs_full_audit',
bld.SAMBA3_MODULE('vfs_fake_perms',
subsystem='vfs',
source=VFS_FAKE_PERMS_SRC,
- deps='acl attr',
+ deps='acl attr samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_fake_perms'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_fake_perms'))
@@ -102,6 +108,7 @@ bld.SAMBA3_MODULE('vfs_fake_perms',
bld.SAMBA3_MODULE('vfs_recycle',
subsystem='vfs',
source=VFS_RECYCLE_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_recycle'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_recycle'))
@@ -109,6 +116,7 @@ bld.SAMBA3_MODULE('vfs_recycle',
bld.SAMBA3_MODULE('vfs_netatalk',
subsystem='vfs',
source=VFS_NETATALK_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_netatalk'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_netatalk'))
@@ -116,6 +124,7 @@ bld.SAMBA3_MODULE('vfs_netatalk',
bld.SAMBA3_MODULE('vfs_default_quota',
subsystem='vfs',
source=VFS_DEFAULT_QUOTA_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_default_quota'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_default_quota'))
@@ -123,6 +132,7 @@ bld.SAMBA3_MODULE('vfs_default_quota',
bld.SAMBA3_MODULE('vfs_readonly',
subsystem='vfs',
source=VFS_READONLY_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_readonly'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_readonly'))
@@ -130,6 +140,7 @@ bld.SAMBA3_MODULE('vfs_readonly',
bld.SAMBA3_MODULE('vfs_cap',
subsystem='vfs',
source=VFS_CAP_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_cap'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_cap'))
@@ -137,6 +148,7 @@ bld.SAMBA3_MODULE('vfs_cap',
bld.SAMBA3_MODULE('vfs_expand_msdfs',
subsystem='vfs',
source=VFS_EXPAND_MSDFS_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_expand_msdfs'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_expand_msdfs'))
@@ -144,6 +156,7 @@ bld.SAMBA3_MODULE('vfs_expand_msdfs',
bld.SAMBA3_MODULE('vfs_shadow_copy',
subsystem='vfs',
source=VFS_SHADOW_COPY_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_shadow_copy'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_shadow_copy'))
@@ -151,6 +164,7 @@ bld.SAMBA3_MODULE('vfs_shadow_copy',
bld.SAMBA3_MODULE('vfs_shadow_copy2',
subsystem='vfs',
source=VFS_SHADOW_COPY2_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_shadow_copy2'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_shadow_copy2'))
@@ -158,6 +172,7 @@ bld.SAMBA3_MODULE('vfs_shadow_copy2',
bld.SAMBA3_MODULE('vfs_afsacl',
subsystem='vfs',
source=VFS_AFSACL_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_afsacl'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_afsacl'))
@@ -233,6 +248,7 @@ bld.SAMBA3_MODULE('vfs_tru64acl',
bld.SAMBA3_MODULE('vfs_catia',
subsystem='vfs',
source=VFS_CATIA_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_catia'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_catia'))
@@ -240,6 +256,7 @@ bld.SAMBA3_MODULE('vfs_catia',
bld.SAMBA3_MODULE('vfs_streams_xattr',
subsystem='vfs',
source=VFS_STREAMS_XATTR_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_streams_xattr'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_streams_xattr'))
@@ -247,6 +264,7 @@ bld.SAMBA3_MODULE('vfs_streams_xattr',
bld.SAMBA3_MODULE('vfs_streams_depot',
subsystem='vfs',
source=VFS_STREAMS_DEPOT_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_streams_depot'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_streams_depot'))
@@ -254,6 +272,7 @@ bld.SAMBA3_MODULE('vfs_streams_depot',
bld.SAMBA3_MODULE('vfs_cacheprime',
subsystem='vfs',
source=VFS_CACHEPRIME_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_cacheprime'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_cacheprime'))
@@ -261,6 +280,7 @@ bld.SAMBA3_MODULE('vfs_cacheprime',
bld.SAMBA3_MODULE('vfs_prealloc',
subsystem='vfs',
source=VFS_PREALLOC_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_prealloc'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_prealloc'))
@@ -268,6 +288,7 @@ bld.SAMBA3_MODULE('vfs_prealloc',
bld.SAMBA3_MODULE('vfs_commit',
subsystem='vfs',
source=VFS_COMMIT_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_commit'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_commit'))
@@ -280,6 +301,13 @@ bld.SAMBA3_MODULE('vfs_gpfs',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_gpfs'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_gpfs'))
+bld.SAMBA3_MODULE('vfs_gpfs_hsm_notify',
+ subsystem='vfs',
+ source=VFS_GPFS_HSM_NOTIFY_SRC,
+ init_function='',
+ internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_gpfs_hsm_notify'),
+ enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_gpfs_hsm_notify'))
+
bld.SAMBA3_MODULE('vfs_notify_fam',
subsystem='vfs',
source=VFS_NOTIFY_FAM_SRC,
@@ -290,6 +318,7 @@ bld.SAMBA3_MODULE('vfs_notify_fam',
bld.SAMBA3_MODULE('vfs_readahead',
subsystem='vfs',
source=VFS_READAHEAD_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_readahead'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_readahead'))
@@ -297,6 +326,7 @@ bld.SAMBA3_MODULE('vfs_readahead',
bld.SAMBA3_MODULE('vfs_tsmsm',
subsystem='vfs',
source=VFS_TSMSM_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_tsmsm'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_tsmsm'))
@@ -304,6 +334,7 @@ bld.SAMBA3_MODULE('vfs_tsmsm',
bld.SAMBA3_MODULE('vfs_fileid',
subsystem='vfs',
source=VFS_FILEID_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_fileid'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_fileid'))
@@ -311,6 +342,7 @@ bld.SAMBA3_MODULE('vfs_fileid',
bld.SAMBA3_MODULE('vfs_aio_fork',
subsystem='vfs',
source=VFS_AIO_FORK_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_aio_fork'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_aio_fork'))
@@ -318,6 +350,7 @@ bld.SAMBA3_MODULE('vfs_aio_fork',
bld.SAMBA3_MODULE('vfs_preopen',
subsystem='vfs',
source=VFS_PREOPEN_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_preopen'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_preopen'))
@@ -325,6 +358,7 @@ bld.SAMBA3_MODULE('vfs_preopen',
bld.SAMBA3_MODULE('vfs_syncops',
subsystem='vfs',
source=VFS_SYNCOPS_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_syncops'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_syncops'))
@@ -332,6 +366,7 @@ bld.SAMBA3_MODULE('vfs_syncops',
bld.SAMBA3_MODULE('vfs_acl_xattr',
subsystem='vfs',
source=VFS_ACL_XATTR_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_acl_xattr'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_acl_xattr'))
@@ -347,6 +382,7 @@ bld.SAMBA3_MODULE('vfs_acl_tdb',
bld.SAMBA3_MODULE('vfs_smb_traffic_analyzer',
subsystem='vfs',
source=VFS_SMB_TRAFFIC_ANALYZER_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_smb_traffic_analyzer'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_smb_traffic_analyzer'))
@@ -354,6 +390,7 @@ bld.SAMBA3_MODULE('vfs_smb_traffic_analyzer',
bld.SAMBA3_MODULE('vfs_onefs',
subsystem='vfs',
source=VFS_ONEFS_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_onefs'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_onefs'))
@@ -361,6 +398,7 @@ bld.SAMBA3_MODULE('vfs_onefs',
bld.SAMBA3_MODULE('vfs_onefs_shadow_copy',
subsystem='vfs',
source=VFS_ONEFS_SHADOW_COPY_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_onefs_shadow_copy'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_onefs_shadow_copy'))
@@ -368,6 +406,7 @@ bld.SAMBA3_MODULE('vfs_onefs_shadow_copy',
bld.SAMBA3_MODULE('vfs_dirsort',
subsystem='vfs',
source=VFS_DIRSORT_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_dirsort'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_dirsort'))
@@ -375,6 +414,7 @@ bld.SAMBA3_MODULE('vfs_dirsort',
bld.SAMBA3_MODULE('vfs_scannedonly',
subsystem='vfs',
source=VFS_SCANNEDONLY_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_scannedonly'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_scannedonly'))
@@ -382,6 +422,7 @@ bld.SAMBA3_MODULE('vfs_scannedonly',
bld.SAMBA3_MODULE('vfs_crossrename',
subsystem='vfs',
source=VFS_CROSSRENAME_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_crossrename'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_crossrename'))
@@ -389,6 +430,7 @@ bld.SAMBA3_MODULE('vfs_crossrename',
bld.SAMBA3_MODULE('vfs_linux_xfs_sgid',
subsystem='vfs',
source=VFS_LINUX_XFS_SGID_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_linux_xfs_sgid'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_linux_xfs_sgid'))
@@ -396,51 +438,13 @@ bld.SAMBA3_MODULE('vfs_linux_xfs_sgid',
bld.SAMBA3_MODULE('vfs_time_audit',
subsystem='vfs',
source=VFS_TIME_AUDIT_SRC,
+ deps='samba-util',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_time_audit'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_time_audit'))
-CHARSET_WEIRD_SRC = 'weird.c'
-CHARSET_CP850_SRC = 'CP850.c'
-CHARSET_CP437_SRC = 'CP437.c'
-CHARSET_MACOSXFS_SRC = 'charset_macosxfs.c'
-
-
-bld.SAMBA3_SUBSYSTEM('charset',
- source='',
- vars=locals())
-
-bld.SAMBA3_MODULE('charset_weird',
- subsystem='charset',
- source=CHARSET_WEIRD_SRC,
- init_function='',
- internal_module=bld.SAMBA3_IS_STATIC_MODULE('charset_weird'),
- enabled=bld.SAMBA3_IS_ENABLED_MODULE('charset_weird'))
-
-bld.SAMBA3_MODULE('charset_CP850',
- subsystem='charset',
- source=CHARSET_CP850_SRC,
- init_function='',
- internal_module=bld.SAMBA3_IS_STATIC_MODULE('charset_CP850'),
- enabled=bld.SAMBA3_IS_ENABLED_MODULE('charset_CP850'))
-
-bld.SAMBA3_MODULE('charset_CP437',
- subsystem='charset',
- source=CHARSET_CP437_SRC,
- init_function='',
- internal_module=bld.SAMBA3_IS_STATIC_MODULE('charset_CP437'),
- enabled=bld.SAMBA3_IS_ENABLED_MODULE('charset_CP437'))
-
-bld.SAMBA3_MODULE('charset_macosxfs',
- subsystem='charset',
- source=CHARSET_MACOSXFS_SRC,
- init_function='',
- internal_module=bld.SAMBA3_IS_STATIC_MODULE('charset_macosxfs'),
- enabled=bld.SAMBA3_IS_ENABLED_MODULE('charset_macosxfs'))
-
-
PERFCOUNT_ONEFS_SRC = 'perfcount_onefs.c'
PERFCOUNT_TEST_SRC = 'perfcount_test.c'