From 32991bedc3a6475f1401855c2318ae5b15f8a16b Mon Sep 17 00:00:00 2001 From: Peter Tribble Date: Mon, 13 Mar 2017 20:25:34 +0000 Subject: 5188 SVR4 packaging shouldn't depend on openssl or libwanboot Reviewed by: Igor Kozhukhov Reviewed by: Alexander Eremin Approved by: Gordon Ross --- usr/src/lib/libpkg/common/dstream.c | 89 ++----------------------------------- 1 file changed, 4 insertions(+), 85 deletions(-) (limited to 'usr/src/lib/libpkg/common/dstream.c') diff --git a/usr/src/lib/libpkg/common/dstream.c b/usr/src/lib/libpkg/common/dstream.c index 38ca430614..6622b74361 100644 --- a/usr/src/lib/libpkg/common/dstream.c +++ b/usr/src/lib/libpkg/common/dstream.c @@ -19,6 +19,10 @@ * CDDL HEADER END */ +/* + * Copyright (c) 2017 Peter Tribble. + */ + /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -42,7 +46,6 @@ #include #include #include -#include #include "pkglib.h" #include "pkglibmsgs.h" #include "pkglocale.h" @@ -135,7 +138,6 @@ ds_order(char *list[]) static char *pds_header; static char *ds_header; -static char *ds_header_raw; static int ds_headsize; static char * @@ -421,15 +423,6 @@ ds_init(char *device, char **pkg, char *norewind) pds_header = ds_header; - /* save raw copy of header for later use in BIO_dump_header */ - if ((ds_header_raw = (char *)malloc(header_size)) == NULL) { - progerr(pkg_gt(ERR_UNPACK)); - logerr(pkg_gt(MSG_MEM)); - (void) ds_close(0); - return (1); - } - (void) memcpy(ds_header_raw, ds_header, header_size); - /* read datastream table of contents */ ds_head = tail = (struct dstoc *)0; ds_volcnt = 1; @@ -491,16 +484,9 @@ ds_init(char *device, char **pkg, char *norewind) } (void) strlcat(cmd, pkg[i], CMDSIZ); (void) strlcat(cmd, "'/*' ", CMDSIZ); - - /* extract signature too, if present. */ - (void) strlcat(cmd, SIGNATURE_FILENAME, CMDSIZ); (void) strlcat(cmd, " ", CMDSIZ); } - /* - * if we are extracting all packages (pkgs == NULL), - * signature will automatically be extracted - */ if (n = esystem(cmd, ds_fd, -1)) { rpterr(); progerr(pkg_gt(ERR_UNPACK)); @@ -717,73 +703,6 @@ ds_next(char *device, char *instdir) /*NOTREACHED*/ } -/* - * Name: BIO_ds_dump - * Description: Dumps all data from the static 'ds_fd' file handle into - * the supplied BIO. - * - * Arguments: err - where to record any errors. - * device - Description of device being dumped into, - * for error reporting - * bio - BIO object to dump data into - * - * Returns : zero - successfully dumped all data to EOF - * non-zero - some failure occurred. - */ -int -BIO_ds_dump(PKG_ERR *err, char *device, BIO *bio) -{ - int amtread; - char readbuf[BLK_SIZE]; - - /* - * note this will read to the end of the device, so it won't - * work for character devices since we don't know when the - * end of the CPIO archive is - */ - while ((amtread = read(ds_fd, readbuf, BLK_SIZE)) != 0) { - if (BIO_write(bio, readbuf, amtread) != amtread) { - pkgerr_add(err, PKGERR_WRITE, ERR_WRITE, device, - ERR_error_string(ERR_get_error(), NULL)); - return (1); - } - } - - return (0); - /*NOTREACHED*/ -} - - -/* - * Name: BIO_ds_dump_header - * Description: Dumps all ds_headsize bytes from the - * static 'ds_header_raw' character array - * to the supplied BIO. - * - * Arguments: err - where to record any errors. - * bio - BIO object to dump data into - * - * Returns : zero - successfully dumped all raw - * header characters - * non-zero - some failure occurred. - */ -int -BIO_ds_dump_header(PKG_ERR *err, BIO *bio) -{ - - char zeros[BLK_SIZE]; - - (void) memset(zeros, 0, BLK_SIZE); - - if (BIO_write(bio, ds_header_raw, ds_headsize) != ds_headsize) { - pkgerr_add(err, PKGERR_WRITE, ERR_WRITE, "bio", - ERR_error_string(ERR_get_error(), NULL)); - return (1); - } - - return (0); -} - /* * ds_ginit: Determine the device being accessed, set the buffer size, * and perform any device specific initialization. -- cgit v1.2.3