skip book previous and next navigation links
go up to top of book: HP Open Source Security for OpenVMS Volume 3:... HP Open Source Security for OpenVMS Volume 3:...
go to beginning of chapter: KRB5 (Kerberos V5) Application Programming Interface KRB5 (Kerberos V5) Application Programming Interface
go to previous page: krb5_set_principal_realm  Set the realm in the current context krb5_set_principal_realm Set the realm in the current context
go to next page: krb5_string_to_cksumtype  Convert a string to a checksum typekrb5_string_to_cksumtype Convert a string to a checksum type
end of book navigation links

krb5_sname_to_principal -- Generate a full principal name from a service name 



C Prototype 

krb5_error_code krb5_sname_to_principal(
         krb5_context     context,
         const char       *hostname,
         const char       *sname,
         krb5_int32       type,
         krb5_principal   *ret_princ );

Arguments 

context
(input)
 The context structure.
hostname (input)  The host name, or NULL to use the local host.
sname (input) The service name.
type (input)  A principal type. The type argument controls how krb5_sname_to_principal generates the principal name, ret_princ, for the named service, sname. Valid values are:

KRB5_NT_SRV_HST -- The hostname will be canonicalized (a fully qualified lowercase hostname using the primary name and the domain name), before ret_princ is generated in the form sname/hostname@LOCAL.REALM. Most applications should use KRB5_NT_SRV_HST.

KRB5_NT_UNKNOWN -- While the generated principal name will have the form sname/hostname@LOCAL.REALM, the hostname will not be canonicalized first. It will appear exactly as it was passed in hostname.
ret_princ (output)  The returned full principal name.

Description 

This routine generates a full principal name to be used when authenticating with the named service on the host., given a hostname hostname and a generic service name sname. The full principal name is returned in ret_princ.

The realm of the principal is determined internally by calling krb5_get_host_realm.

The caller should release the storage in ret_princ by calling krb5_free_principal when it is finished with the principal.

Return Values 

This routine returns the following KRB5 status code:

0
Successful completion.
ENOMEM
Insufficient memory.


go to previous page: krb5_set_principal_realm  Set the realm in the current context krb5_set_principal_realm Set the realm in the current context
go to next page: krb5_string_to_cksumtype  Convert a string to a checksum typekrb5_string_to_cksumtype Convert a string to a checksum type