diff options
author | epochqwert <epoch@53flpnlls43fcguy.onion> | 2015-02-06 04:41:43 -0600 |
---|---|---|
committer | epochqwert <epoch@53flpnlls43fcguy.onion> | 2015-02-06 04:41:43 -0600 |
commit | af42bb47f92b772411cd4235c850caa0ac988a10 (patch) | |
tree | d554c838af5c6aeb1b66261e1347481571462824 /src/libexec/sockip.c | |
parent | 3c2d290d17b739f14774dfcdf48581c1fb212286 (diff) | |
download | misc-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/sockip.c')
-rw-r--r-- | src/libexec/sockip.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libexec/sockip.c b/src/libexec/sockip.c index 542a88d..f1f0480 100644 --- a/src/libexec/sockip.c +++ b/src/libexec/sockip.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> @@ -7,7 +8,7 @@ int main(int argc,char *argv[]) { struct sockaddr_in6 sa6; unsigned int sl=sizeof(sa6); char h[NI_MAXHOST], s[NI_MAXSERV]; - if(getsockname(0,(struct sockaddr *)&sa6,&sl) == -1) return 1; + if(getsockname(argc>1?atoi(argv[1]):0,(struct sockaddr *)&sa6,&sl) == -1) return 1; if(getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),s,sizeof(s),NI_NUMERICHOST|NI_NUMERICSERV)) return 2; puts(h); puts(s); |