summaryrefslogtreecommitdiff
path: root/src/libexec
diff options
context:
space:
mode:
authorEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-12-09 03:27:26 -0600
committerEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-12-09 03:27:26 -0600
commit612926651db0c13fa9f45f58764b56ab132b211c (patch)
tree1daa3f7e1379961c092bf25b4f16ba3244dcb8f1 /src/libexec
parent06327cbeb735d3e8592df3ce6f8cc8a80b461787 (diff)
downloadmisc-612926651db0c13fa9f45f58764b56ab132b211c.tar.gz
misc-612926651db0c13fa9f45f58764b56ab132b211c.zip
ident.sh to make ident queries easier to use in scripts.
gopherd.sh changed to use new output of peerip. peerip changes to output peer's port on second line. httpd changed... I dunno what. AOEU and aoeu to help with playing with dvorak.
Diffstat (limited to 'src/libexec')
-rw-r--r--src/libexec/httpd.c2
-rw-r--r--src/libexec/peerip.c10
2 files changed, 8 insertions, 4 deletions
diff --git a/src/libexec/httpd.c b/src/libexec/httpd.c
index cd44446..22d9b2b 100644
--- a/src/libexec/httpd.c
+++ b/src/libexec/httpd.c
@@ -87,7 +87,7 @@ int main(int argc,char *argv[]) {
printf("HTTP/1.1 500 Internal Server Error\r\n");
standard_headers();
printf("Content-type: text/html\r\n\r\ncouldn't chdir(\"%s\");",SITES_ROOT);
- //wtf? not sites dir???
+ //wtf? no sites dir???
exit(2);
}
}
diff --git a/src/libexec/peerip.c b/src/libexec/peerip.c
index d35aca7..9298f87 100644
--- a/src/libexec/peerip.c
+++ b/src/libexec/peerip.c
@@ -6,8 +6,12 @@ int main(int argc,char *argv[]) {
int i;
struct sockaddr sa;
int sl=sizeof(sa);
- char host[256];
+ char h[NI_MAXHOST], s[NI_MAXSERV];
getpeername(0,&sa,&sl);
- getnameinfo(&sa,sl,host,256,0,0,NI_NUMERICHOST);
- puts(host);
+ if(getnameinfo(&sa,sl,h,sizeof(h),s,sizeof(s),NI_NUMERICHOST|NI_NUMERICSERV)) {
+ return 1;
+ }
+ puts(h);
+ puts(s);
+ return 0;
}