ref: f6ca02a2b05e03fb20cb3958c6f80dcc6e6092ee
parent: 2d06a930cc56ebbb4b6bdff969b3306a9a61c3c3
author: sirjofri <[email protected]>
date: Tue Apr 27 10:56:18 EDT 2021
fix: don't wait for \n, but \r instead (RFC)
--- a/fingerd.c
+++ b/fingerd.c
@@ -42,12 +42,12 @@
fd = open(file, OREAD);
if (fd < 0){
if (perr)
- print("File %s not Found.\n", file);
+ print("File %s not Found.\r\n", file);
return 0;
}
while ((n = read(fd, buf, BUFSIZ)) > 0)
if (write(1, buf, n) != n)
- print("Error writing data!\n");
+ print("Error writing data!\r\n");
close(fd);
return 1;
}
@@ -67,7 +67,7 @@
void
printuserinfo(char *user)
{
- print("%s\n", user);
+ print("%s\r\n", user);
}
void
@@ -78,15 +78,15 @@
int fd, n, i;
fd = open("/usr", OREAD);
if (fd < 0){
- print("Can't list users.\n");
+ print("Can't list users.\r\n");
return;
}
n = dirreadall(fd, &dirbuf);
close(fd);
if (n)
- print("User list:\n");
+ print("User list:\r\n");
else
- print("No users.\n");
+ print("No users.\r\n");
for (i = 0; i < n; i++){
path = smprint("/usr/%s/finger/finger", dirbuf[i].name);
if (vaccess(path)){
@@ -100,7 +100,7 @@
printnouser(char *user)
{
if (!cat(usernotfound, 0))
- print("User %s not found or private.\n", user);
+ print("User %s not found or private.\r\n", user);
}
void
@@ -107,7 +107,7 @@
printnofile(char *file)
{
if (!cat(usernotfound, 0))
- print("File %s not found.\n", file);
+ print("File %s not found.\r\n", file);
}
void
@@ -124,7 +124,7 @@
} ARGEND
bin = Bfdopen(0, OREAD);
- req = Brdline(bin, '\n');
+ req = Brdline(bin, '\r');
if (req == nil)
sysfatal("bad read: %r");
n = Blinelen(bin);
@@ -133,7 +133,7 @@
switch(n){
case 1: /* server request */
if (!cat(motd, 0))
- print("motd not found.\n");
+ print("motd not found.\r\n");
if (puserlist)
printuserlist();
break;