Date: Tue, 2 Feb 2010 19:19:26 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 174178 for review Message-ID: <201002021919.o12JJQiv003435@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=174178 Change 174178 by rwatson@rwatson_vimage_client on 2010/02/02 19:18:45 When compressing in a sandbox, forward 'numflag' for zlib compression, asithat controls the compression level. Reported by: kris Affected files ... .. //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzip.c#9 edit .. //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzip.h#3 edit .. //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzsandbox.c#14 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzip.c#9 (text+ko) ==== @@ -186,7 +186,7 @@ static int cflag; /* stdout mode */ static int dflag; /* decompress mode */ static int lflag; /* list mode */ -static int numflag = 6; /* gzip -1..-9 value */ +int numflag = 6; /* gzip -1..-9 value */ #ifndef SMALL static int fflag; /* force mode */ ==== //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzip.h#3 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009 Robert N. M. Watson + * Copyright (c) 2009-2010 Robert N. M. Watson * All rights reserved. * * WARNING: THIS IS EXPERIMENTAL SECURITY SOFTWARE THAT MUST NOT BE RELIED @@ -34,6 +34,12 @@ #ifndef _GZIP_H_ #define _GZIP_H_ +/* + * We need to forward the global variable 'numflag' to the sandbox as well as + * function arguments. + */ +extern int numflag; + off_t gz_compress(int in, int out, off_t *gsizep, const char *origname, uint32_t mtime); off_t gz_compress_wrapper(int in, int out, off_t *gsizep, ==== //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzsandbox.c#14 (text+ko) ==== @@ -82,6 +82,7 @@ struct host_gz_compress_req { char hgc_req_origname[PATH_MAX]; + int hgc_req_numflag; uint32_t hgc_req_mtime; } __packed; @@ -103,6 +104,7 @@ bzero(&req, sizeof(req)); strlcpy(req.hgc_req_origname, origname, sizeof(req.hgc_req_origname)); + req.hgc_req_numflag = numflag; req.hgc_req_mtime = mtime; iov_req.iov_base = &req; iov_req.iov_len = sizeof(req); @@ -137,6 +139,7 @@ bcopy(buffer, &req, sizeof(req)); bzero(&rep, sizeof(rep)); + numflag = req.hgc_req_numflag; rep.hgc_rep_retval = gz_compress(fd_in, fd_out, &rep.hgc_rep_gsize, req.hgc_req_origname, req.hgc_req_mtime); iov.iov_base = &rep;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002021919.o12JJQiv003435>