Commit Graph

1538 Commits

Author SHA1 Message Date
Ruslan Ermilov
a3ac07a54e Sort sections. 2005-01-18 09:29:40 +00:00
Xin LI
06eda379d4 64-bit clean + WARNS=6:
- Convert the (char *) cast+cast backs magic to
	  memcpy(3).  Without this, the resulting code
	  is potentially risky with higher optimization
	  levels.
	- Avoid same name when calling local variables,
	  as well as global symbols.  This reduces
	  confusion for both human and compiler.
	- Add necessary casts, consts
	- Use new style function defination.
	- Minor style.Makefile(5) tweak
	- Bump WARNS?= from 0 to 6

** for the aout code: changes are intentionally limited
   to ease maintaince.
2005-01-14 12:22:57 +00:00
Tom Rhodes
43d8ef3f27 Restore these files to make ldconfig(8) happy. 2005-01-11 16:40:29 +00:00
Tom Rhodes
290f99bb70 Remove a.out runtime linker. It doesn't build and was removed from the
build over two years ago by peter.

The binary a.out version of ld.so can be obtained from misc/compat22 or
src/lib/compat/compat22.

Discussed on:	-arch
Voted yes:	jhb, ru, linimon, delphij
2005-01-11 06:15:19 +00:00
Yaroslav Tykhiy
1850cfa1c5 Replace err(3) calls when in daemon mode by syslog(3), too.
A daemon has no stderr to send its complains to.

Pointed out by:	Nick Leuta
MFC after:	1 week
2005-01-10 12:19:11 +00:00
Ruslan Ermilov
b5b0bba4df NOPAM -> NO_PAM 2004-12-21 12:49:24 +00:00
Ruslan Ermilov
731db6a428 NOINET6 -> NO_INET6 2004-12-21 10:49:29 +00:00
Ruslan Ermilov
a216173556 NOCRYPT -> NO_CRYPT 2004-12-21 10:16:04 +00:00
Ruslan Ermilov
ab7a294721 NODOCCOMPRESS -> NO_DOCCOMPRESS
NOINFO -> NO_INFO
NOINFOCOMPRESS -> NO_INFOCOMPRESS
NOLINT -> NO_LINT
NOPIC -> NO_PIC
NOPROFILE -> NO_PROFILE
2004-12-21 09:33:47 +00:00
Ruslan Ermilov
e653b48c80 Start the dreaded NOFOO -> NO_FOO conversion.
OK'ed by:	core
2004-12-21 08:47:35 +00:00
Yaroslav Tykhiy
bcd2618483 Do a small style(9) fix before I'm hacking the code itself. 2004-12-16 07:27:28 +00:00
Yaroslav Tykhiy
8efc8b18e5 free(3) is void already. 2004-12-16 07:17:56 +00:00
Yaroslav Tykhiy
6c98f40194 Never emit a message to stderr: use syslog instead.
When in inetd mode, this prevents bogus messages from
appearing on the control channel.  When running as a
daemon, we shouldn't write to the terminal we used to
have at all.

PR:		bin/74823
MFC after:	1 week
2004-12-12 17:30:28 +00:00
Olivier Houchard
25a252899e Implement a dummy atomic_cmpset_32(). It should be safe to use it in rtld as
the signals are masked anyway.
2004-11-23 16:32:34 +00:00
Yaroslav Tykhiy
ebd83647a4 When looking for a virtual host to handle the connection,
stop the search on the first match for efficiency.

Submitted by:	Nick Leuta
2004-11-22 11:10:04 +00:00
Yaroslav Tykhiy
4cbc4ad644 Calling pam_chauthtok() isn't really needed since
an FTP user has no chance to change password anyway.

Submitted by:	Nick Leuta
2004-11-22 11:02:42 +00:00
Yaroslav Tykhiy
e897216f45 Don't log the chroot dir on every command since it's constant for a session.
Log it once at the beginning of the session instead.  OTOH, log wd each
time for the sake of better auditing and consistent log format.

Proposed by:	Nick Leuta <skynick -at- mail.sc.ru>
2004-11-22 10:48:29 +00:00
Yaroslav Tykhiy
7cdd3cb70b Always log remote IP.
PR:		bin/59773
2004-11-22 10:27:16 +00:00
Yaroslav Tykhiy
04683b2c35 Treat host name buffers consistently. 2004-11-22 10:16:43 +00:00
Yaroslav Tykhiy
215a9f9de5 Make chrootdir global and use it in log messages
regarding restricted users.

