From a4b588a6a210c336804f979c218df27bb041f0a5 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Sat, 16 Jun 2001 23:00:55 +0000 Subject: [PATCH] manpage git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10059 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/krb5_get_krbhst.3 | 58 ++++++++++++++++++++ lib/krb5/krb5_krbhst_init.3 | 103 ++++++++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 lib/krb5/krb5_get_krbhst.3 create mode 100644 lib/krb5/krb5_krbhst_init.3 diff --git a/lib/krb5/krb5_get_krbhst.3 b/lib/krb5/krb5_get_krbhst.3 new file mode 100644 index 000000000..f7c2df3ee --- /dev/null +++ b/lib/krb5/krb5_get_krbhst.3 @@ -0,0 +1,58 @@ +.\" Copyright (c) 2001 Kungliga Tekniska Högskolan +.\" $Id$ +.Dd June 17, 2001 +.Dt KRB5_GET_KRBHST 3 +.Os HEIMDAL +.Sh NAME +.Nm krb5_get_krbhst +.Nm krb5_get_krb_admin_hst +.Nm krb5_get_krb_changepw_hst +.Nm krb5_get_krb524hst +.Nm krb5_free_krbhst +.Nd lookup Kerberos KDC hosts +.Sh SYNOPSIS +.Fd #include + +.Ft krb5_error_code +.Fn krb5_get_krbhst "krb5_context context" "const krb5_realm *realm" "char ***hostlist" +.Ft krb5_error_code +.Fn krb5_get_krb_admin_hst "krb5_context context" "const krb5_realm *realm" "char ***hostlist" +.Ft krb5_error_code +.Fn krb5_get_krb_changepw_hst "krb5_context context" "const krb5_realm *realm" "char ***hostlist" +.Ft krb5_error_code +.Fn krb5_get_krb524hst "krb5_context context" "const krb5_realm *realm" "char ***hostlist" +.Ft krb5_error_code +.Fn krb5_free_krbhst "krb5_context context" "char **hostlist" + +.Sh DESCRIPTION + +These functions implement the old API to get a list of Kerberos hosts, +and are thus similar to the +.Fn krb5_krbhst_init +functions. However, since these functions returns +.Em all +hosts in one go, they potentially have to do more lookups than +necessary. These functions remain for compatibility reasons. +.Pp +After a call to one of these functions, +.Fa hostlist +is a +.Dv NULL +terminated list of strings, pointing to the requested Kerberos hosts. These should be freed with +.Fn krb5_free_krbhst +when done with. + + +.Sh EXAMPLE +The following code will print the KDCs of the realm +.Dq MY.REALM . +.Bd -literal -offset indent +char **hosts, **p; +krb5_get_krbhst(context, "MY.REALM", &hosts); +for(p = hosts; *p; p++) + printf("%s\\n", *p); +krb5_free_krbhst(context, hosts); +.Ed +.\" .Sh BUGS +.Sh SEE ALSO +.Xr krb5_krbhst_init 3 diff --git a/lib/krb5/krb5_krbhst_init.3 b/lib/krb5/krb5_krbhst_init.3 new file mode 100644 index 000000000..f9b32b6ec --- /dev/null +++ b/lib/krb5/krb5_krbhst_init.3 @@ -0,0 +1,103 @@ +.\" Copyright (c) 2001 Kungliga Tekniska Högskolan +.\" $Id$ +.Dd June 17, 2001 +.Dt KRB5_KRBHST_INIT 3 +.Os HEIMDAL +.Sh NAME +.Nm krb5_krbhst_init , +.Nm krb5_krbhst_next , +.Nm krb5_krbhst_next_as_string , +.Nm krb5_krbhst_reset , +.Nm krb5_krbhst_free +.Nd lookup Kerberos KDC hosts +.Sh SYNOPSIS +.Fd #include + +.Ft krb5_error_code +.Fn krb5_krbhst_init "krb5_context context" "const char *realm" "unsigned int type" "krb5_krbhst_handle *handle" +.Ft krb5_error_code +.Fn "krb5_krbhst_next" "krb5_context context" "krb5_krbhst_handle handle" "krb5_krbhst_info **host" +.Ft krb5_error_code +.Fn krb5_krbhst_next_as_string "krb5_context context" "krb5_krbhst_handle handle" "char *hostname" "size_t hostlen" +.Ft void +.Fn krb5_krbhst_reset "krb5_context context" "krb5_krbhst_handle handle" +.Ft void +.Fn krb5_krbhst_free "krb5_context context" "krb5_krbhst_handle handle" +.Sh DESCRIPTION + +These functions are used to sequence through all Kerberos hosts of a +particular realm and service. The service type can be the KDCs, the +administrative servers, the password changing servers, or the servers +for Kerberos 4 ticket conversion. +.Pp +First a handle to a particular service is obtained by calling +.Fn krb5_krbhst_init +with the +.Fa realm +of interest and the type of service to lookup. The +.Fa type +can be one of: +.Pp +.Bl -hang -compact -offset indent +.It KRB5_KRBHST_KDC +.It KRB5_KRBHST_ADMIN +.It KRB5_KRBHST_CHANGEPW +.It KRB5_KRBHST_KRB524 +.El +.Pp +The +.Fa handle +is returned to the caller, and should be passed to the other +functions. +.Pp +For each call to +.Fn krb5_krbhst_next +information a new host is returned. The former function returns in +.Fa host +a pointer to a structure containing information about the host, such +as protocol, hostname, and port: +.Bd -literal -offset indent +typedef struct krb5_krbhst_info { + enum { KRB5_KRBHST_UDP, + KRB5_KRBHST_TCP, + KRB5_KRBHST_HTTP } proto; + unsigned short port; + struct addrinfo *ai; + struct krb5_krbhst_info *next; + char hostname[1]; +} krb5_krbhst_info; +.Ed +.Pp +The related function, +.Fn krb5_krbhst_next_as_string , +return the same information as a url-like string. +.Pp +When there are no more hosts, these functions return +.Dv KRB5_KDC_UNREACH . +.Pp +To re-iterate over all hosts, call +.Fn krb5_krbhst_reset +and the next call to +.Fn krb5_krbhst_next +will return the first host. +.Pp +When done with the handle, +.Fn krb5_krbhst_free +should be called. +.Sh EXAMPLE +The following code will print the KDCs of the realm +.Dq MY.REALM . +.Bd -literal -offset indent +krb5_krbhst_handle handle; +char host[MAXHOSTNAMELEN]; +krb5_krbhst_init(context, "MY.REALM", KRB5_KRBHST_KDC, &handle); +while(krb5_krbhst_next_as_string(context, handle, + host, sizeof(host)) == 0) + printf("%s\\n", host); +krb5_krbhst_free(context, handle); +.Ed +.\" .Sh BUGS +.Sh HISTORY +These functions first appeared in Heimdal 0.3g. +.Sh SEE ALSO +.Xr krb5_get_krbhst 3