Commit Graph

1037 Commits

Author SHA1 Message Date
Ruslan Ermilov
f0134e3330 mdoc(7) police: nits. 2002-08-13 11:11:32 +00:00
Ruslan Ermilov
d075dcedfc mdoc(7) police: tidy up. 2002-08-13 11:05:04 +00:00
Jens Schweikhardt
2b239dd118 Fix typos; each file has at least one s/seperat/separat/
(I skipped those in contrib/, gnu/ and crypto/)
While I was at it, fixed a lot more found by ispell that I
could identify with certainty to be errors. All of these
were in comments or text, not in actual code.

Suggested by:	bde
MFC after:	3 days
2002-08-11 13:05:30 +00:00
Yaroslav Tykhiy
a117c34534 Rework storing files thoroughly. This includes:
o Remove the race between stat(2) & fopen(3) when creating
  a unique file.

o Improve bound checking when generating a unique name from
  a given pathname.

o Ignore REST marker on APPE.  No RFC specifies this case,
  but the idea of resuming APPE's implies this.

o By default, deny upload resumes and appends by anonymous users.
  Previously these commands were translated to STOU silently,
  which led to broken files on server without any notification
  to the user.

o Add an option, -m, to allow anonymous users to modify
  existing files (e.g., to resume uploads) if filesystem
  permissions permit.

Portions obrainded from:	OpenBSD
MFC after:			3 weeks
2002-08-08 17:53:52 +00:00
John Polstra
0df23e4bd5 Don't acquire the writer lock in rtld_exit when clearing the shared
objects' reference counts.  This function is called by the atexit
mechanism at program shutdown.  I don't think the locking is necessary
here.  It caused OpenOffice builds to hang more often than not.
Credit to Martin Blapp and Matt Dillon for helping to diagnose this
problem and for testing the fix.
2002-08-08 15:53:23 +00:00
Yaroslav Tykhiy
1b9f1a4bd2 1) Use "pathstring" instead of "STRING" consistently.
2) Remove unneeded "if not NULL" props from "pathstring",
   which will never be NULL by the lexer design.

Inspired by:	OpenBSD
MFC after:	1 week
2002-08-05 17:34:15 +00:00
Yaroslav Tykhiy
1d1dc13be6 Since GLOB_NOCHECK is set in the glob(3) call,
glob(3) will return at least one pathname unless
a system error has occured.  It's not a "not found"
error otherwise.

MFC after:	3 days
2002-08-05 14:40:38 +00:00
Yaroslav Tykhiy
effa0530c4 Spot places where "pathname" hasn't been checked
for NULL.  The "pathname" rule may return NULL
on a glob(3) error.

Obtained from:	OpenBSD
MFC after:	1 week
2002-08-05 14:26:40 +00:00
Yaroslav Tykhiy
c452fbe11c Disallow invalid numeric mode values for SITE CHMOD.
Earlier, a decimal number (e.g., 890) could be passed
for mode, leading to dangerous permissions set:
-1, that is, 07777.

Obtained from:	OpenBSD
MFC after:	1 week
2002-08-05 14:10:57 +00:00
Yaroslav Tykhiy
255a70376b Reflect in the ftpd(8) manpage the fact that ASCII SIZE
requests against large files will be denied.

MFC after:	10 days
2002-08-05 13:37:18 +00:00
Yaroslav Tykhiy
781cfb9348 Deny the SIZE command on large files when in ASCII mode.
This eliminates an opportunity for DoS attack.

Pointed out by:	maxim
Inspired by:	lukemftpd, OpenBSD
MFC after:	2 weeks
2002-07-31 10:55:31 +00:00
Yaroslav Tykhiy
2b7489878b Conform to RFC 959, Appendix II, when replying
to a successful MKD command.

MFC after:	1 week
2002-07-29 15:54:27 +00:00
Yaroslav Tykhiy
93bd9dc528 Make the -v' option a synonym for -d'
(as it was intended initially)
and document it in the manpage.

