diff options
author | Dan McDonald <danmcd@joyent.com> | 2021-08-10 13:54:47 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2021-08-10 13:54:47 -0400 |
commit | ee30ac4cb393cc516913d59a0763b8eab34c4836 (patch) | |
tree | 9182b60e82fa53400cdbf706dd5a3054525be332 | |
parent | 2796de090312f1ab84ec80f1e31fd8253a3d03ab (diff) | |
parent | 298aa1575e761a7d02bc7c65fa603ffd0266fcb7 (diff) | |
download | illumos-joyent-ee30ac4cb393cc516913d59a0763b8eab34c4836.tar.gz |
[illumos-gate merge]
commit 298aa1575e761a7d02bc7c65fa603ffd0266fcb7
13935 ksetpw passes integers to %s format specifier
13936 ksetpw typo to strtok_r() prevents space delimited -e enctype_list
13942 ksetpw salt may be used uninitialized
commit ff67a31b6b184e832f89a53763c02c35bd1a7291
13790 krb5: variable may be used uninitialized
21 files changed, 122 insertions, 148 deletions
diff --git a/usr/src/cmd/krb5/Makefile b/usr/src/cmd/krb5/Makefile index 4a53aac973..e077cde822 100644 --- a/usr/src/cmd/krb5/Makefile +++ b/usr/src/cmd/krb5/Makefile @@ -24,14 +24,13 @@ clean := TARGET= clean clobber := TARGET= clobber delete := TARGET= delete install := TARGET= install -lint := TARGET= lint catalog := TARGET= catalog package := TARGET= package _msg := TARGET= _msg .KEEP_STATE: -all clean clobber delete install lint catalog package: $(SUBDIRS) +all clean clobber delete install catalog package: $(SUBDIRS) _msg: $(SUBDIRS) diff --git a/usr/src/cmd/krb5/kadmin/Makefile b/usr/src/cmd/krb5/kadmin/Makefile index 8d0dbdc93f..9db582e2a5 100644 --- a/usr/src/cmd/krb5/kadmin/Makefile +++ b/usr/src/cmd/krb5/kadmin/Makefile @@ -32,7 +32,6 @@ clean := TARGET= clean clobber := TARGET= clobber delete := TARGET= delete install := TARGET= install -lint := TARGET= lint catalog := TARGET= catalog package := TARGET= package _msg:= TARGET= _msg @@ -41,7 +40,7 @@ _msg: $(SUBDIRS) .KEEP_STATE: -all clean clobber delete install lint catalog package: $(SUBDIRS) +all clean clobber delete install catalog package: $(SUBDIRS) # install rule for install_h target diff --git a/usr/src/cmd/krb5/kadmin/cli/Makefile b/usr/src/cmd/krb5/kadmin/cli/Makefile index e74a5ce3ff..0d0023d83c 100644 --- a/usr/src/cmd/krb5/kadmin/cli/Makefile +++ b/usr/src/cmd/krb5/kadmin/cli/Makefile @@ -6,7 +6,7 @@ PROG= kadmin kadmin.local SHFILES= k5srvutil -CLOBBERFILES= $(SHFILES) +CLOBBERFILES= $(SHFILES) KRB5SBINSHFILES= $(SHFILES:%=$(KRB5SBIN)/%) @@ -40,7 +40,7 @@ CERRWARN += -_gcc=-Wno-unused-variable SMATCH=off -COPTFLAG += $(XESS) #-I$(KINCDIR) +COPTFLAG += $(XESS) #-I$(KINCDIR) SHAREDLIBS = -lmech_krb5 -lss @@ -73,8 +73,6 @@ install: $(KRB5SBINPROG) $(KRB5SBINSHFILES) clean: $(RM) $(OBJS) -lint: lint_SRCS - include ../../../Makefile.targ $(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) diff --git a/usr/src/cmd/krb5/kadmin/dbutil/Makefile b/usr/src/cmd/krb5/kadmin/dbutil/Makefile index dcf80c679c..5829118108 100644 --- a/usr/src/cmd/krb5/kadmin/dbutil/Makefile +++ b/usr/src/cmd/krb5/kadmin/dbutil/Makefile @@ -34,7 +34,7 @@ CPPFLAGS += -I. -I$(SRC)/lib/gss_mechs/mech_krb5/include/kerberosIV \ -DHAVE_STRSTR=1 -DHAVE_COMPILE=1 -DHAVE_STEP=1 \ -DHAVE_KRB_DB_H=1 -DHAVE_KDC_H=1 -DKDB4_DISABLE \ -DUSE_KADM5_API_VERSION=2 -COPTFLAG += $(XESS) #-I$(KINCDIR) +COPTFLAG += $(XESS) #-I$(KINCDIR) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable @@ -60,7 +60,7 @@ $(ISRCHDR): $(KRB5IPROPDIR)/iprop.x # Explicitly state the dependency on iprop.h $(OBJS): $(ISRCHDR) -$(PROG): $(OBJS) +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) @@ -69,8 +69,6 @@ install: $(KRB5SBINPROG) clean: $(RM) $(OBJS) $(ISRCHDR) -lint: lint_SRCS - include ../../../Makefile.targ $(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) diff --git a/usr/src/cmd/krb5/kadmin/kclient/Makefile b/usr/src/cmd/krb5/kadmin/kclient/Makefile index b15874dd4b..259068fc81 100644 --- a/usr/src/cmd/krb5/kadmin/kclient/Makefile +++ b/usr/src/cmd/krb5/kadmin/kclient/Makefile @@ -61,7 +61,6 @@ CPPFLAGS += -I$(SRC)/uts/common/gssapi/include \ -I$(SRC)/uts/common/gssapi/include \ -I$(SRC)/uts/common/gssapi/mechs/krb5/include -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function @@ -109,6 +108,4 @@ $(USRLIBSEC)/%: % clean: $(RM) $(OBJS) -lint: lint_SRCS - include ../../../Makefile.targ diff --git a/usr/src/cmd/krb5/kadmin/kclient/kconf.c b/usr/src/cmd/krb5/kadmin/kclient/kconf.c index cf3ddfd158..0529b6df38 100644 --- a/usr/src/cmd/krb5/kadmin/kclient/kconf.c +++ b/usr/src/cmd/krb5/kadmin/kclient/kconf.c @@ -82,7 +82,7 @@ end_list(struct profile_string_list *list, char ***ret_list) static errcode_t add_to_list(struct profile_string_list *list, const char *str) { - char *newstr, **newlist; + char *newstr, **newlist; int newmax; if (list->num + 1 >= list->max) { @@ -122,6 +122,11 @@ main(int argc, char **argv) boolean_t set_change = FALSE; struct profile_string_list values; + file = NULL; + domain = NULL; + master = NULL; + kdcs = NULL; + realm = NULL; (void) setlocale(LC_ALL, ""); #if !defined(TEXT_DOMAIN) diff --git a/usr/src/cmd/krb5/kadmin/kclient/ksetpw.c b/usr/src/cmd/krb5/kadmin/kclient/ksetpw.c index cde7c4b23a..b19d034372 100644 --- a/usr/src/cmd/krb5/kadmin/kclient/ksetpw.c +++ b/usr/src/cmd/krb5/kadmin/kclient/ksetpw.c @@ -22,6 +22,7 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Portions Copyright 2021, Chris Fraire <cfraire@me.com>. */ #include <stdio.h> @@ -50,12 +51,12 @@ main(int argc, char **argv) { krb5_context ctx = NULL; krb5_error_code code = 0; - krb5_enctype *enctypes; + krb5_enctype *enctypes = NULL; int enctype_count = 0; krb5_ccache cc = NULL; krb5_keytab kt = NULL; krb5_kvno kvno = 1; - krb5_principal victim, salt; + krb5_principal victim, salt = NULL; char c, *vprincstr, *ktname, *token, *lasts, *newpw; int result_code, i, len, nflag = 0; krb5_data result_code_string, result_string; @@ -113,7 +114,7 @@ main(int argc, char **argv) break; case 'e': len = strlen(optarg); - token = strtok_r(optarg, ",\t,", &lasts); + token = strtok_r(optarg, ",\t ", &lasts); if (token == NULL) usage(); @@ -244,6 +245,9 @@ main(int argc, char **argv) if (enctype_count && (code = kt_remove_entries(ctx, kt, victim))) goto error; + if (salt == NULL) + salt = victim; + for (i = 0; i < enctype_count; i++) kt_add_entry(ctx, kt, victim, salt, enctypes[i], kvno, newpw); @@ -327,16 +331,17 @@ kt_remove_entries(krb5_context ctx, krb5_keytab kt, const krb5_principal princ) static void kt_add_entry(krb5_context ctx, krb5_keytab kt, const krb5_principal princ, - const krb5_principal sprinc, krb5_enctype enctype, krb5_kvno kvno, - const char *pw) + const krb5_principal sprinc, krb5_enctype enctype, krb5_kvno kvno, + const char *pw) { krb5_keytab_entry *entry; krb5_data password, salt; krb5_keyblock key; krb5_error_code code; - char buf[100]; + char enctype_name[100]; - if ((code = krb5_enctype_to_string(enctype, buf, sizeof (buf)))) { + if ((code = krb5_enctype_to_string(enctype, enctype_name, + sizeof (enctype_name)))) { com_err(whoami, code, gettext("Enctype %d has no name!"), enctype); return; @@ -353,15 +358,15 @@ kt_add_entry(krb5_context ctx, krb5_keytab kt, const krb5_principal princ, if ((code = krb5_principal2salt(ctx, sprinc, &salt)) != 0) { com_err(whoami, code, - gettext("Could not compute salt for %s"), enctype); + gettext("Could not compute salt for %s"), enctype_name); return; } code = krb5_c_string_to_key(ctx, enctype, &password, &salt, &key); if (code != 0) { - com_err(whoami, code, gettext("Could not compute salt for %s"), - enctype); + com_err(whoami, code, + gettext("Could not convert to key for %s"), enctype_name); krb5_xfree(salt.data); return; } diff --git a/usr/src/cmd/krb5/kadmin/kdcmgr/Makefile b/usr/src/cmd/krb5/kadmin/kdcmgr/Makefile index 7431b1d989..2f1364d4f3 100644 --- a/usr/src/cmd/krb5/kadmin/kdcmgr/Makefile +++ b/usr/src/cmd/krb5/kadmin/kdcmgr/Makefile @@ -36,7 +36,6 @@ include ../../../Makefile.cmd POFILE= $(SSRCS:%.sh=%.po) CERRWARN += -_gcc=-Wno-implicit-function-declaration -CERRWARN += $(CNOWARN_UNINIT) # not linted SMATCH=off @@ -57,9 +56,6 @@ $(KLPROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) -lint: - $(LINT.c) $(CSRCS) $(LDLIBS) - clean: $(RM) $(OBJS) diff --git a/usr/src/cmd/krb5/kadmin/kdcmgr/klookup.c b/usr/src/cmd/krb5/kadmin/kdcmgr/klookup.c index e3e60820c3..6fa9641093 100644 --- a/usr/src/cmd/krb5/kadmin/kdcmgr/klookup.c +++ b/usr/src/cmd/krb5/kadmin/kdcmgr/klookup.c @@ -60,6 +60,8 @@ main(int argc, char **argv) int rr_type = T_A; HEADER *h; + type = T_A; + if (argc > 3) exit(1); diff --git a/usr/src/cmd/krb5/kadmin/kpasswd/Makefile b/usr/src/cmd/krb5/kadmin/kpasswd/Makefile index 7e8a5d970d..d7b3db9a85 100644 --- a/usr/src/cmd/krb5/kadmin/kpasswd/Makefile +++ b/usr/src/cmd/krb5/kadmin/kpasswd/Makefile @@ -30,7 +30,7 @@ CPPFLAGS += -I$(SRC)/lib/gss_mechs/mech_krb5/include \ -DHAVE_SYS_TIMEB_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_FTIME=1 \ -DHAVE_TIMEZONE -DUSE_KADM5_API_VERSION=2 -COPTFLAG += $(XESS) #-I$(KINCDIR) +COPTFLAG += $(XESS) #-I$(KINCDIR) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable @@ -47,7 +47,7 @@ LDLIBS += $(KMECHLIB) $(KCLNTLIB) all: $(PROG) -$(PROG): $(OBJS) +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) @@ -56,8 +56,6 @@ install: $(KRB5PROG) clean: $(RM) $(OBJS) -lint: lint_SRCS - include ../../../Makefile.targ $(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) diff --git a/usr/src/cmd/krb5/kadmin/ktutil/Makefile b/usr/src/cmd/krb5/kadmin/ktutil/Makefile index 06ae6585b3..293b2b836f 100644 --- a/usr/src/cmd/krb5/kadmin/ktutil/Makefile +++ b/usr/src/cmd/krb5/kadmin/ktutil/Makefile @@ -24,7 +24,7 @@ CPPFLAGS += -I$(SRC)/uts/common/gssapi/include \ -DHAVE_LIBSOCKET=1 -DHAVE_LIBNSL=1 -DHAVE_UNISTD_H=1 \ -DHAVE_SYS_TIMEB_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_FTIME=1 \ -DHAVE_TIMEZONE -COPTFLAG += $(XESS) #-I$(KINCDIR) +COPTFLAG += $(XESS) #-I$(KINCDIR) CERRWARN += -_gcc=-Wno-implicit-function-declaration CERRWARN += -_gcc=-Wno-unused-function @@ -39,7 +39,7 @@ LDLIBS += $(KMECHLIB) $(ROOT)$(KERBLIBDIR)/libss.so all: $(PROG) -ktutil: $(OBJS) +ktutil: $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) @@ -48,8 +48,6 @@ install: $(KRB5PROG) clean: $(RM) $(OBJS) -lint: lint_SRCS - include ../../../Makefile.targ $(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) diff --git a/usr/src/cmd/krb5/kadmin/server/Makefile b/usr/src/cmd/krb5/kadmin/server/Makefile index 9bb3366ffc..788f0e02b5 100644 --- a/usr/src/cmd/krb5/kadmin/server/Makefile +++ b/usr/src/cmd/krb5/kadmin/server/Makefile @@ -41,7 +41,7 @@ CPPFLAGS += -I. -I$(SRC)/uts/common/gssapi/mechs/krb5/include \ -I$(KRB5IPROPDIR) \ -I$(SRC)/uts/common/gssapi/include/ $(DEFS) -COPTFLAG += $(XESS) #-I$(KINCDIR) +COPTFLAG += $(XESS) #-I$(KINCDIR) CERRWARN += -_gcc=-Wno-implicit-function-declaration CERRWARN += -_gcc=-Wno-unused-variable @@ -84,8 +84,6 @@ check: $(CHKMANIFEST) clean: $(RM) $(OBJS) $(DERIVED_OBJS) $(ISRC) -lint: lint_SRCS - include ../../../Makefile.targ $(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) diff --git a/usr/src/cmd/krb5/kdestroy/Makefile b/usr/src/cmd/krb5/kdestroy/Makefile index 7040c504b9..4dbc1899d1 100644 --- a/usr/src/cmd/krb5/kdestroy/Makefile +++ b/usr/src/cmd/krb5/kdestroy/Makefile @@ -19,8 +19,8 @@ CERRWARN += -_gcc=-Wno-parentheses # not linted SMATCH=off -POFILE = kdestroy.po -POFILES = generic.po +POFILE = kdestroy.po +POFILES = generic.po CPPFLAGS += -I../../../lib/gss_mechs/mech_krb5/include \ -I$(SRC)/uts/common/gssapi/mechs/krb5/include @@ -35,11 +35,11 @@ LDLIBS += $(KMECHLIB) .KEEP_STATE: all: $(PROG) -krpc_sys.o: krpc_sys.c +krpc_sys.o: krpc_sys.c $(COMPILE.c) -o $@ krpc_sys.c $(POST_PROCESS_O) -$(PROG): $(OBJS) +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) @@ -48,17 +48,15 @@ install: $(KRB5PROG) clean: $(RM) $(OBJS) -lint: lint_SRCS - include ../../Makefile.targ -$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) - $(RM) $@ - $(CAT) $(POFILES) > $@ +$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) + $(RM) $@ + $(CAT) $(POFILES) > $@ -generic.po: - $(RM) messages.po - $(XGETTEXT) $(XGETFLAGS) `($(GREP) -l gettext *.[ch] || echo /dev/null)` - $(SED) "/^domain/d" messages.po > $@ - $(RM) messages.po +generic.po: + $(RM) messages.po + $(XGETTEXT) $(XGETFLAGS) `($(GREP) -l gettext *.[ch] || echo /dev/null)` + $(SED) "/^domain/d" messages.po > $@ + $(RM) messages.po diff --git a/usr/src/cmd/krb5/kinit/Makefile b/usr/src/cmd/krb5/kinit/Makefile index 2d3327f269..3a256803a5 100644 --- a/usr/src/cmd/krb5/kinit/Makefile +++ b/usr/src/cmd/krb5/kinit/Makefile @@ -9,7 +9,7 @@ PROG= kinit OBJS = kinit.o SRCS = kinit.c -DEFS = -DHAVE_LIBSOCKET=1 -DHAVE_LIBNSL=1 -DHAVE_PWD_H=1 -DHAVE_COMPILE=1 -DHAVE_STEP=1 +DEFS = -DHAVE_LIBSOCKET=1 -DHAVE_LIBNSL=1 -DHAVE_PWD_H=1 -DHAVE_COMPILE=1 -DHAVE_STEP=1 include ../../Makefile.cmd include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5 @@ -39,7 +39,7 @@ LDLIBS += $(KMECHLIB) all: $(PROG) -$(PROG): $(OBJS) +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) @@ -48,13 +48,11 @@ install: $(KRB5PROG) clean: $(RM) $(OBJS) -lint: lint_SRCS - include ../../Makefile.targ -$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) - $(RM) $@ - $(CAT) $(POFILES) > $@ +$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) + $(RM) $@ + $(CAT) $(POFILES) > $@ generic.po: $(RM) messages.po diff --git a/usr/src/cmd/krb5/klist/Makefile b/usr/src/cmd/krb5/klist/Makefile index 057f73e07d..826e2b0ba3 100644 --- a/usr/src/cmd/krb5/klist/Makefile +++ b/usr/src/cmd/krb5/klist/Makefile @@ -6,9 +6,9 @@ PROG= klist -OUTPUT_OPTION = -I. +OUTPUT_OPTION = -I. -OBJS = klist.o +OBJS = klist.o SRCS = $(OBJS:.o=.c) include ../../Makefile.cmd @@ -31,13 +31,13 @@ CERRWARN += -_gcc=-Wno-unused-function # not linted SMATCH=off -$(GPROGS) := CPPFLAGS += -DSYSV -DSunOS=50 +$(GPROGS) := CPPFLAGS += -DSYSV -DSunOS=50 .KEEP_STATE: all: $(PROG) -$(PROG): $(OBJS) +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) @@ -48,13 +48,11 @@ install_h: clean: $(RM) $(OBJS) -lint: lint_SRCS - include ../../Makefile.targ -$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) - $(RM) $@ - $(CAT) $(POFILES) > $@ +$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) + $(RM) $@ + $(CAT) $(POFILES) > $@ generic.po: $(RM) messages.po diff --git a/usr/src/cmd/krb5/kproplog/Makefile b/usr/src/cmd/krb5/kproplog/Makefile index 1672cdbf85..2b5bca2e8b 100644 --- a/usr/src/cmd/krb5/kproplog/Makefile +++ b/usr/src/cmd/krb5/kproplog/Makefile @@ -61,8 +61,6 @@ $(OBJS): iprop.h install: $(KRB5SBINPROG) -lint: $(ISRC) .WAIT lint_SRCS - clean: $(RM) $(OBJS) $(DERIVED_OBJS) $(ISRC) diff --git a/usr/src/cmd/krb5/krb5-config/Makefile b/usr/src/cmd/krb5/krb5-config/Makefile index 37be975de3..345484e037 100644 --- a/usr/src/cmd/krb5/krb5-config/Makefile +++ b/usr/src/cmd/krb5/krb5-config/Makefile @@ -22,8 +22,6 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# PROG= krb5-config SHFILES= krb5-config CLOBBERFILES = $(SHFILES) @@ -33,7 +31,7 @@ include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5 .KEEP_STATE: -all: $(SHFILES) +all: $(SHFILES) install: all $(KRB5PROG) diff --git a/usr/src/cmd/krb5/krb5kdc/Makefile b/usr/src/cmd/krb5/krb5kdc/Makefile index 95cad3e081..b3f472eda4 100644 --- a/usr/src/cmd/krb5/krb5kdc/Makefile +++ b/usr/src/cmd/krb5/krb5kdc/Makefile @@ -30,7 +30,7 @@ DEFS = -DHAVE_LIBSOCKET=1 -DHAVE_LIBNSL=1 \ -DHAVE_NETINET_IN_H=1 -DHAVE_INET_NTOP=1 \ -DHAVE_SYS_SOCKIO_H=1 -DHAVE_SYS_SELECT_H=1 -CLOBBERFILES += $(RSRC) +CLOBBERFILES += $(RSRC) include ../../Makefile.cmd include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5 @@ -49,7 +49,7 @@ CPPFLAGS += \ -I$(SRC)/lib/gss_mechs/mech_krb5/include \ -I$(SRC)/lib/gss_mechs/mech_krb5/include/krb5\ -I$(SRC)/uts/common/gssapi/mechs/krb5/include \ - -DHAVE_SYSLOG_H=1 + -DHAVE_SYSLOG_H=1 CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function @@ -66,9 +66,9 @@ LDLIBS += -L$(ROOT_KLIBDIR) -L$(KRB5LIB) \ .KEEP_STATE: -all: $(PROG) +all: $(PROG) -$(PROG): $(OBJS) +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) @@ -81,8 +81,6 @@ check: $(CHKMANIFEST) clean: $(RM) $(OBJS) -lint: lint_SRCS - include ../../Makefile.targ $(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) diff --git a/usr/src/cmd/krb5/ldap_util/Makefile b/usr/src/cmd/krb5/ldap_util/Makefile index bdcc3197b0..9e21b95cc3 100644 --- a/usr/src/cmd/krb5/ldap_util/Makefile +++ b/usr/src/cmd/krb5/ldap_util/Makefile @@ -37,7 +37,7 @@ GETDATE = $(SRC)/cmd/krb5/kadmin/cli/getdate.o SRCS = $(OBJS:.o=.c) -DEFS = -DHAVE_LIBSOCKET=1 -DHAVE_LIBNSL=1 -DHAVE_PWD_H=1 -DHAVE_COMPILE=1 -DHAVE_STEP=1 +DEFS = -DHAVE_LIBSOCKET=1 -DHAVE_LIBNSL=1 -DHAVE_PWD_H=1 -DHAVE_COMPILE=1 -DHAVE_STEP=1 include $(SRC)/cmd/Makefile.cmd include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5 @@ -86,13 +86,11 @@ install: $(KRB5SBINPROG) clean: $(RM) $(OBJS) -lint: lint_SRCS - include $(SRC)/cmd/Makefile.targ -$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) - $(RM) $@ - $(CAT) $(POFILES) > $@ +$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) + $(RM) $@ + $(CAT) $(POFILES) > $@ generic.po: $(RM) messages.po diff --git a/usr/src/cmd/krb5/slave/Makefile b/usr/src/cmd/krb5/slave/Makefile index 7604827368..a0a04d1019 100644 --- a/usr/src/cmd/krb5/slave/Makefile +++ b/usr/src/cmd/krb5/slave/Makefile @@ -60,7 +60,6 @@ CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-implicit-function-declaration CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-address @@ -105,10 +104,6 @@ install_h: clean: $(RM) $(CLIENTOBJS) $(SERVEROBJS) $(DERIVED_OBJS) $(COMMONOBJS) $(PROG) $(ISRC) -lint: - $(LINT.c) $(CLIENTSRCS) $(COMMONSRCS) $(LDLIBS) - $(LINT.c) $(SERVERSRCS) $(DERIVED_SRCS) $(COMMONSRCS) $(LDLIBS) - include ../../Makefile.targ $(POFILE): $(DERIVED_FILES) .WAIT $(POFILES) diff --git a/usr/src/cmd/krb5/slave/kprop.c b/usr/src/cmd/krb5/slave/kprop.c index b90b08eaa0..ec740f3ba4 100644 --- a/usr/src/cmd/krb5/slave/kprop.c +++ b/usr/src/cmd/krb5/slave/kprop.c @@ -12,7 +12,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -26,7 +26,7 @@ * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * * */ @@ -72,23 +72,23 @@ void PRS (int, char **); void get_tickets (krb5_context); -static void usage +static void usage (void); -krb5_error_code open_connection +krb5_error_code open_connection (char *, int *, char *, unsigned int); -void kerberos_authenticate - (krb5_context, krb5_auth_context *, +void kerberos_authenticate + (krb5_context, krb5_auth_context *, int, krb5_principal, krb5_creds **); -int open_database +int open_database (krb5_context, char *, int *); -void close_database +void close_database (krb5_context, int); -void xmit_database - (krb5_context, krb5_auth_context, krb5_creds *, +void xmit_database + (krb5_context, krb5_auth_context, krb5_creds *, int, int, int); -void send_error +void send_error (krb5_context, krb5_creds *, int, char *, krb5_error_code); -void update_last_prop_file +void update_last_prop_file (char *, char *); static void usage() @@ -112,7 +112,7 @@ main(argc, argv) krb5_auth_context auth_context; #define ERRMSGSIZ 256 char Errmsg[ERRMSGSIZ]; - + (void) setlocale(LC_ALL, ""); #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ @@ -137,14 +137,14 @@ main(argc, argv) exit(1); } if (fd < 0) { - fprintf(stderr, + fprintf(stderr, gettext("%s: %s while opening connection to %s\n"), progname, Errmsg, slave_host); exit(1); } - kerberos_authenticate(context, &auth_context, fd, my_principal, + kerberos_authenticate(context, &auth_context, fd, my_principal, &my_creds); - xmit_database(context, auth_context, my_creds, fd, database_fd, + xmit_database(context, auth_context, my_creds, fd, database_fd, database_size); update_last_prop_file(slave_host, file); printf(gettext("Database propagation to %s: SUCCEEDED\n"), slave_host); @@ -157,11 +157,11 @@ void PRS(argc, argv) int argc; char **argv; { - int c; + int c; register char *word, ch; - extern int optind; + extern int optind; extern char *optarg; - + progname = argv[0]; while ((c= getopt(argc, argv, "r:f:dP:s:h:")) != EOF) { switch (c) { @@ -213,8 +213,8 @@ void get_tickets(context) char *svcname = NULL; char *def_realm = NULL; char *master_host = NULL; - - + + /* * Figure out what tickets we'll be using to send stuff */ @@ -238,8 +238,8 @@ void get_tickets(context) * Always pick up the master hostname from krb5.conf, as * opposed to picking up the localhost, so we do not get bit * if the master KDC is HA and hence points to a logicalhost. - */ - retval = kadm5_get_master(context, def_realm, &master_host); + */ + retval = kadm5_get_master(context, def_realm, &master_host); if (retval) { free(def_realm); com_err(progname, retval, @@ -350,7 +350,7 @@ void get_tickets(context) if (keytab) (void) krb5_kt_close(context, keytab); - + /* * Now destroy the cache right away --- the credentials we * need will be in my_creds. @@ -375,23 +375,23 @@ open_connection(host, fd, Errmsg, ErrmsgSz) unsigned int ErrmsgSz; { int s; - krb5_error_code retval; - + krb5_error_code retval = 0; + int socket_length; struct addrinfo hints, *ai, *aitop; struct sockaddr_storage ss; char serv_or_port[NI_MAXSERV]; enum err_types {SOCKET, CONNECT}; - int which_err; - + int which_err = -1; + memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; /* go for either IPv4 or v6 */ hints.ai_socktype = SOCK_STREAM; if (port != 0) - (void) snprintf(serv_or_port, sizeof(serv_or_port), ("%hu"), + (void) snprintf(serv_or_port, sizeof(serv_or_port), ("%hu"), port); - else + else strncpy(serv_or_port, KPROP_SERVICE, sizeof(serv_or_port)); if (getaddrinfo(host, serv_or_port, &hints, &aitop) != 0) { @@ -425,17 +425,17 @@ open_connection(host, fd, Errmsg, ErrmsgSz) if (ai == NULL) { switch (which_err) { - case SOCKET: - (void) snprintf(Errmsg, ERRMSGSIZ, + case SOCKET: + (void) snprintf(Errmsg, ERRMSGSIZ, gettext("in call to socket")); break; - case CONNECT: - (void) snprintf(Errmsg, ERRMSGSIZ, + case CONNECT: + (void) snprintf(Errmsg, ERRMSGSIZ, gettext("in call to connect")); break; default : retval = -1; /* generic error */ - (void) snprintf(Errmsg, ERRMSGSIZ, + (void) snprintf(Errmsg, ERRMSGSIZ, gettext("could not setup network")); break; } @@ -464,7 +464,7 @@ open_connection(host, fd, Errmsg, ErrmsgSz) if (getsockname(s, (struct sockaddr *)&ss, &socket_length) < 0) { retval = errno; close(s); - (void) snprintf(Errmsg, ERRMSGSIZ, + (void) snprintf(Errmsg, ERRMSGSIZ, gettext("in call to getsockname")); return(retval); } @@ -492,10 +492,10 @@ void kerberos_authenticate(context, auth_context, fd, me, new_creds) krb5_ap_rep_enc_part *rep_result; retval = krb5_auth_con_init(context, auth_context); - if (retval) + if (retval) exit(1); - krb5_auth_con_setflags(context, *auth_context, + krb5_auth_con_setflags(context, *auth_context, KRB5_AUTH_CONTEXT_DO_SEQUENCE); retval = krb5_auth_con_setaddrs(context, *auth_context, &sender_addr, @@ -505,7 +505,7 @@ void kerberos_authenticate(context, auth_context, fd, me, new_creds) exit(1); } - retval = krb5_sendauth(context, auth_context, (void *)&fd, + retval = krb5_sendauth(context, auth_context, (void *)&fd, kprop_version, me, creds.server, AP_OPTS_MUTUAL_REQUIRED, NULL, &creds, NULL, &error, &rep_result, new_creds); @@ -550,16 +550,16 @@ open_database(context, data_fn, size) { int fd; int err; - struct stat stbuf, stbuf_ok; + struct stat stbuf, stbuf_ok; char *data_ok_fn; static char ok[] = ".dump_ok"; dbpathname = strdup(data_fn); if (!dbpathname) { - com_err(progname, ENOMEM, gettext("allocating database file name '%s'"), - data_fn); - exit(1); - } + com_err(progname, ENOMEM, + gettext("allocating database file name '%s'"), data_fn); + exit(1); + } if ((fd = open(dbpathname, O_RDONLY)) < 0) { com_err(progname, errno, gettext("while trying to open %s"), dbpathname); @@ -574,7 +574,7 @@ open_database(context, data_fn, size) } else if (err) { com_err(progname, err, gettext("while trying to lock '%s'"), dbpathname); exit(1); - } + } if (fstat(fd, &stbuf)) { com_err(progname, errno, gettext("while trying to stat %s"), data_fn); @@ -616,18 +616,18 @@ close_database(context, fd) (void)close(fd); return; } - + /* * Now we send over the database. We use the following protocol: * Send over a KRB_SAFE message with the size. Then we send over the * database in blocks of KPROP_BLKSIZE, encrypted using KRB_PRIV. * Then we expect to see a KRB_SAFE message with the size sent back. - * + * * At any point in the protocol, we may send a KRB_ERROR message; this * will abort the entire operation. */ void -xmit_database(context, auth_context, my_creds, fd, database_fd, +xmit_database(context, auth_context, my_creds, fd, database_fd, in_database_size) krb5_context context; krb5_auth_context auth_context; @@ -642,7 +642,7 @@ xmit_database(context, auth_context, my_creds, fd, database_fd, krb5_error_code retval; krb5_error *error; /* These must be 4 bytes */ - krb5_ui_4 database_size = in_database_size; + krb5_ui_4 database_size = in_database_size; krb5_ui_4 send_size; /* @@ -652,7 +652,7 @@ xmit_database(context, auth_context, my_creds, fd, database_fd, inbuf.data = (char *) &send_size; inbuf.length = sizeof(send_size); /* must be 4, really */ /* KPROP_CKSUMTYPE */ - retval = krb5_mk_safe(context, auth_context, &inbuf, + retval = krb5_mk_safe(context, auth_context, &inbuf, &outbuf, NULL); if (retval) { com_err(progname, retval, gettext("while encoding database size")); @@ -672,12 +672,12 @@ xmit_database(context, auth_context, my_creds, fd, database_fd, */ retval = krb5_auth_con_initivector(context, auth_context); if (retval) { - send_error(context, my_creds, fd, + send_error(context, my_creds, fd, gettext("failed while initializing i_vector"), retval); com_err(progname, retval, gettext("while allocating i_vector")); exit(1); } - + /* * Send over the file, block by block.... */ @@ -731,7 +731,7 @@ xmit_database(context, auth_context, my_creds, fd, database_fd, * the error message */ if (krb5_is_krb_error(&inbuf)) { - retval = krb5_rd_error(context, &inbuf, &error); + retval = krb5_rd_error(context, &inbuf, &error); if (retval) { com_err(progname, retval, gettext("while decoding error response from server")); @@ -743,8 +743,8 @@ xmit_database(context, auth_context, my_creds, fd, database_fd, gettext("Generic remote error: %s\n"), error->text.data); } else if (error->error) { - com_err(progname, - (krb5_error_code) error->error + + com_err(progname, + (krb5_error_code) error->error + ERROR_TABLE_BASE_krb5, gettext("signalled from server")); if (error->text.data) |