Skip to content

Instantly share code, notes, and snippets.

@tommybutler
Created October 14, 2013 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommybutler/6970628 to your computer and use it in GitHub Desktop.
Save tommybutler/6970628 to your computer and use it in GitHub Desktop.
Patch that makes suid binaries possible for App::PAR::Packer (pp), version 1.015 It will not work if you build it with the -c or --clean option when invoking pp. Crypto filters are still in bounds though and work well. My pp helper build script is below. You don't have to use it; it just makes things easier. Substitute filenames as desired. #!/b…
Binary files PAR-Packer-1.015/a.out and PAR-Packer-1.015-patched-for-suid/a.out differ
diff -ruN PAR-Packer-1.015/myldr/boot.c PAR-Packer-1.015-patched-for-suid/myldr/boot.c
--- PAR-Packer-1.015/myldr/boot.c 2013-10-13 23:04:49.243648696 -0500
+++ PAR-Packer-1.015-patched-for-suid/myldr/boot.c 2013-10-12 20:18:12.000000000 -0500
@@ -135,7 +135,7 @@
stmpdir = par_mktmpdir( argv );
if ( !stmpdir ) DIE; /* error message has already been printed */
- rc = my_mkdir(stmpdir, 0700);
+ rc = my_mkdir(stmpdir, 0777);
if ( rc == -1 && errno != EEXIST) {
fprintf(stderr, "%s: creation of private cache subdirectory %s failed (errno= %i)\n",
argv[0], stmpdir, errno);
diff -ruN PAR-Packer-1.015/myldr/internals.c PAR-Packer-1.015-patched-for-suid/myldr/internals.c
--- PAR-Packer-1.015/myldr/internals.c 2013-10-13 23:03:44.479650430 -0500
+++ PAR-Packer-1.015-patched-for-suid/myldr/internals.c 2013-10-12 20:17:53.000000000 -0500
@@ -114,7 +114,7 @@
return;
#endif
}
- i = PerlDir_mkdir(stmpdir, 0700);
+ i = PerlDir_mkdir(stmpdir, 0777);
if ( (i != 0) && (i != EEXIST) && (i != -1) ) {
croak("%s: creation of private cache subdirectory %s failed (errno=%i)\n",
fakeargv[0], stmpdir, i);
diff -ruN PAR-Packer-1.015/myldr/mktmpdir.c PAR-Packer-1.015-patched-for-suid/myldr/mktmpdir.c
--- PAR-Packer-1.015/myldr/mktmpdir.c 2013-10-13 23:04:01.619649971 -0500
+++ PAR-Packer-1.015-patched-for-suid/myldr/mktmpdir.c 2013-10-12 20:16:29.000000000 -0500
@@ -44,7 +44,7 @@
return par_lstat(val, &PL_statbuf) == 0 &&
S_ISDIR(PL_statbuf.st_mode) &&
PL_statbuf.st_uid == getuid() &&
- (PL_statbuf.st_mode & 0777) == 0700;
+ (PL_statbuf.st_mode & 0777) == 0777;
}
#endif
@@ -182,17 +182,18 @@
_mkdir(top_tmpdir); /* FIXME bail if error (other than EEXIST) */
#else
{
- if (mkdir(top_tmpdir, 0700) == -1 && errno != EEXIST) {
+ if (mkdir(top_tmpdir, 0777) == -1 && errno != EEXIST) {
fprintf(stderr, "%s: creation of private subdirectory %s failed (errno=%i)\n",
argv[0], top_tmpdir, errno);
return NULL;
}
-
+/*
if (!isSafeDir(top_tmpdir)) {
fprintf(stderr, "%s: private subdirectory %s is unsafe (please remove it and retry your operation)\n",
argv[0], top_tmpdir);
return NULL;
}
+*/
}
#endif
@@ -282,7 +283,7 @@
a prior invocation crashed leaving garbage in a temp directory that
might interfere. */
- while (my_mkdir(stmpdir, 0700) == -1 && errno == EEXIST) {
+ while (my_mkdir(stmpdir, 0777) == -1 && errno == EEXIST) {
sprintf(
stmpdir,
"%s%stemp-%u-%u%s",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment