PreviousNext

The server_store_acl Routine

The server_store_acl( ) routine stores an ACL and its related information in the appropriate backing store databases.

/******
*
* server_store_acl -- Store ACL-related data.
*
*
* The data is stored in databases that support a
* name->object_uuid->acl_uuid style of ACL lookup.
*
*
* Called from server_acl_mgr_setup().
*
******/

void server_store_acl(
dce_db_handle_t db_acl, /* ACL (UUID)-indexed store. */
dce_db_handle_t db_object, /* Object (UUID)-indexed store. */
dce_db_handle_t db_name, /* Name-indexed store. */
sec_acl_t *acl, /* The ACL itself. */
uuid_t *acl_uuid, /* ACL UUID. */
uuid_t *object_uuid, /* Object UUID. */
unsigned_char_t *object_name, /* The name of the object. */
void *object_data, /* The actual object data contents. */
/* NOTE: NOT USED NOW. */
boolean32 is_container, /* Are we storing a container ACL? */
unsigned32 *status) /* To return status. */
{

/* These two variables are used to hold UUIDs for the ACLs we will */
/* need to create if we have a container ACL on our hands... */
uuid_t def_object, def_container;
sample_data_t sample_data;

*status = error_status_ok;

/* Null the contents of the object_data variable... */
bzero(object_data, sizeof object_data);

/* If we have a container ACL, then we have to create and store the */
/* special stuff associated with it-- namely, the container ACL */
/* itself, and a default object ACL to go with it... */
if (is_container)
{
/* Create a UUID for the default object ACL... */
uuid_create(&def_object, status);

/* Create a UUID for the default container ACL... */
uuid_create(&def_container, status);

/* Store the default object ACL into UUID-indexed store... */
dce_db_store_by_uuid(db_acl, &def_object, acl, status);

/* Store the default container ACL into UUID-indexed */
/* store... */
dce_db_store_by_uuid(db_acl, &def_container, acl, status);

}

/* Store the plain object ACL into ACL UUID-indexed store... */
dce_db_store_by_uuid(db_acl, acl_uuid, acl, status);

/* Store the ACL UUID(s) into a standard object header... */
dce_db_std_header_init(
db_object, /* Object database. */
&(sample_data.s_hdr), /* Object data hdr. */
object_uuid, /* Object UUID. */
acl_uuid, /* ACL UUID. */
&def_object, /* Default object ACL. */
&def_container, /* Default container ACL. */
0, /* Reference count. */
status);

/* Now store the object data keyed by object UUID... */
if (strcmp(object_name, SAMPLE_OBJECT_NAME) == 0)
strcpy(sample_data.s_data.message,
"THIS IS AN OFFICIAL SAMPLE OBJECT TEXT!");
else if (strcmp(object_name, MGMT_OBJ_NAME) == 0)
strcpy(sample_data.s_data.message,
"THIS IS AN OFFICIAL MGMT OBJECT SAMPLE TEXT!");
else
strcpy(sample_data.s_data.message,
"I DON'T KNOW WHAT THIS IS!");

dce_db_store_by_uuid(db_object, object_uuid, (void *)&sample_data, status);

/* Finally, store the object UUID keyed by the object ("residual") */
/* name... */
dce_db_store_by_name(db_name, (char *)object_name, object_uuid, status);

}