Skip to content

Commit

Permalink
Fix --dont-verify and enhance symlink checks
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae committed Sep 21, 2016
1 parent d3b584d commit 98f5062
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions bin/ipa-resign.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Example:
${cmd} -L # enumerate codesign identities, grab one and use it with -i
${cmd} -i AD71EB42BC289A2B9FD3C2D5C9F02D923495A23C test-app.ipa
${cmd} -i AD71EB4... -c --lipo arm64 -w -V test-app.ipa
`);
} else {
const target = (conf.s || conf.single) ? 'signFile' : 'signIPA';
Expand Down
13 changes: 11 additions & 2 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
const Applesign = require('./');

const as = new Applesign({
identity: 'A5A2C300FE2A8EAC99A9601FDAAEA811CC80586F'
/* bin/ipa-resign -L to list all available identities in your system */
identity: 'A5A2C300FE2A8EAC99A9601FDAAEA811CC80586F',
/* clone the entitlements from the mobile provisioning */
cloneEntitlements: false,
mobileProvisioning: '/tmp/embedded.mobileprovision'
});

const s = as.signIPA('/tmp/ada.ipa', onEnd)
if (process.argv.length < 3) {
console.error('Usage: example.js [path/to/ipa]');
process.exit(1);
}

const s = as.signIPA(process.argv[2], onEnd)
.on('message', (msg) => {
console.log('message', msg);
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@
]
},
"name": "applesign",
"version": "0.9.2"
"version": "1.0.0"
}
13 changes: 7 additions & 6 deletions session.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,16 @@ module.exports = class ApplesignSession {
let found = false;
walk.walkSync(appdir, (basedir, filename, stat) => {
const file = path.join(basedir, filename);
/* only walk on files. Symlinks and other special files are forbidden */
if (!fs.lstatSync(file).isFile()) {
return;
}
if (file.endsWith(exe)) {
this.emit('message', 'Executable found at ' + file);
libraries.push(file);
found = true;
return;
}
if (!fs.lstatSync(file).isFile()) {
return;
}
try {
const fd = fs.openSync(file, 'r');
let buffer = new Buffer(4);
Expand Down Expand Up @@ -531,10 +532,10 @@ module.exports = class ApplesignSession {
peek(cb);
});
};
if (this.config.dontVerify) {
return next();
}
peek(() => {
if (this.config.dontVerify) {
return next();
}
libsCopy = libs.slice(0);
const verify = (cb) => {
if (libsCopy.length === 0) {
Expand Down

0 comments on commit 98f5062

Please sign in to comment.