summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2016-03-08 10:49:49 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2016-03-08 10:49:49 -0800
commitaf7a541a90f647596ccf1309d0d77925b8c5f742 (patch)
treeee20511cec3f503b608f5719ea649f32f64c9cb3
parent0193c0d3e1633676d73477d3fb2c2be319e9da1b (diff)
Verify using device and inode (not file realpath).v1.1.27
-rw-r--r--cydo.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/cydo.cpp b/cydo.cpp
index 1bc2a22..bed6198 100644
--- a/cydo.cpp
+++ b/cydo.cpp
@@ -28,6 +28,8 @@
#include <launch.h>
+#include <sys/stat.h>
+
#include <Menes/Function.h>
typedef Function<void, const char *, launch_data_t> LaunchDataIterator;
@@ -50,6 +52,12 @@ int main(int argc, char *argv[]) {
auto cydia(false);
+ struct stat correct;
+ if (lstat("/Applications/Cydia.app/Cydia", &correct) == -1) {
+ fprintf(stderr, "you have no arms left");
+ return EX_NOPERM;
+ }
+
launch_data_dict_iterate(response, [=, &cydia](const char *name, launch_data_t value) {
if (launch_data_get_type(response) != LAUNCH_DATA_DICTIONARY)
return;
@@ -92,12 +100,16 @@ int main(int argc, char *argv[]) {
if (program == NULL)
return;
- if (strcmp(program, "/Applications/Cydia.app/Cydia") == 0)
+ struct stat check;
+ if (lstat(program, &check) == -1)
+ return;
+
+ if (correct.st_dev == check.st_dev && correct.st_ino == check.st_ino)
cydia = true;
});
if (!cydia) {
- fprintf(stderr, "thou shalt not pass\n");
+ fprintf(stderr, "none shall pass\n");
return EX_NOPERM;
}