[SCM] The rsync repository. - branch master updated
Rsync CVS commit messages
rsync-cvs at lists.samba.org
Mon Jul 6 05:53:53 UTC 2020
The branch, master has been updated
via bb16db17 Send the uid/gid 0 name since not all systems use 0 for root.
via d6f0342a Change name map funcs to return a const char*.
via 6f6e5b51 Some TANDEM ACL support.
via 28de25a6 Some whitespace & paren cleanup.
from 052b34dc A bit more configure tweaking.
https://git.samba.org/?p=rsync.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit bb16db1747e1119e3cbdbcee6d47ecd68def66cc
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Jul 5 22:51:12 2020 -0700
Send the uid/gid 0 name since not all systems use 0 for root.
commit d6f0342a344f4718beae65a5a68d19b2751e5f6a
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Jul 5 22:17:09 2020 -0700
Change name map funcs to return a const char*.
commit 6f6e5b51ccfc2b07528fd571ea11505f22704880
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Jul 5 19:57:30 2020 -0700
Some TANDEM ACL support.
commit 28de25a6640189ca327d380e6456cab03223cb05
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Jul 5 20:07:10 2020 -0700
Some whitespace & paren cleanup.
-----------------------------------------------------------------------
Summary of changes:
authenticate.c | 8 +-
compat.c | 5 +
flist.c | 2 +-
lib/sysacls.c | 620 ++++++++++++++++++++++++++++-----------------------------
lib/sysacls.h | 2 +
options.c | 1 +
uidlist.c | 79 ++++----
7 files changed, 364 insertions(+), 353 deletions(-)
Changeset truncated at 500 lines:
diff --git a/authenticate.c b/authenticate.c
index 3ef83ef2..8fd6ff69 100644
--- a/authenticate.c
+++ b/authenticate.c
@@ -227,7 +227,7 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
char *users = lp_auth_users(module);
char challenge[MAX_DIGEST_LEN*2];
char line[BIGPATHBUFLEN];
- char **auth_uid_groups = NULL;
+ const char **auth_uid_groups = NULL;
int auth_uid_groups_cnt = -1;
const char *err = NULL;
int group_match = -1;
@@ -287,7 +287,7 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
else {
gid_t *gid_array = gid_list.items;
auth_uid_groups_cnt = gid_list.count;
- auth_uid_groups = new_array(char *, auth_uid_groups_cnt);
+ auth_uid_groups = new_array(const char *, auth_uid_groups_cnt);
for (j = 0; j < auth_uid_groups_cnt; j++)
auth_uid_groups[j] = gid_to_group(gid_array[j]);
}
@@ -313,7 +313,7 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
else if (opt_ch == 'd')
err = "denied by rule";
else {
- char *group = group_match >= 0 ? auth_uid_groups[group_match] : NULL;
+ const char *group = group_match >= 0 ? auth_uid_groups[group_match] : NULL;
err = check_secret(module, line, group, challenge, pass);
}
@@ -324,7 +324,7 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
int j;
for (j = 0; j < auth_uid_groups_cnt; j++) {
if (auth_uid_groups[j])
- free(auth_uid_groups[j]);
+ free((char*)auth_uid_groups[j]);
}
free(auth_uid_groups);
}
diff --git a/compat.c b/compat.c
index 527201ac..4719ef56 100644
--- a/compat.c
+++ b/compat.c
@@ -73,6 +73,7 @@ int want_xattr_optim = 0;
int proper_seed_order = 0;
int inplace_partial = 0;
int do_negotiated_strings = 0;
+int xmit_id0_names = 0;
/* These index values are for the file-list's extra-attribute array. */
int pathname_ndx, depth_ndx, atimes_ndx, uid_ndx, gid_ndx, acls_ndx, xattrs_ndx, unsort_ndx;
@@ -109,6 +110,7 @@ struct name_num_obj valid_compressions = {
#define CF_CHKSUM_SEED_FIX (1<<5)
#define CF_INPLACE_PARTIAL_DIR (1<<6)
#define CF_VARINT_FLIST_FLAGS (1<<7)
+#define CF_ID0_NAMES (1<<8)
static const char *client_info;
@@ -694,6 +696,8 @@ void setup_protocol(int f_out,int f_in)
compat_flags |= CF_CHKSUM_SEED_FIX;
if (local_server || strchr(client_info, 'I') != NULL)
compat_flags |= CF_INPLACE_PARTIAL_DIR;
+ if (local_server || strchr(client_info, 'u') != NULL)
+ compat_flags |= CF_ID0_NAMES;
if (local_server || strchr(client_info, 'v') != NULL) {
do_negotiated_strings = 1;
compat_flags |= CF_VARINT_FLIST_FLAGS;
@@ -714,6 +718,7 @@ void setup_protocol(int f_out,int f_in)
want_xattr_optim = protocol_version >= 31 && !(compat_flags & CF_AVOID_XATTR_OPTIM);
proper_seed_order = compat_flags & CF_CHKSUM_SEED_FIX ? 1 : 0;
xfer_flags_as_varint = compat_flags & CF_VARINT_FLIST_FLAGS ? 1 : 0;
+ xmit_id0_names = compat_flags & CF_ID0_NAMES ? 1 : 0;
if (am_sender) {
receiver_symlink_times = am_server
? strchr(client_info, 'L') != NULL
diff --git a/flist.c b/flist.c
index 5970ce54..21c0b31a 100644
--- a/flist.c
+++ b/flist.c
@@ -2412,7 +2412,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
file_old_total += flist->used;
if (numeric_ids <= 0 && !inc_recurse)
- send_id_list(f);
+ send_id_lists(f);
/* send the io_error flag */
if (protocol_version < 30)
diff --git a/lib/sysacls.c b/lib/sysacls.c
index a354baed..194efe24 100644
--- a/lib/sysacls.c
+++ b/lib/sysacls.c
@@ -29,7 +29,7 @@
#ifdef DEBUG
#undef DEBUG
#endif
-#define DEBUG(x,y)
+#define DEBUG(x, y)
void SAFE_FREE(void *mem)
{
@@ -44,18 +44,18 @@ void SAFE_FREE(void *mem)
The interfaces that each ACL implementation must support are as follows :
- int sys_acl_get_entry( SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
- int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
+ int sys_acl_get_entry(SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
+ int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
int sys_acl_get_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T *tag_type_p, uint32 *bits_p, id_t *u_g_id_p)
- SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type)
+ SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type)
SMB_ACL_T sys_acl_get_fd(int fd)
- SMB_ACL_T sys_acl_init( int count)
- int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
+ SMB_ACL_T sys_acl_init(int count)
+ int sys_acl_create_entry(SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
int sys_acl_set_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tag_type, uint32 bits, id_t u_g_id)
int sys_acl_set_access_bits(SMB_ACL_ENTRY_T entry, uint32 bits)
- int sys_acl_valid( SMB_ACL_T theacl )
- int sys_acl_set_file( const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
- int sys_acl_set_fd( int fd, SMB_ACL_T theacl)
+ int sys_acl_valid(SMB_ACL_T theacl)
+ int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+ int sys_acl_set_fd(int fd, SMB_ACL_T theacl)
int sys_acl_delete_def_file(const char *path)
int sys_acl_free_acl(SMB_ACL_T posix_acl)
@@ -65,19 +65,19 @@ void SAFE_FREE(void *mem)
/* Identity mapping - easy. */
-int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
+int sys_acl_get_entry(SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
{
- return acl_get_entry( the_acl, entry_id, entry_p);
+ return acl_get_entry(the_acl, entry_id, entry_p);
}
-int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
+int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
{
- return acl_get_tag_type( entry_d, tag_type_p);
+ return acl_get_tag_type(entry_d, tag_type_p);
}
-SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type)
+SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type)
{
- return acl_get_file( path_p, type);
+ return acl_get_file(path_p, type);
}
#if 0
@@ -114,12 +114,12 @@ int sys_acl_get_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T *tag_type_p, uint32 *b
return 0;
}
-SMB_ACL_T sys_acl_init( int count)
+SMB_ACL_T sys_acl_init(int count)
{
return acl_init(count);
}
-int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
+int sys_acl_create_entry(SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
{
return acl_create_entry(pacl, pentry);
}
@@ -153,7 +153,7 @@ int sys_acl_set_access_bits(SMB_ACL_ENTRY_T entry, uint32 bits)
return acl_set_permset(entry, permset);
}
-int sys_acl_valid( SMB_ACL_T theacl )
+int sys_acl_valid(SMB_ACL_T theacl)
{
return acl_valid(theacl);
}
@@ -164,7 +164,7 @@ int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
}
#if 0
-int sys_acl_set_fd( int fd, SMB_ACL_T theacl)
+int sys_acl_set_fd(int fd, SMB_ACL_T theacl)
{
return acl_set_fd(fd, theacl);
}
@@ -191,7 +191,7 @@ int sys_acl_free_acl(SMB_ACL_T the_acl)
* to be broken on Tru64 so we have to manipulate
* the permission bits in the permset directly.
*/
-int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
+int sys_acl_get_entry(SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
{
SMB_ACL_ENTRY_T entry;
@@ -208,12 +208,12 @@ int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p
return errno ? -1 : 0;
}
-int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
+int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
{
- return acl_get_tag_type( entry_d, tag_type_p);
+ return acl_get_tag_type(entry_d, tag_type_p);
}
-SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type)
+SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type)
{
return acl_get_file((char *)path_p, type);
}
@@ -246,12 +246,12 @@ int sys_acl_get_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T *tag_type_p, uint32 *b
return 0;
}
-SMB_ACL_T sys_acl_init( int count)
+SMB_ACL_T sys_acl_init(int count)
{
return acl_init(count);
}
-int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
+int sys_acl_create_entry(SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
{
SMB_ACL_ENTRY_T entry;
@@ -286,20 +286,20 @@ int sys_acl_set_access_bits(SMB_ACL_ENTRY_T entry, uint32 bits)
return acl_set_permset(entry, permset);
}
-int sys_acl_valid( SMB_ACL_T theacl )
+int sys_acl_valid(SMB_ACL_T theacl)
{
acl_entry_t entry;
return acl_valid(theacl, &entry);
}
-int sys_acl_set_file( const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
{
return acl_set_file((char *)name, acltype, theacl);
}
#if 0
-int sys_acl_set_fd( int fd, SMB_ACL_T theacl)
+int sys_acl_set_fd(int fd, SMB_ACL_T theacl)
{
return acl_set_fd(fd, ACL_TYPE_ACCESS, theacl);
}
@@ -702,10 +702,10 @@ int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
* copy the access control and default entries into the buffer
*/
memcpy(&acl_buf[0], &acc_acl->acl[0],
- acc_acl->count * sizeof(acl_buf[0]));
+ acc_acl->count * sizeof acl_buf[0]);
memcpy(&acl_buf[acc_acl->count], &def_acl->acl[0],
- def_acl->count * sizeof(acl_buf[0]));
+ def_acl->count * sizeof acl_buf[0]);
/*
* set the ACL_DEFAULT flag on the default entries
@@ -797,30 +797,38 @@ int sys_acl_free_acl(SMB_ACL_T acl_d)
/* so it is important to check this and avoid acl() */
/* calls if it isn't there. */
-static BOOL hpux_acl_call_presence(void)
+#ifdef __TANDEM
+inline do_acl(const char *path_p, int cmd, int nentries, struct acl *aclbufp)
{
+ return acl((char*)path_p, cmd, nentries, aclbufp);
+}
+#define acl(p,c,n,a) do_acl(p,c,n,a)
+#endif
+static BOOL hpux_acl_call_presence(void)
+{
+#ifndef __TANDEM
shl_t handle = NULL;
void *value;
int ret_val=0;
static BOOL already_checked=0;
- if(already_checked)
+ if (already_checked)
return True;
-
ret_val = shl_findsym(&handle, "acl", TYPE_PROCEDURE, &value);
- if(ret_val != 0) {
+ if (ret_val != 0) {
DEBUG(5, ("hpux_acl_call_presence: shl_findsym() returned %d, errno = %d, error %s\n",
ret_val, errno, strerror(errno)));
- DEBUG(5,("hpux_acl_call_presence: acl() system call is not present. Check if you have JFS 3.3 and above?\n"));
+ DEBUG(5, ("hpux_acl_call_presence: acl() system call is not present. Check if you have JFS 3.3 and above?\n"));
return False;
}
- DEBUG(10,("hpux_acl_call_presence: acl() system call is present. We have JFS 3.3 or above \n"));
+ DEBUG(10, ("hpux_acl_call_presence: acl() system call is present. We have JFS 3.3 or above \n"));
already_checked = True;
+#endif
return True;
}
@@ -886,7 +894,7 @@ SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type)
int naccess; /* # of access ACL entries */
int ndefault; /* # of default ACL entries */
- if(hpux_acl_call_presence() == False) {
+ if (hpux_acl_call_presence() == False) {
/* Looks like we don't have the acl() system call on HPUX.
* May be the system doesn't have the latest version of JFS.
*/
@@ -1013,7 +1021,7 @@ SMB_ACL_T sys_acl_init(int count)
* acl[] array, this actually allocates an ACL with room
* for (count+1) entries
*/
- if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof a[0] + count * sizeof(struct acl))) == NULL) {
+ if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof a[0] + count * sizeof (struct acl))) == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -1111,10 +1119,10 @@ static void hpux_count_obj(int acl_count, struct acl *aclp, struct hpux_acl_type
{
int i;
- memset(acl_type_count, 0, sizeof(struct hpux_acl_types));
+ memset(acl_type_count, 0, sizeof (struct hpux_acl_types));
- for(i=0;i<acl_count;i++) {
- switch(aclp[i].a_type) {
+ for (i = 0; i < acl_count; i++) {
+ switch (aclp[i].a_type) {
case USER:
acl_type_count->n_user++;
break;
@@ -1196,14 +1204,14 @@ static void hpux_swap_acl_entries(struct acl *aclp0, struct acl *aclp1)
static BOOL hpux_prohibited_duplicate_type(int acl_type)
{
- switch(acl_type) {
- case USER:
- case GROUP:
- case DEF_USER:
- case DEF_GROUP:
- return True;
- default:
- return False;
+ switch (acl_type) {
+ case USER:
+ case GROUP:
+ case DEF_USER:
+ case DEF_GROUP:
+ return True;
+ default:
+ return False;
}
}
@@ -1217,19 +1225,19 @@ static BOOL hpux_prohibited_duplicate_type(int acl_type)
static int hpux_get_needed_class_perm(struct acl *aclp)
{
- switch(aclp->a_type) {
- case USER:
- case GROUP_OBJ:
- case GROUP:
- case DEF_USER_OBJ:
- case DEF_USER:
- case DEF_GROUP_OBJ:
- case DEF_GROUP:
- case DEF_CLASS_OBJ:
- case DEF_OTHER_OBJ:
- return aclp->a_perm;
- default:
- return 0;
+ switch (aclp->a_type) {
+ case USER:
+ case GROUP_OBJ:
+ case GROUP:
+ case DEF_USER_OBJ:
+ case DEF_USER:
+ case DEF_GROUP_OBJ:
+ case DEF_GROUP:
+ case DEF_CLASS_OBJ:
+ case DEF_OTHER_OBJ:
+ return aclp->a_perm;
+ default:
+ return 0;
}
}
@@ -1268,13 +1276,13 @@ static int hpux_acl_sort(int acl_count, int calclass, struct acl *aclp)
int n_class_obj_perm = 0;
int i, j;
- if(!acl_count) {
- DEBUG(10,("Zero acl count passed. Returning Success\n"));
+ if (!acl_count) {
+ DEBUG(10, ("Zero acl count passed. Returning Success\n"));
return 0;
}
- if(aclp == NULL) {
- DEBUG(0,("Null ACL pointer in hpux_acl_sort. Returning Failure. \n"));
+ if (aclp == NULL) {
+ DEBUG(0, ("Null ACL pointer in hpux_acl_sort. Returning Failure. \n"));
return -1;
}
@@ -1286,12 +1294,11 @@ static int hpux_acl_sort(int acl_count, int calclass, struct acl *aclp)
* CLASS_OBJ and OTHER_OBJ
*/
- if( (acl_obj_count.n_user_obj != 1) ||
- (acl_obj_count.n_group_obj != 1) ||
- (acl_obj_count.n_class_obj != 1) ||
- (acl_obj_count.n_other_obj != 1)
- ) {
- DEBUG(0,("hpux_acl_sort: More than one entry or no entries for \
+ if (acl_obj_count.n_user_obj != 1
+ || acl_obj_count.n_group_obj != 1
+ || acl_obj_count.n_class_obj != 1
+ || acl_obj_count.n_other_obj != 1) {
+ DEBUG(0, ("hpux_acl_sort: More than one entry or no entries for \
USER OBJ or GROUP_OBJ or OTHER_OBJ or CLASS_OBJ\n"));
return -1;
}
@@ -1299,10 +1306,9 @@ USER OBJ or GROUP_OBJ or OTHER_OBJ or CLASS_OBJ\n"));
/* If any of the default objects are present, there should be only
* one of them each.
*/
-
- if( (acl_obj_count.n_def_user_obj > 1) || (acl_obj_count.n_def_group_obj > 1) ||
- (acl_obj_count.n_def_other_obj > 1) || (acl_obj_count.n_def_class_obj > 1) ) {
- DEBUG(0,("hpux_acl_sort: More than one entry for DEF_CLASS_OBJ \
+ if (acl_obj_count.n_def_user_obj > 1 || acl_obj_count.n_def_group_obj > 1
+ || acl_obj_count.n_def_other_obj > 1 || acl_obj_count.n_def_class_obj > 1) {
+ DEBUG(0, ("hpux_acl_sort: More than one entry for DEF_CLASS_OBJ \
or DEF_USER_OBJ or DEF_GROUP_OBJ or DEF_OTHER_OBJ\n"));
return -1;
}
@@ -1318,40 +1324,34 @@ or DEF_USER_OBJ or DEF_GROUP_OBJ or DEF_OTHER_OBJ\n"));
* than 17 entries on HPUX.
*/
- for(i=0; i<acl_count;i++) {
- for (j=i+1; j<acl_count; j++) {
- if( aclp[i].a_type > aclp[j].a_type ) {
+ for (i = 0; i < acl_count; i++) {
+ for (j = i+1; j < acl_count; j++) {
+ if (aclp[i].a_type > aclp[j].a_type) {
/* ACL entries out of order, swap them */
-
hpux_swap_acl_entries((aclp+i), (aclp+j));
-
- } else if ( aclp[i].a_type == aclp[j].a_type ) {
-
+ } else if (aclp[i].a_type == aclp[j].a_type) {
/* ACL entries of same type, sort by id */
-
- if(aclp[i].a_id > aclp[j].a_id) {
+ if (aclp[i].a_id > aclp[j].a_id) {
hpux_swap_acl_entries((aclp+i), (aclp+j));
} else if (aclp[i].a_id == aclp[j].a_id) {
/* We have a duplicate entry. */
- if(hpux_prohibited_duplicate_type(aclp[i].a_type)) {
+ if (hpux_prohibited_duplicate_type(aclp[i].a_type)) {
DEBUG(0, ("hpux_acl_sort: Duplicate entry: Type(hex): %x Id: %d\n",
aclp[i].a_type, aclp[i].a_id));
return -1;
}
}
-
}
}
}
/* set the class obj permissions to the computed one. */
- if(calclass) {
+ if (calclass) {
int n_class_obj_index = -1;
- for(i=0;i<acl_count;i++) {
+ for (i = 0;i < acl_count; i++) {
n_class_obj_perm |= hpux_get_needed_class_perm((aclp+i));
-
- if(aclp[i].a_type == CLASS_OBJ)
+ if (aclp[i].a_type == CLASS_OBJ)
n_class_obj_index = i;
}
aclp[n_class_obj_index].a_perm = n_class_obj_perm;
@@ -1404,7 +1404,7 @@ int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
--
The rsync repository.
More information about the rsync-cvs
mailing list