From 24b9b564be7938eb74faaefaf78eda4637ee0da3 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 25 Jun 2015 23:31:19 -0700 Subject: [PATCH] Isolate stash directory from codesign validation. --- libuicache.mm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libuicache.mm b/libuicache.mm index 800beb9..0e107f4 100644 --- a/libuicache.mm +++ b/libuicache.mm @@ -12,9 +12,19 @@ static NSArray *(*_MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$e static NSArray *$MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(MIFileManager *self, SEL _cmd, NSURL *url, BOOL ignoring, NSError *error) { MIFileManager *manager(reinterpret_cast([$MIFileManager defaultManager])); - if (NSURL *destiny = [manager destinationOfSymbolicLinkAtURL:url error:NULL]) - url = destiny; - return _MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(self, _cmd, url, NO, error); + NSURL *destiny([manager destinationOfSymbolicLinkAtURL:url error:NULL]); + if (destiny == nil) + return _MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(self, _cmd, url, YES, error); + + NSArray *prefix([url pathComponents]); + size_t skip([[destiny pathComponents] count]); + NSMutableArray *items([NSMutableArray array]); + for (NSURL *item in _MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(self, _cmd, destiny, YES, error)) { + NSArray *components([item pathComponents]); + [items addObject:[NSURL fileURLWithPathComponents:[prefix arrayByAddingObjectsFromArray:[components subarrayWithRange:NSMakeRange(skip, [components count] - skip)]]]]; + } + + return items; } __attribute__((__constructor__)) -- 2.45.2