Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Switch from inet_aton() to inet_pton() (since we supply a compatibility
[rsync/rsync.git]
/
lib
/
sysacls.c
diff --git
a/lib/sysacls.c
b/lib/sysacls.c
index
623aa6d
..
7334fd4
100644
(file)
--- a/
lib/sysacls.c
+++ b/
lib/sysacls.c
@@
-2,6
+2,7
@@
* Unix SMB/CIFS implementation.
* Based on the Samba ACL support code.
* Copyright (C) Jeremy Allison 2000.
* Unix SMB/CIFS implementation.
* Based on the Samba ACL support code.
* Copyright (C) Jeremy Allison 2000.
+ * Copyright (C) 2007-2008 Wayne Davison
*
* The permission functions have been changed to get/set all bits via
* one call. Some functions that rsync doesn't need were also removed.
*
* The permission functions have been changed to get/set all bits via
* one call. Some functions that rsync doesn't need were also removed.
@@
-550,7
+551,7
@@
SMB_ACL_T sys_acl_init(int count)
* acl[] array, this actually allocates an ACL with room
* for (count+1) entries
*/
* acl[] array, this actually allocates an ACL with room
* for (count+1) entries
*/
- if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof
(struct SMB_ACL_T) + count * sizeof
(struct acl))) == NULL) {
+ if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof
a[0] + count * sizeof
(struct acl))) == NULL) {
errno = ENOMEM;
return NULL;
}
errno = ENOMEM;
return NULL;
}
@@
-1006,7
+1007,7
@@
SMB_ACL_T sys_acl_init(int count)
* acl[] array, this actually allocates an ACL with room
* for (count+1) entries
*/
* acl[] array, this actually allocates an ACL with room
* for (count+1) entries
*/
- if ((a =
SMB_MALLOC(sizeof(struct SMB_ACL_T)
+ count * sizeof(struct acl))) == NULL) {
+ if ((a =
(SMB_ACL_T)SMB_MALLOC(sizeof a[0]
+ count * sizeof(struct acl))) == NULL) {
errno = ENOMEM;
return NULL;
}
errno = ENOMEM;
return NULL;
}
@@
-1100,7
+1101,7
@@
struct hpux_acl_types {
* acl types.
*/
* acl types.
*/
-static
int
hpux_count_obj(int acl_count, struct acl *aclp, struct hpux_acl_types *acl_type_count)
+static
void
hpux_count_obj(int acl_count, struct acl *aclp, struct hpux_acl_types *acl_type_count)
{
int i;
{
int i;
@@
-1637,14
+1638,14
@@
SMB_ACL_T sys_acl_init(int count)
return NULL;
}
return NULL;
}
- if ((a =
SMB_MALLOC(sizeof(struct SMB_ACL_T) + sizeof
(struct acl))) == NULL) {
+ if ((a =
(SMB_ACL_T)SMB_MALLOC(sizeof a[0] + sizeof
(struct acl))) == NULL) {
errno = ENOMEM;
return NULL;
}
a->next = -1;
a->freeaclp = False;
errno = ENOMEM;
return NULL;
}
a->next = -1;
a->freeaclp = False;
- a->aclp = (struct acl *)(
&a->aclp + sizeof(struct acl *)
);
+ a->aclp = (struct acl *)(
(char *)a + sizeof a[0]
);
a->aclp->acl_cnt = 0;
return a;
a->aclp->acl_cnt = 0;
return a;
@@
-1735,6
+1736,13
@@
int sys_acl_get_entry( SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
struct new_acl_entry *entry;
int keep_going;
struct new_acl_entry *entry;
int keep_going;
+ if (entry_id == SMB_ACL_FIRST_ENTRY)
+ theacl->count = 0;
+ else if (entry_id != SMB_ACL_NEXT_ENTRY) {
+ errno = EINVAL;
+ return -1;
+ }
+
DEBUG(10,("This is the count: %d\n",theacl->count));
/* Check if count was previously set to -1. *
DEBUG(10,("This is the count: %d\n",theacl->count));
/* Check if count was previously set to -1. *
@@
-1804,7
+1812,6
@@
SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type)
struct acl_entry_link *acl_entry_link_head;
int i;
int rc = 0;
struct acl_entry_link *acl_entry_link_head;
int i;
int rc = 0;
- uid_t user_id;
/* AIX has no DEFAULT */
if ( type == SMB_ACL_TYPE_DEFAULT ) {
/* AIX has no DEFAULT */
if ( type == SMB_ACL_TYPE_DEFAULT ) {
@@
-2025,7
+2032,6
@@
SMB_ACL_T sys_acl_get_fd(int fd)
struct acl_entry_link *acl_entry_link_head;
int i;
int rc = 0;
struct acl_entry_link *acl_entry_link_head;
int i;
int rc = 0;
- uid_t user_id;
/* Get the acl using fstatacl */
/* Get the acl using fstatacl */
@@
-2239,7
+2245,7
@@
int sys_acl_get_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T *tag_type_p, uint32 *b
return -1;
if (*tag_type_p == SMB_ACL_USER || *tag_type_p == SMB_ACL_GROUP)
return -1;
if (*tag_type_p == SMB_ACL_USER || *tag_type_p == SMB_ACL_GROUP)
-
*u_g_id_p = entry->ace_id->id_data
;
+
memcpy(u_g_id_p, entry->ace_id->id_data, sizeof (id_t))
;
permset = &entry->ace_access;
permset = &entry->ace_access;
@@
-2255,6
+2261,11
@@
SMB_ACL_T sys_acl_init( int count)
{
struct acl_entry_link *theacl = NULL;
{
struct acl_entry_link *theacl = NULL;
+ if (count < 0) {
+ errno = EINVAL;
+ return NULL;
+ }
+
DEBUG(10,("Entering sys_acl_init\n"));
theacl = SMB_MALLOC_P(struct acl_entry_link);
DEBUG(10,("Entering sys_acl_init\n"));
theacl = SMB_MALLOC_P(struct acl_entry_link);
@@
-2373,7
+2384,6
@@
int sys_acl_set_file( const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl
struct acl_entry *acl_entry = NULL;
struct ace_id *ace_id = NULL;
uint id_type;
struct acl_entry *acl_entry = NULL;
struct ace_id *ace_id = NULL;
uint id_type;
- uint ace_access;
uint user_id;
uint acl_length;
uint rc;
uint user_id;
uint acl_length;
uint rc;
@@
-2452,7
+2462,7
@@
int sys_acl_set_file( const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl
memcpy(acl_entry->ace_id->id_data, &user_id, sizeof(uid_t));
}
memcpy(acl_entry->ace_id->id_data, &user_id, sizeof(uid_t));
}
- rc = chacl(name,file_acl,file_acl->acl_len);
+ rc = chacl(
(char*)
name,file_acl,file_acl->acl_len);
DEBUG(10,("errno is %d\n",errno));
DEBUG(10,("return code is %d\n",rc));
SAFE_FREE(file_acl);
DEBUG(10,("errno is %d\n",errno));
DEBUG(10,("return code is %d\n",rc));
SAFE_FREE(file_acl);
@@
-2551,7
+2561,7
@@
int sys_acl_set_fd( int fd, SMB_ACL_T theacl)
}
#endif
}
#endif
-int sys_acl_delete_def_file(
const char *name
)
+int sys_acl_delete_def_file(
UNUSED(const char *name)
)
{
/* AIX has no default ACL */
return 0;
{
/* AIX has no default ACL */
return 0;
@@
-2694,6
+2704,8
@@
int sys_acl_set_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tag_type, uint32 bits,
rc = mbr_uid_to_uuid(u_g_id, uu);
else
rc = mbr_gid_to_uuid(u_g_id, uu);
rc = mbr_uid_to_uuid(u_g_id, uu);
else
rc = mbr_gid_to_uuid(u_g_id, uu);
+ if (rc != 0)
+ return rc;
if (acl_set_tag_type(entry, tag_type) != 0
|| acl_set_qualifier(entry, &uu) != 0
if (acl_set_tag_type(entry, tag_type) != 0
|| acl_set_qualifier(entry, &uu) != 0