From: Wayne Davison Date: Mon, 6 Feb 2006 18:57:10 +0000 (+0000) Subject: This has been replaced by the "incoming chmod" and "outgoing chmod" X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/commitdiff_plain/1cac29a2342126fc335a3b7fb957747775e5a34f This has been replaced by the "incoming chmod" and "outgoing chmod" daemon options. --- diff --git a/rsyncd-perm.diff b/rsyncd-perm.diff deleted file mode 100644 index ac458e3..0000000 --- a/rsyncd-perm.diff +++ /dev/null @@ -1,164 +0,0 @@ ---- old/loadparm.c -+++ new/loadparm.c -@@ -142,6 +142,10 @@ typedef struct - char *temp_dir; - char *uid; - -+ int create_mask; -+ int directory_mask; -+ int force_create_mode; -+ int force_directory_mode; - int max_connections; - int max_verbosity; - int timeout; -@@ -187,6 +191,10 @@ static service sDefault = - /* temp_dir; */ NULL, - /* uid; */ NOBODY_USER, - -+ /* create_mask; */ CHMOD_BITS, -+ /* directory_mask; */ CHMOD_BITS, -+ /* force_create_mode; */ 0, -+ /* force_directory_mode; */ 0, - /* max_connections; */ 0, - /* max_verbosity; */ 1, - /* timeout; */ 0, -@@ -291,10 +299,14 @@ static struct parm_struct parm_table[] = - - {"auth users", P_STRING, P_LOCAL, &sDefault.auth_users, NULL,0}, - {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL,0}, -+ {"create mask", P_OCTAL, P_LOCAL, &sDefault.create_mask, NULL,0}, -+ {"directory mask", P_OCTAL, P_LOCAL, &sDefault.directory_mask, NULL,0}, - {"dont compress", P_STRING, P_LOCAL, &sDefault.dont_compress, NULL,0}, - {"exclude from", P_STRING, P_LOCAL, &sDefault.exclude_from, NULL,0}, - {"exclude", P_STRING, P_LOCAL, &sDefault.exclude, NULL,0}, - {"filter", P_STRING, P_LOCAL, &sDefault.filter, NULL,0}, -+ {"force create mode", P_OCTAL, P_LOCAL, &sDefault.force_create_mode, NULL,0}, -+ {"force directory mode",P_OCTAL,P_LOCAL, &sDefault.force_directory_mode,NULL,0}, - {"gid", P_STRING, P_LOCAL, &sDefault.gid, NULL,0}, - {"hosts allow", P_STRING, P_LOCAL, &sDefault.hosts_allow, NULL,0}, - {"hosts deny", P_STRING, P_LOCAL, &sDefault.hosts_deny, NULL,0}, -@@ -405,6 +417,10 @@ FN_LOCAL_STRING(lp_secrets_file, secrets - FN_LOCAL_STRING(lp_temp_dir, temp_dir) - FN_LOCAL_STRING(lp_uid, uid) - -+FN_LOCAL_INTEGER(lp_create_mask, create_mask) -+FN_LOCAL_INTEGER(lp_directory_mask, directory_mask) -+FN_LOCAL_INTEGER(lp_force_create_mode, force_create_mode) -+FN_LOCAL_INTEGER(lp_force_directory_mode, force_directory_mode) - FN_LOCAL_INTEGER(lp_max_connections, max_connections) - FN_LOCAL_INTEGER(lp_max_verbosity, max_verbosity) - FN_LOCAL_INTEGER(lp_timeout, timeout) ---- old/rsync.c -+++ new/rsync.c -@@ -43,6 +43,8 @@ extern int am_server; - extern int am_sender; - extern int am_generator; - extern int am_starting_up; -+extern int am_daemon; -+extern int module_id; - extern int preserve_uid; - extern int preserve_gid; - extern int inplace; -@@ -116,6 +118,7 @@ int set_file_attrs(char *fname, struct f - int updated = 0; - STRUCT_STAT st2; - int change_uid, change_gid; -+ mode_t mode = file->mode; /* file->mode shouldn't be modified */ - - if (!st) { - if (dry_run) -@@ -191,9 +194,19 @@ int set_file_attrs(char *fname, struct f - updated = 1; - } - -+ if (am_daemon) { -+ 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); -+ } -+ } -+ - #ifdef HAVE_CHMOD -- if ((st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) { -- int ret = do_chmod(fname, file->mode); -+ if ((st->st_mode & CHMOD_BITS) != (mode & CHMOD_BITS)) { -+ int ret = do_chmod(fname, mode); - if (ret < 0) { - rsyserr(FERROR, errno, - "failed to set permissions on %s", ---- old/rsyncd.conf.yo -+++ new/rsyncd.conf.yo -@@ -219,6 +219,70 @@ file transfers to and from that module s - was run as root. This complements the "uid" option. The default is gid -2, - which is normally the group "nobody". - -+dit(bf(create mask)) When a file is created (or touched) by rsyncd the -+permissions will be taken from the source file bit-wise 'AND'ed with this -+parameter. This parameter may be thought of as a bit-wise MASK for the UNIX -+modes of a file. Any bit not set here will be removed from the modes set -+on a file when it is created. -+ -+The default value of this parameter is set to 07777 to be provide the -+default behaviour of older versions. -+ -+Following this rsync will bit-wise 'OR' the UNIX mode created from this -+parameter with the value of the force create mode parameter which is set -+to 000 by default. -+ -+This parameter does not affect directory modes. See the parameter -+"directory mask" for details. -+ -+See also the "force create mode" parameter for forcing particular mode bits -+to be set on created files. See also the "directory mask" parameter for -+masking mode bits on created directories. -+ -+dit(bf(force create mode)) This parameter specifies a set of UNIX -+mode bit permissions that will always be set on a file created by -+rsyncd. This is done by bitwise 'OR'ing these bits onto the mode -+bits of a file that is being created or having its permissions changed. -+ -+The default for this parameter is (in octal) 000. The modes in this -+parameter are bitwise 'OR'ed onto the file mode after the mask set in -+the "create mask" parameter is applied. -+ -+See also the parameter "create mask" for details on -+masking mode bits on files. -+ -+ -+dit(bf(directory mask)) When a directory is created (or touched) by -+rsyncd the permissions will be taken from the source directory -+bit-wise 'AND'ed with this parameter. This parameter may be thought -+of as a bit-wise MASK for the UNIX modes of a file. Any bit not set -+here will be removed from the modes set on a file when it is created. -+ -+The default value of this parameter is set to 07777 to be provide the -+default behaviour of older versions. -+ -+Following this rsync will bit-wise 'OR' the UNIX mode created from this -+parameter with the value of the "force directory mode" parameter which -+is set to 000 by default. -+ -+This parameter does not affect file modes. See the parameter "create mask" -+for details. -+ -+See also the "force directory mode" parameter for forcing particular -+mode bits to be set on created directories. See also the "create mask" -+parameter for masking mode bits on created files. -+ -+dit(bf(force directory mode)) This parameter specifies a set of UNIX mode -+bit permissions that will always be set on a directory created by rsyncd. -+This is done by bitwise 'OR'ing these bits onto the mode bits of a directory -+that is being created. The default for this parameter is (in octal) 0000 -+which will not add any extra permission bits to a created directory. This -+operation is done after the mode mask in the parameter "directory mask" -+is applied. -+ -+See also the parameter directory mask for details on masking mode bits on -+created directories. -+ - dit(bf(filter)) The "filter" option allows you to specify a space-separated - list of filter rules that the daemon will not allow to be read or written. - This is only superficially equivalent to the client specifying these