]> git.neil.brown.name Git - portmap.git/log
portmap.git
9 years agoOnly fail an 'unregister' attempt if nothing can be unregistered. master
Denis Zaitceff [Fri, 20 Jun 2014 17:09:26 +0000 (23:09 +0600)]
Only fail an 'unregister' attempt if nothing can be unregistered.

It is possible that the registration for some protocol can be
unregistered by a given request, but others cannot.
Currently we abort if we find something that cannot be unregistered,
even if we have already successfuly unregistered something else.
It is better to unregister whatever we can, and return success if
anything was successful.

Original comment:

There is some inconsistency(-alike?) in the portmap protocol:

a) PMAPPROC_SET registers the only one program using the
 (prog,vers,prot) key, while PMAPPROC_UNSET unregisters all the (two)
 programs, as it uses just the (prog,vers) key.

b) Then, it seems to be pretty legal, if two different processes SET
 the same (prog,vers) tuples - one for TCP and another for UDP.

And at the UNSET step, portmap can catch some security question: say,
one process has been used the privileged port for registration, while
another process has not.  And, considering b), portmap must refuse to
UNSET the privileged port if it was asked by unprivileged port's
process.  And this should not be considered as an error, while ever
one port is UNSET.  But in the current implementation, that "mixed"
cases are treated as just an error.  The patch fixes this behaviour.
Please apply it, if my understanding is correct.

Signed-off-by: Neil Brown <neilb@suse.de>
9 years agoAvoid list corruption in load_table()
Denis Zaitceff [Sat, 24 May 2014 15:27:45 +0000 (21:27 +0600)]
Avoid list corruption in load_table()

load_table() currently swallows the current - last in the list - (*ep) item.
This may be a registration of the UDP port that portmap listens on.

Signed-off-by: Neil Brown <neilb@suse.de>
13 years agoNO_PERROR: control overriding of perror() symbol
Mike Frysinger [Tue, 11 Jan 2011 19:09:05 +0000 (14:09 -0500)]
NO_PERROR: control overriding of perror() symbol

Doing static builds of portmap might fail when the C library's perror()
function is pulled in and collides with portmap's definition.  So add a
flag to control the local override.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agoNO_FORK: control usage of fork() for nommu systems
Mike Frysinger [Tue, 11 Jan 2011 19:09:04 +0000 (14:09 -0500)]
NO_FORK: control usage of fork() for nommu systems

nommu systems lack a fork() function, so add a NO_FORK flag to control
its usage.  We don't lose a ton of functionality in doing so, and on an
embedded system, this is OK.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agoNO_PIE: make PIE support controllable
Mike Frysinger [Tue, 11 Jan 2011 19:09:03 +0000 (14:09 -0500)]
NO_PIE: make PIE support controllable

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agoREADME: fix typo in tcp wrapper doc
Mike Frysinger [Tue, 11 Jan 2011 19:09:02 +0000 (14:09 -0500)]
README: fix typo in tcp wrapper doc

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Neil Brown <neilb@suse.de>
15 years agoportmap: specify port via cmdline
Enrico Weigelt, metux IT service [Sun, 22 Feb 2009 22:13:03 +0000 (23:13 +0100)]
portmap: specify port via cmdline

15 years agopmap_check.c: fixed correct use of const char* to suppress compiler warnings
Enrico Weigelt, metux IT service [Sun, 22 Feb 2009 19:25:50 +0000 (20:25 +0100)]
pmap_check.c: fixed correct use of const char* to suppress compiler warnings

15 years agopmap_check.c: suppressed warning on const-values as non-const parameters
Enrico Weigelt, metux IT service [Sun, 22 Feb 2009 19:19:39 +0000 (20:19 +0100)]
pmap_check.c: suppressed warning on const-values as non-const parameters

15 years agopmap_dump.c: protoname() now returning const char*
Enrico Weigelt, metux IT service [Sun, 22 Feb 2009 19:09:11 +0000 (20:09 +0100)]
pmap_dump.c: protoname() now returning const char*

This fixes a compiler-warning on returning string constants as non-const char*

15 years agoportmap.c: suppressed warning on assigning an non-const value to optarg
Enrico Weigelt, metux IT service [Sun, 22 Feb 2009 19:05:40 +0000 (20:05 +0100)]
portmap.c: suppressed warning on assigning an non-const value to optarg

15 years agoadded .gitignore
Enrico Weigelt, metux IT service [Sun, 22 Feb 2009 18:58:30 +0000 (19:58 +0100)]
added .gitignore

15 years agoVarious config and option improvements.
Enrico Weigelt [Tue, 13 May 2008 01:20:53 +0000 (11:20 +1000)]
Various config and option improvements.

- Various aspects of the Makefile are not configurable by setting
  macros on commandline or in environment
- new config.h file to allow various tunables like daemon uid and
  path to record current mapping table.
- new commandline to:
   Allow foreground running with syslog logging (-F)
   Change the file in which the mapping is stored (-f)
   Specify the username that portmap should run as (-U).

