OSF DCE Application Development Guide--Introduction and Style Guide

A Sample Application
/* Get the lifetime for the server’s Ticket-Granting-Ticket (TGT). */
/* Note that sec_login_get_expiration() returns a non-zero */
/* status for an uncertified login context. This is not */
/* an error. Hence the special error checking... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sec_login_get_expiration()"));
sec_login_get_expiration(login_context,
&expiration,
status);
if (*status != sec_login_s_not_certified)
{
print_server_error("sec_login_validate_identity()", *status);
return;
}
/* Get current time... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling time()"));
time(&current_time);
/* Now, if the expiration time is sooner than the desired "time */
/* left"... */
if (expiration < (current_time + time_left))
{
/* Refresh the server’s authenticated identity... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sec_login_refresh_identity()"));
sec_login_refresh_identity(login_context,
status);
if (*status != error_status_ok)
{
print_server_error("sec_login_refresh_identity()", *status);
return;
}
/* Get key from local file... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sec_key_mgmt_get_key()"));
sec_key_mgmt_get_key(rpc_c_authn_dce_secret,
keytab,
prin_name,
0,
(void**)&keydata,
status);
if (*status != error_status_ok)
{
print_server_error("sec_key_mgmt_get_key()", *status);
return;
}
124246 Tandem Computers Incorporated A 31