aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicholas Jones <carpaski@gentoo.org>2004-08-02 18:49:31 +0000
committerNicholas Jones <carpaski@gentoo.org>2004-08-02 18:49:31 +0000
commit5d4e95342ff095a74ad291725d985e6fae4c4c49 (patch)
tree2cf4f64c8891101781b9fecfc8e0fc9d1ab77c4a /src
parentbin/emerge: Added code to skip directory in info dir. (#59138) (diff)
downloadportage-cvs-5d4e95342ff095a74ad291725d985e6fae4c4c49.tar.gz
portage-cvs-5d4e95342ff095a74ad291725d985e6fae4c4c49.tar.bz2
portage-cvs-5d4e95342ff095a74ad291725d985e6fae4c4c49.zip
Cleanups, typo fixes, extra info output, binary altroot fix, bad mirror
message. portage-2.0.51_pre14
Diffstat (limited to 'src')
-rw-r--r--src/sandbox-1.1/ChangeLog26
-rw-r--r--src/sandbox-1.1/libsandbox.c7
-rw-r--r--src/tbz2tool.c46
3 files changed, 42 insertions, 37 deletions
diff --git a/src/sandbox-1.1/ChangeLog b/src/sandbox-1.1/ChangeLog
index 6f64b35..dd33423 100644
--- a/src/sandbox-1.1/ChangeLog
+++ b/src/sandbox-1.1/ChangeLog
@@ -1,16 +1,20 @@
# ChangeLog for Path Sandbox
# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/ChangeLog,v 1.35 2004/04/12 00:27:51 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/ChangeLog,v 1.36 2004/08/02 18:49:31 carpaski Exp $
+
+ 02 Aug 2004; Nicholas Jones <carpaski@gentoo.org> libsandbox.c: Code from
+ Seth Robertson that tracked down all adjuct flags for read operations that
+ do not invoke a write operation.
04 Apr 2004; Nicholas Jones <carpaski@gentoo.org> libsandbox.c, sandbox.c:
- Another fix from jstubbs regarding a free() on a stack variable for the
- environment -- tracking now prevents extraneous free()'s segfault.
-
+ Another fix from jstubbs regarding a free() on a stack variable for the
+ environment -- tracking now prevents extraneous free()'s segfault.
+
04 Apr 2004; Nicholas Jones <carpaski@gentoo.org> libsandbox.c, sandbox.c:
- J. Stubbs tracked down a new bug where mkdir was failing to the patch on
- the lstat in mkdir... it now only returns 0 or -1 as documented for mkdir.
- Also remove the errno = ESUCCESS settings as documentation points out that
- a library isn't allowed to do that.
+ J. Stubbs tracked down a new bug where mkdir was failing to the patch on
+ the lstat in mkdir... it now only returns 0 or -1 as documented for mkdir.
+ Also remove the errno = ESUCCESS settings as documentation points out that
+ a library isn't allowed to do that.
04 Apr 2004; Nicholas Jones <carpaski@gentoo.org> libsandbox.c: Added a
file_security_check() function to check random potential exploits on files
@@ -36,11 +40,11 @@
execve, so pass our own copy of the environment. Bug #42290.
11 Jan 2004; Nicholas Jones <carpaski@gentoo.org> create-decls:
- Changed tail to head and added a notice about duration of glibc check.
+ Changed tail to head and added a notice about duration of glibc check.
21 Dec 2003; Nicholas Jones <carpaski@gentoo.org> create-decls:
- Changed the glibc subversion check to use /usr/bin/* instead of /bin/sh
- as there isn't a guarentee that it is dynamic.
+ Changed the glibc subversion check to use /usr/bin/* instead of /bin/sh
+ as there isn't a guarentee that it is dynamic.
02 Nov 2003; Martin Schlemmer <azarah@gentoo.org> libsandbox.c :
If 'file' passed to before_syscall(const char *func, const char *file) is
diff --git a/src/sandbox-1.1/libsandbox.c b/src/sandbox-1.1/libsandbox.c
index d0d0633..77f64bd 100644
--- a/src/sandbox-1.1/libsandbox.c
+++ b/src/sandbox-1.1/libsandbox.c
@@ -25,7 +25,7 @@
* as some of the InstallWatch code was used.
*
*
- * $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/libsandbox.c,v 1.20 2004/07/24 04:09:36 jstubbs Exp $
+ * $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/libsandbox.c,v 1.21 2004/08/02 18:49:31 carpaski Exp $
*
*/
@@ -1351,8 +1351,9 @@ before_syscall_open_int(const char *func, const char *file, int flags)
static int
before_syscall_open_char(const char *func, const char *file, const char *mode)
{
- if ((strcmp(mode, "r") == 0) || (strcmp(mode, "rb") == 0)
- || (strcmp(mode, "rm") == 0)) {
+ if (*mode == 'r' && ((strcmp(mode, "r") == 0) ||
+ /* The strspn accept args are known non-writable modifiers */
+ (strlen(++mode) == strspn(mode, "xbtmc")))) {
return before_syscall("open_rd", file);
} else {
return before_syscall("open_wr", file);
diff --git a/src/tbz2tool.c b/src/tbz2tool.c
index d9b56b7..86df9a3 100644
--- a/src/tbz2tool.c
+++ b/src/tbz2tool.c
@@ -1,4 +1,4 @@
-/* $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/tbz2tool.c,v 1.2 2003/02/16 02:49:57 carpaski Exp $ */
+/* $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/tbz2tool.c,v 1.3 2004/08/02 18:49:31 carpaski Exp $ */
#include <stdio.h>
#include <sys/types.h>
@@ -36,16 +36,16 @@ void writefileto(FILE *src, FILE *dest, int endpos) {
int pos=ftell(src);
int thiscount;
while (pos < endpos) {
- //thiscount=how much to read
+ /* thiscount=how much to read */
thiscount=endpos-pos;
if (thiscount>BUFLEN)
thiscount=BUFLEN;
thiscount=fread(mybuf, 1, thiscount , src);
- //thiscount=how much we actually did read
+ /* thiscount=how much we actually did read */
if (thiscount==0)
- //eof -- shouldn't happen
+ /* eof -- shouldn't happen */
break;
- //update internal position counter
+ /* update internal position counter */
pos+=thiscount;
fwrite(mybuf, 1, thiscount, dest);
}
@@ -66,23 +66,23 @@ int main(int argc, char **argv) {
goto memalloc;
}
- //JOIN MODE
+ /* JOIN MODE */
if (!(strcmp(argv[1],"join"))) {
- //check if datafile exists
+ /* check if datafile exists */
if (!(exists(argv[2]))) {
printf("%s: %s doesn't exist\n",myname,argv[2]);
free(mystat);
goto error;
}
- //check if dbfile exists
+ /* check if dbfile exists */
if (!(exists(argv[3]))) {
printf("%s: %s doesn't exist\n",myname,argv[3]);
free(mystat);
goto error;
}
- //create end buffer for later use
+ /* create end buffer for later use */
endbuf[0]=((mystat->st_size) & 0xff000000) >> 24;
endbuf[1]=((mystat->st_size) & 0x00ff0000) >> 16;
endbuf[2]=((mystat->st_size) & 0x0000ff00) >> 8;
@@ -92,11 +92,11 @@ int main(int argc, char **argv) {
endbuf[6]='O';
endbuf[7]='P';
- //if outfile exists, unlink first (safer)
+ /* if outfile exists, unlink first (safer) */
if (exists(argv[4]))
unlink(argv[4]);
- //open datafile for reading
+ /* open datafile for reading */
if ((datafile=fopen(argv[2],"r"))==NULL) {
free(mybuf);
free(mystat);
@@ -104,7 +104,7 @@ int main(int argc, char **argv) {
goto error;
}
- //open dbfile for reading
+ /* open dbfile for reading */
if ((dbfile=fopen(argv[3],"r"))==NULL) {
fclose(datafile);
free(mybuf);
@@ -113,7 +113,7 @@ int main(int argc, char **argv) {
goto error;
}
- //open outfile for writing
+ /* open outfile for writing */
if ((outfile=fopen(argv[4],"a"))==NULL) {
fclose(dbfile);
fclose(datafile);
@@ -133,29 +133,29 @@ int main(int argc, char **argv) {
free(mystat);
exit(0);
- //SPLIT MODE
+ /* SPLIT MODE */
} else if (!(strcmp(argv[1],"split"))) {
- //check if infile exists
+ /* check if infile exists */
if (!(exists(argv[2]))) {
printf("%s: %s doesn't exist\n",myname,argv[2]);
free(mystat);
goto error;
}
- //store infile size for later use
+ /* store infile size for later use */
insize=mystat->st_size;
- //if datafile exists, unlink first (safer)
+ /* if datafile exists, unlink first (safer) */
if (exists(argv[3]))
unlink(argv[3]);
- //if dbfile exists, unlink first (safer)
+ /* if dbfile exists, unlink first (safer) */
if (exists(argv[4]))
unlink(argv[4]);
- //open infile for reading
+ /* open infile for reading */
if ((infile=fopen(argv[2],"r"))==NULL) {
free(mybuf);
free(mystat);
@@ -163,10 +163,10 @@ int main(int argc, char **argv) {
goto error;
}
- //read in end buffer
+ /* read in end buffer */
fseek(infile,-8,SEEK_END);
fread(endbuf,1,8,infile);
- //quick end buffer read and verification
+ /* quick end buffer read and verification */
if ( (endbuf[4]!='S') || (endbuf[5]!='T') || (endbuf[6]!='O') || (endbuf[7]!='P') ) {
fclose(infile);
free(mybuf);
@@ -181,7 +181,7 @@ int main(int argc, char **argv) {
seekto=seekto+endbuf[2]*256;
seekto=seekto+endbuf[3];
- //open datafile for writing
+ /* open datafile for writing */
if ((datafile=fopen(argv[3],"a"))==NULL) {
fclose(infile);
free(mybuf);
@@ -190,7 +190,7 @@ int main(int argc, char **argv) {
goto error;
}
- //open dbfile for writing
+ /* open dbfile for writing */
if ((dbfile=fopen(argv[4],"a"))==NULL) {
fclose(datafile);
fclose(infile);