MFC after:	2 weeks
2002-07-26 16:07:19 +00:00
Yaroslav Tykhiy
38ed70b1ae Document the -u (set umask) option
(which has been there at least since 4.4BSD-Lite!)

MFC after:	2 weeks
2002-07-26 16:01:24 +00:00
Yaroslav Tykhiy
0e063efefb Sort command-line options according to the mostly used style:
alphabetical order, lower and upper case of the same letter
stick together, lower case first.

MFC after:	2 weeks
2002-07-26 15:46:08 +00:00
Yaroslav Tykhiy
4454edd688 Use <arpa/ftp.h> stuff cleanly, without introducing
non-portable constants (in this case, hidden as offsets
to the "?AEIL" string.)

MFC after:	1 week
2002-07-25 17:41:47 +00:00
Yaroslav Tykhiy
8af7c9a3c0 Re-use passive data ports with the SO_REUSEADDR
socket option to avoid exausting the passive port
space by TIME_WAIT'ing connections.

PR:		bin/36955
Submitted by:	Maxim Konovalov <maxim@FreeBSD.org>
MFC after:	2 weeks
2002-07-24 16:11:34 +00:00
Yaroslav Tykhiy
57d4ef078c Remove the outdated casts to "char *" from the setsockopt(2),
write(2), and getipnodebyaddr(3) calls.  Now all the above functions
accept "void *" in that arguments and have prototypes.  Thus, the
casts are useless under the normal circumstances (and would be harmful
if the functions had no prototypes.)

MFC after:	2 weeks
2002-07-24 15:30:53 +00:00
Yaroslav Tykhiy
406d1ae93a Clean up the syslog(3) messages on the setsockopt(2) errors:
o Always check a setsockopt(2) return value
o Use a consistent message format
o Don't abort if the failed setsockopt(2) was actually not vital
o Use LOG_WARNING, not LOG_ERR, in non-fatal cases

MFC after:	1 week
2002-07-24 14:50:17 +00:00
Hajimu UMEMOTO
fc99a00c7f use IPV6_V6ONLY instead of non standard IPV6_BINDV6ONLY.
MFC after:	1 week
2002-07-22 15:22:53 +00:00
Yaroslav Tykhiy
e4648f051f Fix one RFC 959 incompliance:
Double double-quotes in a PWD result
if they appear in the directory pathname.

PR:		misc/18365
MFC after:	1 week
2002-07-22 07:41:14 +00:00
Philippe Charnier
0c9dd24bbb Correct wrong grammar from previous commit. Note that fingerd is not limited
to being an interface to finger(1), see -p flag. Remove a reference to
name(?) program we don't have.

Submitted by:	wollman
2002-07-21 13:02:13 +00:00
Yaroslav Tykhiy
1b0e12d747 Allow deleting and renaming stale symlinks and
deleting symlinks pointing to directories.

PR:		bin/37250
Submitted by:	Nino Dehne <TeCeEm@gmx.de>
MFC after:	1 week
2002-07-21 12:06:56 +00:00
Jake Burkholder
b1d6ef2ee9 Add END markers to asm functions so that debuggers can find their size. 2002-07-17 22:20:41 +00:00
Yaroslav Tykhiy
233c0f6643 Avoid passing NULL to freehostent(3).
MFC after:	1 week
2002-07-17 19:29:25 +00:00
Yaroslav Tykhiy
4b4cc4c60b Fix setting parameters for getipnodebyaddr(3):
o "struct addrinfo" contains a pointer to "struct sockaddr,"
  not "struct sockaddr" itself
o the function takes a pointer to "struct in*_addr", not to
  "struct sockaddr," so the address length must be corresponding

MFC after:	1 week
2002-07-17 19:07:07 +00:00
Mike Heffner
12da320bf9 GLOB_QUOTE has been retired. 2002-07-17 05:47:49 +00:00
Yaroslav Tykhiy
5f76ebf34e Use the right indent for the closing brace: it belongs to `if',
not to `for'.  The previous indent was reather misleading for
the code reader.

