Commit Graph

1392 Commits

Author SHA1 Message Date
maxim
b218fbfba3 o Merge rev. 1.5 libexec/ftpd/ftpd.c from DragonflyBSD:
Do not unconditionally fork() after accept().  accept() can
  return -1 due to an interrupted system call (i.e. SIGCHLD).
  If we fork in that case ftpd can get into an
  accept()/SIGCHLD/fork/[fail]/repeat loop.

  Reported-by: fabian <fabian.duelli@bluewin.ch>

Obtained from:	DragonflyBSD
MFC after:	1 month
2004-09-24 13:21:52 +00:00
cognet
f73db50f56 Add stubs for TLS.
Arbitraly choose the 2nd variant until I figure out which one I should use.
2004-09-23 23:04:52 +00:00
trhodes
97ba99e4ad Remove named-xfer, it does not exist in BIND 9. 2004-09-22 14:17:56 +00:00
des
a4c12f8006 Switch from BIND 8 to BIND 9.
Submitted by:	(in part) dougb@, trhodes@
Reviewed by:	dougb@, trhodes@, re@
MFC after:	5 days
2004-09-21 19:01:48 +00:00
maxim
6c3a896977 Avoid accidental use of ANSI C trigraphs.
Spotted by:	Pawel Worach
Obtained from:	NetBSD (rev. 1.11, 1.13)
2004-08-21 07:23:41 +00:00
obrien
22dcfa59a7 Add some details about our wonderful system. 2004-08-21 03:36:47 +00:00
obrien
a1194af70b Turn on the FreeBSD login user capabilities database support. 2004-08-18 06:46:25 +00:00
marius
24ad8a9842 Instead of "OpenFirmware", "openfirmware", etc. use the official spelling
"Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended).

Ok'ed by:	tmm
2004-08-16 15:45:27 +00:00
cperciva
e629b37603 Join the 21st century: Cryptography is no longer an optional component
of releases.  The -DNOCRYPT build option still exists for anyone who
really wants to build non-cryptographic binaries, but the "crypto"
release distribution is now part of "base", and anyone installing from a
release will get cryptographic binaries.

Approved by:	re (scottl), markm
Discussed on:	freebsd-current, in late April 2004
2004-08-06 07:27:08 +00:00
dfr
c42f6bfee0 Add stubs for powerpc TLS.
Submitted by: ssouhlal
2004-08-04 19:12:14 +00:00
dfr
4e9853427f Add support for Thread Local Storage. 2004-08-03 08:51:00 +00:00
yar
55224f76bf ftpd(8) seems to be WARNS=2 clean now.
Tested on:	i386, ia64, amd64, sparc64, alpha
2004-07-31 15:07:33 +00:00
yar
d786b94f15 Change `(foo *)0'' to `NULL'' where it's possible
(and it appears possible throughout ftpd(8) source.)

It is not a mere issue of style: Null pointers in C
seem to have been mistaken one way or another quite often.
2004-07-31 15:03:17 +00:00
yar
06b7ed859f Kill a small herd of casts to off_t where they were not needed.
Thank Fortune, the C compiler can figure out by itself the proper
conversion for assignments, comparisons, and prototyped function
arguments.
2004-07-31 14:46:41 +00:00
yar
634a2a6e4f Printf(3) off_t values through conversion to intmax_t since
we've got <stdint.h> et al now.  (This makes ftpd(8) WARNS=2 clean.)
2004-07-31 14:22:02 +00:00
yar
6f57f3272c Kill an unused variable (heading to WARNS=2.) 2004-07-31 14:03:59 +00:00
yar
81692845b8 Convert a couple of bogus null statements to the right form.
(Heading to WARNS=2.)
2004-07-31 14:03:14 +00:00
yar
4cacae89d9 Ditto for (gid_t). 2004-07-30 17:30:07 +00:00
yar
dc8c8c95c0 Kill casts to (uid_t) obviously left from the K&R era.
Prototyping library functions in header files has rendered
them superfluous.
2004-07-30 17:27:23 +00:00
yar
8839880434 Add a comment to explain that the loop around the call to bind(2)
is not a hack, but it has a clear purpose.
2004-07-30 17:18:57 +00:00
yar
9fb1cda8d0 Open a socket for a data transfer in active mode using euid
of the current user, not root.  This will allow neat things
like matching anonymous FTP data traffic with a single ipfw(8)
rule:
	ipfw add ... tcp from any to any uid ftp

Note that the control connection socket still belongs to the
user ftpd(8) was started from, usually root.