Signed-off-by: Neil Brown <neilb@suse.de>
16 years agoTreat ports below 512 as reserved ports.
Neil Brown [Sun, 15 Jul 2007 23:18:55 +0000 (09:18 +1000)]
Treat ports below 512 as reserved ports.

Though applications trying to bind a reserved port normally look in
the range 512-1024 (because below there is very dense with well known
ports), all ports 1-1024 are reserved in that only root can bind to them.
So when checking if a port is 'reserved' we should allow it anywhere in
the full range.

This allows sunrpc.minresvport to be set low and portmap will still
allow mappings made by the kernel.

The status of 0 as a reserved port is doubtful, but
check_privileged_port will never be called with a 0, so it doesn't
matter.

16 years agofix building with tcpd support disabled
Mike Frysinger [Sun, 13 May 2007 21:17:32 +0000 (17:17 -0400)]
fix building with tcpd support disabled

Make sure pmap_check.c only includes tcpd.h when HOSTS_ACCESS is defined.

Signed-off-by: Timothy Redaelli <drizzt@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Neil Brown <neilb@suse.de>
16 years agorespect DESTDIR and dont use -s with install
Mike Frysinger [Sun, 13 May 2007 21:15:12 +0000 (17:15 -0400)]
respect DESTDIR and dont use -s with install

$(DESTDIR) is the standard for installing into other trees, not $(BASEDIR) ...
so I've converted the Makefile to use that.  I've also left in $(BASEDIR) as a
default to support old installs; not sure if you'd just cut it.

Stripping should be left to the person to handle, not automatically done by
the install step.  Also, `install -s` always calls `strip` which is
wrong/undesired in cross-compiling scenarios.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Neil Brown <neilb@suse.de>
16 years agoRelease version 6.0 portmap_6.0
Neil Brown [Fri, 11 May 2007 03:02:10 +0000 (13:02 +1000)]
Release version 6.0

Add a README, update CHANGES, and add a -V flag to print version.

16 years agoRemove most sccs-id tags
Neil Brown [Fri, 11 May 2007 02:39:01 +0000 (12:39 +1000)]
Remove most sccs-id tags

as we don't use sccs anymore.

17 years agoEnable compile-time configurable DNS lookup for tcp_wrapper checking.
Neil Brown [Mon, 23 Apr 2007 06:20:21 +0000 (16:20 +1000)]
Enable compile-time configurable DNS lookup for tcp_wrapper checking.

There is some small risk of deadlocking if portmap uses gethostbyaddr
for source host authentication.  But some people like it.
So make it compile-time configurable:
   make USE_DNS=yes

17 years agoAllow uid/gid to be set at compile or run time.
Neil Brown [Mon, 23 Apr 2007 06:20:17 +0000 (16:20 +1000)]
Allow uid/gid to be set at compile or run time.

New compile time options to set uid and gid rather than default of '1'.
Also compile-time configurable username to provide uid/gid.
Also -u and -g runtime options to set same.

17 years agocleanup portmap Makefile
Mike Frysinger [Fri, 20 Apr 2007 04:27:43 +0000 (00:27 -0400)]
cleanup portmap Makefile

Signed-off-by: Neil Brown <neilb@suse.de>
17 years agofix output in portmap help
Mike Frysinger [Fri, 20 Apr 2007 04:13:54 +0000 (00:13 -0400)]
fix output in portmap help

Signed-off-by: Neil Brown <neilb@suse.de>
17 years agoStore mapping table in a file. origin
Neil Brown [Fri, 20 Apr 2007 02:42:49 +0000 (12:42 +1000)]
Store mapping table in a file.

Thus we can restore it if killed and restarted.

17 years agoImprove protection against unapproved service deletion.
Neil Brown [Fri, 20 Apr 2007 02:42:48 +0000 (12:42 +1000)]
Improve protection against unapproved service deletion.

If a privilege port was used to register a service, then a privileged
port must be used to unregister it.
This allows system services (statd/lockd/mountd) to safely register
non-privileged ports.
This is good because they don't really need privileged ports, and
using privileged ports when not needed is a waste of scarce recourses.

17 years agoRemove setsid references.
Neil Brown [Fri, 20 Apr 2007 02:42:46 +0000 (12:42 +1000)]
Remove setsid references.

They aren't used so....

17 years agoRemove all 'register' variable attributes.
Neil Brown [Fri, 20 Apr 2007 02:42:45 +0000 (12:42 +1000)]
Remove all 'register' variable attributes.

17 years agoSimple 'install' Makefile target
Neil Brown [Fri, 20 Apr 2007 02:42:36 +0000 (12:42 +1000)]
Simple 'install' Makefile target

Copies from Debian (but without /usr/share/doc/portmap stuff).

17 years agoMan page updates.
Neil Brown [Fri, 20 Apr 2007 02:42:35 +0000 (12:42 +1000)]
Man page updates.

Document -l option from Fedora, and general cosmetic improvements.

17 years agoAdd man pages from Debian
Neil Brown [Fri, 20 Apr 2007 02:42:34 +0000 (12:42 +1000)]
Add man pages from Debian