MFC after:	1 week
2002-07-16 16:48:15 +00:00
Yaroslav Tykhiy
55b54aa791 Replace the awkward hackery about strtok(3)
by conventional one-way parsing of ftphosts(5).
Don't let NULL hostname pointers into virtual
host records as well.

PR:		bin/18410
MFC after:	1 month
2002-07-16 16:30:41 +00:00
Alfred Perlstein
af37179b5f Port to TI/RPC and/or IPV6.
Submitted by: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
2002-07-15 18:51:57 +00:00
Yaroslav Tykhiy
737d08f31e Use fgetln(3) to read lines from configuration files (ftpusers, ftphosts.)
Thus lines of any length can be handled, unlike before.

Don't assume that each line read from the files ends with a newline.

As a side effect in inithosts(), don't use automatic buffer at all,
utilize malloc(3) when getting local host name instead.

PR:		misc/21494
Reviewed by:	maxim, mikeh
MFC after:	1 month
2002-07-12 15:51:15 +00:00
Johan Karlsson
7da9dccb66 Add ability to only beep when mail arrives.
comsat:
        only send two bell charecters if S_IXGRP is set and S_IXUSR is not.

biff:
        add new option 'b' to set S_IXGRP.

PR:             10931
Submitted by:   Andrew J. Korty <ajk@purdue.edu>
Approved by:    sheldonh (mentor)
MFC after:      1 month
2002-07-09 02:16:49 +00:00
John Polstra
e6f0183bff Remove the nanosleep calls from the spin loops in the locking code.
They provided little benefit (if any) and they caused some problems
in OpenOffice, at least in post-KSE -current and perhaps in other
environments too.  The nanosleep calls prevented the profiling timer
from advancing during the spinloops, thereby preventing the thread
scheduler from ever pre-empting the spinning thread.  Alexander
Kabaev diagnosed this problem, Martin Blapp helped with testing,
and Matt Dillon provided some helpful suggestions.

This is a short-term fix for a larger problem.  The use of spinlocking
isn't guaranteed to work in all cases.  For example, if the spinning
thread has higher priority than all other threads, it may never be
pre-empted, and the thread holding the lock may never progress far
enough to release the lock.  On the other hand, spinlocking is the
only locking that can work with an arbitrary unknown threads package.

I have some ideas for a much better fix in the longer term.  It
would eliminate all locking inside the dynamic linker by making it
safe for symbol lookups and lazy binding to proceed in parallel
with a call to dlopen or dlclose.  This means that the only mutual
exclusion needed would be to prevent multiple simultaneous calls
to dlopen and/or dlclose.  That mutual exclusion could be put into
the native pthreads library.  Applications using foreign threads
packages would have to make their own arrangements to ensure that
they did not have multiple threads in dlopen and/or dlclose -- a
reasonable requirement in my opinion.

MFC after:	3 days
2002-07-06 20:25:56 +00:00
Philippe Charnier
3f162cb85d The .Nm utility 2002-07-06 19:19:48 +00:00
Dan Moschuk
0849c18499 Make sure to reset transflag back to zero upon succesfully using sendfile()
to transfer a file.

PR: 39362
Submitted by: TANAKA Hiroyuki <kattyo@abk.nu>
MFC after: 1 week
2002-07-03 00:12:00 +00:00
Hajimu UMEMOTO
b0f06def52 Cope with 2292bis-01 getaddrinfo (no NI_WITHSCOPEID, always attach
scope identifier).

MFC after:	3 weeks
2002-07-02 11:11:17 +00:00
Maxim Konovalov
3ded9dcdae Remove trailing whitespaces. 2002-07-01 14:30:38 +00:00
Maxim Konovalov
3af48c420b Move 'byte_count' calculation just before 'recvurg' check. It is a global
variable and used in myoob().

