1*ae771770SStanislav Sedov.\" Copyright (c) 1997-2003 Kungliga Tekniska Högskolan 2bbd80c28SJacques Vidrine.\" (Royal Institute of Technology, Stockholm, Sweden). 3bbd80c28SJacques Vidrine.\" All rights reserved. 4bbd80c28SJacques Vidrine.\" 5bbd80c28SJacques Vidrine.\" Redistribution and use in source and binary forms, with or without 6bbd80c28SJacques Vidrine.\" modification, are permitted provided that the following conditions 7bbd80c28SJacques Vidrine.\" are met: 8bbd80c28SJacques Vidrine.\" 9bbd80c28SJacques Vidrine.\" 1. Redistributions of source code must retain the above copyright 10bbd80c28SJacques Vidrine.\" notice, this list of conditions and the following disclaimer. 11bbd80c28SJacques Vidrine.\" 12bbd80c28SJacques Vidrine.\" 2. Redistributions in binary form must reproduce the above copyright 13bbd80c28SJacques Vidrine.\" notice, this list of conditions and the following disclaimer in the 14bbd80c28SJacques Vidrine.\" documentation and/or other materials provided with the distribution. 15bbd80c28SJacques Vidrine.\" 16bbd80c28SJacques Vidrine.\" 3. Neither the name of the Institute nor the names of its contributors 17bbd80c28SJacques Vidrine.\" may be used to endorse or promote products derived from this software 18bbd80c28SJacques Vidrine.\" without specific prior written permission. 19bbd80c28SJacques Vidrine.\" 20bbd80c28SJacques Vidrine.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 21bbd80c28SJacques Vidrine.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22bbd80c28SJacques Vidrine.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23bbd80c28SJacques Vidrine.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 24bbd80c28SJacques Vidrine.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25bbd80c28SJacques Vidrine.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26bbd80c28SJacques Vidrine.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27bbd80c28SJacques Vidrine.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28bbd80c28SJacques Vidrine.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29bbd80c28SJacques Vidrine.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30bbd80c28SJacques Vidrine.\" SUCH DAMAGE. 31bbd80c28SJacques Vidrine.\" 32*ae771770SStanislav Sedov.\" $Id$ 33bbd80c28SJacques Vidrine.\" 34c19800e8SDoug Rabson.Dd September 3, 2003 35b528cefcSMark Murray.Dt KRB5_425_CONV_PRINCIPAL 3 36b528cefcSMark Murray.Os HEIMDAL 37b528cefcSMark Murray.Sh NAME 38b528cefcSMark Murray.Nm krb5_425_conv_principal , 39b528cefcSMark Murray.Nm krb5_425_conv_principal_ext , 40b528cefcSMark Murray.Nm krb5_524_conv_principal 4145524cd7SAssar Westerlund.Nd converts to and from version 4 principals 428373020dSJacques Vidrine.Sh LIBRARY 438373020dSJacques VidrineKerberos 5 Library (libkrb5, -lkrb5) 44b528cefcSMark Murray.Sh SYNOPSIS 45bbd80c28SJacques Vidrine.In krb5.h 46b528cefcSMark Murray.Ft krb5_error_code 47b528cefcSMark Murray.Fn krb5_425_conv_principal "krb5_context context" "const char *name" "const char *instance" "const char *realm" "krb5_principal *principal" 48b528cefcSMark Murray.Ft krb5_error_code 49b528cefcSMark Murray.Fn krb5_425_conv_principal_ext "krb5_context context" "const char *name" "const char *instance" "const char *realm" "krb5_boolean (*func)(krb5_context, krb5_principal)" "krb5_boolean resolve" "krb5_principal *principal" 50b528cefcSMark Murray.Ft krb5_error_code 51b528cefcSMark Murray.Fn krb5_524_conv_principal "krb5_context context" "const krb5_principal principal" "char *name" "char *instance" "char *realm" 52b528cefcSMark Murray.Sh DESCRIPTION 53b528cefcSMark MurrayConverting between version 4 and version 5 principals can at best be 54b528cefcSMark Murraydescribed as a mess. 55b528cefcSMark Murray.Pp 56b528cefcSMark MurrayA version 4 principal consists of a name, an instance, and a realm. A 57b528cefcSMark Murrayversion 5 principal consists of one or more components, and a 58b528cefcSMark Murrayrealm. In some cases also the first component/name will differ between 59b528cefcSMark Murrayversion 4 and version 5. Furthermore the second component of a host 60b528cefcSMark Murrayprincipal will be the fully qualified domain name of the host in 61b528cefcSMark Murrayquestion, while the instance of a version 4 principal will only 628373020dSJacques Vidrinecontain the first part (short hostname). Because of these problems 638373020dSJacques Vidrinethe conversion between principals will have to be site customized. 64b528cefcSMark Murray.Pp 65b528cefcSMark Murray.Fn krb5_425_conv_principal_ext 66b528cefcSMark Murraywill try to convert a version 4 principal, given by 67b528cefcSMark Murray.Fa name , 68b528cefcSMark Murray.Fa instance , 69b528cefcSMark Murrayand 70b528cefcSMark Murray.Fa realm , 71b528cefcSMark Murrayto a version 5 principal. This can result in several possible 72b528cefcSMark Murrayprincipals, and if 73b528cefcSMark Murray.Fa func 74b528cefcSMark Murrayis non-NULL, it will be called for each candidate principal. 75b528cefcSMark Murray.Fa func 76b528cefcSMark Murrayshould return true if the principal was 77b528cefcSMark Murray.Dq good . 78b528cefcSMark MurrayTo accomplish this, 79b528cefcSMark Murray.Fn krb5_425_conv_principal_ext 80b528cefcSMark Murraywill look up the name in 81b528cefcSMark Murray.Pa krb5.conf . 82b528cefcSMark MurrayIt first looks in the 83b528cefcSMark Murray.Li v4_name_convert/host 84b528cefcSMark Murraysubsection, which should contain a list of version 4 names whose 85b528cefcSMark Murrayinstance should be treated as a hostname. This list can be specified 86b528cefcSMark Murrayfor each realm (in the 87b528cefcSMark Murray.Li realms 88b528cefcSMark Murraysection), or in the 89b528cefcSMark Murray.Li libdefaults 90b528cefcSMark Murraysection. If the name is found the resulting name of the principal 91b528cefcSMark Murraywill be the value of this binding. The instance is then first looked 92b528cefcSMark Murrayup in 93b528cefcSMark Murray.Li v4_instance_convert 94b528cefcSMark Murrayfor the specified realm. If found the resulting value will be used as 95b528cefcSMark Murrayinstance (this can be used for special cases), no further attempts 96b528cefcSMark Murraywill be made to find a conversion if this fails (with 97b528cefcSMark Murray.Fa func ) . 98b528cefcSMark MurrayIf the 99b528cefcSMark Murray.Fa resolve 100b528cefcSMark Murrayparameter is true, the instance will be looked up with 101b528cefcSMark Murray.Fn gethostbyname . 102b528cefcSMark MurrayThis can be a time consuming, error prone, and unsafe operation. Next 103b528cefcSMark Murraya list of hostnames will be created from the instance and the 104b528cefcSMark Murray.Li v4_domains 105b528cefcSMark Murrayvariable, which should contain a list of possible domains for the 106b528cefcSMark Murrayspecific realm. 107b528cefcSMark Murray.Pp 108b528cefcSMark MurrayOn the other hand, if the name is not found in a 109b528cefcSMark Murray.Li host 110b528cefcSMark Murraysection, it is looked up in a 111b528cefcSMark Murray.Li v4_name_convert/plain 112b528cefcSMark Murraybinding. If found here the name will be converted, but the instance 113b528cefcSMark Murraywill be untouched. 114b528cefcSMark Murray.Pp 115b528cefcSMark MurrayThis list of default host-type conversions is compiled-in: 116b528cefcSMark Murray.Bd -literal -offset indent 117b528cefcSMark Murrayv4_name_convert = { 118b528cefcSMark Murray host = { 119b528cefcSMark Murray ftp = ftp 120b528cefcSMark Murray hprop = hprop 1218373020dSJacques Vidrine imap = imap 122b528cefcSMark Murray pop = pop 123b528cefcSMark Murray rcmd = host 1248373020dSJacques Vidrine smtp = smtp 125b528cefcSMark Murray } 126b528cefcSMark Murray} 127b528cefcSMark Murray.Ed 128b528cefcSMark Murray.Pp 129b528cefcSMark MurrayIt will only be used if there isn't an entry for these names in the 130b528cefcSMark Murrayconfig file, so you can override these defaults. 131b528cefcSMark Murray.Pp 132b528cefcSMark Murray.Fn krb5_425_conv_principal 133b528cefcSMark Murraywill call 134b528cefcSMark Murray.Fn krb5_425_conv_principal_ext 135b528cefcSMark Murraywith 136b528cefcSMark Murray.Dv NULL 137b528cefcSMark Murrayas 138b528cefcSMark Murray.Fa func , 139b528cefcSMark Murrayand the value of 140b528cefcSMark Murray.Li v4_instance_resolve 141b528cefcSMark Murray(from the 142b528cefcSMark Murray.Li libdefaults 143b528cefcSMark Murraysection) as 144b528cefcSMark Murray.Fa resolve . 145b528cefcSMark Murray.Pp 146b528cefcSMark Murray.Fn krb5_524_conv_principal 147b528cefcSMark Murraybasically does the opposite of 148b528cefcSMark Murray.Fn krb5_425_conv_principal , 149b528cefcSMark Murrayit just doesn't have to look up any names, but will instead truncate 150b528cefcSMark Murrayinstances found to belong to a host principal. The 151b528cefcSMark Murray.Fa name , 152b528cefcSMark Murray.Fa instance , 153b528cefcSMark Murrayand 154b528cefcSMark Murray.Fa realm 155b528cefcSMark Murrayshould be at least 40 characters long. 156b528cefcSMark Murray.Sh EXAMPLES 157b528cefcSMark MurraySince this is confusing an example is in place. 158b528cefcSMark Murray.Pp 159b528cefcSMark MurrayAssume that we have the 160b528cefcSMark Murray.Dq foo.com , 161b528cefcSMark Murrayand 162b528cefcSMark Murray.Dq bar.com 163b528cefcSMark Murraydomains that have shared a single version 4 realm, FOO.COM. The version 4 164b528cefcSMark Murray.Pa krb.realms 165b528cefcSMark Murrayfile looked like: 166b528cefcSMark Murray.Bd -literal -offset indent 167b528cefcSMark Murrayfoo.com FOO.COM 168b528cefcSMark Murray\&.foo.com FOO.COM 169b528cefcSMark Murray\&.bar.com FOO.COM 170b528cefcSMark Murray.Ed 171b528cefcSMark Murray.Pp 172b528cefcSMark MurrayA 173b528cefcSMark Murray.Pa krb5.conf 174b528cefcSMark Murrayfile that covers this case might look like: 175b528cefcSMark Murray.Bd -literal -offset indent 176b528cefcSMark Murray[libdefaults] 177b528cefcSMark Murray v4_instance_resolve = yes 178b528cefcSMark Murray[realms] 179b528cefcSMark Murray FOO.COM = { 180b528cefcSMark Murray kdc = kerberos.foo.com 181b528cefcSMark Murray v4_instance_convert = { 182b528cefcSMark Murray foo = foo.com 183b528cefcSMark Murray } 184b528cefcSMark Murray v4_domains = foo.com 185b528cefcSMark Murray } 186b528cefcSMark Murray.Ed 187b528cefcSMark Murray.Pp 188b528cefcSMark MurrayWith this setup and the following host table: 189b528cefcSMark Murray.Bd -literal -offset indent 190b528cefcSMark Murrayfoo.com 191b528cefcSMark Murraya-host.foo.com 192b528cefcSMark Murrayb-host.bar.com 193b528cefcSMark Murray.Ed 194b528cefcSMark Murraythe following conversions will be made: 195b528cefcSMark Murray.Bd -literal -offset indent 196c19800e8SDoug Rabsonrcmd.a-host -\*(Gt host/a-host.foo.com 197c19800e8SDoug Rabsonftp.b-host -\*(Gt ftp/b-host.bar.com 198c19800e8SDoug Rabsonpop.foo -\*(Gt pop/foo.com 199c19800e8SDoug Rabsonftp.other -\*(Gt ftp/other.foo.com 200c19800e8SDoug Rabsonother.a-host -\*(Gt other/a-host 201b528cefcSMark Murray.Ed 202b528cefcSMark Murray.Pp 203b528cefcSMark MurrayThe first three are what you expect. If you remove the 204b528cefcSMark Murray.Dq v4_domains , 205b528cefcSMark Murraythe fourth entry will result in an error (since the host 206b528cefcSMark Murray.Dq other 207b528cefcSMark Murraycan't be found). Even if 208b528cefcSMark Murray.Dq a-host 209b528cefcSMark Murrayis a valid host name, the last entry will not be converted, since the 210b528cefcSMark Murray.Dq other 211b528cefcSMark Murrayname is not known to represent a host-type principal. 212b528cefcSMark MurrayIf you turn off 213b528cefcSMark Murray.Dq v4_instance_resolve 214b528cefcSMark Murraythe second example will result in 215b528cefcSMark Murray.Dq ftp/b-host.foo.com 216b528cefcSMark Murray(because of the default domain). And all of this is of course only 217b528cefcSMark Murrayvalid if you have working name resolving. 218b528cefcSMark Murray.Sh SEE ALSO 219b528cefcSMark Murray.Xr krb5_build_principal 3 , 220b528cefcSMark Murray.Xr krb5_free_principal 3 , 221b528cefcSMark Murray.Xr krb5_parse_name 3 , 222b528cefcSMark Murray.Xr krb5_sname_to_principal 3 , 223b528cefcSMark Murray.Xr krb5_unparse_name 3 , 224b528cefcSMark Murray.Xr krb5.conf 5 225