1
.TH "Heimdal Kerberos 5 principal functions" 3 "30 Jul 2011" "Version 1.5" "HeimdalKerberos5library" \" -*- nroff -*-
5
Heimdal Kerberos 5 principal functions \-
10
.RI "KRB5_LIB_FUNCTION void KRB5_LIB_CALL \fBkrb5_free_principal\fP (krb5_context context, krb5_principal p)"
13
.RI "KRB5_LIB_FUNCTION void KRB5_LIB_CALL \fBkrb5_principal_set_type\fP (krb5_context context, krb5_principal principal, int type)"
16
.RI "KRB5_LIB_FUNCTION int KRB5_LIB_CALL \fBkrb5_principal_get_type\fP (krb5_context context, krb5_const_principal principal)"
19
.RI "KRB5_LIB_FUNCTION const char *KRB5_LIB_CALL \fBkrb5_principal_get_realm\fP (krb5_context context, krb5_const_principal principal)"
22
.RI "KRB5_LIB_FUNCTION unsigned int KRB5_LIB_CALL \fBkrb5_principal_get_num_comp\fP (krb5_context context, krb5_const_principal principal)"
25
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_parse_name_flags\fP (krb5_context context, const char *name, int flags, krb5_principal *principal)"
28
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_parse_name\fP (krb5_context context, const char *name, krb5_principal *principal)"
31
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_unparse_name_fixed\fP (krb5_context context, krb5_const_principal principal, char *name, size_t len)"
34
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_unparse_name_fixed_short\fP (krb5_context context, krb5_const_principal principal, char *name, size_t len)"
37
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_unparse_name_fixed_flags\fP (krb5_context context, krb5_const_principal principal, int flags, char *name, size_t len)"
40
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_unparse_name\fP (krb5_context context, krb5_const_principal principal, char **name)"
43
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_unparse_name_flags\fP (krb5_context context, krb5_const_principal principal, int flags, char **name)"
46
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_unparse_name_short\fP (krb5_context context, krb5_const_principal principal, char **name)"
49
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_principal_set_realm\fP (krb5_context context, krb5_principal principal, krb5_const_realm realm)"
52
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_build_principal\fP (krb5_context context, krb5_principal *principal, int rlen, krb5_const_realm realm,...)"
55
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_make_principal\fP (krb5_context context, krb5_principal *principal, krb5_const_realm realm,...)"
58
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_copy_principal\fP (krb5_context context, krb5_const_principal inprinc, krb5_principal *outprinc)"
61
.RI "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL \fBkrb5_principal_compare_any_realm\fP (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)"
64
.RI "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL \fBkrb5_principal_compare\fP (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)"
67
.RI "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL \fBkrb5_realm_compare\fP (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)"
70
.RI "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL \fBkrb5_principal_match\fP (krb5_context context, krb5_const_principal princ, krb5_const_principal pattern)"
73
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_sname_to_principal\fP (krb5_context context, const char *hostname, const char *sname, int32_t type, krb5_principal *ret_princ)"
76
.RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_parse_nametype\fP (krb5_context context, const char *str, int32_t *nametype)"
79
.RI "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL \fBkrb5_principal_is_krbtgt\fP (krb5_context context, krb5_const_principal p)"
82
.SH "Detailed Description"
85
.SH "Function Documentation"
87
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_build_principal (krb5_context context, krb5_principal * principal, int rlen, krb5_const_realm realm, ...)"
89
Build a principal using vararg style building
93
\fIcontext\fP A Kerberos context.
95
\fIprincipal\fP returned principal
97
\fIrlen\fP length of realm
99
\fIrealm\fP realm name
101
\fI...\fP a list of components ended with NULL.
106
An krb5 error code, see krb5_get_error_message().
110
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_principal (krb5_context context, krb5_const_principal inprinc, krb5_principal * outprinc)"
116
\fIcontext\fP A Kerberos context.
118
\fIinprinc\fP principal to copy
120
\fIoutprinc\fP copied principal, free with \fBkrb5_free_principal()\fP
125
An krb5 error code, see krb5_get_error_message().
129
.SS "KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_principal (krb5_context context, krb5_principal p)"
131
Frees a Kerberos principal allocated by the library with \fBkrb5_parse_name()\fP, \fBkrb5_make_principal()\fP or any other related principal functions.
135
\fIcontext\fP A Kerberos context.
137
\fIp\fP a principal to free.
142
An krb5 error code, see krb5_get_error_message().
146
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_make_principal (krb5_context context, krb5_principal * principal, krb5_const_realm realm, ...)"
148
Build a principal using vararg style building
152
\fIcontext\fP A Kerberos context.
154
\fIprincipal\fP returned principal
156
\fIrealm\fP realm name
158
\fI...\fP a list of components ended with NULL.
163
An krb5 error code, see krb5_get_error_message().
167
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_name (krb5_context context, const char * name, krb5_principal * principal)"
169
Parse a name into a krb5_principal structure
173
\fIcontext\fP Kerberos 5 context
175
\fIname\fP name to parse into a Kerberos principal
177
\fIprincipal\fP returned principal, free with \fBkrb5_free_principal()\fP.
182
An krb5 error code, see krb5_get_error_message().
186
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_name_flags (krb5_context context, const char * name, int flags, krb5_principal * principal)"
188
Parse a name into a krb5_principal structure, flags controls the behavior.
192
\fIcontext\fP Kerberos 5 context
194
\fIname\fP name to parse into a Kerberos principal
196
\fIflags\fP flags to control the behavior
198
\fIprincipal\fP returned principal, free with \fBkrb5_free_principal()\fP.
203
An krb5 error code, see krb5_get_error_message().
207
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_nametype (krb5_context context, const char * str, int32_t * nametype)"
209
Parse nametype string and return a nametype integer
210
.SS "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_compare (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)"
212
Compares the two principals, including realm of the principals and returns TRUE if they are the same and FALSE if not.
216
\fIcontext\fP Kerberos 5 context
218
\fIprinc1\fP first principal to compare
220
\fIprinc2\fP second principal to compare
225
\fBkrb5_principal_compare_any_realm()\fP
227
\fBkrb5_realm_compare()\fP
231
.SS "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_compare_any_realm (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)"
233
Return TRUE iff princ1 == princ2 (without considering the realm)
237
\fIcontext\fP Kerberos 5 context
239
\fIprinc1\fP first principal to compare
241
\fIprinc2\fP second principal to compare
246
non zero if equal, 0 if not
251
\fBkrb5_principal_compare()\fP
253
\fBkrb5_realm_compare()\fP
257
.SS "KRB5_LIB_FUNCTION unsigned int KRB5_LIB_CALL krb5_principal_get_num_comp (krb5_context context, krb5_const_principal principal)"
259
Get number of component is principal.
263
\fIcontext\fP Kerberos 5 context
265
\fIprincipal\fP principal to query
270
number of components in string
274
.SS "KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_principal_get_realm (krb5_context context, krb5_const_principal principal)"
276
Get the realm of the principal
280
\fIcontext\fP A Kerberos context.
282
\fIprincipal\fP principal to get the realm for
287
realm of the principal, don't free or use after krb5_principal is freed
291
.SS "KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_principal_get_type (krb5_context context, krb5_const_principal principal)"
293
Get the type of the principal
297
\fIcontext\fP A Kerberos context.
299
\fIprincipal\fP principal to get the type for
304
the type of principal
308
.SS "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_is_krbtgt (krb5_context context, krb5_const_principal p)"
310
Check if the cname part of the principal is a krbtgt principal
311
.SS "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_match (krb5_context context, krb5_const_principal princ, krb5_const_principal pattern)"
313
return TRUE iff princ matches pattern
314
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_principal_set_realm (krb5_context context, krb5_principal principal, krb5_const_realm realm)"
316
Set a new realm for a principal, and as a side-effect free the previous realm.
320
\fIcontext\fP A Kerberos context.
322
\fIprincipal\fP principal set the realm for
324
\fIrealm\fP the new realm to set
329
An krb5 error code, see krb5_get_error_message().
333
.SS "KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_principal_set_type (krb5_context context, krb5_principal principal, int type)"
335
Set the type of the principal
339
\fIcontext\fP A Kerberos context.
341
\fIprincipal\fP principal to set the type for
343
\fItype\fP the new type
348
An krb5 error code, see krb5_get_error_message().
352
.SS "KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_realm_compare (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)"
354
return TRUE iff realm(princ1) == realm(princ2)
358
\fIcontext\fP Kerberos 5 context
360
\fIprinc1\fP first principal to compare
362
\fIprinc2\fP second principal to compare
367
\fBkrb5_principal_compare_any_realm()\fP
369
\fBkrb5_principal_compare()\fP
373
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sname_to_principal (krb5_context context, const char * hostname, const char * sname, int32_t type, krb5_principal * ret_princ)"
375
Create a principal for the service running on hostname. If KRB5_NT_SRV_HST is used, the hostname is canonization using DNS (or some other service), this is potentially insecure.
379
\fIcontext\fP A Kerberos context.
381
\fIhostname\fP hostname to use
383
\fIsname\fP Service name to use
385
\fItype\fP name type of pricipal, use KRB5_NT_SRV_HST or KRB5_NT_UNKNOWN.
387
\fIret_princ\fP return principal, free with \fBkrb5_free_principal()\fP.
392
An krb5 error code, see krb5_get_error_message().
396
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name (krb5_context context, krb5_const_principal principal, char ** name)"
398
Unparse the Kerberos name into a string
402
\fIcontext\fP Kerberos 5 context
404
\fIprincipal\fP principal to query
406
\fIname\fP resulting string, free with krb5_xfree()
411
An krb5 error code, see krb5_get_error_message().
415
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed (krb5_context context, krb5_const_principal principal, char * name, size_t len)"
417
Unparse the principal name to a fixed buffer
421
\fIcontext\fP A Kerberos context.
423
\fIprincipal\fP principal to unparse
425
\fIname\fP buffer to write name to
427
\fIlen\fP length of buffer
432
An krb5 error code, see krb5_get_error_message().
436
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed_flags (krb5_context context, krb5_const_principal principal, int flags, char * name, size_t len)"
438
Unparse the principal name with unparse flags to a fixed buffer.
442
\fIcontext\fP A Kerberos context.
444
\fIprincipal\fP principal to unparse
446
\fIflags\fP unparse flags
448
\fIname\fP buffer to write name to
450
\fIlen\fP length of buffer
455
An krb5 error code, see krb5_get_error_message().
459
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed_short (krb5_context context, krb5_const_principal principal, char * name, size_t len)"
461
Unparse the principal name to a fixed buffer. The realm is skipped if its a default realm.
465
\fIcontext\fP A Kerberos context.
467
\fIprincipal\fP principal to unparse
469
\fIname\fP buffer to write name to
471
\fIlen\fP length of buffer
476
An krb5 error code, see krb5_get_error_message().
480
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_flags (krb5_context context, krb5_const_principal principal, int flags, char ** name)"
482
Unparse the Kerberos name into a string
486
\fIcontext\fP Kerberos 5 context
488
\fIprincipal\fP principal to query
490
\fIflags\fP flag to determine the behavior
492
\fIname\fP resulting string, free with krb5_xfree()
497
An krb5 error code, see krb5_get_error_message().
501
.SS "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_short (krb5_context context, krb5_const_principal principal, char ** name)"
503
Unparse the principal name to a allocated buffer. The realm is skipped if its a default realm.
507
\fIcontext\fP A Kerberos context.
509
\fIprincipal\fP principal to unparse
511
\fIname\fP returned buffer, free with krb5_xfree()
516
An krb5 error code, see krb5_get_error_message().