Date: Wed, 21 Dec 2011 21:09:40 +0100 (CET) From: "Walter C. Pelissero" <walter.pelissero@iesy.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/163515: b64encode/uuencode create files with no permissions Message-ID: <201112212009.pBLK9e6h016976@scylla.home.lan> Resent-Message-ID: <201112212030.pBLKUA5Z083115@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 163515 >Category: bin >Synopsis: b64encode/uuencode create files with no permissions >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 21 20:30:09 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Walter C. Pelissero >Release: FreeBSD 8.2-STABLE amd64 >Organization: >Environment: System: FreeBSD scylla.home.lan 8.2-STABLE FreeBSD 8.2-STABLE #0: Wed Nov 30 12:39:31 CET 2011 root@scylla.home.lan:/usr/obj/usr/src/sys/GA870AUD3 amd64 >Description: b64encode when called with just one argument (input from stdin), but specifying an output file with the -o option, creates the file with mode 000 (that is, none is allowed to do anything with it). Same behaviour is assumed from uuencode, being the same executable. >How-To-Repeat: b64encode -o file.encoded file < /dev/null >Fix: Apply the following patch: Index: uuencode.c =================================================================== RCS file: /repos/src/usr.bin/uuencode/uuencode.c,v retrieving revision 1.18.30.1 diff -c -r1.18.30.1 uuencode.c *** uuencode.c 3 Aug 2009 08:13:06 -0000 1.18.30.1 --- uuencode.c 21 Dec 2011 19:55:49 -0000 *************** *** 110,118 **** mode = sb.st_mode & RWX; ++argv; break; ! case 1: #define RW (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) ! mode = RW & ~umask(RW); break; case 0: default: --- 110,121 ---- mode = sb.st_mode & RWX; ++argv; break; ! case 1: { #define RW (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) ! int om = umask(0); ! mode = RW & ~om; ! umask(om); /* restore the umask */ ! } break; case 0: default: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112212009.pBLK9e6h016976>