PR:		bin/65928
Submitted by:	Eugene Grosbein <eugen at grosbein.pp.ru>
MFC after:	1 month
2004-07-30 16:57:42 +00:00
kan
44ddf6cddd Call nmatch function with parameters casted to types the function actually
expects.
2004-07-29 18:05:20 +00:00
stefanf
e0b2a5b339 Fix a few cases that relied on 'implicit int' (constraint violation in C99). 2004-07-11 17:37:33 +00:00
ru
9f45c1d92e mdoc(7) fixes. 2004-07-07 19:57:16 +00:00
stefanf
9dea8aeba1 Consistently use __inline instead of __inline__ as the former is an empty macro
in <sys/cdefs.h> for compilers without support for inline.
2004-07-04 16:11:03 +00:00
ru
305463f129 Deal with double whitespace. 2004-07-03 00:06:28 +00:00
ru
20fbd172b2 Mechanically kill hard sentence breaks. 2004-07-02 21:28:50 +00:00
ru
4b39413aeb Removed trailing whitespace. 2004-07-02 19:07:33 +00:00
csjp
78ac741f00 The call to setuid(2) subsequently causes setgroups(2) to fail. setgroups(2)
requires super-user access in order to complete successfully.
Move setgroups(2) to execute before setuid(2) so that it is successful.
2004-06-30 18:58:19 +00:00
phk
f899356ae4 Nuke COMPAT_43 2004-06-25 10:11:28 +00:00
brian
453b5a4b34 Call tzset() at startup.
Submitted by:	Andrzej ToboÅa <ato@iem.pw.edu.pl>
2004-06-21 10:47:12 +00:00
brian
86ff38aa6a o Reduce path names in RRQ and WRQ packets by:
Reducing "/+./" strings to "/"
    Reducing "/[^/]+/../" to "/"

o Don't send an OACK when the result of the [RW]RQ is an error.

These changes allow tftpd to interact with pxelinux.bin from the syslinux
package.

Whilst the path reducing code doesn't properly handle situations where the
path component before the "/../" is a symlink to (say) ".", I would suggest
that it does the right thing in terms of the clients perception of what
their path string actually represents.  This seems better than using
realpath() and breaking environments where symlinks point outside of the
directory hierarchy that tftpd is configured to allow.
2004-06-21 08:01:16 +00:00
tmm
1dc333167a Fix the problem that surfaced with the new binutils import on sparc64
(and that is for now being worked around by a binutils patch).

The rtld code tested &_DYNAMIC against 0 to see whether rtld itself
was built as PIC or not. While the sparc64 MD code did not rely
on the preset value of the GOT slot for _DYNAMIC any more due
to previous binutils changes, it still used to not be 0, so
that this check did work. The new binutils do however initialize
this slot with 0. As a consequence, rtld would not properly initialize
itself and crash.
Fix that by introducing a new macro, RTLD_IS_DYNAMIC, to take the role
of this test. For sparc64, it is implemented using the rtld_dynamic()
code that was already there. If an architecture does not provide its
own implementation, we default to the old check.

While being there, mark _DYNAMIC as a weak symbol in the sparc64
rtld_start.S. This is needed in the LDSCRIPT case, which is however
not currently supported for want of an actual ldscript.

Sanity checked with md5 on alpha, amd64, i386 and ia64.
2004-06-18 02:01:37 +00:00
cognet
98a02072fc This comment should have been removed in the previous commit.
Spotted out by: marcus, simon
2004-06-17 19:01:53 +00:00
cognet
42e5ac9f05 Woohoo !
the latest binutils import mades this gross hack useless, so just remove it.
2004-06-17 17:53:16 +00:00
obrien
536504fc3c Commit a crude hack so we get sparc64 snapshots working again with a
stable ld.so.  We need to revisit the rtld-elf/sparc64/rtld_start.S
rev. 1.5 and rtld-elf/sparc64/rtld_machdep.h rev. 1.5, which was
suppose to allow stock Binutils 2.13 (and later) to be used.
2004-06-17 16:08:20 +00:00
obrien
0ac1bd72be Fall out from Binutils 2.15: don't bulid the ld.so on Sparc64. 2004-06-17 03:04:24 +00:00
bms
34bae8c803 Whitespace. 2004-06-14 22:44:13 +00:00
bms
bf98536752 Do not depend on the global 'sockt' being initialized to 0;
instead, use the symbolic constant STDIN_FILENO, as this is
a daemon invoked from inetd.
Remove 'sockt' as it is not referenced.
2004-06-14 22:43:05 +00:00
obrien
fc65dfcc08 Simplify conditional compilation logic some. 2004-06-13 19:54:12 +00:00
eik
9b2de159a4 give out a little more information in case of a missing dependency
PR:		56549
Submitted by:	edwin
Reviewed by:	joerg, ru
Approved by:	joerg
MFC after:	2 weeks
2004-05-28 00:05:28 +00:00
mdodd
8c3c3c59d7 - Close fd if fdopen(fd) fails.
- Format return () to resemble the one 5 lines up.
2004-05-25 01:40:27 +00:00
mdodd
dbabd85d3e Add two new flags: -w, which allows new files to be created,
and -U, which allows the umask to be set.

