fingerd_bsd: "merge" with finger_bsd

In order to reduce duplicated code
This commit is contained in:
AndersonTorres 2022-03-13 19:06:09 -03:00
parent 3f51820f39
commit bf2d8ef550
4 changed files with 31 additions and 104 deletions

View file

@ -1,26 +0,0 @@
{ lib, stdenv, fetchurl }:
# !!! Duplication: this package is almost exactly the same as `bsd-fingerd'.
stdenv.mkDerivation rec {
pname = "bsd-fingerd";
version = "0.17";
src = fetchurl {
url = "mirror://ibiblioPubLinux/system/network/finger/bsd-finger-${version}.tar.gz";
sha256 = "1yhkiv0in588il7f84k2xiy78g9lv12ll0y7047gazhiimk5v244";
};
NIX_CFLAGS_COMPILE = "-D_GNU_SOURCE";
patches = [ ./ubuntu-0.17-9.patch ];
preBuild = "cd fingerd";
preInstall = "mkdir -p $out/man/man8 $out/sbin ";
meta = with lib; {
platforms = platforms.linux;
license = licenses.bsdOriginal;
};
}

View file

@ -1,67 +0,0 @@
--- bsd-finger-0.17.orig/fingerd/fingerd.8
+++ bsd-finger-0.17/fingerd/fingerd.8
@@ -36,10 +36,10 @@
.Dt FINGERD 8
.Os "Linux NetKit (0.17)"
.Sh NAME
-.Nm fingerd
+.Nm in.fingerd
.Nd remote user information server
.Sh SYNOPSIS
-.Nm fingerd
+.Nm in.fingerd
.Op Fl wulf
.Op Fl pL Ar path
.Op Fl t Ar timeout
@@ -61,7 +61,7 @@
banner
which also shows some informations (e.g. uptime, operating system name and
release) about the system the
-.Nm fingerd
+.Nm in.fingerd
is running on. Some sites may consider this a security risk as it
gives out information that may be useful to crackers.
.Pp
@@ -85,7 +85,7 @@
.Pp
The
.Fl p
-option allows specification of an alternate location for fingerd to find
+option allows specification of an alternate location for in.fingerd to find
the
.Dq finger
program. The
@@ -97,7 +97,7 @@
option specifies the time to wait for a request before closing the
connection. A value of 0 waits forever. The default is 60 seconds.
.Pp
-Options to fingerd should be specified in
+Options to in.fingerd should be specified in
.Pa /etc/inetd.conf .
.Pp
The finger protocol consists mostly of specifying command arguments.
@@ -105,12 +105,12 @@
.Xr inetd 8
.Dq super-server
runs
-.Nm fingerd
+.Nm in.fingerd
for
.Tn TCP
requests received on port 79.
Once connected
-.Nm fingerd
+.Nm in.fingerd
reads a single command line
terminated by a
.Aq Tn CRLF
--- bsd-finger-0.17.orig/fingerd/fingerd.c
+++ bsd-finger-0.17/fingerd/fingerd.c
@@ -55,6 +55,7 @@
#include <netinet/in.h>
#include <sys/utsname.h>
#include <sys/wait.h>
+#include <sys/socket.h>
#include "pathnames.h"
#include "../version.h"

View file

@ -1,26 +1,47 @@
{ lib, stdenv, fetchurl }:
# !!! Duplication: this package is almost exactly the same as `bsd-finger'.
{ lib
, stdenv
, fetchurl
, buildClient ? true
}:
stdenv.mkDerivation rec {
pname = "bsd-finger";
srcName = "bsd-finger";
pname = srcName + lib.optionalString (!buildClient) "d";
version = "0.17";
src = fetchurl {
url = "mirror://ibiblioPubLinux/system/network/finger/bsd-finger-${version}.tar.gz";
sha256 = "1yhkiv0in588il7f84k2xiy78g9lv12ll0y7047gazhiimk5v244";
url = "mirror://ibiblioPubLinux/system/network/finger/${srcName}-${version}.tar.gz";
hash = "sha256-hIhdZo0RfvUOAccDSkXYND10fOxiEuQOjQgVG8GOE/o=";
};
# outputs = [ "out" "man" ];
NIX_CFLAGS_COMPILE = "-D_GNU_SOURCE";
patches = [ ./ubuntu-0.17-9.patch ];
patches = [
./ubuntu-0.17-9.patch
];
preBuild = "cd finger";
preBuild = let
srcdir = if buildClient then "finger" else "fingerd";
in ''
cd ${srcdir}
'';
preInstall = "mkdir -p $out/man/man1 $out/bin ";
preInstall = let
bindir = if buildClient then "bin" else "sbin";
mandir = if buildClient then "man/man1" else "man/man8";
in ''
mkdir -p $out/${bindir} $out/${mandir}
'';
meta = with lib; {
description =
if buildClient
then "User information lookup program"
else "Remote user information server";
platforms = platforms.linux;
license = licenses.bsdOriginal;
};
}
# TODO: multiple outputs (manpage)

View file

@ -5476,6 +5476,7 @@ with pkgs;
findutils = callPackage ../tools/misc/findutils { };
finger_bsd = callPackage ../tools/networking/bsd-finger { };
fingerd_bsd = finger_bsd.override({ buildClient = false; });
iprange = callPackage ../applications/networking/firehol/iprange.nix {};
@ -21264,8 +21265,6 @@ with pkgs;
felix_remoteshell = callPackage ../servers/felix/remoteshell.nix { };
fingerd_bsd = callPackage ../servers/fingerd/bsd-fingerd { };
inherit (callPackages ../servers/firebird { }) firebird_4 firebird_3 firebird_2_5 firebird;
freeradius = callPackage ../servers/freeradius { };