diff options
author | nectar <nectar@FreeBSD.org> | 2003-10-09 19:36:20 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2003-10-09 19:36:20 +0000 |
commit | 5c90662d441c12cd30c694eb1172d6fea2f8f282 (patch) | |
tree | cb08d962a1d1ff9fd191e67849a7057861f42a50 /crypto/heimdal/lib/kadm5 | |
parent | 12eb3dee85137da9effa7d2df35e855dd0a3814a (diff) | |
download | FreeBSD-src-5c90662d441c12cd30c694eb1172d6fea2f8f282.zip FreeBSD-src-5c90662d441c12cd30c694eb1172d6fea2f8f282.tar.gz |
Vendor import of Heimdal 0.6.
Diffstat (limited to 'crypto/heimdal/lib/kadm5')
-rw-r--r-- | crypto/heimdal/lib/kadm5/ChangeLog | 29 | ||||
-rw-r--r-- | crypto/heimdal/lib/kadm5/Makefile.am | 6 | ||||
-rw-r--r-- | crypto/heimdal/lib/kadm5/Makefile.in | 25 | ||||
-rw-r--r-- | crypto/heimdal/lib/kadm5/dump_log.c | 16 | ||||
-rw-r--r-- | crypto/heimdal/lib/kadm5/init_c.c | 20 | ||||
-rw-r--r-- | crypto/heimdal/lib/kadm5/ipropd_master.c | 30 | ||||
-rw-r--r-- | crypto/heimdal/lib/kadm5/ipropd_slave.c | 2 | ||||
-rw-r--r-- | crypto/heimdal/lib/kadm5/log.c | 18 | ||||
-rw-r--r-- | crypto/heimdal/lib/kadm5/send_recv.c | 6 |
9 files changed, 114 insertions, 38 deletions
diff --git a/crypto/heimdal/lib/kadm5/ChangeLog b/crypto/heimdal/lib/kadm5/ChangeLog index d6fbe0d..1879c19 100644 --- a/crypto/heimdal/lib/kadm5/ChangeLog +++ b/crypto/heimdal/lib/kadm5/ChangeLog @@ -1,6 +1,33 @@ +2003-04-16 Love Hörnquist Åstrand <lha@it.su.se> + + * send_recv.c: check return values from krb5_data_alloc + * log.c: check return values from krb5_data_alloc + +2003-04-16 Love Hörnquist Åstrand <lha@it.su.se> + + * dump_log.c (print_entry): check return values from + krb5_data_alloc + +2003-04-01 Love Hörnquist Åstrand <lha@it.su.se> + + * init_c.c (kadm_connect): if a context realm was passed in, use + that to form the kadmin/admin principal + +2003-03-19 Love Hörnquist Åstrand <lha@it.su.se> + + * ipropd_master.c (main): make sure we don't consider dead slave + for select processing + (write_stats): use slave_stats_file variable, + check return value of strftime + (args): allow specifying slave stats file + (slave_dead): close the fd when the slave dies + 2002-10-21 Johan Danielsson <joda@pdc.kth.se> - * ipropd_slave.c: pull up 1.27; use a temporary database + * ipropd_slave.c (from Derrick Brashear): Propagating a large + database without this means the slave kdcs can get erroneous + HDB_NOENTRY and return the resulting errors. This creates a new db + handle, populates it, and moves it into place. 2002-08-26 Assar Westerlund <assar@kth.se> diff --git a/crypto/heimdal/lib/kadm5/Makefile.am b/crypto/heimdal/lib/kadm5/Makefile.am index 05621dd..9b0c49d 100644 --- a/crypto/heimdal/lib/kadm5/Makefile.am +++ b/crypto/heimdal/lib/kadm5/Makefile.am @@ -1,10 +1,10 @@ -# $Id: Makefile.am,v 1.51 2002/08/16 20:57:09 joda Exp $ +# $Id: Makefile.am,v 1.51.6.1 2003/05/12 15:20:46 joda Exp $ include $(top_srcdir)/Makefile.am.common lib_LTLIBRARIES = libkadm5srv.la libkadm5clnt.la -libkadm5srv_la_LDFLAGS = -version-info 7:5:0 -libkadm5clnt_la_LDFLAGS = -version-info 6:3:2 +libkadm5srv_la_LDFLAGS = -version-info 7:6:0 +libkadm5clnt_la_LDFLAGS = -version-info 6:4:2 sbin_PROGRAMS = dump_log replay_log truncate_log libkadm5srv_la_LIBADD = ../krb5/libkrb5.la ../hdb/libhdb.la ../roken/libroken.la diff --git a/crypto/heimdal/lib/kadm5/Makefile.in b/crypto/heimdal/lib/kadm5/Makefile.in index 7fc233f..22b3a55 100644 --- a/crypto/heimdal/lib/kadm5/Makefile.in +++ b/crypto/heimdal/lib/kadm5/Makefile.in @@ -14,11 +14,11 @@ @SET_MAKE@ -# $Id: Makefile.am,v 1.51 2002/08/16 20:57:09 joda Exp $ +# $Id: Makefile.am,v 1.51.6.1 2003/05/12 15:20:46 joda Exp $ # $Id: Makefile.am.common,v 1.5 2002/05/19 18:35:37 joda Exp $ -# $Id: Makefile.am.common,v 1.36 2002/08/19 16:10:25 joda Exp $ +# $Id: Makefile.am.common,v 1.37.2.1 2003/05/08 17:08:09 joda Exp $ SHELL = @SHELL@ srcdir = @srcdir@ @@ -114,6 +114,7 @@ LIB_roken = @LIB_roken@ LIB_security = @LIB_security@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ NEED_WRITEAUTH_FALSE = @NEED_WRITEAUTH_FALSE@ NEED_WRITEAUTH_TRUE = @NEED_WRITEAUTH_TRUE@ NROFF = @NROFF@ @@ -192,7 +193,7 @@ LIB_readline = @LIB_readline@ NROFF_MAN = groff -mandoc -Tascii -@KRB4_TRUE@LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS) +LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS) @KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \ @KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la @@ -202,8 +203,8 @@ NROFF_MAN = groff -mandoc -Tascii @DCE_TRUE@LIB_kdfs = $(top_builddir)/lib/kdfs/libkdfs.la lib_LTLIBRARIES = libkadm5srv.la libkadm5clnt.la -libkadm5srv_la_LDFLAGS = -version-info 7:5:0 -libkadm5clnt_la_LDFLAGS = -version-info 6:3:2 +libkadm5srv_la_LDFLAGS = -version-info 7:6:0 +libkadm5clnt_la_LDFLAGS = -version-info 6:4:2 sbin_PROGRAMS = dump_log replay_log truncate_log libkadm5srv_la_LIBADD = ../krb5/libkrb5.la ../hdb/libhdb.la ../roken/libroken.la @@ -399,10 +400,10 @@ all: all-am .SUFFIXES: .SUFFIXES: .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .c .lo .o .obj -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(top_srcdir)/configure.in $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/kadm5/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) libLTLIBRARIES_INSTALL = $(INSTALL) install-libLTLIBRARIES: $(lib_LTLIBRARIES) @@ -658,7 +659,9 @@ info: info-am info-am: -install-data-am: install-data-local install-kadm5includeHEADERS +install-data-am: install-kadm5includeHEADERS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-exec-am: install-libLTLIBRARIES install-libexecPROGRAMS \ install-sbinPROGRAMS @@ -689,8 +692,8 @@ uninstall-am: uninstall-info-am uninstall-kadm5includeHEADERS \ clean-libtool clean-sbinPROGRAMS distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am info info-am install install-am install-data \ - install-data-am install-data-local install-exec install-exec-am \ - install-info install-info-am install-kadm5includeHEADERS \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-kadm5includeHEADERS \ install-libLTLIBRARIES install-libexecPROGRAMS install-man \ install-sbinPROGRAMS install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ @@ -824,7 +827,7 @@ dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans install-cat-mans: $(SHELL) $(top_srcdir)/cf/install-catman.sh "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS) -install-data-local: install-cat-mans +install-data-hook: install-cat-mans .et.h: $(COMPILE_ET) $< diff --git a/crypto/heimdal/lib/kadm5/dump_log.c b/crypto/heimdal/lib/kadm5/dump_log.c index 5689f35..f8309fb 100644 --- a/crypto/heimdal/lib/kadm5/dump_log.c +++ b/crypto/heimdal/lib/kadm5/dump_log.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2003 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -34,7 +34,7 @@ #include "iprop.h" #include "parse_time.h" -RCSID("$Id: dump_log.c,v 1.12 2002/05/24 15:19:18 joda Exp $"); +RCSID("$Id: dump_log.c,v 1.13 2003/04/16 17:56:02 lha Exp $"); static char *op_names[] = { "get", @@ -89,7 +89,9 @@ print_entry(kadm5_server_context *server_context, krb5_free_principal(context, source); break; case kadm_rename: - krb5_data_alloc(&data, len); + ret = krb5_data_alloc(&data, len); + if (ret) + krb5_err (context, 1, ret, "kadm_rename: data alloc: %d", len); krb5_ret_principal(sp, &source); krb5_storage_read(sp, data.data, data.length); hdb_value2entry(context, &data, &ent); @@ -102,7 +104,9 @@ print_entry(kadm5_server_context *server_context, hdb_free_entry(context, &ent); break; case kadm_create: - krb5_data_alloc(&data, len); + ret = krb5_data_alloc(&data, len); + if (ret) + krb5_err (context, 1, ret, "kadm_create: data alloc: %d", len); krb5_storage_read(sp, data.data, data.length); ret = hdb_value2entry(context, &data, &ent); if(ret) @@ -110,7 +114,9 @@ print_entry(kadm5_server_context *server_context, mask = ~0; goto foo; case kadm_modify: - krb5_data_alloc(&data, len); + ret = krb5_data_alloc(&data, len); + if (ret) + krb5_err (context, 1, ret, "kadm_modify: data alloc: %d", len); krb5_ret_int32(sp, &mask); krb5_storage_read(sp, data.data, data.length); ret = hdb_value2entry(context, &data, &ent); diff --git a/crypto/heimdal/lib/kadm5/init_c.c b/crypto/heimdal/lib/kadm5/init_c.c index c7236b6..0ed1df1 100644 --- a/crypto/heimdal/lib/kadm5/init_c.c +++ b/crypto/heimdal/lib/kadm5/init_c.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2003 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -37,7 +37,7 @@ #include <netinet/in.h> #include <netdb.h> -RCSID("$Id: init_c.c,v 1.44 2002/06/16 15:13:25 nectar Exp $"); +RCSID("$Id: init_c.c,v 1.45 2003/04/01 15:06:41 lha Exp $"); static void set_funcs(kadm5_client_context *c) @@ -335,6 +335,7 @@ kadm_connect(kadm5_client_context *ctx) int error; char portstr[NI_MAXSERV]; char *hostname, *slash; + char *service_name; krb5_context context = ctx->context; memset (&hints, 0, sizeof(hints)); @@ -377,7 +378,20 @@ kadm_connect(kadm5_client_context *ctx) close(s); return ret; } - ret = krb5_parse_name(context, KADM5_ADMIN_SERVICE, &server); + + if (ctx->realm) + asprintf(&service_name, "%s@%s", KADM5_ADMIN_SERVICE, ctx->realm); + else + asprintf(&service_name, "%s", KADM5_ADMIN_SERVICE); + + if (service_name == NULL) { + freeaddrinfo (ai); + close(s); + return ENOMEM; + } + + ret = krb5_parse_name(context, service_name, &server); + free(service_name); if(ret) { freeaddrinfo (ai); if(ctx->ccache == NULL) diff --git a/crypto/heimdal/lib/kadm5/ipropd_master.c b/crypto/heimdal/lib/kadm5/ipropd_master.c index 626e853..537d403 100644 --- a/crypto/heimdal/lib/kadm5/ipropd_master.c +++ b/crypto/heimdal/lib/kadm5/ipropd_master.c @@ -34,10 +34,12 @@ #include "iprop.h" #include <rtbl.h> -RCSID("$Id: ipropd_master.c,v 1.28 2002/08/16 18:27:53 joda Exp $"); +RCSID("$Id: ipropd_master.c,v 1.29 2003/03/19 11:56:38 lha Exp $"); static krb5_log_facility *log_facility; +const char *slave_stats_file = KADM5_SLAVE_STATS; + static int make_signal_socket (krb5_context context) { @@ -123,6 +125,10 @@ slave_seen(slave *s) static void slave_dead(slave *s) { + if (s->fd >= 0) { + close (s->fd); + s->fd = -1; + } s->flags |= SLAVE_F_DEAD; slave_seen(s); } @@ -406,12 +412,12 @@ process_msg (krb5_context context, slave *s, int log_fd, static void write_stats(krb5_context context, slave *slaves, u_int32_t current_version) { - char str[30]; + char str[100]; rtbl_t tbl; time_t t = time(NULL); FILE *fp; - fp = fopen(KADM5_SLAVE_STATS, "w"); + fp = fopen(slave_stats_file, "w"); if (fp == NULL) return; @@ -457,8 +463,9 @@ write_stats(krb5_context context, slave *slaves, u_int32_t current_version) else rtbl_add_column_entry(tbl, SLAVE_STATUS, "Up"); - strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S", - localtime(&slaves->seen)); + if (strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S %Z", + localtime(&slaves->seen)) == 0) + strlcpy(str, "Unknown time", sizeof(str)); rtbl_add_column_entry(tbl, SLAVE_SEEN, str); slaves = slaves->next; @@ -482,6 +489,7 @@ static struct getargs args[] = { { "keytab", 'k', arg_string, &keytab_str, "keytab to get authentication from", "kspec" }, { "database", 'd', arg_string, &database, "database", "file"}, + { "slave-stats-file", 0, arg_string, &slave_stats_file, "file"}, { "version", 0, arg_flag, &version_flag }, { "help", 0, arg_flag, &help_flag } }; @@ -566,6 +574,8 @@ main(int argc, char **argv) max_fd = max(max_fd, listen_fd); for (p = slaves; p != NULL; p = p->next) { + if (p->flags & SLAVE_F_DEAD) + continue; FD_SET(p->fd, &readset); max_fd = max(max_fd, p->fd); } @@ -584,8 +594,11 @@ main(int argc, char **argv) kadm5_log_get_version_fd (log_fd, ¤t_version); if (current_version > old_version) - for (p = slaves; p != NULL; p = p->next) + for (p = slaves; p != NULL; p = p->next) { + if (p->flags & SLAVE_F_DEAD) + continue; send_diffs (context, p, log_fd, database, current_version); + } } if (ret && FD_ISSET(signal_fd, &readset)) { @@ -604,12 +617,15 @@ main(int argc, char **argv) send_diffs (context, p, log_fd, database, current_version); } - for(p = slaves; ret && p != NULL; p = p->next) + for(p = slaves; ret && p != NULL; p = p->next) { + if (p->flags & SLAVE_F_DEAD) + continue; if (FD_ISSET(p->fd, &readset)) { --ret; if(process_msg (context, p, log_fd, database, current_version)) slave_dead(p); } + } if (ret && FD_ISSET(listen_fd, &readset)) { add_slave (context, keytab, &slaves, listen_fd); diff --git a/crypto/heimdal/lib/kadm5/ipropd_slave.c b/crypto/heimdal/lib/kadm5/ipropd_slave.c index 31ab429..f8846c0 100644 --- a/crypto/heimdal/lib/kadm5/ipropd_slave.c +++ b/crypto/heimdal/lib/kadm5/ipropd_slave.c @@ -33,7 +33,7 @@ #include "iprop.h" -RCSID("$Id: ipropd_slave.c,v 1.26.2.1 2002/10/21 16:06:25 joda Exp $"); +RCSID("$Id: ipropd_slave.c,v 1.27 2002/10/21 15:51:44 joda Exp $"); static krb5_log_facility *log_facility; diff --git a/crypto/heimdal/lib/kadm5/log.c b/crypto/heimdal/lib/kadm5/log.c index 01432c9..8ea3ca9 100644 --- a/crypto/heimdal/lib/kadm5/log.c +++ b/crypto/heimdal/lib/kadm5/log.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2003 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "kadm5_locl.h" -RCSID("$Id: log.c,v 1.19 2002/05/24 15:19:21 joda Exp $"); +RCSID("$Id: log.c,v 1.20 2003/04/16 17:56:55 lha Exp $"); /* * A log record consists of: @@ -268,7 +268,9 @@ kadm5_log_replay_create (kadm5_server_context *context, krb5_data data; hdb_entry ent; - krb5_data_alloc (&data, len); + ret = krb5_data_alloc (&data, len); + if (ret) + return ret; krb5_storage_read (sp, data.data, len); ret = hdb_value2entry (context->context, &data, &ent); krb5_data_free(&data); @@ -421,7 +423,11 @@ kadm5_log_replay_rename (kadm5_server_context *context, krb5_ret_principal (sp, &source); princ_len = krb5_storage_seek(sp, 0, SEEK_CUR) - off; data_len = len - princ_len; - krb5_data_alloc (&value, data_len); + ret = krb5_data_alloc (&value, data_len); + if (ret) { + krb5_free_principal (context->context, source); + return ret; + } krb5_storage_read (sp, value.data, data_len); ret = hdb_value2entry (context->context, &value, &target_ent); krb5_data_free(&value); @@ -509,7 +515,9 @@ kadm5_log_replay_modify (kadm5_server_context *context, krb5_ret_int32 (sp, &mask); len -= 4; - krb5_data_alloc (&value, len); + ret = krb5_data_alloc (&value, len); + if (ret) + return ret; krb5_storage_read (sp, value.data, len); ret = hdb_value2entry (context->context, &value, &log_ent); krb5_data_free(&value); diff --git a/crypto/heimdal/lib/kadm5/send_recv.c b/crypto/heimdal/lib/kadm5/send_recv.c index c13f01b..fe44b76 100644 --- a/crypto/heimdal/lib/kadm5/send_recv.c +++ b/crypto/heimdal/lib/kadm5/send_recv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2002 Kungliga Tekniska Högskolan + * Copyright (c) 1997-2003 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "kadm5_locl.h" -RCSID("$Id: send_recv.c,v 1.9 2002/05/24 15:19:23 joda Exp $"); +RCSID("$Id: send_recv.c,v 1.10 2003/04/16 17:58:59 lha Exp $"); kadm5_ret_t _kadm5_client_send(kadm5_client_context *context, krb5_storage *sp) @@ -47,6 +47,8 @@ _kadm5_client_send(kadm5_client_context *context, krb5_storage *sp) len = krb5_storage_seek(sp, 0, SEEK_CUR); ret = krb5_data_alloc(&msg, len); + if (ret) + return ret; krb5_storage_seek(sp, 0, SEEK_SET); krb5_storage_read(sp, msg.data, msg.length); |