Obtained from:	 Patton Electronics, Co.
2004-05-24 22:56:15 +00:00
stefanf
12a8a7fa4c Include <stdlib.h> for exit() and abort() prototypes.
Approved by:	das (mentor)
2004-05-24 13:21:24 +00:00
stefanf
04f0693a84 Include <netinet/in.h> for ntoh*() and hton*() prototypes.
Approved by:	das (mentor)
2004-05-24 11:59:17 +00:00
mdodd
c29bed19c8 Support basename and path based constrained matches.
eg:
	[foo]
	...

	matches any executable 'foo'

	[/usr/bin/foo/]
	...

	matches any executable under the directory /usr/bin/foo/

Exact matches continue to function as before.

PR:		 bin/66769
Submitted-by:	 Dan Nelson
2004-05-24 01:24:13 +00:00
ru
7024cb358c Markup fixes. 2004-05-16 22:12:12 +00:00
ru
90981450b5 Markup nit. 2004-05-16 22:11:56 +00:00
ru
54449ad4e3 There's no such beast like AF_INET4, even when powered by whiskey. 2004-05-16 22:11:40 +00:00
ru
e260fd7688 Bump document date for the latest change.
Minor markup tweaks.
2004-05-16 22:11:22 +00:00
cognet
c80c24dad9 Work around a problem somewhere with binutils (?) on arm, hopefully without
breaking any other arch this time.
2004-05-15 00:13:14 +00:00
se
4e41874389 Fix breakage caused by alphabetically sorting SRCS: rtld_start.S must come first!
The previous version made all shared binaries dump core.
2004-05-14 21:01:52 +00:00
cognet
6cb32d10f5 Import arm bits for rtld-elf.
Obtained from:	NetBSD
2004-05-14 12:15:51 +00:00
tjr
4b192dc71d Handle variable argument lists correctly in reply() and lreply().
In particular, do not pass the same va_list to both vprintf() and
vsyslog() without first reinitializing it. This fixes ftpd -d
on amd64.
2004-05-13 05:36:38 +00:00
mux
1d9918b99c Cast the terminating NULL to char * in the execl() call.
Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>
2004-04-04 20:53:23 +00:00
dfr
f758b08c5a If we change obj_rtld.path after initialising __progname, make sure we
change __progname to point at the new storage otherwise it ends up
pointing at freed memory which leads to confusing garbled error messages.
2004-03-29 18:37:37 +00:00
pjd
b1d34c6743 Make fingerd(8) WARNS2 clean. 2004-03-29 09:29:51 +00:00
peter
88a11443a2 More stack alignment fixes. Arrange so we call _rtld() in ld-elf.so.1
with the correct alignment.  This is important because this calls to
library static constructors are made from here.  The bug in the old crt*.s
files hid this because in this case, two wrongs do indeed make a right.
Also, call _rtld_bind() with the correct alignment, because it calls back
into the pthread library locking functions.  If things happen just
the wrong way, we get a SIG10 due to the broken stack alignment.
2004-03-21 01:43:39 +00:00
peter
ccd389b7a3 Add initial support for compiling a special 32 bit version of
ld-elf.so.1 on 64 bit systems.  Most of this involves using alternate
paths, environment variables and diagnostic messages.

The build glue is seperate.
2004-03-21 01:21:26 +00:00
bde
1e78a65d3a Fixed a misspelling of 0 as NULL. 2004-03-14 05:27:26 +00:00
mlaier
6be47b725d Link pf to the build and install:
This adds the former ports registered groups: proxy and authpf as well as
the proxy user. Make sure to run mergemaster -p in oder to complete make
installworld without errors.

This also provides the passive OS fingerprints from OpenBSD (pf.os) and an
example pf.conf.

For those who want to go without pf; it provides a NO_PF knob to make.conf.