PR:		bin/38928
Submitted by:	Oliver Fromme <olli@secnetix.de>
MFC after:	1 month
2002-07-01 14:29:44 +00:00
Matthew N. Dodd
d186bb1240 Implement a flag to disable directory creation for anonymous users.
PR:		misc/38987
Submitted by:	Peter da Silva <peter@abbnm.com>
MFC after:	1 week
2002-07-01 02:30:11 +00:00
Mark Murray
f2ed975453 Remove a GCC-specific command-line option. We should be using WARNS=n
for this stuff.
2002-06-28 10:36:14 +00:00
Garrett Wollman
80536ead7f When the -p flag is specified, set an environment variable to the name
of the remote host (or rather, the name as mangled by realhostname_sa())
so that the process can use it to behave differently depending on the
origin on the request.  We use this to implement rudimentary visibility
control on our user information.

Make sure that the child process's standard error goes through the same
NVT-ASCII filter as is applied to the standard output.

Don't attempt to call logerr() from the child since stdio is not safe in
a vforked process.  Just write a message to fd 2 instead.  (Ideally, the
parent would open two pipes, and siphon off our stderr to some place less
public, but I have not attempted to do so in this implementation.)
2002-06-26 21:46:56 +00:00
Mark Murray
6481307030 Gut out (by default unused) cruft, and tidy up warnings. 2002-06-26 17:09:08 +00:00
John Polstra
d1c02bccdc Update the asm statements to use the "+" modifier instead of
matching constraints where appropriate.  This makes the dynamic
linker buildable at -O0 again.

Thanks to Bruce Evans for identifying the cause of the build
problem.

MFC after:	1 week
2002-06-24 23:19:18 +00:00
Jake Burkholder
cf85da5c68 Add needed include of mman.h to fix sparc64 buildworld. 2002-06-24 05:23:46 +00:00
Matthew Dillon
b6801e6b54 The last bits of the alloca -> mmap fix. IA64 and SPARC64 (current only).
Untested (testing request went unanswered), but sparc64 is not expected to
cause problems.  IA64 is not expected to cause problems but the patch was
slightly more complex so the possibility exists.

Approved by:    jdp
2002-06-22 18:36:21 +00:00
Matthew Dillon
eebf98659e This is the same alloca() fix as was committed for i386. David O'Brien
tested the patch on -stable.

Reviewed by:	obrien
Approved by:	jdp
MFC after:	3 days
2002-06-18 05:42:33 +00:00
John Polstra
5f8aa32e1b Dillon's recent commits to the dynamic linker without running them
by me first have given me a good excuse to drop my MAINTAINERship.

MFC after:	1 week
2002-06-10 21:51:16 +00:00
Matthew Dillon
b08440e568 Correct a bug in the last commit. The whole point of creating a 'done:'
goto target was so the cache could be freed.  So free the cache after
done: rather then before done: (!)

Submitted by:	Gavin Atkinson <gavin@ury.york.ac.uk>
2002-06-10 21:15:50 +00:00
Matthew Dillon
b603db3019 In tracking down an installation seg fault with then openoffice port
Martin Blapp determined that the elf dynamic loader was at fault.  In
particular, the loader uses alloca() to allocate a symbol cache on the
stack.  Normally this would work just fine, but if the loader is called
from a threaded program and the object being loaded is fairly large the
alloca() can blow away the thread stack and effect other nearby thread
stacks as well.  My testing showed that the symbol cache can be as large
as 250KBytes during the openoffice port build and install sequence.  Martin
was able to work around the problem by disabling the symbol cache
(cache = NULL;).  However, this solution is not adequate for commit because
it can cause an enormous cpu burden for applications which do a lot of
dynamic loading (e.g. like konqueror).

The solution is to use anonymous mmap() to temporarily allocate space to
hold the symbol cache.  In testing I found that replacing the alloca()
with mmap() has no observable degredation in performance.

It should be noted that this bug does not necessarily cause an immediate
crash but can instead result in long term corruption and instability in
applications that load modules from threads.  The bug is almost certainly
responsible for some of the instabilities found in konqueror, for example,
and possibly netscape too.

Sleuthing work by: Martin Blapp <mb@imp.ch>
X-MFC after:	Before or after the 4.6 release depending on the release engineers
2002-06-10 18:52:31 +00:00
Garrett Wollman
f24b479854 Add used include of <string.h>.
Delete unused include of <strings.h>.
2002-05-30 21:35:39 +00:00