From 612926651db0c13fa9f45f58764b56ab132b211c Mon Sep 17 00:00:00 2001 From: Epoch Qwert Date: Tue, 9 Dec 2014 03:27:26 -0600 Subject: 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. --- src/libexec/httpd.c | 2 +- src/libexec/peerip.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3