OSF DCE Application Development Guide--Introduction and Style Guide
A Sample Application
/* Create a context and get the login context... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sec_login_setup_identity()"));
sec_login_setup_identity(prin_name,
sec_login_no_flags,
login_context,
status);
if (*status != error_status_ok)
{
print_server_error("sec_login_setup_identity()", *status);
return;
}
/* Get secret key from the keytab 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;
}
/* Validate the login context... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sec_login_validate_identity()"));
sec_login_validate_identity(*login_context,
keydata,
&reset_pwd,
&auth_src,
status);
if (*status != error_status_ok)
{
print_server_error("sec_login_validate_identity()", *status);
return;
}
/* Finally, set the context... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sec_login_set_context()"));
sec_login_set_context(*login_context, status);
if (*status != error_status_ok)
{
print_server_error("sec_login_set_context()", *status);
return;
}
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug7,
"Exiting server_get_identity()"));
124246 Tandem Computers Incorporated A− 29