OSF DCE Application Development Guide--Introduction and Style Guide
OSF DCE Application Development Guide—Introduction and Style Guide
/******
*
*
* is_valid_principal -- Find out whether the specified principal is a
* member of the group he’s supposed to be.
*
*
******/
boolean32 is_valid_principal(
unsigned_char_t *princ_name, /* Full name of principal to test. */
unsigned_char_t *group, /* Group we want principal to be in. */
unsigned32 *status)
{
unsigned_char_t *local_name; /* For principal’s local name. */
char *cell_name; /* Local cell name. */
sec_rgy_handle_t rhandle; /* Local registry binding. */
boolean32 is_valid; /* To hold result of registry call. */
fprintf(stdout, "sample_client: Entering is_valid_principal()...0);
fprintf(stdout, "sample_client: Initial principal name == %s0, princ_name);
fprintf(stdout, "sample_client: Initial group name == %s0, group);
/* Find out the local cell name... */
fprintf(stdout, "sample_client: Calling dce_cf_get_cell_name()...0);
dce_cf_get_cell_name(&cell_name, status);
if (*status != dce_cf_st_ok)
{
print_error("dce_cf_get_cell_name()", *status);
return 0;
}
/* Now bind to the local cell registry... */
fprintf(stdout, "sample_client: Calling sec_rgy_site_open()...0);
sec_rgy_site_open(cell_name, &rhandle, status);
if (*status != error_status_ok)
{
free(cell_name);
print_error("sec_rgy_site_open()", *status);
return 0;
}
/* Free the cellname string space... */
free(cell_name);
if (*status != rpc_s_ok)
{
print_error("free()", *status);
return 0;
}
/* Get the specified principal’s local (cell-relative) name... */
local_name = malloc(strlen((char *)princ_name));
fprintf(stdout, "sample_client: Calling sec_id_parse_name()...0);
A− 90 Tandem Computers Incorporated 124246