MFC after:	2 weeks
2004-11-18 14:15:32 +00:00
Yaroslav Tykhiy
2b7eb1c076 Nitpicking on style(9) and whitespace.
Tested with:	md5(1)
2004-11-18 13:55:15 +00:00
Yaroslav Tykhiy
0c4b401f76 Use __FBSDID. 2004-11-18 13:46:29 +00:00
Yaroslav Tykhiy
405e2987ca Don't say, "file: permission denied," if the operation
is disabled entirely.
2004-11-18 11:50:01 +00:00
Yaroslav Tykhiy
02c9749295 Use uniform punctuation, capitalization, and language style
in server messages wherever this doesn't contradict to a particular
message format.
2004-11-18 11:45:13 +00:00
Yaroslav Tykhiy
eb5b2bb3ae Apply __printflike() to the appendf() prototype so the compiler
can detect format errors.
2004-11-18 11:32:35 +00:00
Yaroslav Tykhiy
82c03024c2 Fix perror_reply() vs. reply() usage. 2004-11-18 11:27:31 +00:00
Yaroslav Tykhiy
4a3e5acd8d '\n' needs not to appear in reply() strings. 2004-11-18 11:07:00 +00:00
Yaroslav Tykhiy
6b2dee6ba1 Log pathname arguments to ftp commands as the user specified them;
add the working directory pathname to the log message if any of
such arguments isn't absolute.  This has advantage over the old
way of logging that an admin can see what users are actually trying
to do, and where.  The old code was also not too robust when it
came to a chrooted session and an absolute pathname.

Pointed out by: Nick Leuta
MFC after:      2 weeks
2004-11-18 10:02:28 +00:00
Yaroslav Tykhiy
ac4f2391be Use S_ISDIR() macro instead of a hand-rolled test. 2004-11-18 09:26:58 +00:00
Yaroslav Tykhiy
75933089af getcwd() won't leave a error string in the buffer, unlike getwd(). 2004-11-18 00:14:09 +00:00
Yaroslav Tykhiy
de9b6c0343 Use POSIX functions instead of legacy ones:
getwd() -> getcwd()
	wait3() -> waitpid()
2004-11-17 22:43:46 +00:00
Yaroslav Tykhiy
7e295315e6 Kill more unneeded casts found.
Noticed by:	Nick Leuta <skynick -at- mail.sc.ru> (some of them)
2004-11-17 11:52:41 +00:00
John Baldwin
165204a75f Remove 80386 support from the ELF run time linker. 2004-11-16 20:45:51 +00:00
Yaroslav Tykhiy
3b48b87700 Don't invent ways of capitalization orthogonal to the English grammar. 2004-11-15 12:47:44 +00:00
Yaroslav Tykhiy
41c57b487e RFC 959 states that the following codes should be used
for status replies on file system objects:

 212 Directory status.
 213 File status.

Reported by:	Oleg Koreshkov <okor -at- zone.salut.ru>
MFC after:	1 week
2004-11-15 12:41:56 +00:00
Ruslan Ermilov
1b1aa7e465 So do it like we do in usr.bin/tip/tip/Makefile. ;) 2004-11-14 22:18:31 +00:00
Jens Schweikhardt
443ceb1c7e Revert previous commit. As ru explains:
In the old world (as the surrounding comment in makefile says), there
 was the /usr/libexec/ld-elf.so.1 binary which is now a symlink to
 /libexec/ld-elf.so.1. To symlink, we need to make sure that the
 _target_ (and the target is /usr/libexec/ld-elf.so.1) doesn't have
 "schg" flag set. A real solution is to protect the chflags call only if
 target exists, like we do in usr.bin/tip/tip/Makefile.

Requested by:	ru
2004-11-14 21:14:06 +00:00
Jens Schweikhardt
6ccc491b4b Avoid an (ignored) error by invoking chflags on the link target, not the
symlink.

