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	Thu Apr 29 11:14:13 2021
+++ b/fingerd.c	Thu Apr 29 11:28:39 2021
@@ -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,14 +128,24 @@
 
 	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--;
 	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){