new package: add package 'portmap'

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2010-12-06 19:55:46 +01:00
parent 8464ab8f52
commit 7dbd87b3a1
9 changed files with 217 additions and 0 deletions

11
packages/network/portmap/build Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. config/options $1
cd $PKG_BUILD
make FACILITY=LOG_AUTH \
ZOMBIES='-DIGNORE_SIGCHLD -Dlint' \
LIBS="-lnsl" \
AUX="" \
HOSTS_ACCESS="" \

View File

@ -0,0 +1,30 @@
#!/bin/sh
################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv
# http://www.openelec.tv
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
# starting portmap
#
# runlevels: openelec, textmode
. /etc/profile
progress "starting portmap"
portmap

View File

@ -0,0 +1,10 @@
#!/bin/sh
. config/options $1
mkdir -p $INSTALL/sbin
cp $PKG_BUILD/portmap $INSTALL/sbin/
mkdir -p $INSTALL/usr/sbin
cp $PKG_BUILD/pmap_set $INSTALL/usr/sbin/
cp $PKG_BUILD/pmap_dump $INSTALL/usr/sbin/

View File

@ -0,0 +1,16 @@
PKG_NAME="portmap"
PKG_VERSION="4"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="OSS"
PKG_SITE="ftp://ftp.porcupine.org/pub/security/"
PKG_URL="ftp://ftp.porcupine.org/pub/security/${PKG_NAME}_${PKG_VERSION}.tar.gz"
PKG_DEPENDS=""
PKG_BUILD_DEPENDS="toolchain"
PKG_PRIORITY="optional"
PKG_SECTION="network"
PKG_SHORTDESC="portmap: RPC portmapper"
PKG_LONGDESC="This is an RPC portmapper that prevents theft of NIS (YP), NFS, and other sensitive information via the portmapper. As an option, the program supports access control in the style of the tcp wrapper (log_tcp) package."
PKG_IS_ADDON="no"
PKG_AUTORECONF="no"

View File

@ -0,0 +1,18 @@
--- portmap_4/portmap.c.old 1996-05-31 09:52:59.000000000 -0400
+++ portmap_4/portmap.c 2002-12-13 11:44:16.000000000 -0500
@@ -94,6 +94,7 @@
#ifdef SYSV40
#include <netinet/in.h>
#endif
+#include <errno.h>
extern char *strerror();
#include <stdlib.h>
@@ -124,7 +125,6 @@
static void callit();
struct pmaplist *pmaplist;
int debugging = 0;
-extern int errno;
#include "pmap_check.h"

View File

@ -0,0 +1,27 @@
--- portmap_4/Makefile.orig Fri May 31 09:50:40 1996
+++ portmap_4/Makefile Fri Aug 9 17:40:43 1996
@@ -67,9 +67,9 @@
SHELL = /bin/sh
-COPT = -Dconst= -Dperror=xperror $(HOSTS_ACCESS) $(CHECK_PORT) \
+COPT = -Dconst= $(HOSTS_ACCESS) $(CHECK_PORT) \
$(SYS) -DFACILITY=$(FACILITY) $(ULONG) $(ZOMBIES) $(SA_LEN)
-CFLAGS = $(COPT) -O $(NSARCHS) $(SETPGRP)
+CFLAGS = $(COPT) $(RPM_OPT_FLAGS) $(NSARCHS) $(SETPGRP)
OBJECTS = portmap.o pmap_check.o from_local.o $(AUX)
all: portmap pmap_dump pmap_set
--- portmap_4/Makefile.bad 1996-05-31 09:50:40.000000000 -0400
+++ portmap_4/Makefile 2002-12-12 09:54:00.000000000 -0500
@@ -74,8 +74,8 @@
all: portmap pmap_dump pmap_set
-portmap: $(OBJECTS) $(WRAP_DIR)/libwrap.a
- $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(WRAP_DIR)/libwrap.a $(LIBS)
+portmap: $(OBJECTS)
+ $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
pmap_dump: pmap_dump.c
$(CC) $(CFLAGS) -o $@ $? $(LIBS)

View File

