shithub: fingerd

Download patch

ref: e36ece0f555d55a9ee79ef64a582cd093c41ab2b
parent: 5c1eb502a15d76a93a0600b57fb50a53e320790b
author: sirjofri <sirjofri@sirjofri.de>
date: Thu Apr 29 11:28:39 EDT 2021

adds namespace.finger support (untested)

--- a/fingerd.c
+++ b/fingerd.c
@@ -1,9 +1,12 @@
 #include <u.h>
 #include <libc.h>
+#include <auth.h>
 #include <bio.h>
 
 #define BUFSIZ 8192
+#define LOG "fingerd"
 
+char *nsfile = "/lib/namespace.finger";
 char *usernotfound = "/lib/finger/usernotfound";
 char *filenotfound = "/lib/finger/filenotfound";
 char *motd = "/lib/finger/motd";
@@ -21,7 +24,7 @@
 		return 0;
 	}
 	close(fd);
-	return -1;
+	return 1;
 }
 
 void
@@ -125,8 +128,10 @@
 
 	bin = Bfdopen(0, OREAD);
 	req = Brdline(bin, '\n');
-	if (req == nil)
+	if (req == nil){
+		syslog(1, LOG, "bad read: %r");
 		sysfatal("bad read: %r");
+	}
 	n = Blinelen(bin);
 	req[n-1] = 0;
 	n--;
@@ -133,6 +138,14 @@
 	if (req[n-1] == '\r'){
 		req[n-1] = 0;
 		n--;
+	}
+
+	if (vaccess(nsfile)){
+		if (addns("none", nsfile) < 0){
+			print("internal error.\r\n");
+			syslog(1, LOG, "addns failed: %r");
+			sysfatal("addns failed: %r");
+		}
 	}
 
 	switch(n){