Article View: comp.sources.bugs
Article #2089PAX leaves archives world writeable
From: Rob McMahon
Date: Tue, 21 Feb 1989 15:11
Date: Tue, 21 Feb 1989 15:11
62 lines
2656 bytes
2656 bytes
Pax creating an archive with a -f flag leaves the archive mode 666. It calls
umask(0) early on, storing the old umask in `mask', but doesn't use this when
creating the archive. I believe this patch fixes the problem, and also a
similar one on systems not having the mkdir system call.
Rob
RCS file: fileio.c,v
retrieving revision 1.1
diff -c -r1.1 fileio.c
*** /tmp/,RCSt1a01285 Tue Feb 21 15:04:47 1989
--- fileio.c Tue Feb 21 14:37:09 1989
***************
*** 93,101 ****
archivefd = open(ar_file, O_RDONLY | O_BINARY);
bufend = bufidx = bufstart; /* set up for initial read */
} else if (mode == AR_WRITE) {
! archivefd = open(ar_file, O_WRONLY|O_TRUNC|O_CREAT|O_BINARY, 0666);
} else if (mode == AR_APPEND) {
! archivefd = open(ar_file, O_RDWR | O_BINARY, 0666);
bufend = bufidx = bufstart; /* set up for initial read */
}
--- 93,102 ----
archivefd = open(ar_file, O_RDONLY | O_BINARY);
bufend = bufidx = bufstart; /* set up for initial read */
} else if (mode == AR_WRITE) {
! archivefd = open(ar_file, O_WRONLY|O_TRUNC|O_CREAT|O_BINARY,
! 0666 & ~mask);
} else if (mode == AR_APPEND) {
! archivefd = open(ar_file, O_RDWR | O_BINARY, 0666 & ~mask);
bufend = bufidx = bufstart; /* set up for initial read */
}
RCS file: port.c,v
retrieving revision 1.1
diff -c -r1.1 port.c
*** /tmp/,RCSt1a01291 Tue Feb 21 15:06:27 1989
--- port.c Mon Feb 20 23:07:31 1989
***************
*** 114,121 ****
case 0: /* Child process */
! status = umask(0); /* Get current umask */
! status = umask(status | (0777 & ~dmode)); /* Set for mkdir */
execl("/bin/mkdir", "mkdir", dpath, (char *) 0);
_exit(-1); /* Can't exec /bin/mkdir */
--- 114,120 ----
case 0: /* Child process */
! (void) umask(mask | (0777 & ~dmode)); /* Set for mkdir */
execl("/bin/mkdir", "mkdir", dpath, (char *) 0);
_exit(-1); /* Can't exec /bin/mkdir */
--
UUCP: ...!mcvax!ukc!warwick!cudcv PHONE: +44 203 523037
JANET: cudcv@uk.ac.warwick ARPA: cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England
Technical Details
Message-ID:
<110@titania.warwick.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!warwick!cudcvShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!warwick!cudcv From: cudcv@warwick.ac.uk (Rob McMahon) Newsgroups: comp.sources.bugs Subject: PAX leaves archives world writeable Message-ID: <110@titania.warwick.ac.uk> Date: 21 Feb 89 15:11:09 GMT Reply-To: cudcv@warwick.ac.uk (Rob McMahon) Organization: Computing Services, Warwick University, UK Lines: 62