17 years agoAdd -f option
Neil Brown [Fri, 20 Apr 2007 02:42:33 +0000 (12:42 +1000)]
Add -f option

diff --git a/portmap.c b/portmap.c
index a5008c5..e6ee5f6 100644

17 years agoAdd -i/-l option to bind to a local address.
Neil Brown [Fri, 20 Apr 2007 02:42:33 +0000 (12:42 +1000)]
Add -i/-l option to bind to a local address.

e.g. to bind to 127.0.0.1

 -i address  is from Debian
 -l          is from Fedora and means "-i 127.0.0.1"

17 years agoAdd -t option for chroot.
Neil Brown [Fri, 20 Apr 2007 02:42:32 +0000 (12:42 +1000)]
Add -t option for chroot.

From debian.

17 years agoDefault to -O2
Neil Brown [Fri, 20 Apr 2007 02:42:31 +0000 (12:42 +1000)]
Default to -O2

And make it easy to override the optimisation level e.g.
  RPM_OPT_FLAGS=-Os make

17 years agoCompile portmap with -pie
Neil Brown [Fri, 20 Apr 2007 02:42:30 +0000 (12:42 +1000)]
Compile portmap with -pie

This is from SuSE/Fedora.  I think it makes address space
randomisation work.
I don't know what 'visibility "hidden"' is all about..

17 years agoRemove get_myaddress
Neil Brown [Fri, 20 Apr 2007 02:42:29 +0000 (12:42 +1000)]
Remove get_myaddress

Just use INADDR_LOOPBACK for pmap_dump.
glibc already uses the loopback interface for pmap_set, pmap_unset.

17 years agodrop priv groups as well as uid.
Neil Brown [Fri, 20 Apr 2007 02:42:29 +0000 (12:42 +1000)]
drop priv groups as well as uid.

This isn't really needed as no file access is done,
but Debian does it so...

17 years agosscanf safety.
Neil Brown [Fri, 20 Apr 2007 02:42:20 +0000 (12:42 +1000)]
sscanf safety.

Don't scanf unlimited strings: set a limit of 255 chars.

17 years agoSignal handling fixes.
Neil Brown [Fri, 20 Apr 2007 02:42:08 +0000 (12:42 +1000)]
Signal handling fixes.

Ignore sigchld and sigpipe.
And as reap is now not used, don't compile it.

17 years agosyslog fixes
Neil Brown [Fri, 20 Apr 2007 02:42:07 +0000 (12:42 +1000)]
syslog fixes

Use LOG_DAEMON rather than LOG_MAIL, and add LOG_NDELAY.
Fedora Likes LOG_AUTH
SuSE Likes LOG_AUTH
Debian Likes LOG_DAEMON

I prefer LOG_DAEMON.

17 years agoProtect errno inside signal handler.
Alexander Achenbach [Fri, 20 Apr 2007 02:42:06 +0000 (12:42 +1000)]
Protect errno inside signal handler.

From: Alexander Achenbach <xela@slit.de>

If a signal handler modifies errno at random times,
other code can be badly confused.  So in 'reap', save
and restore it.

(From debian)

17 years agoCorrect typo in error message: udp -> tcp
Neil Brown [Fri, 20 Apr 2007 02:42:05 +0000 (12:42 +1000)]
Correct typo in error message: udp -> tcp

17 years agoClean up more warnings.
Neil Brown [Fri, 20 Apr 2007 02:42:03 +0000 (12:42 +1000)]
Clean up more warnings.

Add -Wall -Wstrict-prototypes and clean up associated
warnings.

17 years agoMakefile fixes for clean compile.
Neil Brown [Fri, 20 Apr 2007 02:41:38 +0000 (12:41 +1000)]
Makefile fixes for clean compile.

Remove old stuff from Makefile, and remove daemon.c and strerror.c
as they really aren't needed.
Now get a clean compile.

17 years agoAdd some missing #includes
Neil Brown [Fri, 20 Apr 2007 02:41:38 +0000 (12:41 +1000)]
Add some missing #includes

to remove more compile warning.

17 years agoAdd lots of needed type-casts.
Neil Brown [Fri, 20 Apr 2007 02:41:37 +0000 (12:41 +1000)]
Add lots of needed type-casts.

This removes a lot of noisy warnings so that real bugs might become visible.

17 years agoRemove #define of perror.
Neil Brown [Fri, 20 Apr 2007 02:41:29 +0000 (12:41 +1000)]
Remove #define of perror.

Original code defined a new perror to send error messages via
syslog so that perror calls in the rpc library would be redefined as well,
and the had -Dperror=xperror in the Makefile to override this.

Debian and Fedora just removed the "-Dperror=.."
SuSE fixed up problems by adding some more "#undef perror".

I have taken the Debian/Fedora approach and tidied up related bits of code.

17 years agoInitial checkin of portmap_beta5 portmap_5beta
Neil Brown [Fri, 20 Apr 2007 00:35:59 +0000 (10:35 +1000)]
Initial checkin of portmap_beta5

Both the current Debian and SuSE distros have identical .tar.gz
containing these files.