PR:		kern/73016
Submitted by:	John E. Hein <jhein@timing.com>
MFC after:	1 week
2004-11-14 12:47:20 +00:00
Bjoern A. Zeeb
6c58990d47 Add knob NO_NIS (fka NO_YP_LIBC) and make world compileable when set.
If turned on  no NIS support and related programs will be built.

Lost parts rediscovered by:	Danny Braniss <danny at cs.huji.ac.il>
PR:		bin/68303
No objections:	des, gshapiro, nectar
Reviewed by:	ru
Approved by:	rwatson (mentor)
MFC after:	2 weeks
2004-11-13 20:40:32 +00:00
Yaroslav Tykhiy
6e4b0a55f7 Using off_t to pass a block size is obvious overkill.
The size_t type is better suited for that, particularly because
the "blksize" argument is to be passed to malloc() and read().
On 64-bit archs it's more to a style issue, but the good style
of coding in C is also important.
2004-11-13 13:42:43 +00:00
Yaroslav Tykhiy
e3765043a8 Kill ancient casts to integral types left from the K&R era.
They're unneeded and sometimes erroneous now.
2004-11-13 13:15:47 +00:00
John Baldwin
2939195e46 Remove these unused files before any other archs include the same bogus
file.
2004-11-12 18:05:30 +00:00
Peter Wemm
24b4ec3d21 The 32 bit compatability ld-elf32.so.1 cannot use i386_set_ldt() when
running on an amd64 kernel.  Use the recently exposed direct %fs/%gs set
routines instead for the TLS setup of 32 bit binaries.
2004-11-06 03:32:07 +00:00
Ruslan Ermilov
dee651eb15 Introduce the PRECIOUSPROG knob in bsd.prog.mk, similar
to PRECIOUSLIB from bsd.lib.mk.  The side effect of this
is making installing the world under jail(8) possible by
using another knob, NOFSCHG.

Reviewed by:	oliver
2004-11-03 18:01:21 +00:00
Yaroslav Tykhiy
8c1c21f2ef Fix logxfer() by using realpath(3) instead of playing with getwd(3).
Previously logxfer() used to record bogus pathnames to the log
in some cases, namely, when cwd was / or "name" was absolute.

Noticed by:	Nick Leuta
MFC after:	2 weeks
2004-11-03 06:52:40 +00:00
Yaroslav Tykhiy
bb4641e28b Replace the last occurence of (long long) and %qd with
(intmax_t) and %jd, which is the right way to printf
an off_t in the presence of <stdint.h>.

Submitted by:	Nick Leuta
2004-11-02 18:48:44 +00:00
Suleiman Souhlal
6c2a9753f2 Implement TLS relocations for powerpc.
Approved by:	grehan (mentor)
2004-11-02 09:47:01 +00:00
Suleiman Souhlal
5bbd22ee8d Do the TLS offset allocations before relocations, as otherwise there
can be overlap in the TLS offsets, if the relocations are done in a
certain order.

Approved by:	dfr, grehan (mentor)
2004-11-02 09:42:21 +00:00
Yaroslav Tykhiy
545ea86459 OpenPAM allows passing a NULL "pamh" to pam_strerror() to indicate
that the creation of a PAM context has failed.

N.B. This does not apply to pam_strerror() in RELENG_4, it
will mishandle a NULL "pamh".

Discussed with:	des
2004-11-01 16:05:57 +00:00
Yaroslav Tykhiy
de45162d8c - Stop shadowing global "pamh" by a local variable in auth_pam().
- Stop calling pam_strerror() with NULL pamh.
- Add a missing call to pam_end().

PR:		bin/59776
Submitted by:	Nick Leuta <see PR for email>
MFC after:	2 weeks
2004-10-30 17:30:56 +00:00
Yaroslav Tykhiy
c29b9b4797 Describe the semantics of the sgetpwnam() helper function
in the comment above it so that nobody will save pointers
returned inside "struct passwd" across the calls to the function.
2004-10-30 16:11:15 +00:00
Yaroslav Tykhiy
c999732b45 Log the actual number of bytes sent on the wire to /var/log/ftpd
instead of the disk size of the file sent.   Since the log file
is intended to provide data for anonymous ftp traffic accounting,
the disk size of the file isn't really informative in this case.