__FreeBSD_version will be bumped soon to reflect this and to be able to
change ports accordingly.

Approved by:	bms(mentor)
2004-03-08 22:03:29 +00:00
markm
0b0ae8e16e Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64
2004-03-05 08:10:19 +00:00
mlaier
54bb06645b Add skeleton build dirs for pf userland:
libexec/ftp-proxy	- ftp proxy for pf
 sbin/pfctl		- equivalent to sbin/ipf
 sbin/pflogd		- deamon logging packets via if_pflog in pcap format
 usr.sbin/authpf	- authentification shell to modify pf rulesets

Bring along some altq headers used to satisfy pfctl/authpf compile. This
helps to keep the diff down and will make it easy to have a altq-patchset
use the full powers of pf.

Also make sure that the pf headers are installed.

This does not link anything to the build. There will be a NO_PF switch for
make.conf once pf userland is linked.

Approved by:	bms(mentor)
2004-02-28 21:50:50 +00:00
kan
524af60ccd Do not depend on existence of _end symbol in obj_from_addr, use
obj->mapbase and obj->mapsize instead.

Prompted by: 	OpenOffice debugging session at last BSDCon.
2004-02-25 17:06:16 +00:00
das
8c6bf9351e Don't pass a pointer to a 'long' to a function that expects an 'int *'.
Submitted by:	Roop Nanuwa <roop@hqst.com>
PR:		62615
2004-02-16 10:03:44 +00:00
roam
4d05d5efa5 Add the '-h hostname' to usage(), too.
While I'm here, sync the usage() synopsis with the manual page synopsis:
make the [-i | -s] explicit and sort the options alphabetically.

Reminded by:		ru
MFC after:		3 days
2004-02-13 09:26:54 +00:00
roam
0d5a6d9790 Document the '-h hostname' option, which seems to have been present
ever since rev. 1.1 of bootpd.c.
While I'm here, rearrange the synopsis a bit: sort the options and
clarify that -i and -s are mutually exclusive.

Reported by:	Atanas Buchvarov <nasko@nove.bg>
MFC after:	3 days
2004-02-10 15:12:01 +00:00
yar
c0140bd141 NULL looks better than (char *)0 unless we're passing
an unprototyped argument to a function.
2004-02-07 14:59:11 +00:00
yar
ec50e6c644 Deny attempts to rename a file from guest users if the policy
says they may not modify existing files through FTP.

Renaming a file is effectively a way to modify it.
For instance, if a malicious party is unable to delete or overwrite
a sensitive file, they can nevertheless rename it to a hidden name
and then upload a troyan horse under the guise of the old file name.
2004-02-07 14:54:30 +00:00
yar
b836e6309f perror_reply() should not be used where errno isn't meaningful. 2004-02-07 14:38:04 +00:00
yar
b6d44d65d8 Work around a bug in some clients by never returning raw directory
contents in reply to a RETR command.  Such clients consider RETR
as a way to tell a file from a directory.  Mozilla is an example.

PR:		bin/62232
Submitted by:	Bob Finch <bob+freebsd <at> nas <dot> com>
MFC after:	1 week
2004-02-07 14:11:38 +00:00
ru
743cc6d002 Fixed style of DPADD and LDADD assignments as per style.Makefile(5). 2004-02-05 22:44:25 +00:00
ru
0999d17b26 Removed unnecessary dependencies on librpcsvc.
Prodded by:	des
2004-02-04 11:59:08 +00:00
ru
7e3a5665be Put libdevstat before libkvm, because the former depends on the latter. 2004-02-04 10:20:43 +00:00
ru
794727acbe - Added the NOPAM knob, for consistency with ${.CURDIR}/../ftpd.
- Unbreak -DNOPAM -DNOSHARED build by putting -lmd after -lopie.

(Static build with PAM remains broken.)
2004-02-04 10:05:21 +00:00
fjoe
42373eaca9 Fix "warning: value computed is not used".
Found by:	gcc 2.95.4 [FreeBSD]
2004-02-03 18:53:40 +00:00
ru
0cd813cbba Removed duplicate -lutil. 2004-02-02 18:23:18 +00:00
ru
5eae3592f4 Reorder dependencies to fix static NOPAM build.
Submitted by:	lorder(1)
2004-02-02 18:19:41 +00:00
charnier
9af7d6a659 add missing setusershell() calls.
PR: bin/2442
Reviewed by: Friedemann Becker <zxmxy33@mail.uni-tuebingen.de>
2004-01-18 21:29:33 +00:00
ru
6593bb80ea - Build things in pure dictionary order (see sort(1)).
- Unify the conditional assignments section so that architectural
  exclusions come first, then options and !options, sorted by the
  option name, also in directory order, then architecture specific
  sections, sorted by the architecture name, with i386 being a
  traditional exception.

