diff options
author | Keith M Wesolowski <wesolows@foobazco.org> | 2014-05-20 16:28:15 +0000 |
---|---|---|
committer | Keith M Wesolowski <wesolows@foobazco.org> | 2014-05-20 16:28:15 +0000 |
commit | a3b10e3c9a99db4c1c8cdd0e4f4b1a14e56378e6 (patch) | |
tree | dd5a51ebe24072008d62c505887fe983dbc4fcbc | |
parent | 507453da825ff988a9b2a5d5844c5bc677153049 (diff) | |
parent | 826ac02a0def83e0a41b29321470d299c7389aab (diff) | |
download | illumos-joyent-a3b10e3c9a99db4c1c8cdd0e4f4b1a14e56378e6.tar.gz |
[illumos-gate merge]
commit 826ac02a0def83e0a41b29321470d299c7389aab
4857 xargs(1) -n and -I combine to do potentially the wrong thing
commit be082110c08433beadb738ad3be035a73d995ea8
4730 metaslab group taskq should be destroyed in metaslab_group_destroy()
commit a65cd518c5d0f30c53594a7022eb0f7d04c98cef
4853 illumos-gate is not lint-clean when built with openssl 1.0
Conflicts:
usr/src/test/util-tests/tests/Makefile
usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com
usr/src/lib/libwanboot/Makefile.com
usr/src/lib/libpkg/Makefile.com
usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com
usr/src/cmd/ssh/sshd/Makefile
usr/src/cmd/ssh/ssh/Makefile
usr/src/cmd/ssh/ssh-keysign/Makefile
usr/src/cmd/ssh/ssh-keyscan/Makefile
usr/src/cmd/ssh/ssh-keygen/Makefile
usr/src/cmd/ssh/ssh-agent/Makefile
usr/src/cmd/ssh/ssh-add/Makefile
usr/src/cmd/ssh/sftp/Makefile
usr/src/cmd/ssh/sftp-server/Makefile
usr/src/cmd/ssh/libssh/Makefile.com
usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/Makefile
usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/Makefile
28 files changed, 416 insertions, 67 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/Makefile b/usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/Makefile index fb8c1cdad6..99e3319958 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/Makefile +++ b/usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/Makefile @@ -25,9 +25,14 @@ include ../Makefile.com PROG= p12split -LDLIBS += -lwanboot -linetutil -lwanbootutil -lsunw_crypto +LDLIBS += -lwanboot -linetutil -lwanbootutil CPPFLAGS += -I$(CMNCRYPTDIR) +# libcrypto has no lint library, so we can only include this while building +$(PROG) := LDLIBS += -lsunw_crypto + +LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2 + all: $(PROG) install: all $(ROOTCMD) diff --git a/usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/p12split.c b/usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/p12split.c index 600f7ffd33..5716224bdc 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/p12split.c +++ b/usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/p12split.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <libintl.h> #include <locale.h> @@ -262,7 +260,6 @@ do_certs(void) int i; for (i = 0; i < sk_X509_num(ta_in); i++) { - /* LINTED */ x = sk_X509_value(ta_in, i); (void) printf( gettext("\nTrust Anchor cert %d:\n"), i); @@ -287,7 +284,7 @@ do_certs(void) } (void) sunw_print_times(stdout, PRNT_BOTH, - NULL, x); + NULL, x); } } } @@ -376,13 +373,11 @@ check_certs(STACK_OF(X509) *ta_in, X509 **c_in) return; for (i = 0; i < sk_X509_num(ta_in); ) { - /* LINTED */ curr = sk_X509_value(ta_in, i); ret = time_check_print(curr); if ((ret != CHK_TIME_OK && ret != CHK_TIME_IS_BEFORE) && del_expired) { (void) fprintf(stderr, gettext(" Removing cert\n")); - /* LINTED */ curr = sk_X509_delete(ta_in, i); X509_free(curr); continue; @@ -586,14 +581,12 @@ cleanup: */ if (clist != NULL) { if (cert != NULL && sk_X509_num(clist) == 1) { - /* LINTED */ (void) sk_X509_delete(clist, 0); } sk_X509_pop_free(clist, X509_free); } if (klist != NULL) { if (pkey != NULL && sk_EVP_PKEY_num(klist) == 1) { - /* LINTED */ (void) sk_EVP_PKEY_delete(klist, 0); } sk_EVP_PKEY_pop_free(klist, sunw_evp_pkey_free); diff --git a/usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/Makefile b/usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/Makefile index acad766bd3..798f005ab8 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/Makefile +++ b/usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/Makefile @@ -25,9 +25,12 @@ include ../Makefile.com PROG = wanboot-cgi -LDLIBS += -lgen -lnsl -lwanbootutil -lnvpair -lwanboot -lsunw_crypto +LDLIBS += -lgen -lnsl -lwanbootutil -lnvpair -lwanboot CPPFLAGS += -I$(CMNCRYPTDIR) +# libcrypto has no lint library, so we can only include this while building +$(PROG) := LDLIBS += -lsunw_crypto + all: $(PROG) install: all $(ROOTCMD) diff --git a/usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/wanboot-cgi.c b/usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/wanboot-cgi.c index c8f391031a..1f956eb683 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/wanboot-cgi.c +++ b/usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/wanboot-cgi.c @@ -877,7 +877,6 @@ build_trustfile(const char *path, void *truststorepath) * Merge the two stacks of pkcs12 certs. */ for (i = 0; i < sk_X509_num(i_anchors); i++) { - /* LINTED */ x = sk_X509_delete(i_anchors, i); (void) sk_X509_push(o_anchors, x); } @@ -1090,7 +1089,6 @@ get_hostnames(const char *path, void *nvl) p12 = NULL; for (i = 0; i < sk_X509_num(certs); i++) { - /* LINTED */ x = sk_X509_value(certs, i); if (!one_name(sunw_issuer_attrs(x, buf, sizeof (buf) - 1), nvl)) { diff --git a/usr/src/cmd/ssh/libssh/Makefile.com b/usr/src/cmd/ssh/libssh/Makefile.com index 4017af7905..a3eee2a21d 100644 --- a/usr/src/cmd/ssh/libssh/Makefile.com +++ b/usr/src/cmd/ssh/libssh/Makefile.com @@ -94,7 +94,7 @@ LIBS = $(LIBRARY) $(LINTLIB) # Define LDLIBS conditionally for lintcheck, rather than in general, since # we're building an archive library which itself links to nothing, we just # want lint to know about these libraries. -lintcheck := LDLIBS += -lsunw_crypto -lz -lsocket -lnsl -lc +lintcheck := LDLIBS += -lz -lsocket -lnsl -lc $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC) POFILE_DIR = ../.. diff --git a/usr/src/cmd/ssh/sftp-server/Makefile b/usr/src/cmd/ssh/sftp-server/Makefile index f49dde54ee..b0a62c02e6 100644 --- a/usr/src/cmd/ssh/sftp-server/Makefile +++ b/usr/src/cmd/ssh/sftp-server/Makefile @@ -31,7 +31,10 @@ SRCS = $(OBJS:.o=.c) include ../../Makefile.cmd include ../Makefile.ssh-common -LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket -lsunw_crypto +LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket + +# libcrypto has no lint library, so we can only use it when building +$(PROG) := LDLIBS += -lsunw_crypto POFILE_DIR = .. diff --git a/usr/src/cmd/ssh/sftp/Makefile b/usr/src/cmd/ssh/sftp/Makefile index f3c0ea7a75..a4414f9893 100644 --- a/usr/src/cmd/ssh/sftp/Makefile +++ b/usr/src/cmd/ssh/sftp/Makefile @@ -35,7 +35,10 @@ SRCS = $(OBJS:.o=.c) include ../../Makefile.cmd include ../Makefile.ssh-common -LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket -lsunw_crypto -ltecla +LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket -ltecla + +# libcrypto has no lint library, so we can only use it when building +$(PROG) := LDLIBS += -lsunw_crypto POFILE_DIR = .. diff --git a/usr/src/cmd/ssh/ssh-add/Makefile b/usr/src/cmd/ssh/ssh-add/Makefile index 3235839e06..756ad2b047 100644 --- a/usr/src/cmd/ssh/ssh-add/Makefile +++ b/usr/src/cmd/ssh/ssh-add/Makefile @@ -32,7 +32,10 @@ SRCS = $(OBJS:.o=.c) include ../../Makefile.cmd include ../Makefile.ssh-common -LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket -lsunw_crypto +LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket + +# libcrypto has no lint library, so we can only use it when building +$(PROG) := LDLIBS += -lsunw_crypto POFILE_DIR= .. diff --git a/usr/src/cmd/ssh/ssh-agent/Makefile b/usr/src/cmd/ssh/ssh-agent/Makefile index ab2e1eb49d..a712fd8700 100644 --- a/usr/src/cmd/ssh/ssh-agent/Makefile +++ b/usr/src/cmd/ssh/ssh-agent/Makefile @@ -32,7 +32,10 @@ SRCS = $(OBJS:.o=.c) include ../../Makefile.cmd include ../Makefile.ssh-common -LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket -lsunw_crypto +LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket + +# libcrypto has no lint library, so we can only use it when building +$(PROG) := LDLIBS += -lsunw_crypto POFILE_DIR= .. diff --git a/usr/src/cmd/ssh/ssh-keygen/Makefile b/usr/src/cmd/ssh/ssh-keygen/Makefile index 0c90716768..9459171749 100644 --- a/usr/src/cmd/ssh/ssh-keygen/Makefile +++ b/usr/src/cmd/ssh/ssh-keygen/Makefile @@ -32,7 +32,10 @@ SRCS = $(OBJS:.o=.c) include ../../Makefile.cmd include ../Makefile.ssh-common -LDLIBS += $(SSH_COMMON_LDLIBS) -lsunw_crypto -lsocket +LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket + +# libcrypto has no lint library, so we can only use it when building +$(PROG) := LDLIBS += -lsunw_crypto POFILE_DIR= .. diff --git a/usr/src/cmd/ssh/ssh-keyscan/Makefile b/usr/src/cmd/ssh/ssh-keyscan/Makefile index 90428880a3..c0d53c34b7 100644 --- a/usr/src/cmd/ssh/ssh-keyscan/Makefile +++ b/usr/src/cmd/ssh/ssh-keyscan/Makefile @@ -32,7 +32,10 @@ SRCS = $(OBJS:.o=.c) include ../../Makefile.cmd include ../Makefile.ssh-common -LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket -lnsl -lz -lsunw_crypto +LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket -lnsl -lz + +# libcrypto has no lint library, so we can only use it when building +$(PROG) := LDLIBS += -lsunw_crypto POFILE_DIR= .. diff --git a/usr/src/cmd/ssh/ssh-keysign/Makefile b/usr/src/cmd/ssh/ssh-keysign/Makefile index 649935a050..304729f44c 100644 --- a/usr/src/cmd/ssh/ssh-keysign/Makefile +++ b/usr/src/cmd/ssh/ssh-keysign/Makefile @@ -36,7 +36,10 @@ include ../Makefile.ssh-common FILEMODE= 04555 -LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket -lnsl -lz -lsunw_crypto +LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket -lnsl -lz + +# libcrypto has no lint library, so we can only use it when building +$(PROG) := LDLIBS += -lsunw_crypto POFILE_DIR= .. diff --git a/usr/src/cmd/ssh/ssh/Makefile b/usr/src/cmd/ssh/ssh/Makefile index 2d77334497..c27b0ca92e 100644 --- a/usr/src/cmd/ssh/ssh/Makefile +++ b/usr/src/cmd/ssh/ssh/Makefile @@ -40,9 +40,11 @@ include ../Makefile.ssh-common LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket \ -lnsl \ -lz \ - -lsunw_crypto \ -lgss +# libcrypto has no lint library, so we can only use it when building +$(PROG) := LDLIBS += -lsunw_crypto + POFILE_DIR= .. .KEEP_STATE: diff --git a/usr/src/cmd/ssh/sshd/Makefile b/usr/src/cmd/ssh/sshd/Makefile index 4c82633347..ad28d6764c 100644 --- a/usr/src/cmd/ssh/sshd/Makefile +++ b/usr/src/cmd/ssh/sshd/Makefile @@ -75,12 +75,14 @@ LDLIBS += $(SSH_COMMON_LDLIBS) -lsocket \ -lpam \ -lbsm \ -lwrap \ - -lsunw_crypto \ -lgss \ -lcontract MAPFILES = $(MAPFILE.INT) $(MAPFILE.NGB) LDFLAGS += $(MAPFILES:%=-M%) +# libcrypto has no lint library, so we can only use it when building +$(PROG) := LDLIBS += -lsunw_crypto + POFILE_DIR= .. .KEEP_STATE: diff --git a/usr/src/cmd/xargs/xargs.c b/usr/src/cmd/xargs/xargs.c index e50c7d6d45..2e568d54ba 100644 --- a/usr/src/cmd/xargs/xargs.c +++ b/usr/src/cmd/xargs/xargs.c @@ -19,7 +19,8 @@ * CDDL HEADER END */ /* - * Copyright 2012 DEY Storage Systems, Inc. All rights reserved. + * Copyright 2014 Garrett D'Amore <garrett@damore.org> + * Copyright 2012 DEY Storage Systems, Inc. * * Portions of this file developed by DEY Storage Systems, Inc. are licensed * under the terms of the Common Development and Distribution License (CDDL) @@ -115,6 +116,8 @@ static int N_lines = 0; static int DASHX = FALSE; static int MORE = TRUE; static int PER_LINE = FALSE; +static int LINE_CONT = FALSE; +static int EAT_LEAD = FALSE; static int ERR = FALSE; static int OK = TRUE; static int LEGAL = FALSE; @@ -211,7 +214,8 @@ main(int argc, char **argv) case 'I': /* -I replstr: Insert mode. replstr *is* required. */ - INSERT = PER_LINE = LEGAL = TRUE; + INSERT = PER_LINE = LEGAL = EAT_LEAD = TRUE; + LINE_CONT = FALSE; N_ARGS = 0; INSPAT = optarg; if (*optarg == '\0') { @@ -232,7 +236,8 @@ main(int argc, char **argv) * parse this by hand: */ - INSERT = PER_LINE = LEGAL = TRUE; + INSERT = PER_LINE = LEGAL = EAT_LEAD = TRUE; + LINE_CONT = FALSE; N_ARGS = 0; if ((optarg != NULL) && (*optarg != '\0')) { INSPAT = optarg; @@ -254,9 +259,9 @@ main(int argc, char **argv) * -L number: # of times cmd is executed * number *is* required here: */ - PER_LINE = TRUE; + PER_LINE = LINE_CONT = TRUE; N_ARGS = 0; - INSERT = FALSE; + INSERT = EAT_LEAD = FALSE; if ((PER_LINE = atoi(optarg)) <= 0) { ermsg(_("#lines must be positive int: %s\n"), optarg); @@ -272,9 +277,9 @@ main(int argc, char **argv) * parseargs handles the optional arg processing. */ - PER_LINE = LEGAL = TRUE; /* initialization */ + PER_LINE = LINE_CONT = LEGAL = TRUE; N_ARGS = 0; - INSERT = FALSE; + INSERT = EAT_LEAD = FALSE; if ((optarg != NULL) && (*optarg != '\0')) { if ((PER_LINE = atoi(optarg)) <= 0) @@ -292,7 +297,7 @@ main(int argc, char **argv) optarg); } else { LEGAL = DASHX || N_ARGS == 1; - INSERT = PER_LINE = FALSE; + INSERT = PER_LINE = LINE_CONT = FALSE; } break; @@ -421,8 +426,8 @@ main(int argc, char **argv) N_args++; - if ((PER_LINE && N_lines >= PER_LINE) || - (N_ARGS && (N_args) >= N_ARGS)) { + if ((PER_LINE && (N_lines >= PER_LINE)) || + (N_ARGS && (N_args >= N_ARGS))) { break; } @@ -520,17 +525,19 @@ static char * getarg(char *arg) { char *xarg = arg; - wchar_t c; + wchar_t c = 0; char mbc[MB_LEN_MAX]; size_t len; int escape = 0; int inquote = 0; + int last = 0; arg[0] = '\0'; while (MORE) { len = 0; + last = c; c = getwchr(mbc, &len); if (((arg - xarg) + len) > BUFLIM) { @@ -546,6 +553,16 @@ getarg(char *arg) store_str(&arg, mbc, len); continue; } + /* + * NB: Some other versions rip off all of the trailing + * blanks. The spec only claims that this should + * be done for a single blank. We follow the spec. + */ + if (LINE_CONT && iswctype(last, blank)) { + len = 0; + *arg = 0; + continue; + } /* FALLTHRU */ case '\0': @@ -617,7 +634,16 @@ getarg(char *arg) store_str(&arg, mbc, len); continue; } - /* unquoted blank */ + if (EAT_LEAD && last == 0) { + c = 0; /* Roll it back */ + continue; + } + if (PER_LINE) { + store_str(&arg, mbc, len); + continue; + } + + /* unquoted blank without special handling */ break; } @@ -729,7 +755,7 @@ insert(char *pattern, char *subst) bufend = &buffer[MAXSBUF]; while (*++pat) { - if (strncmp(pat, INSPAT, ipatlen) == 0) { + if (strncmp(pat, INSPAT, ipatlen + 1) == 0) { if (pbuf + len >= bufend) { break; } else { @@ -904,8 +930,8 @@ usage() * -Estr -> "-E "str" * -i -> "-i "{}" * -irep -> "-i "rep" - * -l -> "-i "1" - * -l10 -> "-i "10" + * -l -> "-l "1" + * -l10 -> "-l "10" * * since the -e, -i and -l flags all take optional subarguments, */ diff --git a/usr/src/common/net/wanboot/boot_http.c b/usr/src/common/net/wanboot/boot_http.c index 737f49a8aa..26590369cd 100644 --- a/usr/src/common/net/wanboot/boot_http.c +++ b/usr/src/common/net/wanboot/boot_http.c @@ -2254,7 +2254,6 @@ print_ciphers(SSL *ssl) return; for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) { - /* LINTED */ c = sk_SSL_CIPHER_value(sk, i); libbootlog(BOOTLOG_VERBOSE, "%08lx %s", c->id, c->name); } diff --git a/usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com b/usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com index 50e298bc09..3ba997f3d8 100644 --- a/usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com +++ b/usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com @@ -40,8 +40,8 @@ BERLIB64= $(BERLIB) OPENSSLLIBS= $(BERLIB) -lsunw_crypto -lcryptoutil -lc OPENSSLLIBS64= $(BERLIB64) -lsunw_crypto -lcryptoutil -lc -LINTSSLLIBS = $(BERLIB) -lsunw_crypto -lcryptoutil -lc -LINTSSLLIBS64 = $(BERLIB64) -lsunw_crypto -lcryptoutil -lc +LINTSSLLIBS = $(BERLIB) -lcryptoutil -lc +LINTSSLLIBS64 = $(BERLIB64) -lcryptoutil -lc SRCDIR= ../common INCDIR= ../../include diff --git a/usr/src/lib/libkmf/plugins/kmf_openssl/common/openssl_spi.c b/usr/src/lib/libkmf/plugins/kmf_openssl/common/openssl_spi.c index fc3da4b7e8..19d757df90 100644 --- a/usr/src/lib/libkmf/plugins/kmf_openssl/common/openssl_spi.c +++ b/usr/src/lib/libkmf/plugins/kmf_openssl/common/openssl_spi.c @@ -2033,7 +2033,7 @@ OpenSSL_CertGetPrintable(KMF_HANDLE_T handle, const KMF_DATA *pcert, #if OPENSSL_VERSION_NUMBER < 0x10000000L STACK *emlst = NULL; #else - STACK_OF(OPENSSL_STRING) *emlst = NULL; + STACK_OF(OPENSSL_STRING) *emlst = NULL; #endif X509_EXTENSION *ex; X509_CINF *ci; @@ -2153,7 +2153,7 @@ OpenSSL_CertGetPrintable(KMF_HANDLE_T handle, const KMF_DATA *pcert, #else for (j = 0; j < sk_OPENSSL_STRING_num(emlst); j++) (void) BIO_printf(mem, "%s\n", - sk_OPENSSL_STRING_value(emlst, j)); + sk_OPENSSL_STRING_value(emlst, j)); #endif len = BIO_gets(mem, resultStr, KMF_CERT_PRINTABLE_LEN); @@ -2499,7 +2499,6 @@ static X509 *ocsp_find_signer_sk(STACK_OF(X509) *certs, OCSP_RESPID *id) keyhash = id->value.byKey->data; /* Calculate hash of each key and compare */ for (i = 0; i < sk_X509_num(certs); i++) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ X509 *x = sk_X509_value(certs, i); /* Use pubkey_digest to get the key ID value */ (void) X509_pubkey_digest(x, EVP_sha1(), tmphash, NULL); @@ -3639,7 +3638,6 @@ extract_pem(KMF_HANDLE *kmfh, } for (i = 0; i < sk_X509_INFO_num(x509_info_stack); i++) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ cert_infos[ncerts] = sk_X509_INFO_value(x509_info_stack, i); ncerts++; } @@ -3721,7 +3719,6 @@ extract_pem(KMF_HANDLE *kmfh, err: /* Cleanup the stack of X509 info records */ for (i = 0; i < sk_X509_INFO_num(x509_info_stack); i++) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ info = (X509_INFO *)sk_X509_INFO_value(x509_info_stack, i); X509_INFO_free(info); } @@ -3742,7 +3739,6 @@ openssl_parse_bags(STACK_OF(PKCS12_SAFEBAG) *bags, char *pin, int i; for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ PKCS12_SAFEBAG *bag = sk_PKCS12_SAFEBAG_value(bags, i); ret = openssl_parse_bag(bag, pin, (pin ? strlen(pin) : 0), keys, certs); @@ -3773,12 +3769,10 @@ set_pkey_attrib(EVP_PKEY *pkey, ASN1_TYPE *attrib, int nid) X509_ATTRIBUTE *a; for (i = 0; i < sk_X509_ATTRIBUTE_num(pkey->attributes); i++) { - /* LINTED E_BAD_PTR_CASE_ALIGN */ a = sk_X509_ATTRIBUTE_value(pkey->attributes, i); if (OBJ_obj2nid(a->object) == nid) { X509_ATTRIBUTE_free(a); - /* LINTED E_BAD_PTR_CAST_ALIGN */ - sk_X509_ATTRIBUTE_set(pkey->attributes, + (void) sk_X509_ATTRIBUTE_set(pkey->attributes, i, attr); return (KMF_OK); } @@ -3955,7 +3949,6 @@ openssl_pkcs12_parse(PKCS12 *p12, char *pin, for (i = 0; ret == KMF_OK && i < sk_PKCS7_num(asafes); i++) { bags = NULL; - /* LINTED E_BAD_PTR_CAST_ALIGN */ p7 = sk_PKCS7_value(asafes, i); bagnid = OBJ_obj2nid(p7->type); @@ -4233,7 +4226,6 @@ find_attr(STACK_OF(X509_ATTRIBUTE) *attrs, int nid) return (NULL); for (i = 0; i < sk_X509_ATTRIBUTE_num(attrs); i++) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ a = sk_X509_ATTRIBUTE_value(attrs, i); if (OBJ_obj2nid(a->object) == nid) return (a); @@ -4274,7 +4266,6 @@ convertToRawKey(EVP_PKEY *pkey, KMF_RAW_KEY_DATA *key) ASN1_TYPE *ty = NULL; int numattr = sk_ASN1_TYPE_num(attr->value.set); if (attr->single == 0 && numattr > 0) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ ty = sk_ASN1_TYPE_value(attr->value.set, 0); } if (ty != NULL) { @@ -4298,7 +4289,6 @@ convertToRawKey(EVP_PKEY *pkey, KMF_RAW_KEY_DATA *key) ASN1_TYPE *ty = NULL; int numattr = sk_ASN1_TYPE_num(attr->value.set); if (attr->single == 0 && numattr > 0) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ ty = sk_ASN1_TYPE_value(attr->value.set, 0); } key->id.Data = (uchar_t *)malloc( @@ -4329,7 +4319,6 @@ convertPK12Objects( int i; for (i = 0; sslkeys != NULL && i < sk_EVP_PKEY_num(sslkeys); i++) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ EVP_PKEY *pkey = sk_EVP_PKEY_value(sslkeys, i); rv = convertToRawKey(pkey, &key); if (rv == KMF_OK) @@ -4341,7 +4330,6 @@ convertPK12Objects( /* Now add the certificate to the certlist */ for (i = 0; sslcert != NULL && i < sk_X509_num(sslcert); i++) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ X509 *cert = sk_X509_value(sslcert, i); rv = add_cert_to_list(kmfh, cert, certlist, ncerts); if (rv != KMF_OK) @@ -4357,7 +4345,6 @@ convertPK12Objects( * Lint is complaining about the embedded casting, and * to fix it, you need to fix openssl header files. */ - /* LINTED E_BAD_PTR_CAST_ALIGN */ c = sk_X509_value(sslcacerts, i); /* Now add the ca cert to the certlist */ @@ -5424,7 +5411,6 @@ OpenSSL_FindCertInCRL(KMF_HANDLE_T handle, int numattr, KMF_ATTRIBUTE *attrlist) } for (i = 0; i < sk_X509_REVOKED_num(revoke_stack); i++) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ revoke = sk_X509_REVOKED_value(revoke_stack, i); if (ASN1_INTEGER_cmp(xcert->cert_info->serialNumber, revoke->serialNumber) == 0) { diff --git a/usr/src/lib/libpkg/Makefile.com b/usr/src/lib/libpkg/Makefile.com index 0106d8288f..1d8a658d52 100644 --- a/usr/src/lib/libpkg/Makefile.com +++ b/usr/src/lib/libpkg/Makefile.com @@ -64,7 +64,11 @@ $(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC) LIBS = $(DYNLIB) $(LINTLIB) -LDLIBS += -lc -lsunw_ssl -lwanboot -lsunw_crypto -lscf -ladm +LDLIBS += -lc -lwanboot -lscf -ladm + +# libcrypto and libssl have no lint library, and so can only be used when +# building +$(DYNLIB) := LDLIBS += -lsunw_crypto -lsunw_ssl CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/lib/libpkg/common/security.c b/usr/src/lib/libpkg/common/security.c index 9f2070c0c6..4210ba5c32 100644 --- a/usr/src/lib/libpkg/common/security.c +++ b/usr/src/lib/libpkg/common/security.c @@ -110,7 +110,6 @@ get_cert_chain(PKG_ERR *err, X509 *cert, STACK_OF(X509) *clcerts, /* add all ca certs into the store */ for (i = 0; i < sk_X509_num(cas); i++) { - /* LINTED pointer cast may result in improper alignment */ ca_cert = sk_X509_value(cas, i); if (X509_STORE_add_cert(ca_store, ca_cert) == 0) { pkgerr_add(err, PKGERR_NOMEM, gettext(ERR_MEM)); @@ -174,8 +173,7 @@ char NID_commonName, sname, ATTR_MAX) <= 0) { (void) strncpy(sname, - X509_NAME_oneline(xname, - NULL, 0), ATTR_MAX); + X509_NAME_oneline(xname, NULL, 0), ATTR_MAX); sname[ATTR_MAX - 1] = '\0'; } return (sname); @@ -205,8 +203,7 @@ char NID_commonName, sname, ATTR_MAX) <= 0) { (void) strncpy(sname, - X509_NAME_oneline(xname, - NULL, 0), ATTR_MAX); + X509_NAME_oneline(xname, NULL, 0), ATTR_MAX); sname[ATTR_MAX - 1] = '\0'; } return (sname); diff --git a/usr/src/lib/libwanboot/Makefile.com b/usr/src/lib/libwanboot/Makefile.com index 1e6310f9ba..350c49e2a9 100644 --- a/usr/src/lib/libwanboot/Makefile.com +++ b/usr/src/lib/libwanboot/Makefile.com @@ -60,7 +60,12 @@ include ../../Makefile.lib LIBS += $(LINTLIB) LDLIBS += -lnvpair -lresolv -lnsl -lsocket -ldevinfo -ldhcputil \ - -linetutil -lc -lsunw_crypto -lsunw_ssl + -linetutil -lc + +# libcrypto and libssl have no lint library, so we can only use it when +# building +$(DYNLIB) := LDLIBS += -lsunw_crypto -lsunw_ssl + CPPFLAGS = -I$(SRC)/common/net/wanboot/crypt $(CPPFLAGS.master) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com b/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com index 7345ddc892..e8433d8087 100644 --- a/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com +++ b/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com @@ -73,7 +73,12 @@ TSSLIB=-L$(TSPILIBDIR) TSSLIB64=-L$(TSPILIBDIR)/$(MACH64) TSSINC=-I$(TSPIINCDIR) -LDLIBS += $(TSSLIB) -L$(ADJUNCT_PROTO)/lib -lc -luuid -lmd -ltspi -lsunw_crypto +LDLIBS += $(TSSLIB) -L$(ADJUNCT_PROTO)/lib -lc -luuid -lmd -ltspi + +# libcrypto has no lint library, so we can only use it when +# building +$(LIBS) := LDLIBS += -lsunw_crypto + CPPFLAGS += -xCC -D_POSIX_PTHREAD_SEMANTICS $(TSSINC) CPPFLAGS64 += $(CPPFLAGS) C99MODE= $(C99_ENABLE) diff --git a/usr/src/pkg/manifests/system-test-utiltest.mf b/usr/src/pkg/manifests/system-test-utiltest.mf index 54ec7dcc29..5ccc2647d1 100644 --- a/usr/src/pkg/manifests/system-test-utiltest.mf +++ b/usr/src/pkg/manifests/system-test-utiltest.mf @@ -28,5 +28,6 @@ file path=opt/util-tests/README mode=0444 file path=opt/util-tests/bin/utiltest mode=0555 file path=opt/util-tests/runfiles/default.run mode=0444 file path=opt/util-tests/tests/printf_test mode=0555 +file path=opt/util-tests/tests/xargs_test mode=0555 license lic_CDDL license=lic_CDDL depend fmri=system/test/testrunner type=require diff --git a/usr/src/test/util-tests/runfiles/default.run b/usr/src/test/util-tests/runfiles/default.run index 3122bb6640..d78cdbf77b 100644 --- a/usr/src/test/util-tests/runfiles/default.run +++ b/usr/src/test/util-tests/runfiles/default.run @@ -25,3 +25,4 @@ outputdir = /var/tmp/test_results [/opt/util-tests/tests/printf_test] [/opt/util-tests/tests/allowed-ips] +[/opt/util-tests/tests/xargs_test] diff --git a/usr/src/test/util-tests/tests/Makefile b/usr/src/test/util-tests/tests/Makefile index 86d9e01fc8..892b9ce57c 100644 --- a/usr/src/test/util-tests/tests/Makefile +++ b/usr/src/test/util-tests/tests/Makefile @@ -14,6 +14,6 @@ # Copyright 2014 Garrett D'Amore <garrett@damore.org> # -SUBDIRS = dladm printf +SUBDIRS = dladm printf xargs include $(SRC)/test/Makefile.com diff --git a/usr/src/test/util-tests/tests/xargs/Makefile b/usr/src/test/util-tests/tests/xargs/Makefile new file mode 100644 index 0000000000..cf89660f75 --- /dev/null +++ b/usr/src/test/util-tests/tests/xargs/Makefile @@ -0,0 +1,38 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# Copyright 2014 Garrett D'Amore <garrett@damore.org> +# + +include $(SRC)/cmd/Makefile.cmd +include $(SRC)/test/Makefile.com + +PROG = xargs_test + +ROOTOPTPKG = $(ROOT)/opt/util-tests +TESTDIR = $(ROOTOPTPKG)/tests + +CMDS = $(PROG:%=$(TESTDIR)/%) +$(CMDS) := FILEMODE = 0555 + +all lint clean clobber: + +install: all $(CMDS) + +$(CMDS): $(TESTDIR) $(PROG).ksh + +$(TESTDIR): + $(INS.dir) + +$(TESTDIR)/%: %.ksh + $(INS.rename) diff --git a/usr/src/test/util-tests/tests/xargs/xargs_test.ksh b/usr/src/test/util-tests/tests/xargs/xargs_test.ksh new file mode 100644 index 0000000000..2d6f76ce10 --- /dev/null +++ b/usr/src/test/util-tests/tests/xargs/xargs_test.ksh @@ -0,0 +1,262 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2014 Garrett D'Amore <garrett@damore.org> +# + +XARGS=${XARGS:=/usr/bin/xargs} + +test_start() { + print "TEST STARTING ${1}: ${2}" +} + +test_pass() { + print "TEST PASS: ${1}" +} + +test_fail() { + print "TEST FAIL: ${1}: ${2}" + exit -1 +} + +checkrv() { + if [[ $? -ne 0 ]]; then + test_fail $1 "exit failure" + fi +} + +compare() { + if [[ "$2" != "$3" ]]; then + test_fail $1 "compare mismatch, got [$2] expected [$3]" + fi +} + +test1() { + t=test1 + test_start $t "-I handling" + comp=$(echo foo bar baz other | $XARGS -I THING echo '** THING **') + checkrv $t + good='** foo bar baz other **' + compare $t "$comp" "$good" + test_pass $t +} + +test2() { + t=test2 + test_start $t "-n 1 handling" + comp=$(echo foo bar baz other | $XARGS -n 1 echo '***') + checkrv $t + good='*** foo +*** bar +*** baz +*** other' + compare $t "$comp" "$good" + test_pass $t +} + +test3() { + t=test3 + test_start $t "-I before -n 1" + comp=$(echo foo bar baz other | $XARGS -I THING -n1 echo '** THING **') + checkrv $t + good='** THING ** foo +** THING ** bar +** THING ** baz +** THING ** other' + compare $t "$comp" "$good" + test_pass $t +} + +test4() { + t=test4 + test_start $t "-n 1 before -I" + comp=$(echo foo bar baz other | $XARGS -n 1 -I THING echo '** THING **') + checkrv $t + good='** foo bar baz other **' + compare $t "$comp" "$good" + test_pass $t +} + +test5() { + t=test5 + test_start $t "-i multiple lines handling" + comp=$(printf "abc def\nxyz\n123" | $XARGS -n1 -i echo '[{}]') + checkrv $t + good='[abc def] +[xyz] +[123]' + compare $t "$comp" "$good" + test_pass $t +} + +test6() { + t=test6 + test_start $t "-E handling" + comp=$(printf "abc def xyx\n_\n123\nnope" | $XARGS -edef echo) + checkrv $t + good='abc' + compare $t "$comp" "$good" + test_pass $t +} + +test7() { + t=test7 + test_start $t "newlines in arguments" + comp=$(printf "abc def\nxyz\n\n123 456\n789" | $XARGS echo) + checkrv $t + good='abc def xyz 123 456 789' + compare $t "$comp" "$good" + test_pass $t +} + +test8() { + t=test8 + test_start $t "limited counts via -n3" + comp=$(printf "abc def ghi jkl mno 123 456 789" | $XARGS -n 3 echo '**' ) + checkrv $t + good='** abc def ghi +** jkl mno 123 +** 456 789' + compare $t "$comp" "$good" + test_pass $t +} + +test9() { + t=test9 + test_start $t "multiple lines via -L2" + comp=$(printf "abc def\n123 456\npeterpiper" | $XARGS -L2 echo '**') + checkrv $t + good='** abc def 123 456 +** peterpiper' + compare $t "$comp" "$good" + test_pass $t +} + +test10() { + t=test10 + test_start $t "argument sizes" + comp=$(printf "abc def 123 456 peter alpha\n" | $XARGS -s15 echo) + checkrv $t + good='abc def +123 456 +peter +alpha' + compare $t "$comp" "$good" + test_pass $t +} + +test11() { + t=test11 + test_start $t "bare -e" + comp=$(printf "abc def _ end of string" | $XARGS -e echo '**') + checkrv $t + good='** abc def _ end of string' + compare $t "$comp" "$good" + test_pass $t +} + +test12() { + t=test12 + test_start $t "-E ''" + comp=$(printf "abc def _ end of string" | $XARGS -E '' echo '**') + checkrv $t + good='** abc def _ end of string' + compare $t "$comp" "$good" + test_pass $t +} + +test13() { + t=test13 + test_start $t "end of string (no -E or -e)" + comp=$(printf "abc def _ end of string" | $XARGS echo '**') + checkrv $t + good='** abc def' + compare $t "$comp" "$good" + test_pass $t +} + +test14() { + t=test14 + test_start $t "trailing blank with -L" + comp=$(printf "abc def \n123 456\npeter\nbogus" | $XARGS -L2 echo '**') + checkrv $t + good='** abc def 123 456 peter +** bogus' + compare $t "$comp" "$good" + test_pass $t +} + +test15() { + t=test15 + test_start $t "leading and embedded blanks with -i" + comp=$(printf "abc def\n xyz bogus\nnext" | $XARGS -i echo '** {}') + checkrv $t + good='** abc def +** xyz bogus +** next' + compare $t "$comp" "$good" + test_pass $t +} + +test16() { + t=test16 + test_start $t "single character replstring" + comp=$(echo foo bar baz other | $XARGS -I X echo '** X **') + checkrv $t + good='** foo bar baz other **' + compare $t "$comp" "$good" + test_pass $t +} + +test17() { + t=test17 + test_start $t "null byte separators" + comp=$(print 'foo bar baz\000more data' | $XARGS -n1 -0 echo '**') + checkrv $t + good='** foo bar baz +** more data' + compare $t "$comp" "$good" + test_pass $t +} + +test18() { + t=test18 + test_start $t "escape characters" + comp=$(printf 'foo\\ bar second" "arg third' | $XARGS -n1 echo '**') + checkrv $t + good='** foo bar +** second arg +** third' + compare $t "$comp" "$good" + test_pass $t +} + +test1 +test2 +test3 +test4 +test5 +test6 +test7 +test8 +test9 +test10 +test11 +test12 +test13 +test14 +test15 +test16 +test17 +test18 diff --git a/usr/src/uts/common/fs/zfs/metaslab.c b/usr/src/uts/common/fs/zfs/metaslab.c index 6229bfced4..d2193a67b1 100644 --- a/usr/src/uts/common/fs/zfs/metaslab.c +++ b/usr/src/uts/common/fs/zfs/metaslab.c @@ -326,7 +326,7 @@ metaslab_group_create(metaslab_class_t *mc, vdev_t *vd) mg->mg_class = mc; mg->mg_activation_count = 0; - mg->mg_taskq = taskq_create("metaslab_group_tasksq", metaslab_load_pct, + mg->mg_taskq = taskq_create("metaslab_group_taskq", metaslab_load_pct, minclsyspri, 10, INT_MAX, TASKQ_THREADS_CPU_PCT); return (mg); @@ -344,6 +344,7 @@ metaslab_group_destroy(metaslab_group_t *mg) */ ASSERT(mg->mg_activation_count <= 0); + taskq_destroy(mg->mg_taskq); avl_destroy(&mg->mg_metaslab_tree); mutex_destroy(&mg->mg_lock); kmem_free(mg, sizeof (metaslab_group_t)); |