PR:		bin/72687
Submitted by:	Oleg Koreshkov
MFC after:	1 week
2004-10-24 20:12:08 +00:00
Ruslan Ermilov
a35d88931c For variables that are only checked with defined(), don't provide
any fake value.
2004-10-24 15:33:08 +00:00
Stefan Farfeleder
b08f8f39ca Remove definition of struct dom_binding, it's non-standard C code and
unnecessary since src/include/rpcsvc/ypclnt.h's revision 1.10.
2004-10-17 19:33:33 +00:00
Yaroslav Tykhiy
b4585cc137 We must not fall back to the old way (read-write)
if sendfile() transferred some data before throwing
a error condition because sendfile() won't move the
file offset for read() to start from.

MFC after:	2 weeks
2004-10-15 09:51:36 +00:00
Yaroslav Tykhiy
2f492fc883 Clean-up around sendfile(): drop an excessive check for error condition. 2004-10-15 09:38:13 +00:00
Yaroslav Tykhiy
2e22b91434 Account for the fact that sendfile(2) may hit the end of file
prematurely, e.g., if the file has been truncated by someone else.

PR:		bin/72649
Submitted by:	Oleg Koreshkov (portions)
MFC after:	2 weeks
2004-10-15 09:31:08 +00:00
Jens Schweikhardt
69ffe299bd Correct grammos. Added BUGS: may mishandle nonstandard manual pages,
especially third party junk^Wpages, like emulators/mtools(1) and friends.
2004-10-06 18:31:45 +00:00
Warner Losh
780afd18cd Report once that the device isn't there, but keep trying. Don't
filter the errno values.  They don't make as much sense as they used
to given how we do devices in /dev.
2004-09-29 20:55:14 +00:00
Olivier Houchard
34be051190 Don't try to relocate the dynamic loader in reloc_non_plt(). It has already
been done before.
2004-09-28 14:43:12 +00:00
Olivier Houchard
0e030636cb Use add instead of saving the sp in a register. 2004-09-28 14:41:15 +00:00
Maxim Konovalov
6d4a0e75fc Indent. 2004-09-24 13:22:45 +00:00
Maxim Konovalov
40e677651c 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
Olivier Houchard
9ac88d19dc 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
Tom Rhodes
3a710cbaba Remove named-xfer, it does not exist in BIND 9. 2004-09-22 14:17:56 +00:00
Dag-Erling Smørgrav
cd3ee173f9 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 Konovalov
9f09e3bbc6 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
David E. O'Brien
1ca2208839 Add some details about our wonderful system. 2004-08-21 03:36:47 +00:00
David E. O'Brien
46c33242d2 Turn on the FreeBSD login user capabilities database support. 2004-08-18 06:46:25 +00:00
Marius Strobl
39513fa664 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
Colin Percival
d37df47d31 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
Doug Rabson
fca32c746e Add stubs for powerpc TLS.
Submitted by: ssouhlal
2004-08-04 19:12:14 +00:00
Doug Rabson
017246d02f Add support for Thread Local Storage. 2004-08-03 08:51:00 +00:00
Yaroslav Tykhiy
809ad9288f ftpd(8) seems to be WARNS=2 clean now.
Tested on:	i386, ia64, amd64, sparc64, alpha
2004-07-31 15:07:33 +00:00
Yaroslav Tykhiy
aa5a9d3fff 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
Yaroslav Tykhiy
0e519c96ef 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
Yaroslav Tykhiy
a57e1ef070 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
Yaroslav Tykhiy
c16cd94d23 Kill an unused variable (heading to WARNS=2.) 2004-07-31 14:03:59 +00:00
Yaroslav Tykhiy
012cdd2c90 Convert a couple of bogus null statements to the right form.
(Heading to WARNS=2.)
2004-07-31 14:03:14 +00:00
Yaroslav Tykhiy
c4536e21d4 Ditto for (gid_t). 2004-07-30 17:30:07 +00:00
Yaroslav Tykhiy
52e7ee748d 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
Yaroslav Tykhiy
9ec7612a2f 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
Yaroslav Tykhiy
6c124a8422 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
Alexander Kabaev
c27501e784 Call nmatch function with parameters casted to types the function actually
expects.
2004-07-29 18:05:20 +00:00
Stefan Farfeleder
70c3c978b9 Fix a few cases that relied on 'implicit int' (constraint violation in C99). 2004-07-11 17:37:33 +00:00
Ruslan Ermilov
2410103c1d mdoc(7) fixes. 2004-07-07 19:57:16 +00:00
Stefan Farfeleder
5908d366fb 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
Ruslan Ermilov
1171aedcdf Deal with double whitespace. 2004-07-03 00:06:28 +00:00
Ruslan Ermilov
c481aa05e8 Mechanically kill hard sentence breaks. 2004-07-02 21:28:50 +00:00
Ruslan Ermilov
d37ea99837 Removed trailing whitespace. 2004-07-02 19:07:33 +00:00
Christian S.J. Peron
0c90b4887e 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
Poul-Henning Kamp
be825f30a5 Nuke COMPAT_43 2004-06-25 10:11:28 +00:00
Brian Somers
3ec73cf100 Call tzset() at startup.
Submitted by:	Andrzej ToboÅa <ato@iem.pw.edu.pl>
2004-06-21 10:47:12 +00:00
Brian Somers
7bc7e0c85e 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
Thomas Moestl
d05bb9a2a6 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
Olivier Houchard
45ab3f5350 This comment should have been removed in the previous commit.
Spotted out by: marcus, simon
2004-06-17 19:01:53 +00:00
Olivier Houchard
f77d42ce5c Woohoo !
the latest binutils import mades this gross hack useless, so just remove it.
2004-06-17 17:53:16 +00:00
David E. O'Brien
d8a921c775 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
David E. O'Brien
9896c5f11a Fall out from Binutils 2.15: don't bulid the ld.so on Sparc64. 2004-06-17 03:04:24 +00:00
Bruce M Simpson
872b0f7946 Whitespace. 2004-06-14 22:44:13 +00:00
Bruce M Simpson
17d7976856 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
David E. O'Brien
63047c6ffc Simplify conditional compilation logic some. 2004-06-13 19:54:12 +00:00
Oliver Eikemeier
0a16eb8341 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
Matthew N. Dodd
e99c7b0d2c - Close fd if fdopen(fd) fails.
- Format return () to resemble the one 5 lines up.
2004-05-25 01:40:27 +00:00
Matthew N. Dodd
eff7787706 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
Stefan Farfeleder
28e1bf4689 Include <stdlib.h> for exit() and abort() prototypes.
Approved by:	das (mentor)
2004-05-24 13:21:24 +00:00
Stefan Farfeleder
40905e9049 Include <netinet/in.h> for ntoh*() and hton*() prototypes.
Approved by:	das (mentor)
2004-05-24 11:59:17 +00:00
Matthew N. Dodd
966efcc767 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
Ruslan Ermilov
38e3e1c352 Markup fixes. 2004-05-16 22:12:12 +00:00
Ruslan Ermilov
426994532f Markup nit. 2004-05-16 22:11:56 +00:00
Ruslan Ermilov
53ee59fe53 There's no such beast like AF_INET4, even when powered by whiskey. 2004-05-16 22:11:40 +00:00
Ruslan Ermilov
caa40776d2 Bump document date for the latest change.
Minor markup tweaks.
2004-05-16 22:11:22 +00:00
Olivier Houchard
3088daddf3 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
Stefan Eßer
55a4ccf3e8 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
Olivier Houchard
e659267f1e Import arm bits for rtld-elf.
Obtained from:	NetBSD
2004-05-14 12:15:51 +00:00
Tim J. Robbins
9cbb335cfd 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
Maxime Henrion
dfd6a083db 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
Doug Rabson
f88e6caca2 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
Pawel Jakub Dawidek
ece20938e5 Make fingerd(8) WARNS2 clean. 2004-03-29 09:29:51 +00:00
Peter Wemm
c707fea10b 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 Wemm
c905e45dc0 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
Bruce Evans
2dc8d58f59 Fixed a misspelling of 0 as NULL. 2004-03-14 05:27:26 +00:00
Max Laier
8d69c48be5 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
Mark Murray
16fc3635f7 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
Max Laier
278445ba35 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
Alexander Kabaev
2627f3570d 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
David Schultz
4f70638ec2 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
Peter Pentchev
dc546e1a0e 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
Peter Pentchev
f9566be8dd 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
Yaroslav Tykhiy
385f9bf07c NULL looks better than (char *)0 unless we're passing
an unprototyped argument to a function.
2004-02-07 14:59:11 +00:00
Yaroslav Tykhiy
b943b3c4ae 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
Yaroslav Tykhiy
3f8b9cfe85 perror_reply() should not be used where errno isn't meaningful. 2004-02-07 14:38:04 +00:00
Yaroslav Tykhiy
10e8910499 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
Ruslan Ermilov
47d7e8a96f Fixed style of DPADD and LDADD assignments as per style.Makefile(5). 2004-02-05 22:44:25 +00:00
Ruslan Ermilov
3ce0bf5144 Removed unnecessary dependencies on librpcsvc.
Prodded by:	des
2004-02-04 11:59:08 +00:00
Ruslan Ermilov
80c49332e2 Put libdevstat before libkvm, because the former depends on the latter. 2004-02-04 10:20:43 +00:00
Ruslan Ermilov
a9993ab438 - 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
Max Khon
6e918a4d5e Fix "warning: value computed is not used".
Found by:	gcc 2.95.4 [FreeBSD]
2004-02-03 18:53:40 +00:00
Ruslan Ermilov
8dfe84c2fb Removed duplicate -lutil. 2004-02-02 18:23:18 +00:00
Ruslan Ermilov
40f38d59c2 Reorder dependencies to fix static NOPAM build.
Submitted by:	lorder(1)
2004-02-02 18:19:41 +00:00
Philippe Charnier
c433c9daac add missing setusershell() calls.
PR: bin/2442
Reviewed by: Friedemann Becker <zxmxy33@mail.uni-tuebingen.de>
2004-01-18 21:29:33 +00:00
Ruslan Ermilov
d10a8d6cb4 - 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
Eric Anholt
c83098a31d 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
Doug Rabson
ae59481b1a Initialise some uninitialised variables.
Thanks to: valgrind
2003-12-31 15:10:41 +00:00
David E. O'Brien
cf3fef3bdd 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 Wemm
6143d8ba5f 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 Wemm
080f5381b7 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 Wemm
165d50f626 Only define CACHE_LINE_SIZE in one place.. 2003-12-11 04:49:37 +00:00
Peter Wemm
40a7c81112 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
Maxim Sobolev
9e95548c30 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
Hartmut Brandt
89624a3490 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
Yaroslav Tykhiy
db1c2da334 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
Anton Berezin
4893027ac4 Sync comment with code's reality.
MFC after:	1 week
2003-11-14 12:56:56 +00:00
Peter Wemm
d988f6deec Tidy up some xdrproc_t related warnings. 2003-10-26 04:32:53 +00:00
Peter Wemm
45ffe5605f Pacify gcc warning with a Douglas Adams reference. 2003-10-26 04:30:05 +00:00
Tim J. Robbins
392d789d29 Make the warning message stand out more. 2003-10-11 07:37:55 +00:00
Tim J. Robbins
a14c617681 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
Tim J. Robbins
99d21d504c 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
Hajimu UMEMOTO
206fe568bf 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
Matthew N. Dodd
5515f48ce3 Retire the WITH_LIBMAP compile knob; libmap is now a standard feature. 2003-09-13 21:50:36 +00:00
Matthew N. Dodd
4402996dea 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
David E. O'Brien
1569f861d7 Deal with the LOGIN_NAME_MAX issue in the NetBSD->FreeBSD
translation^H^H^Hhack layer.
2003-09-11 03:28:21 +00:00
David E. O'Brien
79a21e62da Add a dependancy on 'nbsd2fbsd.h' 2003-09-10 19:03:48 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Alexander Kabaev
84c0a48249 Eliminate last three uses of varargs.h in the tree. These three files
were including varargs.h file but did not use any of its macros,
so they escaped the clean-up before.
2003-09-01 04:12:18 +00:00
Ceri Davies
a707b683e7 Add a note that the -u option can be overridden by settings in login.conf(5).
PR:		docs/56017
Submitted by:	Josef El-Rayes <j.el-rayes@daemon.li>
2003-08-31 07:45:48 +00:00
David E. O'Brien
0e9a61d260 Remove a useless '/'. 2003-08-24 17:35:52 +00:00
Warner Losh
566ef09073 Very minor style nit: sort include files alphabetically. 2003-08-22 02:22:59 +00:00
Gordon Tetlow
df7bdd0ae9 Forgot one instance of ld-elf.so.1. Convert to ${PROG}
Pointed out by:	obrien
2003-08-17 22:12:26 +00:00
Gordon Tetlow
dbbcd515ff Don't forget to honor DESTDIR. Also switch over to using PROG instead of
the binary name directly.
2003-08-17 18:59:30 +00:00
Gordon Tetlow
a857d9305c Don't forget to chflags noschg the existing binary so we can symlink
over it safely.

