Displaying 20 results from an estimated 30 matches for "do_chmod".
2017 May 26
9
[Bug 12806] New: Deleting in a row of hardlinked snapshots resets file permissions.
https://bugzilla.samba.org/show_bug.cgi?id=12806
Bug ID: 12806
Summary: Deleting in a row of hardlinked snapshots resets file
permissions.
Product: rsync
Version: 3.1.0
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5
Component: core
2017 Jun 08
0
[Bug 12806] Deleting in a row of hardlinked snapshots resets file permissions.
...--- a/delete.c
+++ b/delete.c
@@ -97,10 +97,10 @@ static enum delret delete_dir_contents(char *fname, uint16
flags)
}
strlcpy(p, fp->basename, remainder);
- if (!(fp->mode & S_IWUSR) && !am_root && fp->flags & FLAG_OWNED_BY_US)
- do_chmod(fname, fp->mode | S_IWUSR);
/* Save stack by recursing to ourself directly. */
if (S_ISDIR(fp->mode)) {
+ if (!(fp->mode & S_IWUSR) && !am_root && fp->flags &
FLAG_OWNED_BY_US)
+ do_chmod(fname, fp->mode | S_IWUSR);...
2006 Aug 02
0
[PATCH] xenstore-chmod
...ined(CLIENT_chmod)
+ errx(1, "Usage: %s [-h] [-s] key <mode [modes...]>", progname);
#endif
}
@@ -78,10 +80,61 @@ do_rm(char *path, struct xs_handle *xsh,
}
#endif
+#if defined(CLIENT_chmod)
+#define PATH_SEP ''/''
+#define MAX_PATH_LEN 256
+
+static void
+do_chmod(char *path, struct xs_permissions *perms, int nperms, int upto,
+ int recurse, struct xs_handle *xsh, xs_transaction_t xth)
+{
+ int ret;
+
+ if (!path[0])
+ return;
+
+ ret = xs_set_permissions(xsh, xth, path, perms, nperms);
+ if (!ret)
+ err(1, "Error occurred setting permissio...
2018 Feb 05
2
Unfortunate results from fake-super
...ts created as a mode-600 file, but the code
> later tweaks the permissions to match the symlink, which is (as you
> note) a bad thing.
>
> My first reaction is to change the code in set_stat_xattr()
> (in xattrs.c) from:
>
> if (fst.st_mode != mode)
> do_chmod(fname, mode);
>
> to:
>
> if (fst.st_mode != mode && !S_ISLNK(file->mode))
> do_chmod(fname, mode);
>
> ..wayne..
That's certainly an improvement; from the safety point of view, leaving
it as 0600 is a lot better than leaving it as 0777...
2018 Feb 03
4
Unfortunate results from fake-super
When using fake-super mode in an rsync receiver, anything that's neither a
file nor a directory (e.g. devices, symlinks, etc) is converted into a file,
and properties such as original ownership, filetype, and permissions are
stored in a specific extended attribute.
In the case of a symlink, the contents of the link are stored in a plain
file. The original mode of the symlink is normally
2018 Feb 06
0
Unfortunate results from fake-super
...but the code
>> later tweaks the permissions to match the symlink, which is (as you
>> note) a bad thing.
>>
>> My first reaction is to change the code in set_stat_xattr()
>> (in xattrs.c) from:
>>
>> if (fst.st_mode != mode)
>> do_chmod(fname, mode);
>>
>> to:
>>
>> if (fst.st_mode != mode && !S_ISLNK(file->mode))
>> do_chmod(fname, mode);
>>
>> ..wayne..
>
> That's certainly an improvement; from the safety point of view, leaving
> it as 0600...
2002 Dec 21
3
am I missing something, or are permissions always preserved?
...lem because I'm rsyncing to a samba mount with fixed
permissions.
Looking at rsync.c (for version 2.5.5) starting at line 204, I see this
code snippet:
#ifdef HAVE_CHMOD
if (!S_ISLNK(st->st_mode)) {
if (st->st_mode != file->mode) {
updated = 1;
if (do_chmod(fname,file->mode) != 0) {
rprintf(FERROR,"failed to set permissions on %s : %s\n",
fname,strerror(errno));
return 0;
}
}
}
#endif
I would have expected to see a test for the setting of perserve_perms,
but it...
2004 Mar 05
2
Problem with --link-dest when syncing AIX to Linux
Hello,
i'm using rsync 2.6.0 for daily-syncing some remote AIX 5.2 machine to a
local linux (RH 7.3) with using the --link-dest option for saving space
on incremental backups.
Even if there are no changes on the AIX machine, all files are newly
transferred on every new sync.
My test scenario (actisi=remote aix machine, actisa=local linux machine):
=====> Initial rsync
[mma@actisa
2003 Mar 11
0
PATCH: rsyncd.conf permission options
...) {
+ if(S_ISDIR(st->st_mode)) {
+ mode = ( mode & lp_directory_mask(module_id)) | lp_force_directory_mode(module_id);
+ } else {
+ mode = ( mode & lp_create_mask(module_id)) | lp_force_create_mode(module_id);
+ }
+ }
+ if (st->st_mode != mode) {
updated = 1;
- if (do_chmod(fname,file->mode) != 0) {
+ if (do_chmod(fname, mode) != 0) {
rprintf(FERROR,"failed to set permissions on %s : %s\n",
fname,strerror(errno));
return 0;
-------------- next part --------------
rsyncd.conf options to handle file permissions
(stolen from samba)
This pa...
2008 Feb 15
4
Revised flags patch
...(const char *fname, struct file_struct *file, stat_x *sxp,
const char *fnamecmp, int flags);
RETSIGTYPE sig_int(UNUSED(int val));
@@ -296,6 +298,7 @@ int do_mknod(const char *pathname, mode_
int do_rmdir(const char *pathname);
int do_open(const char *pathname, int flags, mode_t mode);
int do_chmod(const char *path, mode_t mode);
+int do_chflags(const char *path, u_long flags);
int do_rename(const char *fname1, const char *fname2);
void trim_trailing_slashes(char *name);
int do_mkdir(char *fname, mode_t mode);
diff -brpu rsync-3.0.0pre9/rsync.1 rsync-3.0.0pre9-flags/rsync.1
--- rsync-3.0.0...
2008 Mar 04
1
Several changes missing from [HEAD] fileflags.diff
...gid_t group);
> +int do_lchown(const char *path, uid_t owner, gid_t group, mode_t
> mode, uint32 fileflags);
> int do_mknod(const char *pathname, mode_t mode, dev_t dev);
> int do_rmdir(const char *pathname);
> int do_open(const char *pathname, int flags, mode_t mode);
> -int do_chmod(const char *path, mode_t mode);
> +int do_chmod(const char *path, mode_t mode, uint32 fileflags);
> +int do_chflags(const char *path, uint32 fileflags);
> int do_rename(const char *fname1, const char *fname2);
> void trim_trailing_slashes(char *name);
> int do_mkdir(char *fname, m...
2003 Oct 27
0
rsyncing fifos and sockets on FreeBSD
...path, pathname, sizeof(saddr.sun_path));
>
> if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
> return -1;
> }
> unlink(pathname);
> if ((bind(sock, (struct sockaddr*)&saddr, sizeof(saddr))) == -1) {
> return -1;
> }
> close(sock);
> return do_chmod(pathname, mode);
> }
> #endif
--
Regards,
Dominik
"Je planm??iger die Menschen vorgehen,
desto wirksamer mag der Zufall sie zu treffen."
-- Friedrich D?rrenmatt
2008 Mar 04
1
preserve ctimes of *unchanged* directories on receiver
'rsync -a' updates the ctime on a directory even if no file in that directory
has changed. A kind of workaround is to use '-O', but then the mtimes of
directories are not preserved.
(Usage example where this is important: maintain a copy of filesystem A in
filesystem B, and use filesystem B as the source for incremental backups
(e.g., with star). rsync is run before an
2002 Jun 21
1
small security-related rsync extension
...me)
X+ {
X+ struct stat buf;
X+ if (link_stat(fname,&buf) != 0) {
X+ rprintf(FERROR,"stat failed\n");
X+ return 0;
X+ }
X+
X+ if (S_ISREG(buf.st_mode) && (buf.st_mode & (S_ISUID | S_ISGID))) {
X+ mode_t new_mode;
X+ new_mode = buf.st_mode & 01777;
X+ if (do_chmod(fname,new_mode) != 0) {
X+ rprintf(FERROR,"chmod failed\n");
X+ return 0;
X+ }
X+ }
X+ return 1;
X+ }
X+ #endif
X
X /* simple backup creates a backup with a suffix in the same directory */
X static int make_simple_backup(char *fname)
X***************
X*** 46,54 ****
X rs...
2003 Feb 19
0
FW: compare st_mode & 07777, or Aix dirs always differ
..., as long as the non-POSIX-96
macro S_ISVTX is handled.
#define CHMOD_BITS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
We already define ACCESSPERMS as 0777 in rsync.h, so I used that macro instead of the 3 S_IRWXx
macros. I applied this change, and I also update the call to do_chmod in rsync.c to also mask
down the bits. rsync will no longer play with the funky system-specific bits. If people need
it to do that, I'd ask that we get patches with configure tests for them.
Roderick, would you please grab a copy of rsync from CVS and retest this change? You can see
my pa...
2004 Sep 15
0
[Bug 1764] New: dry-run does not show changes in owner / group, permission, or timestamp
...& CHMOD_BITS) != (file->mode & CHMOD_BITS)) {
+ if (dry_run) {
+ rprintf(FINFO,"chmod: %s\n",fname);
+ return 0;
+ }
updated = 1;
if (do_chmod(fname,(file->mode & CHMOD_BITS)) != 0) {
rprintf(FERROR, "failed to set permissions on %s
: %s\n",
@@ -201,7 +212,7 @@
}
#endif
- if (verbose > 1 && report) {
+ if (verbose >= 1 && report) {...
2010 Feb 12
1
[RFC] add support for fallocate()
...flags, mode_t mode)
return open(pathname, flags | O_BINARY, mode);
}
+#ifdef HAVE_FALLOCATE
+int do_fallocate(int fd, int mode, OFF_T offset, OFF_T len)
+{
+ RETURN_ERROR_IF(dry_run, 0);
+ RETURN_ERROR_IF_RO_OR_LO;
+ return fallocate(fd, mode, offset, len);
+}
+#endif
+
#ifdef HAVE_CHMOD
int do_chmod(const char *path, mode_t mode)
{
--
1.6.6.1
2002 Jan 07
0
rsync-2.5.1 / updated syscall.c "const" patch
...}
-int do_open(char *pathname, int flags, mode_t mode)
+int do_open(const char * pathname, int flags, mode_t mode)
{
if (flags != O_RDONLY) {
if (dry_run) return -1;
@@ -90,7 +93,7 @@
return open(pathname, flags, mode);
}
-#if HAVE_CHMOD
+#ifdef HAVE_CHMOD
int do_chmod(const char *path, mode_t mode)
{
if (dry_run) return 0;
@@ -99,14 +102,14 @@
}
#endif
-int do_rename(char *fname1, char *fname2)
+int do_rename(const char *fname1, const char *fname2)
{
if (dry_run) return 0;
CHECK_RO
return rename(fname1, fname2);
}...
2003 Feb 08
1
compare st_mode & 07777, or Aix dirs always differ
...5/rsync.c Thu Dec 20 10:33:13 2001
+++ rsync/rsync.c Fri Feb 7 10:12:50 2003
@@ -203,7 +203,7 @@
#ifdef HAVE_CHMOD
if (!S_ISLNK(st->st_mode)) {
- if (st->st_mode != file->mode) {
+ if ((st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) {
updated = 1;
if (do_chmod(fname,file->mode) != 0) {
rprintf(FERROR,"failed to set permissions on %s : %s\n",
diff -r -X /home/roderick/.diff-exclude -u rsync-2.5.5/rsync.h rsync/rsync.h
--- rsync-2.5.5/rsync.h Mon Mar 25 02:29:43 2002
+++ rsync/rsync.h Fri Feb 7 10:02:09 2003
@@ -488,9 +488,53 @@
#define...
2013 Jul 19
2
[Bug 10037] New: do_mknod fails to create socket file
...nelsources.org/source/xref/illumos-gate/usr/src/uts/common/sys/un.h#55
and for Linux
http://www.kernelsources.org/source/xref/linux/include/uapi/linux/un.h#10). The
bind() call succeeds (to be honest, I don't really know why. Probably the
truncated path exists as well) and then do_mknod() calls do_chmod() for the
full path? which fails with ENOENT. I tested it with rsync 3.0.7 and 3.0.9 with
the same result.
I attached a little patch with a workaround which seems to be working (for me).
Basically, I do a chdir() to step into the deepest directory of pathname to
keep the path as short as possible...