aboutsummaryrefslogtreecommitdiffstats
path: root/src/libexec/peereid.c
diff options
context:
space:
mode:
authorepochqwert <epoch@53flpnlls43fcguy.onion>2015-02-06 04:41:43 -0600
committerepochqwert <epoch@53flpnlls43fcguy.onion>2015-02-06 04:41:43 -0600
commitaf42bb47f92b772411cd4235c850caa0ac988a10 (patch)
treed554c838af5c6aeb1b66261e1347481571462824 /src/libexec/peereid.c
parent3c2d290d17b739f14774dfcdf48581c1fb212286 (diff)
downloadmisc-af42bb47f92b772411cd4235c850caa0ac988a10.tar.gz
misc-af42bb47f92b772411cd4235c850caa0ac988a10.zip
ident.sh got a format string vuln fix.
ident_service.sh will ident a service given its remote IP and port. (only run if ident is running on that remote computer) argc is just because I always forget what argc is for however many args. peereid is for unix sockets' ids peerip and sockip got the same upgrade. can now use the optional argv[1] to set the number of the file descriptor to use.
Diffstat (limited to 'src/libexec/peereid.c')
-rw-r--r--src/libexec/peereid.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libexec/peereid.c b/src/libexec/peereid.c
new file mode 100644
index 0000000..e2e5c5f
--- /dev/null
+++ b/src/libexec/peereid.c
@@ -0,0 +1,12 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+int main(int argc,char *argv[]) {
+ uid_t euid;
+ gid_t egid;
+ if(getpeereid(argc>1?atoi(argv[1]):0,&euid,&egid) == -1) return 1;
+ printf("%d\n%d\n",euid,egid);
+ return 0;
+}