Pointed out by:	yosimoto@waishi.jp
2003-08-17 18:50:56 +00:00
Gordon Tetlow
df7c0368c1 As long threatened, stage 2 of making a dynamically-linked root a reality.
Install rtld into /libexec.
2003-08-17 08:06:00 +00:00
Gordon Tetlow
7b73593acd Prepend /lib to the builtin library search path in rtld. 2003-08-17 07:55:17 +00:00
Mark Murray
482d5f1f6a Make sure that a "make release" (more accurately the bit that makes
the crunched binary) get a non-cryptographic telnet. This is overkill
in that it covers stuff that is not normally used in a crunched binary.
2003-07-24 17:19:15 +00:00
Mark Murray
3665b7c29b Ensure that for the cryptographic instances of *telnet*, the "crypto"
distribution is used. This only affects release-building.
2003-07-24 07:19:55 +00:00
Mark Murray
acce0bcdb3 Test correct macro for "without crypto" option(s). 2003-07-20 23:29:46 +00:00
Yaroslav Tykhiy
0183b0b8b8 Prototype defttymode() instead of just declaring it. 2003-07-18 16:25:55 +00:00
Mark Murray
4afa371832 Very big makeover in the way telnet, telnetd and libtelnet are built.
Previously, there were two copies of telnet; a non-crypto version
that lived in the usual places, and a crypto version that lived in
crypto/telnet/. The latter was built in a broken manner somewhat akin
to other "contribified" sources. This meant that there were 4 telnets
competing with each other at build time - KerberosIV, Kerberos5,
plain-old-secure and base. KerberosIV is no longer in the running, but
the other three took it in turns to jump all over each other during a
"make buildworld".

As the crypto issue has been clarified, and crypto _calls_ are not
a problem, crypto/telnet has been repo-copied to contrib/telnet,
and with this commit, all telnets are now "contribified". The contrib
path was chosen to not destroy history in the repository, and differs
from other contrib/ entries in that it may be worked on as "normal"
BSD code. There is no dangerous crypto in these sources, only a
very weak system less strong than enigma(1).

Kerberos5 telnet and Secure telnet are now selected by using the usual
macros in /etc/make.conf, and the build process is unsurprising and
less treacherous.
2003-07-16 20:59:15 +00:00
Yaroslav Tykhiy
e25d3184d0 Block SIGURG while reading from the control channel.
Rationale:

SIGURG is configured by ftpd to interrupt system calls, which is useful
during data transfers.  However, SIGURG could interrupt I/O on the
control channel as well, which was mistaken for the end of the session.

A practical example could be aborting the download of a tiny file,
when the abort sequence reached ftpd after ftpd had passed the file
data to the system and returned to its command loop.

Reported by:	ceri
MFC after:	1 week
2003-07-09 13:54:33 +00:00
Yaroslav Tykhiy
39b96ba75d Improve error handling in getline():
- always check the return value from getc(3) for EOF;
- if the attempt to read the TELNET command byte has
  returned EOF, exit from the loop instead of using
  the EOF value as a normal character.