Prodded by:	bde
2004-01-16 15:23:19 +00:00
anholt
f69246ee4c man ftpd says that "by default, anonymous users cannot modify existing files."
However, the code did allow deletion of files.  Make deleting require the -m
flag, too.

PR:		bin/60809
Submitted by:	Alexander Melkov <melkov@comptek.ru>
2004-01-07 19:28:31 +00:00
dfr
ec25118d4b Initialise some uninitialised variables.
Thanks to: valgrind
2003-12-31 15:10:41 +00:00
obrien
c9e8288e34 Document what the PAM believers failed to do (and should have),
which is how to rsh as root into a machine.
2003-12-17 22:38:57 +00:00
peter
f9016d0ffd Fix dynamic linking a bit more.. enough that mozilla-firebird works if you
dig up the patches for amd64 support for it.

Note to self: do not put a 64 bit value in a 32 bit space.
2003-12-12 01:12:41 +00:00
peter
7368638dde Revert last change. ../rtld.c uses CACHE_LINE_SIZE too.
Change it to 64 while here.

Reported by:  ps
2003-12-11 18:42:51 +00:00
peter
e87d087aa1 Only define CACHE_LINE_SIZE in one place.. 2003-12-11 04:49:37 +00:00
peter
20d7a03f75 CACHE_LINE_SIZE is 64 on athlon and amd64 chips, not 32. This should
probably be 128 since that is what the hardware prefetch fill size is
on both the p3, p4 and athlon* cpus.
2003-12-11 04:47:53 +00:00
sobomax
dced91d8f3 Fix a bug which causes wrong filename being written into the syslog
in the case when client sends request with RFC2347 options.

Approved by:	re
MFC After:	2 weeks
2003-11-20 13:36:31 +00:00
harti
91fb8e3f9c Replace all uses of the old netgraph constants NG_*LEN by the new
constants NG_*SIZ that include the trailing NUL byte. This change
is mostly mechanical except for the replacement of a couple of snprintf()
and sprintf() calls with strlcpy.
2003-11-15 15:26:35 +00:00
yar
759577e793 If a file to send in ASCII mode already has CRLF as end-of-line,
don't add excessive CR on the wire.

PR:		bin/59285
Submitted by:	Andrey Beresovsky <and at rsu.ru>
MFC after:	1 week
2003-11-15 11:08:26 +00:00
tobez
0105a2bc6c Sync comment with code's reality.
MFC after:	1 week
2003-11-14 12:56:56 +00:00
peter
b35f301d40 Tidy up some xdrproc_t related warnings. 2003-10-26 04:32:53 +00:00
peter
9e4da6dd3b Pacify gcc warning with a Douglas Adams reference. 2003-10-26 04:30:05 +00:00
tjr
971569170c Make the warning message stand out more. 2003-10-11 07:37:55 +00:00
tjr
20b1e12f1f Warn users that makekey may disappear in a future release now that the
last in-tree consumer has gone.
2003-10-09 10:06:30 +00:00
tjr
e6d1ceacac Use the new style struct sockaddr instead of osockaddr in system calls
so that talkd works without COMPAT_43.

Obtained from:	NetBSD (christos), Rumi Szabolcs
2003-09-28 09:16:09 +00:00
ume
d25cb60913 Don't depend on IPv4-mapped IPv6 address to bind to both IPv4
and IPv6.

Wrote at:	Hakone.
Powered by:	Warner Losh's scotch whisky.
Requested by:	nork
2003-09-14 16:42:46 +00:00
mdodd
2641112114 Retire the WITH_LIBMAP compile knob; libmap is now a standard feature. 2003-09-13 21:50:36 +00:00
mdodd
df4cd81882 Change libmap.c:lm_init() to return a status value; 0 for success
(libmap available) and 1 for failure.  Assign this return to the
global 'libmap_disable' variable in rtld.c.

This totally prevents any libmap functions from being called after
lm_init() if no config file is present.
2003-09-13 21:43:08 +00:00
obrien
507c61e256 Deal with the LOGIN_NAME_MAX issue in the NetBSD->FreeBSD
translation^H^H^Hhack layer.
2003-09-11 03:28:21 +00:00