return acl_delete_def_file(name);
}
-int sys_acl_free_acl(SMB_ACL_T the_acl)
+int sys_acl_free_acl(SMB_ACL_T the_acl)
{
return acl_free(the_acl);
}
* The interface to DEC/Compaq Tru64 UNIX ACLs
* is based on Draft 13 of the POSIX spec which is
* slightly different from the Draft 16 interface.
- *
+ *
* Also, some of the permset manipulation functions
* such as acl_clear_perm() and acl_add_perm() appear
* to be broken on Tru64 so we have to manipulate
return acl_delete_def_file((char *)name);
}
-int sys_acl_free_acl(SMB_ACL_T the_acl)
+int sys_acl_free_acl(SMB_ACL_T the_acl)
{
return acl_free(the_acl);
}
break;
}
ndefault = count - naccess;
-
+
/*
* if the caller wants the default ACL we have to copy
* the entries down to the start of the acl[] buffer
if (acl_d->acl[naccess].a_type & ACL_DEFAULT)
break;
}
-
+
acl_d->count = naccess;
return acl_d;
if (*tag_type_p == SMB_ACL_USER || *tag_type_p == SMB_ACL_GROUP)
*u_g_id_p = entry->a_id;
-
+
return 0;
}
}
return 0;
}
-
+
int sys_acl_valid(SMB_ACL_T acl_d)
{
return acl_sort(acl_d);
ret = acl(path, SETACL, acl_d->count, acl_d->acl);
sys_acl_free_acl(acl_d);
-
+
return ret;
}
-int sys_acl_free_acl(SMB_ACL_T acl_d)
+int sys_acl_free_acl(SMB_ACL_T acl_d)
{
SAFE_FREE(acl_d);
return 0;
int ndefault; /* # of default ACL entries */
if (hpux_acl_call_presence() == False) {
- /* Looks like we don't have the acl() system call on HPUX.
+ /* Looks like we don't have the acl() system call on HPUX.
* May be the system doesn't have the latest version of JFS.
*/
- return NULL;
+ return NULL;
}
if (type != SMB_ACL_TYPE_ACCESS && type != SMB_ACL_TYPE_DEFAULT) {
break;
}
ndefault = count - naccess;
-
+
/*
* if the caller wants the default ACL we have to copy
* the entries down to the start of the acl[] buffer
* aclp - Array of ACL structures.
* acl_type_count - Pointer to acl_types structure. Should already be
* allocated.
- * Output:
+ * Output:
*
- * acl_type_count - This structure is filled up with counts of various
+ * acl_type_count - This structure is filled up with counts of various
* acl types.
*/
for (i = 0; i < acl_count; i++) {
switch (aclp[i].a_type) {
- case USER:
+ case USER:
acl_type_count->n_user++;
break;
- case USER_OBJ:
+ case USER_OBJ:
acl_type_count->n_user_obj++;
break;
- case DEF_USER_OBJ:
+ case DEF_USER_OBJ:
acl_type_count->n_def_user_obj++;
break;
- case GROUP:
+ case GROUP:
acl_type_count->n_group++;
break;
- case GROUP_OBJ:
+ case GROUP_OBJ:
acl_type_count->n_group_obj++;
break;
- case DEF_GROUP_OBJ:
+ case DEF_GROUP_OBJ:
acl_type_count->n_def_group_obj++;
break;
- case OTHER_OBJ:
+ case OTHER_OBJ:
acl_type_count->n_other_obj++;
break;
- case DEF_OTHER_OBJ:
+ case DEF_OTHER_OBJ:
acl_type_count->n_def_other_obj++;
break;
case CLASS_OBJ:
case DEF_GROUP:
acl_type_count->n_def_group++;
break;
- default:
+ default:
acl_type_count->n_illegal_obj++;
break;
}
}
}
-/* swap_acl_entries: Swaps two ACL entries.
+/* swap_acl_entries: Swaps two ACL entries.
*
* Inputs: aclp0, aclp1 - ACL entries to be swapped.
*/
}
/* prohibited_duplicate_type
- * Identifies if given ACL type can have duplicate entries or
+ * Identifies if given ACL type can have duplicate entries or
* not.
*
* Inputs: acl_type - ACL Type.
*
- * Outputs:
+ * Outputs:
*
- * Return..
+ * Return..
*
* True - If the ACL type matches any of the prohibited types.
* False - If the ACL type doesn't match any of the prohibited types.
- */
+ */
static BOOL hpux_prohibited_duplicate_type(int acl_type)
{
switch (acl_type) {
case USER:
case GROUP:
- case DEF_USER:
+ case DEF_USER:
case DEF_GROUP:
return True;
default:
/* get_needed_class_perm
* Returns the permissions of a ACL structure only if the ACL
- * type matches one of the pre-determined types for computing
+ * type matches one of the pre-determined types for computing
* CLASS_OBJ permissions.
*
* Inputs: aclp - Pointer to ACL structure.
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 USER:
+ case GROUP_OBJ:
+ case GROUP:
+ case DEF_USER_OBJ:
case DEF_USER:
- case DEF_GROUP_OBJ:
+ case DEF_GROUP_OBJ:
case DEF_GROUP:
case DEF_CLASS_OBJ:
- case DEF_OTHER_OBJ:
+ case DEF_OTHER_OBJ:
return aclp->a_perm;
- default:
+ default:
return 0;
}
}
#if !defined(HAVE_HPUX_ACLSORT)
/*
* The aclsort() system call is available on the latest HPUX General
- * Patch Bundles. So for HPUX, we developed our version of acl_sort
- * function. Because, we don't want to update to a new
+ * Patch Bundles. So for HPUX, we developed our version of acl_sort
+ * function. Because, we don't want to update to a new
* HPUX GR bundle just for aclsort() call.
*/
struct hpux_acl_types acl_obj_count;
int n_class_obj_perm = 0;
int i, j;
-
+
if (!acl_count) {
DEBUG(10, ("Zero acl count passed. Returning Success\n"));
return 0;
hpux_count_obj(acl_count, aclp, &acl_obj_count);
- /* There should be only one entry each of type USER_OBJ, GROUP_OBJ,
- * CLASS_OBJ and OTHER_OBJ
+ /* There should be only one entry each of type USER_OBJ, GROUP_OBJ,
+ * CLASS_OBJ and OTHER_OBJ
*/
if (acl_obj_count.n_user_obj != 1
return -1;
}
- /* We now have proper number of OBJ and DEF_OBJ entries. Now sort the acl
- * structures.
+ /* We now have proper number of OBJ and DEF_OBJ entries. Now sort the acl
+ * structures.
*
* Sorting crieteria - First sort by ACL type. If there are multiple entries of
* same ACL type, sort by ACL id.
*
- * I am using the trivial kind of sorting method here because, performance isn't
+ * I am using the trivial kind of sorting method here because, performance isn't
* really effected by the ACLs feature. More over there aren't going to be more
- * than 17 entries on HPUX.
+ * than 17 entries on HPUX.
*/
for (i = 0; i < acl_count; i++) {
}
return 0;
}
-
+
int sys_acl_valid(SMB_ACL_T acl_d)
{
return acl_sort(acl_d);
int ret;
if (hpux_acl_call_presence() == False) {
- /* Looks like we don't have the acl() system call on HPUX.
+ /* Looks like we don't have the acl() system call on HPUX.
* May be the system doesn't have the latest version of JFS.
*/
errno=ENOSYS;
- return -1;
+ return -1;
}
if (type != SMB_ACL_TYPE_ACCESS && type != SMB_ACL_TYPE_DEFAULT) {
ret = acl(path, ACL_SET, acl_d->count, acl_d->acl);
sys_acl_free_acl(acl_d);
-
+
return ret;
}
-int sys_acl_free_acl(SMB_ACL_T acl_d)
+int sys_acl_free_acl(SMB_ACL_T acl_d)
{
free(acl_d);
return 0;
return acl_delete_def_file(name);
}
-int sys_acl_free_acl(SMB_ACL_T acl_d)
+int sys_acl_free_acl(SMB_ACL_T acl_d)
{
if (acl_d->freeaclp) {
acl_free(acl_d->aclp);
}
/* Get the acl using statacl */
-
+
DEBUG(10, ("Entering sys_acl_get_file\n"));
DEBUG(10, ("path_p is %s\n", path_p));
file_acl = (struct acl *)SMB_MALLOC(BUFSIZ);
-
+
if (file_acl == NULL) {
errno=ENOMEM;
DEBUG(0, ("Error in AIX sys_acl_get_file: %d\n", errno));
* to be specified but, it's better than leaving it 0 */
acl_entry_link->entryp->ace_type = acl_entry->ace_type;
-
+
acl_entry_link->entryp->ace_access = acl_entry->ace_access;
-
+
memcpy(acl_entry_link->entryp->ace_id, idp, sizeof (struct ace_id));
/* The access in the acl entries must be left shifted by *
DEBUG(10, ("acl_entry = %d\n", acl_entry));
DEBUG(10, ("The ace_type is %d\n", acl_entry->ace_type));
-
+
acl_entry = acl_nxt(acl_entry);
}
} /* end of if enabled */
new_acl_entry->ace_access = file_acl->o_access << 6;
idp->id_type = SMB_ACL_OTHER;
break;
-
+
case 1:
new_acl_entry->ace_access = file_acl->u_access << 6;
idp->id_type = SMB_ACL_USER_OBJ;
break;
-
+
default:
return NULL;
int rc = 0;
/* Get the acl using fstatacl */
-
+
DEBUG(10, ("Entering sys_acl_get_fd\n"));
DEBUG(10, ("fd is %d\n", fd));
file_acl = (struct acl *)SMB_MALLOC(BUFSIZ);
DEBUG(10, ("acl_entry is %d\n", acl_entry));
DEBUG(10, ("acl_last(file_acl) id %d\n", acl_last(file_acl)));
-
+
/* Check if the extended acl bit is on. *
* If it isn't, do not show the *
* contents of the acl since AIX intends *
* the extended info to remain unused */
-
+
if (file_acl->acl_mode & S_IXACL){
/* while we are not pointing to the very end */
while (acl_entry < acl_last(file_acl)) {
}
idp = acl_entry->ace_id;
-
+
/* Check if this is the first entry in the linked list. *
* The first entry needs to keep prevp pointing to NULL *
* and already has entryp allocated. */
DEBUG(10, ("acl_entry = %d\n", acl_entry));
DEBUG(10, ("The ace_type is %d\n", acl_entry->ace_type));
-
+
acl_entry = acl_nxt(acl_entry);
}
} /* end of if enabled */
}
acl_entry_link->nextp = NULL;
-
+
new_acl_entry = acl_entry_link->entryp;
idp = new_acl_entry->ace_id;
-
+
new_acl_entry->ace_len = sizeof (struct acl_entry);
new_acl_entry->ace_type = ACC_PERMIT;
idp->id_len = sizeof (struct ace_id);
DEBUG(10, ("idp->id_len = %d\n", idp->id_len));
memset(idp->id_data, 0, sizeof (uid_t));
-
+
switch (i) {
case 2:
new_acl_entry->ace_access = file_acl->g_access << 6;
idp->id_type = SMB_ACL_GROUP_OBJ;
break;
-
+
case 3:
new_acl_entry->ace_access = file_acl->o_access << 6;
idp->id_type = SMB_ACL_OTHER;
break;
-
+
case 1:
new_acl_entry->ace_access = file_acl->u_access << 6;
idp->id_type = SMB_ACL_USER_OBJ;
break;
-
+
default:
return NULL;
}
-
+
acl_entry_link_head->count++;
DEBUG(10, ("new_acl_entry->ace_access = %d\n", new_acl_entry->ace_access));
}
acl_entry_link_head->count = 0;
SAFE_FREE(file_acl);
-
+
return acl_entry_link_head;
}
#endif
SMB_ACL_T sys_acl_init(int count)
{
struct acl_entry_link *theacl = NULL;
-
+
if (count < 0) {
errno = EINVAL;
return NULL;
}
DEBUG(10, ("user_obj=%d, group_obj=%d, other_obj=%d\n", user_obj, group_obj, other_obj));
-
+
if (user_obj != 1 || group_obj != 1 || other_obj != 1)
- return -1;
+ return -1;
return 0;
}
DEBUG(10, ("Entering sys_acl_set_file\n"));
DEBUG(10, ("File name is %s\n", name));
-
+
/* AIX has no default ACL */
if (acltype == SMB_ACL_TYPE_DEFAULT)
return 0;
errno = ENOMEM;
DEBUG(0, ("Error in sys_acl_set_file is %d\n", errno));
return -1;
- }
+ }
memcpy(file_acl_temp, file_acl, file_acl->acl_len);
SAFE_FREE(file_acl);
file_acl->acl_len += sizeof (struct acl_entry);
acl_entry->ace_len = acl_entry_link->entryp->ace_len;
acl_entry->ace_access = acl_entry_link->entryp->ace_access;
-
+
/* In order to use this, we'll need to wait until we can get denies */
/* if (!acl_entry->ace_access && acl_entry->ace_type == ACC_PERMIT)
acl_entry->ace_type = ACC_SPECIFY; */
acl_entry->ace_type = ACC_SPECIFY;
-
+
ace_id = acl_entry->ace_id;
-
+
ace_id->id_type = acl_entry_link->entryp->ace_id->id_type;
DEBUG(10, ("The id type is %d\n", ace_id->id_type));
ace_id->id_len = acl_entry_link->entryp->ace_id->id_len;
uint user_id;
uint acl_length;
uint rc;
-
+
DEBUG(10, ("Entering sys_acl_set_fd\n"));
acl_length = BUFSIZ;
file_acl = (struct acl *)SMB_MALLOC(BUFSIZ);
}
memset(file_acl, 0, BUFSIZ);
-
+
file_acl->acl_len = ACL_SIZ;
file_acl->acl_mode = S_IXACL;
file_acl->acl_len += sizeof (struct acl_entry);
acl_entry->ace_len = acl_entry_link->entryp->ace_len;
acl_entry->ace_access = acl_entry_link->entryp->ace_access;
-
+
/* In order to use this, we'll need to wait until we can get denies */
/* if (!acl_entry->ace_access && acl_entry->ace_type == ACC_PERMIT)
acl_entry->ace_type = ACC_SPECIFY; */
-
+
acl_entry->ace_type = ACC_SPECIFY;
-
+
ace_id = acl_entry->ace_id;
-
+
ace_id->id_type = acl_entry_link->entryp->ace_id->id_type;
DEBUG(10, ("The id type is %d\n", ace_id->id_type));
ace_id->id_len = acl_entry_link->entryp->ace_id->id_len;
memcpy(&user_id, acl_entry_link->entryp->ace_id->id_data, sizeof (uid_t));
memcpy(ace_id->id_data, &user_id, sizeof (uid_t));
}
-
+
rc = fchacl(fd, file_acl, file_acl->acl_len);
DEBUG(10, ("errno is %d\n", errno));
DEBUG(10, ("return code is %d\n", rc));
SAFE_FREE(acl_entry_link->prevp);
SAFE_FREE(acl_entry_link->entryp);
SAFE_FREE(acl_entry_link);
-
+
return 0;
}