Last active
November 25, 2015 21:30
-
-
Save spheromak/6f35955856389fbe7e70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# build cap_fake if it doesn't exist | |
# | |
if [ -z "$CIRCLECI" ]; then | |
echo "Nothing to do for cap fake unless we are are on Circle" | |
exit 1 | |
fi | |
if [ -f ~/bin/set_cap_file.so ] ; then | |
echo "Cap fake lib already installed" | |
exit 1 | |
fi | |
# wheee! | |
cap_code=<<EOF | |
#include <stdio.h> | |
#include <sys/capability.h> | |
int cap_set_file(const char *path_p, cap_t cap_p) { | |
printf("*** Intercepting cap_set_file() call and returning SUCCESS ***\n"); | |
return 0; | |
} | |
EOF | |
echo $cap_code | gcc -Wall -fPIC -shared -o ~/bin/set_cap_file.so -xc - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment