[107551] trunk/base/src/darwintracelib1.0/darwintrace.c

cal at macports.org cal at macports.org
Tue Jul 2 17:01:48 PDT 2013


Revision: 107551
          https://trac.macports.org/changeset/107551
Author:   cal at macports.org
Date:     2013-07-02 17:01:48 -0700 (Tue, 02 Jul 2013)
Log Message:
-----------
darwintrace: fix disabling the sandbox, continue searching if dependency check fails

Disabling the sandbox means the filemap contains a single entry allowing '/'.
This previously failed with the new __dt_pathbeginswith function.

If a dependency check previously failed, the file was considered inaccessible.
However, there might be situations, where the filemap contains further entries
allowing access.

Modified Paths:
--------------
    trunk/base/src/darwintracelib1.0/darwintrace.c

Modified: trunk/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- trunk/base/src/darwintracelib1.0/darwintrace.c	2013-07-02 23:59:46 UTC (rev 107550)
+++ trunk/base/src/darwintracelib1.0/darwintrace.c	2013-07-03 00:01:48 UTC (rev 107551)
@@ -197,6 +197,12 @@
 static inline int __darwintrace_pathbeginswith(const char* str, const char* prefix) {
 	char s;
 	char p;
+
+	// '/' is the allow all wildcard
+	if (strcmp(prefix, "/") == 0) {
+		return 1;
+	}
+
 	do {
 		s = *str++;
 		p = *prefix++;
@@ -801,8 +807,8 @@
 					if (ask_for_dependency(normalizedpath)) {
 						return 1;
 					} else {
-						__darwintrace_log_op("sandbox_violation", normalizedpath, 0);
-						return 0;
+						/* try to find another entry allowing this access */
+						continue;
 					}
 				default:
 					fprintf(stderr, "darwintrace: error: unexpected byte in file map: `%x'\n", *t);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130702/681810b5/attachment.html>


More information about the macports-changes mailing list