From cb584f63489ee1763441981729a595e8800c28e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 26 May 2003 21:56:28 +0000 Subject: [PATCH] pacify mdoclink git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12331 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/changepw.c | 16 ++++- lib/krb5/get_host_realm.c | 2 + lib/krb5/krb5.3 | 4 +- lib/krb5/krb5.conf.5 | 2 + lib/krb5/krb5_address.3 | 3 +- lib/krb5/krb5_c_make_checksum.3 | 2 +- lib/krb5/krb5_config.3 | 6 +- lib/krb5/krb5_principal.3 | 2 +- lib/krb5/krb5_set_default_realm.3 | 2 +- lib/krb5/net_write.c | 58 ++++++++++++++++ lib/krb5/roken_rename.h | 112 ++++++++++++++++++++++++++++++ lib/krb5/send_to_kdc.c | 6 ++ lib/krb5/verify_krb5_conf.8 | 33 ++++++++- 13 files changed, 236 insertions(+), 12 deletions(-) create mode 100644 lib/krb5/roken_rename.h diff --git a/lib/krb5/changepw.c b/lib/krb5/changepw.c index bae29ea48..540d36193 100644 --- a/lib/krb5/changepw.c +++ b/lib/krb5/changepw.c @@ -150,7 +150,7 @@ out2: */ static krb5_error_code -setpw_send_request (krb5_context context, +mssetpw_send_request (krb5_context context, krb5_auth_context *auth_context, krb5_creds *creds, krb5_principal targprinc, @@ -394,6 +394,17 @@ process_reply (krb5_context context, } } +static krb5_error_code +setpw_send_request (krb5_context context, + krb5_auth_context *auth_context, + krb5_creds *creds, + krb5_principal targprinc, + int sock, + char *passwd, + const char *host) +{ + +} /* * change the password using the credentials in `creds' (for the @@ -421,7 +432,8 @@ struct kpwd_proc { kpwd_send_request send_req; kpwd_process_reply process_rep; } procs[] = { - { "MS set password", setpw_send_request, process_reply }, + { "set password", setpw_send_request, process_reply }, + { "MS set password", mssetpw_send_request, process_reply }, { "change password", chgpw_send_request, process_reply }, { NULL } }; diff --git a/lib/krb5/get_host_realm.c b/lib/krb5/get_host_realm.c index 09c7ba249..61b3235ce 100644 --- a/lib/krb5/get_host_realm.c +++ b/lib/krb5/get_host_realm.c @@ -161,6 +161,8 @@ krb5_get_host_realm_int (krb5_context context, dns_locate_enable = krb5_config_get_bool_default(context, NULL, TRUE, "libdefaults", "dns_lookup_realm", NULL); for (p = host; p != NULL; p = strchr (p + 1, '.')) { + if (strchr(p + 1, '.') == NULL) /* dont use if only one label left */ + break; if(config_find_realm(context, p, realms) == 0) { if(strcasecmp(*realms[0], "dns_locate") == 0) { if(use_dns) diff --git a/lib/krb5/krb5.3 b/lib/krb5/krb5.3 index 823ad2a82..d20af4a62 100644 --- a/lib/krb5/krb5.3 +++ b/lib/krb5/krb5.3 @@ -39,11 +39,11 @@ .Nd kerberos 5 library .Sh LIBRARY Kerberos 5 Library (libkrb5, -lkrb5) +.Sh SYNOPSIS +.In krb5.h .Sh DESCRIPTION These functions constitute the Kerberos 5 library, .Em libkrb5 . -Declarations for these functions may be obtained from the include file -.Pa krb5.h . .Sh LIST OF FUNCTIONS .sp 2 .nf diff --git a/lib/krb5/krb5.conf.5 b/lib/krb5/krb5.conf.5 index 1cb1d0a00..1e768b8d5 100644 --- a/lib/krb5/krb5.conf.5 +++ b/lib/krb5/krb5.conf.5 @@ -37,6 +37,8 @@ .Sh NAME .Nm /etc/krb5.conf .Nd configuration file for Kerberos 5 +.Sh SYNOPSIS +.In krb5.h .Sh DESCRIPTION The .Nm diff --git a/lib/krb5/krb5_address.3 b/lib/krb5/krb5_address.3 index 37c0f3395..dc97f45bd 100644 --- a/lib/krb5/krb5_address.3 +++ b/lib/krb5/krb5_address.3 @@ -297,7 +297,8 @@ and .Fa addr2 so that it can be used for sorting addresses. If the addresses are the same address -.Fa krb5_address_order will be return 0. +.Fa krb5_address_order +will be return 0. .Pp .Fn krb5_address_compare compares the addresses diff --git a/lib/krb5/krb5_c_make_checksum.3 b/lib/krb5/krb5_c_make_checksum.3 index 174a2a6d4..153189b4c 100644 --- a/lib/krb5/krb5_c_make_checksum.3 +++ b/lib/krb5/krb5_c_make_checksum.3 @@ -73,7 +73,7 @@ Kerberos 5 Library (libkrb5, -lkrb5) .Fa "krb5_checksum *cksum" .Fc .Ft void -.Fo krb5_free_checksum_contents. +.Fo krb5_free_checksum_contents . .Fa "krb5_context context" .Fa "krb5_checksum *cksum" .Fc diff --git a/lib/krb5/krb5_config.3 b/lib/krb5/krb5_config.3 index 2bc9a4316..006cdb300 100644 --- a/lib/krb5/krb5_config.3 +++ b/lib/krb5/krb5_config.3 @@ -57,9 +57,9 @@ seconds, so the string .Sq 2 weeks will be converted to 1209600 (2 * 7 * 24 * 60 * 60). -.Sh BUGS -Other than for the string case, there's no way to tell whether there -was a value specified or not. .Sh SEE ALSO .Xr krb5_appdefault 3 , .Xr krb5.conf 5 +.Sh BUGS +Other than for the string case, there's no way to tell whether there +was a value specified or not. diff --git a/lib/krb5/krb5_principal.3 b/lib/krb5/krb5_principal.3 index 92103af89..072a8d605 100644 --- a/lib/krb5/krb5_principal.3 +++ b/lib/krb5/krb5_principal.3 @@ -86,7 +86,7 @@ Kerberos 5 Library (libkrb5, -lkrb5) .Ft krb5_error_code .Fn krb5_build_principal_va "krb5_context context" "krb5_principal *principal" "int rlen" "krb5_const_realm realm" "va_list ap" .Ft krb5_error_code -.Fn "krb5_build_principal_ext" "krb5_context context", "krb5_principal *principal" "int rlen" "krb5_const_realm realm" "..." +.Fn "krb5_build_principal_ext" "krb5_context context" "krb5_principal *principal" "int rlen" "krb5_const_realm realm" "..." .Ft krb5_error_code .Fn krb5_build_principal_va_ext "krb5_context context" "krb5_principal *principal" "int rlen" "krb5_const_realm realm" "va_list ap" .Ft krb5_error_code diff --git a/lib/krb5/krb5_set_default_realm.3 b/lib/krb5/krb5_set_default_realm.3 index 92fa532d4..fe28d8616 100644 --- a/lib/krb5/krb5_set_default_realm.3 +++ b/lib/krb5/krb5_set_default_realm.3 @@ -31,7 +31,7 @@ .\" .\" $Id$ .\" -.Dd Mars 16, 2003 +.Dd March 16, 2003 .Dt KRB5_SET_DEFAULT_REALM 3 .Os HEIMDAL .Sh NAME diff --git a/lib/krb5/net_write.c b/lib/krb5/net_write.c index 70d65304c..0d35155c5 100644 --- a/lib/krb5/net_write.c +++ b/lib/krb5/net_write.c @@ -45,3 +45,61 @@ krb5_net_write (krb5_context context, return net_write (fd, buf, len); } + +krb5_ssize_t +krb5_net_write_block(krb5_context context, + void *p_fd, + const void *buf, + size_t len, + time_t timeout) +{ + int fd = *((int *)p_fd); + int ret; + struct timeval tv, *tvp; + const char *cbuf = (const char *)buf; + size_t rem = len; + ssize_t count; + fd_set wfds; + + do { + FD_ZERO(&wfds); + FD_SET(fd, &wfds); + + if (timeout != 0) { + tv.tv_sec = timeout; + tv.tv_usec = 0; + tvp = &tv; + } else + tvp = NULL; + + ret = select(fd + 1, NULL, &wfds, NULL, tvp); + if (ret < 0) { + if (errno == EINTR) + continue; + return -1; + } else if (ret == 0) + return 0; + + if (!FD_ISSET(fd, &wfds)) { + errno = ETIMEDOUT; + return -1; + } + +#ifdef WIN32 + count = send (fd, cbuf, rem, 0); +#else + count = write (fd, cbuf, rem); +#endif + if (count < 0) { + if (errno == EINTR) + continue; + else + return count; + } + cbuf += count; + rem -= count; + + } while (rem > 0); + + return len; +} diff --git a/lib/krb5/roken_rename.h b/lib/krb5/roken_rename.h new file mode 100644 index 000000000..f7a72d2ce --- /dev/null +++ b/lib/krb5/roken_rename.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 1998 - 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $KTH-KRB: roken_rename.h,v 1.13 2002/08/21 13:32:06 joda Exp $ + $NetBSD$ */ + +#ifndef __roken_rename_h__ +#define __roken_rename_h__ + +/* + * Libroken routines that are added libkrb + */ + +#define base64_decode _krb_base64_decode +#define base64_encode _krb_base64_encode + +#define net_write _krb_net_write +#define net_read _krb_net_read +#define _resolve_debug _krb_resolve_debug + +#ifndef HAVE_FLOCK +#define flock _krb_flock +#endif +#ifndef HAVE_GETHOSTNAME +#define gethostname _krb_gethostname +#endif +#ifndef HAVE_GETTIMEOFDAY +#define gettimeofday _krb_gettimeofday +#endif +#ifndef HAVE_GETUID +#define getuid _krb_getuid +#endif +#ifndef HAVE_SNPRINTF +#define snprintf _krb_snprintf +#endif +#ifndef HAVE_ASPRINTF +#define asprintf _krb_asprintf +#endif +#ifndef HAVE_ASNPRINTF +#define asnprintf _krb_asnprintf +#endif +#ifndef HAVE_VASPRINTF +#define vasprintf _krb_vasprintf +#endif +#ifndef HAVE_VASNPRINTF +#define vasnprintf _krb_vasnprintf +#endif +#ifndef HAVE_VSNPRINTF +#define vsnprintf _krb_vsnprintf +#endif +#ifndef HAVE_STRCASECMP +#define strcasecmp _krb_strcasecmp +#endif +#ifndef HAVE_STRNCASECMP +#define strncasecmp _krb_strncasecmp +#endif +#ifndef HAVE_STRDUP +#define strdup _krb_strdup +#endif +#ifndef HAVE_STRLCAT +#define strlcat _krb_strlcat +#endif +#ifndef HAVE_STRLCPY +#define strlcpy _krb_strlcpy +#endif +#ifndef HAVE_STRNLEN +#define strnlen _krb_strnlen +#endif +#ifndef HAVE_SWAB +#define swab _krb_swab +#endif +#ifndef HAVE_STRTOK_R +#define strtok_r _krb_strtok_r +#endif + +#define rk_dns_free_data _krb_dns_free_data +#define rk_dns_lookup _krb_dns_lookup +#define rk_dns_string_to_type _krb_dns_string_to_type +#define rk_dns_type_to_string _krb_dns_type_to_string +#define rk_dns_srv_order _krb_dns_srv_order + +#endif /* __roken_rename_h__ */ diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index eae29fc58..d12700901 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -333,9 +333,15 @@ krb5_sendto (krb5_context context, continue; for (a = ai; a != NULL; a = a->ai_next) { + int flag; + fd = socket (a->ai_family, a->ai_socktype, a->ai_protocol); if (fd < 0) continue; + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { + close(fd); + continue; + } if (connect (fd, a->ai_addr, a->ai_addrlen) < 0) { close (fd); continue; diff --git a/lib/krb5/verify_krb5_conf.8 b/lib/krb5/verify_krb5_conf.8 index c72ffd574..ff7a7d6e8 100644 --- a/lib/krb5/verify_krb5_conf.8 +++ b/lib/krb5/verify_krb5_conf.8 @@ -1,6 +1,37 @@ +.\" Copyright (c) 2000-2003 Kungliga Tekniska Högskolan +.\" (Royal Institute of Technology, Stockholm, Sweden). +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" 3. Neither the name of the Institute nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" .\" $Id$ .\" -.Dd August 30, 2001 +.Dd May 26, 2003 .Dt VERIFY_KRB5_CONF 8 .Os HEIMDAL .Sh NAME