MFC after:	1 week
2003-07-09 13:15:32 +00:00
Yaroslav Tykhiy
39bce48245 Make a malloced copy of "chrootdir" even if it points to an absolute
pathname inside "residue" so "chrootdir" can be simply freed later.

PR:		bin/53435
Submitted by:	Yutaka Ishihara <yutaka at fandc.co.jp>
MFC after:	1 week
2003-07-09 12:46:24 +00:00
Gregory Neil Shapiro
dce6e6518b Remove MAINTAINER= lines from individual Makefiles in favor of the
MAINTAINER file (which already had entries for sendmail).
2003-07-07 03:54:04 +00:00
Jake Burkholder
d037213487 Avoid using the global offset table to get the address of _DYNAMIC in
rtld.  When _DYNAMIC is referenced normally from C the global offset
table is used implicitly, but newer versions of binutils don't initialize
it statically in the binary, so this doesn't work until rtld is relocated,
which _DYNAMIC is needed for...  So, as on other systems with the same
problem, we disassemble a call instruction to _DYNAMIC in order to get
its address.
2003-07-04 00:05:15 +00:00
Yaroslav Tykhiy
9581ecbd72 Don't declare unneeded extern variables,
leave alone specifying a wrong type for one of them.
2003-06-21 10:45:38 +00:00
Matthew N. Dodd
e2a474429e Fix warnings on 64 bit platforms.
Noticed by:	 jake
2003-06-19 16:09:18 +00:00
Matthew N. Dodd
5407dd5b82 Add function prototypes. 2003-06-19 05:28:26 +00:00
Matthew N. Dodd
ded0e52363 LD_DUMP_REL_PRE and LD_DUMP_REL_POST don't output to stderr; don't
claim that they do.
2003-06-19 04:34:09 +00:00
Matthew N. Dodd
c5d061c17a Provide a mechanism for dumping relocation information.
Setting the LD_DUMP_REL_PRE or LD_DUMP_REL_POST environment variables
cause rtld-elf to output a table of all relocations.