@ -0,0 +1,51 @@
--- portmap_4/portmap.c.orig 2004-08-12 10:48:13.405000000 -0400
+++ portmap_4/portmap.c 2004-08-12 10:58:13.666000000 -0400
@@ -126,6 +126,7 @@
static void callit();
struct pmaplist *pmaplist;
int debugging = 0;
+int localhost_only = 0;
#include "pmap_check.h"
@@ -140,13 +141,17 @@
int len = sizeof(struct sockaddr_in);
register struct pmaplist *pml;
- while ((c = getopt(argc, argv, "dv")) != EOF) {
+ while ((c = getopt(argc, argv, "dlv")) != EOF) {
switch (c) {
case 'd':
debugging = 1;
break;
+ case 'l':
+ localhost_only = 1;
+ break;
+
case 'v':
verboselog = 1;
break;
@@ -154,6 +159,7 @@
default:
(void) fprintf(stderr, "usage: %s [-dv]\n", argv[0]);
(void) fprintf(stderr, "-d: debugging mode\n");
+ (void) fprintf(stderr, "-l: listen on localhost only\n");
(void) fprintf(stderr, "-v: verbose logging\n");
exit(1);
}
@@ -176,7 +182,12 @@
exit(1);
}
- addr.sin_addr.s_addr = 0;
+ if (localhost_only) {
+ addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ syslog(LOG_NOTICE, "Only binding to LOOPBACK address!");
+ } else {
+ addr.sin_addr.s_addr = 0;
+ }
addr.sin_family = AF_INET;
addr.sin_port = htons(PMAPPORT);
if (bind(sock, (struct sockaddr *)&addr, len) != 0) {

View File

@ -0,0 +1,42 @@
--- portmap_4/Makefile.pie 2003-10-28 20:18:32.000000000 -0800
+++ portmap_4/Makefile 2003-10-28 20:18:32.000000000 -0800
@@ -74,8 +74,11 @@
all: portmap pmap_dump pmap_set
+$(OBJECTS): %.o: %.c
+ $(CC) $(CFLAGS) -fpie -c $<
+
portmap: $(OBJECTS)
- $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
+ $(CC) $(CFLAGS) -o $@ -pie $(OBJECTS) $(LIBS)
pmap_dump: pmap_dump.c
$(CC) $(CFLAGS) -o $@ $? $(LIBS)
--- portmap_4/pmap_check.h.pie 2003-10-28 20:26:34.000000000 -0800
+++ portmap_4/pmap_check.h 2003-10-28 20:26:49.000000000 -0800
@@ -6,6 +6,6 @@
extern int check_setunset();
extern int check_privileged_port();
extern int check_callit();
-extern int verboselog;
-extern int allow_severity;
-extern int deny_severity;
+extern int verboselog __attribute__ ((visibility ("hidden")));
+extern int allow_severity __attribute__ ((visibility ("hidden")));
+extern int deny_severity __attribute__ ((visibility ("hidden")));
--- portmap_4/pmap_check.c.pie 2003-10-28 20:27:38.000000000 -0800
+++ portmap_4/pmap_check.c 2003-10-28 20:27:40.000000000 -0800
@@ -63,9 +63,9 @@
static void logit();
static void toggle_verboselog();
-int verboselog = 0;
-int allow_severity = LOG_INFO;
-int deny_severity = LOG_WARNING;
+int verboselog __attribute ((visibility ("hidden"))) = 0;
+int allow_severity __attribute ((visibility ("hidden"))) = LOG_INFO;
+int deny_severity __attribute ((visibility ("hidden"))) = LOG_WARNING;
/* A handful of macros for "readability". */

View File

@ -0,0 +1,12 @@
--- portmap_4/portmap.c.sigpipe Sun Feb 11 17:45:11 2001
+++ portmap_4/portmap.c Sun Feb 11 17:45:51 2001
@@ -228,6 +228,9 @@
#else
(void)signal(SIGCHLD, reap);
#endif
+ /* Dying on SIGPIPE doesn't help anyone */
+ (void)signal(SIGPIPE, SIG_IGN);
+
svc_run();
syslog(LOG_ERR, "run_svc returned unexpectedly");
abort();