1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

187 Commits

Author SHA1 Message Date
Jeremy Allison
42bd1acad7 s3: VFS: Allow shadow_copy2_connectpath() to return the cached path derived from $cwd.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30 18:39:19 +01:00
Jeremy Allison
27340df4b5 s3: VFS: shadow_copy2: Fix chdir to store off the needed private variables.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

This is not yet used, the users of this will be added later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30 18:39:19 +01:00
Jeremy Allison
9d65107b8f s3: VFS: shadow_copy2: Add two currently unused functions to make pathnames absolute or relative to $cwd.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30 18:39:18 +01:00
Jeremy Allison
2887465108 s3: VFS: shadow_copy2: Change a parameter name.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Allows easy substitution later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30 18:39:18 +01:00
Jeremy Allison
5aa1ea9515 s3: VFS: shadow_copy2: Add a wrapper function to call the original shadow_copy2_strip_snapshot().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Allows an extra (currently unused) parameter to be added.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30 18:39:18 +01:00
Jeremy Allison
72fe2b62e3 s3: VFS: shadow_copy2: Add two new variables to the private data. Not yet used.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30 18:39:18 +01:00
Jeremy Allison
37ef8d3f65 s3: VFS: shadow_copy2: Fix length comparison to ensure we don't overstep a length.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30 18:39:18 +01:00
Jeremy Allison
979e39252b s3: VFS: shadow_copy2: Ensure pathnames for parameters are correctly relative and terminated.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30 18:39:18 +01:00
Jeremy Allison
0a190f4dd9 s3: VFS: shadow_copy2: Correctly initialize timestamp and stripped variables.
Allow the called functions to be fixed to not touch them on error.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30 18:39:18 +01:00
Günther Deschner
dc1754937f s3-modules: fix build warning in vfs shadow copy2 module
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Sun Sep 25 16:42:30 CEST 2016 on sn-devel-144
2016-09-25 16:42:30 +02:00
Uri Simchoni
f41f439335 vfs_shadow_copy: handle non-existant files and wildcards
During path checking, the vfs connectpath_fn is called to
determine the share's root, relative to the file being
queried (for example, in snapshot file this may be other
than the share's "usual" root directory). connectpath_fn
must be able to answer this question even if the path does
not exist and its parent does exist. The convention in this
case is that this refers to a yet-uncreated file under the parent
and all queries are relative to the parent.

This also serves as a workaround for the case where connectpath_fn
has to handle wildcards, as with the case of SMB1 trans2 findfirst.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12172

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Aug 25 05:35:29 CEST 2016 on sn-devel-144
2016-08-25 05:35:29 +02:00
Jeremy Allison
abf18f42dc s3: vfs: shadow_copy2: Replace all uses of (p-name) with len_before_gmt.
p and name don't change, and we've already calculated this length.
Part of the effort to make the code inside vfs_snapper.c that does
the same thing more similar (we can't make these functions identical
due to the 'snapdir' use case).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12150

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-08-18 02:51:15 +02:00
Jeremy Allison
639063da8c s3: vfs: shadow_copy2. Remove any trailing slash when stripping @GMT-YYYY... from the end of a path.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12150

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Aug 17 05:25:30 CEST 2016 on sn-devel-144
2016-08-17 05:25:30 +02:00
Jeremy Allison
6245f2c042 s3: vfs: shadow_copy2: Re-use an existing variable already set to the right value (p - name).
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12150

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2016-08-17 01:22:38 +02:00
Rajesh Joseph
17a6a78e4c shadow_copy2: Fix error handling in shadow_copy2_get_shadow_copy_data
Memory was freed in most of the failure cases. It is always better
to free the memory at the end of the function so that all exit path
of the function will free the memory. Otherwise chances are that
you might miss some cleanup.

Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-07-28 10:06:13 +02:00
Rajesh Joseph
71682e125c shadow_copy2: allow configurable prefix for snapshot name
With growing number of snapshots file-systems need some mechanism
to differentiate one set of snapshots from other, e.g. monthly, weekly,
manual, special events, etc. Therefore these file-systems provide
different ways to tag snapshots, e.g. provide a configurable way to
name snapshots, which is not just based on time. With only shadow:format
it is very difficult to filter these snapshots.

As part of this change added two new options, shadow:snapprefix and
shadow:delimiter, in shadow_copy2 config. This option will accept regular
expression (BRE) as input. With this optional parameter, one can specify a
variable prefix component for names of the snapshot directories in the
file-system. If this parameter is set, together with the shadow:format and
shadow:delimiter parameters it determines the possible names of snapshot
directories in the file-system.

e.g.
shadow:snapprefix = [a-z]*[0-9]

When this option is provided then shadow:format option should always
start with <delimiter> string. This delimiter is configurable via a new option,
i.e. shadow:delimiter. Default value for this is "_GMT",
e.g. _GMT-%Y.%m.%d-%H.%M.%S

Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-07-28 10:06:13 +02:00
Rajesh Joseph
c9b6e99ee1 shadow_copy2: create structure to store module specific information
Create a separate structure to store module specific information. Currently
only config values are saved. As of now there is no cleaner way to store run-time
information or other module specific information in shadow_copy2 module.

Therefore created a new structure to store all module specific information
including config.

Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-07-28 10:06:13 +02:00
Rajesh Joseph
999ea7ea4d shadow_copy2: Fix shadow_copy2_posix_gmt_string return type
This function returns -1 on error but the return type is
size_t which is unsigned.

Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-07-28 10:06:13 +02:00
Jeremy Allison
dc5dad4813 s3: Filenames: Add uint32_t flags parameter to synthetic_smb_fname().
Get it from parent/deriving smb_filename if present.
Use 0 (as usually this a Windows-style lookup) if
not.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 22:57:16 +01:00
Jeremy Allison
d1f26bc432 VFS: Modify chown to take a const struct smb_filename * instead of const char *
Preparing to reduce use of lp_posix_pathnames().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-05 09:39:18 +01:00
Jeremy Allison
8e88b9783d VFS: Modify chmod_acl to take a const struct smb_filename * instead of const char *
Preparing to reduce use of lp_posix_pathnames().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-03 09:04:14 +01:00
Jeremy Allison
ac8fba6ef7 VFS: Modify chmod to take a const struct smb_filename * instead of const char *
Preparing to reduce use of lp_posix_pathnames().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-03 09:04:14 +01:00
Jeremy Allison
c74ae37fe6 VFS: Modify opendir to take a const struct smb_filename * instead of const char *
Preparing to reduce use of lp_posix_pathnames().

Uses the same techniques as commit 616d068f0c
(synthetic_smb_fname()) to cope with modules that
modify the incoming pathname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-01 15:25:22 +01:00
Jeremy Allison
cd1335e67d VFS: Modify rmdir to take a const struct smb_filename * instead of const char *
Preparing to reduce use of lp_posix_pathnames().

Uses the same techniques as commit 616d068f0c
(synthetic_smb_fname()) to cope with modules that
modify the incoming pathname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Feb 25 20:46:49 CET 2016 on sn-devel-144
2016-02-25 20:46:49 +01:00
Jeremy Allison
873df9a8a5 s3: VFS: Modify mkdir to take a const struct smb_filename * instead of const char *
Preparing to reduce use of lp_posix_pathnames().

Uses the same techniques as commit 616d068f0c
(synthetic_smb_fname()) to cope with modules that
modify the incoming pathname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>

Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Wed Feb 24 16:05:55 CET 2016 on sn-devel-144
2016-02-24 16:05:55 +01:00
Jeremy Allison
616d068f0c s3: VFS: Modify SMB_VFS_GET_NT_ACL to take a const struct smb_filename * instead of const char *
Bumps VFS version to 35.

Preparing to reduce use of lp_posix_pathnames().

Most of this is boilerplate, the only subtleties are in
the modules:

vfs_catia.c
vfs_media_harmony.c
vfs_shadow_copy2.c
vfs_unityed_media.c

Where the path is modified then passed to SMB_VFS_NEXT_GET_NT_ACL().
In these cases the change uses synthetic_smb_fname() to
create a new struct smb_filename from the modified path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <rb@sernet.de>
2016-02-16 19:59:24 +01:00
Uri Simchoni
cc2533576b vfs_shadow_copy2: add get_quota function
This is in preparation for handling the quota part
of disk_free via the VFS - each module with a
disk_free_fn should also have a get_quota_fn.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-01-26 15:58:12 +01:00
Uri Simchoni
84333884ff vfs_shadow_copy2: add snapsharepath parameter
This new parameter defines how to get from the snapshot's
root directory to the share's root directory. It is an
alternative to the "basedir" parameter, but functionally
is a superset of basedir.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-26 00:06:16 +01:00
Uri Simchoni
57dab2028d vfs_shadow_copy2: remove basedir state variable
Remove the basedir state variable from the module-specific data
of vfs_shadow_copy2 - this variable is not being used.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-26 00:06:16 +01:00
Uri Simchoni
6ed3985182 vfs_shadow_copy2: check crossmountpoints against snapdirseverywhere
If crossmountpoints is enabled, verify that snapdirseverywhere is
enabled too, since crossmountpoints has no meaning otherwise.

This obviates the check of crossmountpoints against other config
variables.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Jan 22 01:54:06 CET 2016 on sn-devel-144
2016-01-22 01:54:06 +01:00
Uri Simchoni
8a49a63a5a vfs_shadow_copy2: fix case where snapshots are outside the share
Adjust the connect path to the root of the share in the snapshot,
or to the root of the snapshot if the snapshot is "inside" the
share.

This way snapshot symlink regarded as "wide links" if and only if
they point outside the snapshot or they were wide links when
the snapshot was taken.

This allows mounting the snapshots outside the share's root.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11580

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-13 14:03:15 +01:00
Uri Simchoni
3703bca4d9 vfs_shadow_copy2: add shadow_copy2_do_convert()
Add a new routine shadow_copy2_do_convert() which is
like shadow_copy2_convert(), but beside calculating the
path of the snapshot file, it also returns the minimum length
of the subpath which is both inside the share and inside the
same snapshot as the file in question, i.e. (at least in the
classical case) the subdirectory of the the snapshot file's
snapshot directory that corresponds to the file's share root.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11580

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-13 14:03:15 +01:00
Michael Adam
e8e9e7f2fe vfs:shadow_copy2: fix a debug message
The debug message for the mountpoint option was the
wrong way around. This fixes it, also converting
the message to use DBG_WARNING() while we're touching it.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>

Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Wed Jan 13 10:56:42 CET 2016 on sn-devel-144
2016-01-13 10:56:42 +01:00
Jeremy Allison
acbb4ddb68 CVE-2015-5299: s3-shadow-copy2: fix missing access check on snapdir
Fix originally from <partha@exablox.com>

https://bugzilla.samba.org/show_bug.cgi?id=11529

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2015-12-16 12:56:48 +01:00
Ralph Boehme
5b3ed904ca vfs_shadow_copy2: change log level from 0 to 1 and log share path
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-07-16 17:19:19 +02:00
Richard Sharpe
e60cc280d6 Convert all uint8/16/32 to _t in all modules.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-06 04:14:14 +02:00
Volker Lendecke
f686db87a4 source3: Replace ccan hash calls with tdb_jenkins_hash
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-17 11:30:52 +01:00
David Disseldorp
41c4666a72 s3/vfs: remove unused SMB_VFS_DISK_FREE() small_query parameter
The small_query parameter for SMB_VFS_DISK_FREE() was, prior to the
previous commit, used to obtain 16-bit wide free-space information for
the deprecated dskattr SMB_COM_QUERY_INFORMATION_DISK command.

With the dskattr handler now performing the 16-bit collapse directly,
the small_query parameter can be removed from the entire code path.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Feb 17 05:37:20 CET 2015 on sn-devel-104
2015-02-17 05:37:20 +01:00
Volker Lendecke
9c19532134 s3-shadow-copy2: Protect against already converted names
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 27 09:03:53 CEST 2014 on sn-devel-104
2014-06-27 09:03:53 +02:00
Volker Lendecke
1d488270a1 s3-shadow-copy2: Add more debugs
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2014-06-27 06:49:10 +02:00
Volker Lendecke
87cad88230 s3-shadow-copy2: Fix incorrect case submounts
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2014-06-27 06:49:10 +02:00
Christof Schmitt
b053d4b3f9 s3-shadow-copy2: Remove TODO and fix comments
The patch "s3-shadow-copy2: Fix dir/@GMT-2012.10.15-13.48.43 form of
paths" takes care of a case marked as TODO, remove it and adjust the
comments accordingly.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-27 06:49:10 +02:00
Volker Lendecke
16a6181289 s3-shadow-copy2: Fix dir/@GMT-2012.10.15-13.48.43 form of paths
The previous clause in shadow_copy2_strip_snapshot would only handle @GMT-
at the end of a pathname if it was the *only* pathname component. XP
seems to send @GMT- at the end under certain circumstances even with a
path prefix.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2014-06-27 06:49:10 +02:00
Volker Lendecke
68c7b339cc s3-shadow-copy2: Add extreme debug output to shadow_copy2_strip_snapshot
This is sooo hairy to debug when things go wrong :-(

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2014-06-27 06:49:10 +02:00
David Keegel
9acacb27ec shadow_copy2: Fix some typos
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Dec 12 17:58:24 CET 2013 on sn-devel-104
2013-12-12 17:58:24 +01:00
Michael Adam
27baff0ec9 shadow_copy2: add a comment explaining why we don't talloc_zero_array().
Since I stumbled over this slighly sublte point, I thought it is
worthwile to point it our in a comment.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Dec 11 19:55:20 CET 2013 on sn-devel-104
2013-12-11 19:55:20 +01:00
Michael Adam
71318d7d68 shadow_copy2: revert expensive and unnecessary zero-initialization
I was being overly cautious. This is initialization is not
necessary, since further down in the for-loop, the memory
always gets fully initialized because the insert string is
inserted at various slash positions.

So this talloc_zero_array can be skipped: this an expensive
thing to do in virtually every VFS call.

This essentially reverts commit 249e9b4a34.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2013-12-11 17:54:22 +01:00
Michael Adam
6685e6512e s3:modules:shadow_copy2: remove redundant documentation comment block
and refer to the manual page instead

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-12-07 07:43:50 +13:00
Michael Adam
bffaf17d48 s3:modules:shadow_copy2: improve headline comment
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-12-07 07:43:48 +13:00
Michael Adam
b5b5674287 s3:module:shadow_copy2: add my (C)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-12-07 07:43:45 +13:00
Michael Adam
6ccbc1347d shadow_copy2: use stored mount_point instead of recalculating.
In the case of snapdirseverywhere but NOT crossmountpoints.

This spares stat calls.
And is the only correct thing to do if the mount point was
specified in the configuration.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:33 +13:00
Michael Adam
935120dbc0 shadow_copy2: improve debug in shadow_copy2_convert() in snapdirseverywhere mode
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:31 +13:00
Michael Adam
9ab89371c8 shadow_copy2: fix shadow_copy2_convert() in the classical case.
I.e. the non-snapdirseverywhere case.
This in particular fixes the case of a snapdir hierarchy
that is parallel to the share or mountpoint and not subordinate.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:30 +13:00
Michael Adam
86988db1f0 shadow_copy2: add some blank lines for visual separation to shadow_copy2_convert()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:29 +13:00
Michael Adam
249e9b4a34 shadow_copy2: initialize "converted" string to null in shadow_copy2_convert()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:28 +13:00
Michael Adam
4b8d9c65f4 shadow_copy2: fix shadow_copy2_strip_snapshot() in the classical case
I.e., fix detection of already converted names.

This is done by using the shadow_copy2_snapshot_path() function
and comparing if the input string starts with that.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:26 +13:00
Michael Adam
afcb84e69f shadow_copy2: add some debug to shadow_copy2_strip_snapshot()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:25 +13:00
Michael Adam
3d053b1ab3 shadow_copy2: add comments explaining decisions in shadow_copy2_strip_snapshot()
This should make it more easy to understand what the cases are.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:24 +13:00
Michael Adam
38e108563d shadow_copy2: introduce shadow_copy2_snapshot_path()
This builds the posix snapshot path for the connection
at the provided timestamp. For the non-snapdirseverywhere case.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:22 +13:00
Michael Adam
4cc5140bbe shadow_copy2: factor shadow_copy2_posix_gmt_string() out of shadow_copy2_insert_string()
for re-use..

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:21 +13:00
Michael Adam
304a0f531c shadow_copy2: shadow_copy2_insert_string(): do not prepend a "/" in absolute mode
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:20 +13:00
Michael Adam
e86923eb52 shadow_copy2: make shadow_copy2_find_snapdir() return const char *
instead of char *. This eliminates compiler warnings.
snapdir is a const string in all occasions.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:18 +13:00
Michael Adam
dbdb436a80 shadow_copy2: in the classical case, use configured path in shadow_copy2_find_snapdir()
There is no point in searching for snapdir if not in snapdirseverywhere mode.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:17 +13:00
Michael Adam
ea898ea1ac shadow_copy2: implement disk_free
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:15 +13:00
Michael Adam
c4f9954ebb shadow_copy2: log resulting config at the end of shadow_copy2_connect()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:14 +13:00
Michael Adam
a7ca55c8da shadow_copy2: add snapshot_basepath to the config.
This is the absolute version of snapdir.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:13 +13:00
Michael Adam
d34dc1b002 shadow_copy2: add rel_connectpath to config.
This is the share root, relative to the basedir.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:11 +13:00
Michael Adam
2d5a3af4bc shadow_copy2: introduce "shadow:mountpoint" option
Possiblity to explicitly set the share's mount point.
This is useful mainly for debugging and testing purposes.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:10 +13:00
Michael Adam
ed751b9ee4 shadow_copy2: re-add the basedir option.
Disable basedir if it is not an absolute path or if
snapdirseverywhere or crossmountpoints is enabled.

Pair-Programmed-With: Björn Baumbach <bb@sernet.de>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:09 +13:00
Michael Adam
1e887fcda0 shadow_copy2: disable "snapdir:crossmountpoints" if the snapdir is absolute.
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:07 +13:00
Michael Adam
843954989c shadow_copy2: introduce the bool "snapdir_absolute" in the config.
Not exposed but to be used internally.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:05 +13:00
Michael Adam
1ecef57435 shadow_copy2: introduce config struct and function shadow_copy2_connect()
This moves the parsing of the config to a central place.
So users of configuation don't need to call lp_parm_... all the time.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:01 +13:00
Michael Adam
5c900fd930 shadow_copy2: add comment block explaining shadow_copy2_convert()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:58 +13:00
Michael Adam
5da5512985 shadow_copy2: add comment block explaining shadow_copy2_insert_string()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:56 +13:00
Michael Adam
b90d1e6ac0 shadow_copy2: add comment block explaining shadow_copy2_find_snapdir()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:55 +13:00
Michael Adam
5b494b3dea shadow_copy2: add header comment explaining have_snapdir()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:53 +13:00
Michael Adam
9361824ddd shadow_copy2: add comment header describing shadow_copy2_strip_snapshot()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:51 +13:00
Michael Adam
01cb88977d shadow_copy2: break overly long lines in shadow_copy2_snapshot_to_gmt()
According to coding guidelines.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:49 +13:00
Christof Schmitt
c8c0632c87 s3:smb2_find: Return that timestamps do not exist as directories
When a Windows client receives a large directory listing while
querying snapshots, it sends a find request asking for the
timestamp as a directory. A Windows server returns NO_SUCH_FILE,
so make sure Samba returns the same. Otherwise the client will
get confused and display timestamps in the 'previous versions' dialog.

Signed-off-by: Christof Schmitt <christof.schmitt@us.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Sep 10 22:38:51 CEST 2013 on sn-devel-104
2013-09-10 22:38:50 +02:00
Volker Lendecke
e0e5953494 vfs: Convert shadow_copy2_ntimes to cp_smb_filename
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17 14:49:55 -07:00
Volker Lendecke
33037d80d5 vfs: Convert shadow_copy2_unlink to cp_smb_filename
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17 14:49:55 -07:00
Andrew Bartlett
c8ade07760 smbd: Add mem_ctx to {f,}get_nt_acl VFS call
This makes it clear which context the returned SD is allocated on, as
a number of callers do not want it on talloc_tos().

As the ACL transformation allocates and then no longer needs a great
deal of memory, a talloc_stackframe() call is used to contain the
memory that is not returned further up the stack.

Andrew Bartlett
2012-10-11 12:25:11 +11:00
Andrew Bartlett
f2ccff7b06 s3-vfs: Try to be consistent about localtime vs GMT handling in vfs_shadow_copy2
With the ability to handle times a abolute time_t values since 1970
this becomes more important to get absolutly correct.

Andrew Bartlett
2012-08-28 15:47:37 +10:00
Andrew Bartlett
de209587f9 s3-vfs_shadow_copy2: Also accept a sscanf result 2012-08-28 15:47:03 +10:00
Björn Jacke
dab8fe5dea vfs_time_audit: Remove unnecessary return; statement 2012-08-08 00:21:26 +02:00
Stefan Metzmacher
7bc328dcb0 s3:modules: we don't need smbd/proto.h in vfs_shadow_copy2.c
metze
2012-06-06 10:18:39 +02:00
Christian Ambach
2ae02efabd s3:vfs/shadow_copy2 fix some compiler warnings
about unused variables

Autobuild-User: Christian Ambach <ambi@samba.org>
Autobuild-Date: Tue May  8 11:15:07 CEST 2012 on sn-devel-104
2012-05-08 11:15:07 +02:00
Christian Ambach
617b63658b s3:vfs/shadow_copy2 make descending sort order the default
otherwise Explorer won't work correctly when trying to restore a folder
2012-05-08 09:26:07 +02:00
Andrew Bartlett
19eee33d82 s3-vfs: Remove unused lremovexattr call from VFS modules, system.c and configure
If this is ever needed again, it would be more appropriate as an options argument
to removexattr.

Andrew Bartlett
2012-04-05 13:39:01 +10:00
Andrew Bartlett
c70ac29c54 s3-vfs: Remove unused lsetxattr call from VFS modules, system.c and configure
If this is ever needed again, it would be more appropriate as an options argument
to listxattr.

Andrew Bartlett
2012-04-05 13:39:00 +10:00
Andrew Bartlett
b2f7cfa848 s3-vfs: Remove unused lgetxattr call from VFS modules, system.c and configure 2012-04-05 13:39:00 +10:00
Andrew Bartlett
f6e0532024 build: Remove SMB_STRUCT_DIR define 2012-04-05 02:39:09 +02:00
Andrew Bartlett
2320b2144f build: Remove SMB_STRUCT_DIRENT define 2012-04-05 02:39:09 +02:00
Richard Sharpe
422494a8e6 vfs: Make function pointer names consistent. They all end in _fn
Autobuild-User: Richard Sharpe <sharpe@samba.org>
Autobuild-Date: Mon Dec 12 04:58:40 CET 2011 on sn-devel-104
2011-12-12 04:58:40 +01:00
Rusty Russell
b10ad70f8f tdb2: fix build with --enable-tdb2
tdb2 doesn't expost tdb_jenkins_hash; go straight to the source in
ccan/hash.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-08-31 13:56:40 +09:30
Volker Lendecke
dc461cade5 s3: Fix the build, NAME_MAX not universally available
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jun 20 13:45:21 CEST 2011 on sn-devel-104
2011-06-20 13:45:21 +02:00
Volker Lendecke
a8c3d38bc8 s3: Replace shadow_copy2 with a new implementation
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jun 20 11:17:47 CEST 2011 on sn-devel-104
2011-06-20 11:17:47 +02:00
Volker Lendecke
d77854fbb2 struct make "struct shadow_copy_data" its own talloc context 2011-05-31 21:47:07 +02:00
Volker Lendecke
0ec9a90c29 s3: Remove SHADOW_COPY_DATA typedef 2011-05-31 21:47:07 +02:00
Jeremy Allison
7d6ebe0de7 More const fixes. Remove CONST_DISCARD. 2011-05-06 01:44:07 +02:00