This is useful for debugging.
2003-06-19 03:55:38 +00:00
Matthew N. Dodd
94040887ee Move MD function prototypes together. 2003-06-19 02:42:04 +00:00
Matthew N. Dodd
2c297acb7a Fix warnings; no parameters in function prototypes. 2003-06-19 02:39:37 +00:00
Matthew N. Dodd
5952de4b1b Avoid a NULL pointer dereference. 2003-06-18 16:17:13 +00:00
Yaroslav Tykhiy
b19ab1ce69 - Use the initial terminal mode instead of the current mode
as the source of defaults for terminal device parameters.

- Do duplucate code reduction and simplification enabled by
  the above.

Reviewed by:	green
MFC after:	1 month
2003-06-18 13:22:44 +00:00
Matthew N. Dodd
7227105f74 Include libmap.h for prototypes. 2003-06-18 05:31:08 +00:00
Matthew N. Dodd
da9f245470 - Add support for DT_FLAGS.
- Define various things from the most recent ELF spec.
2003-06-18 03:34:29 +00:00
Doug Barton
da14abebe4 More correctly spell "-static" as "NOSHARED?=YES" 2003-06-17 20:07:49 +00:00
Yaroslav Tykhiy
ec754f0964 Improve the manpage language a bit.
A PPP login program is started _automatically_ (i.e., without
human intervention) even with the "pl" capability unset, as soon
as a PPP frame is detected.  But with "pl" set, a PPP login program
is started independently of the result of PPP detection (which is
rendered unnecessary then,) i.e. _unconditionally_.
2003-06-17 12:29:36 +00:00
Doug Barton
7c633f01f6 Link named-xfer -static. This is the only binary that needs to be
statically compiled for named to work chroot'ed, and we'd like
to be able to do that from /etc/rc.d without additional user
intervention.
2003-06-17 08:53:27 +00:00
Yaroslav Tykhiy
a278e092d3 If ftpd is run with an -h option (hide host-specific info,)
don't reveal the info in reply to the SYST command.

Get rid of using the "unix" macro at the same time.  It was a rather
poor way to check if the system was Unix since there were quite a
few Unix clones out there whose cc didn't define "unix" (e.g.,
NetBSD.)  It was also sensitive to the C standard used, which caused
unnecessary trouble:  With -std=c99, it should have been "__unix__",
and so on.

PR:		bin/50690
Submitted by:	Alex Semenyaka <alexs _at_ snark.ratmir.ru>
MFC after:	1 week
2003-06-16 11:30:23 +00:00
John-Mark Gurney
9bf69bf27a fix a couple typos in the comments
From NetBSD's bootpd (in src/usr.sbin/bootp)
2003-06-15 03:08:37 +00:00
John-Mark Gurney
b6a0d4720e fix bootpd to use fd_set. For some reason on Sparc, using int with
select is broken.
2003-06-15 03:05:14 +00:00