Skip to content

Commit

Permalink
Merge branch 'opa334:2.x' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
wwg135 authored May 7, 2024
2 parents 3918347 + 086c20b commit b931840
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Application/Dopamine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2237,7 +2237,7 @@
"$(PROJECT_DIR)/Dopamine/Dependencies",
"$(PROJECT_DIR)/Dopamine/Resources",
);
MARKETING_VERSION = 2.1.3;
MARKETING_VERSION = 2.1.4;
PRODUCT_BUNDLE_IDENTIFIER = com.opa334.Dopamine;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -2274,7 +2274,7 @@
"$(PROJECT_DIR)/Dopamine/Dependencies",
"$(PROJECT_DIR)/Dopamine/Resources",
);
MARKETING_VERSION = 2.1.3;
MARKETING_VERSION = 2.1.4;
PRODUCT_BUNDLE_IDENTIFIER = com.opa334.Dopamine;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
2 changes: 1 addition & 1 deletion BaseBin/_external/basebin/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.3
2.1.4
44 changes: 31 additions & 13 deletions BaseBin/libjailbreak/src/util.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,19 @@
}
}

void JBFixMobilePermissions(void)
void _JBFixMobilePermissionsOfDirectory(NSString *directoryPath, BOOL recursive)
{
@autoreleasepool {
struct stat s;
struct stat s;
NSURL *directoryURL = [NSURL fileURLWithPath:directoryPath];

// Anything in /var/mobile should owned by mobile...
// For some reason some packages seem to fuck this up, so we automatically fix it every userspace reboot and on rejailbreak
NSString *mobilePath = NSJBRootPath(@"/var/mobile");
NSURL *mobileURL = [NSURL fileURLWithPath:mobilePath];

if (stat(mobileURL.fileSystemRepresentation, &s) == 0) {
if (s.st_uid != 501 || s.st_gid != 501) {
chown(mobileURL.fileSystemRepresentation, 501, 501);
}
if (stat(directoryURL.fileSystemRepresentation, &s) == 0) {
if (s.st_uid != 501 || s.st_gid != 501) {
chown(directoryURL.fileSystemRepresentation, 501, 501);
}
}

NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:mobileURL includingPropertiesForKeys:nil options:0 errorHandler:nil];
if (recursive) {
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:directoryURL includingPropertiesForKeys:nil options:0 errorHandler:nil];
for (NSURL *fileURL in enumerator) {
if (stat(fileURL.fileSystemRepresentation, &s) == 0) {
if (s.st_uid != 501 || s.st_gid != 501) {
Expand All @@ -42,4 +38,26 @@ void JBFixMobilePermissions(void)
}
}
}
}

void JBFixMobilePermissions(void)
{
@autoreleasepool {
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:NSJBRootPath(@"/var") error:nil];
if ([attributes[NSFileType] isEqualToString:NSFileTypeSymbolicLink]) {
// /var/jb/var is a symlink, abort
return;
}
attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:NSJBRootPath(@"/var/mobile") error:nil];
if ([attributes[NSFileType] isEqualToString:NSFileTypeSymbolicLink]) {
// /var/jb/var/mobile is a symlink, abort
return;
}

_JBFixMobilePermissionsOfDirectory(NSJBRootPath(@"/var/mobile"), NO);
_JBFixMobilePermissionsOfDirectory(NSJBRootPath(@"/var/mobile/Library"), NO);
_JBFixMobilePermissionsOfDirectory(NSJBRootPath(@"/var/mobile/Library/SplashBoard"), YES);
_JBFixMobilePermissionsOfDirectory(NSJBRootPath(@"/var/mobile/Library/Application Support"), YES);
_JBFixMobilePermissionsOfDirectory(NSJBRootPath(@"/var/mobile/Library/Preferences"), YES);
}
}

0 comments on commit b931840

Please sign in to comment.