Commit Graph

7751 Commits

Author SHA1 Message Date
jgh
2fd2750b54 - address grammar
PR:		203440 (based on)
Submitted by:	ceratv@rpi.edu
Approved by:	wblock@ (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3813
2015-10-05 18:09:43 +00:00
markj
d6b5b38ff0 Revert r288628 and instead fix a discrepancy between the posix_fadvise(2)
man page and POSIX: posix_fadvise(2) returns an error number on failure.

Reported by:	jilles
MFC after:	1 week
2015-10-03 22:27:14 +00:00
hrs
a14f7a3926 - Move PF_LOCAL at the end of the array. PF_INET{,6} is used more often.
- Add SOCKTYPE_ANY to PF_LOCAL.

- Apply AI_CANONNAME to only AF_INET{,6}.  It is not meaningful for the
  other AFs.
2015-10-03 12:40:54 +00:00
jilles
aca221db9d wordexp: Rewrite to make WRDE_NOCMD reliable.
Shell syntax is too complicated to detect command substitution and unquoted
operators reliably without implementing much of sh's parser. Therefore, have
sh do this detection.

While changing sh's support anyway, also read input from a pipe instead of
arguments to avoid {ARG_MAX} limits and improve privacy, and output count
and length using 16 instead of 8 digits.

The basic concept is:
execl("/bin/sh", "sh", "-c", "freebsd_wordexp ${1:+\"$1\"} -f "$2",
    "", flags & WRDE_NOCMD ? "-p" : "", <pipe with words>);

The WRDE_BADCHAR error is still implemented in libc. POSIX requires us to
fail strings containing unquoted braces with code WRDE_BADCHAR. Since this
is normally not a syntax error in sh, there is still a need for checking
code in libc, we_check().

The new we_check() is an optimistic check that all the characters
  <newline> | & ; < > ( ) { }
are quoted. To avoid duplicating too much sh logic, such characters are
permitted when quoting characters are seen, even if the quoting characters
may themselves be quoted. This code reports all WRDE_BADCHAR errors; bad
characters that get past it and are a syntax error in sh return WRDE_SYNTAX.

Although many implementations of WRDE_NOCMD erroneously allow some command
substitutions (and ours even documented this), there appears to be code that
relies on its security (codesearch.debian.net shows quite a few uses).
Passing untrusted data to wordexp() still exposes a denial of service
possibility and a fairly large attack surface.

Reviewed by:	wblock (man page only)
MFC after:	2 weeks
Relnotes:	yes
Security:	fixes command execution with wordexp(untrusted, WRDE_NOCMD)
2015-09-30 21:32:29 +00:00
delphij
e8d1e1d737 In this context fclose() can never fail, so assert it in the test
case.
2015-09-29 17:54:28 +00:00
kib
2b6ac44d5d Annotate arm userspace assembler sources stating their tolerance to
the non-executable stack.

Reviewed by:	andrew
Sponsored by:	The FreeBSD Foundation
2015-09-29 16:09:58 +00:00
delphij
14220da890 Use calloc() instead of malloc + memset.
MFC after:	2 weeks
2015-09-29 04:47:31 +00:00
jilles
9ee3062174 fnmatch(): Remove exponential behaviour as in sh r229201.
The old code was exponential in the number of asterisks in the pattern.
However, once a match has been found upto the next asterisk, the previous
asterisks are no longer relevant.
2015-09-27 12:52:18 +00:00
bdrewery
71fccfc30f Add missing CLEANFILES.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-09-24 23:15:24 +00:00
rodrigc
57dcec656d Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.
Submitted by:   Sascha Wildner <swildner@dragonflybsd.org>
Obtained from:  DragonFlyBSD (commit 5d7d35b17f98588c39b30036f1a3fe8802935c2c)
2015-09-23 16:16:16 +00:00
rodrigc
aa2db6bfb4 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-22 15:57:26 +00:00
rodrigc
5200f4be66 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-22 15:40:07 +00:00
rodrigc
ff5d08b031 Use proper function prototype for readdir().
Eliminates -Wstrict-prototypes warning

Submitted by: Joerg Sonnenberger <joerg@dragonflybsd.org>
Obtained from: DragonFlyBSD (commit 2a6aec8dab58c89961cabcfdb92e0d0ae256dea4)
2015-09-22 07:40:55 +00:00
rodrigc
dc4550e7b2 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-22 07:31:40 +00:00
bdrewery
3faab6f866 Avoid adding duplicates into OBJS. bsd.lib.mk already handles adding
entries to OBJS based on SRCS.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-09-22 04:55:28 +00:00
rodrigc
6e42fc823f Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 21:21:17 +00:00
rodrigc
4dfb6c3572 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 21:21:01 +00:00
rodrigc
70a6c8c892 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:55:00 +00:00
rodrigc
0cbe54eb2d Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:53:24 +00:00
rodrigc
215fea0400 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:52:13 +00:00
rodrigc
ce886a6233 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:51:52 +00:00
rodrigc
a9a0375d7e Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:50:56 +00:00
rodrigc
aa990038b1 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:50:18 +00:00
rodrigc
e5a64a53e6 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:28:49 +00:00
rodrigc
a60b0abd9a Remove names from some prototypes 2015-09-20 20:27:57 +00:00
rodrigc
141020ed04 Remove names from some prototypes 2015-09-20 20:26:46 +00:00
rodrigc
5919af45fe Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:24:28 +00:00
rodrigc
74c1506b33 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:23:16 +00:00
rodrigc
424fc070ef Remove names from some prototypes 2015-09-20 20:21:49 +00:00
rodrigc
e23bf826df Remove names from some prototypes 2015-09-20 20:16:34 +00:00
rodrigc
1737b90d79 Remove names from prototypes 2015-09-20 20:15:44 +00:00
rodrigc
fbd3bd1bfb Add include for declaration of _set_tp(). Eliminates -Wmissing-prototypes warnings. 2015-09-20 04:59:01 +00:00
rodrigc
0cd26f001a Add declarations to eliminate -Wmissing-prototypes warnings 2015-09-20 04:26:55 +00:00
rodrigc
8c6e2102df Use ANSI C prototypes.
Eliminates gcc 4.9 warnings.
2015-09-20 04:23:16 +00:00
rodrigc
101e50ce2f Add declaration to eliminate -Wmissing-prototypes warning 2015-09-20 04:21:44 +00:00
rodrigc
f7aca4b673 Add declarations to netdb_private.h to eliminate -Wmissing-prototypes warnings. 2015-09-20 04:20:31 +00:00
rodrigc
5289640ead Add declarations to eliminate -Wmissing-prototypes warnings 2015-09-20 04:17:53 +00:00
rodrigc
fd3fe449bf Define _NS_PRIVATE to make declarations visible.
This eliminates -Wmissing-prototypes warnings.
2015-09-20 04:17:03 +00:00
rodrigc
587e2d1829 Add missing includes to eliminate -Wmissing-prototypes warnings 2015-09-20 04:15:37 +00:00
rodrigc
a584fc06f1 Adding missing declarations to eliminate -Wmissing-prototypes warnings 2015-09-20 04:06:55 +00:00
rodrigc
07e3f06934 Add missing include to eliminate -Wmissing-prototypes warning 2015-09-20 04:06:04 +00:00
rodrigc
177f72974d Add declaration to eliminate -Wmissing-prototypes warning 2015-09-20 03:59:27 +00:00
rodrigc
49c1e7af60 Add declarations to eliminate -Wmissing-prototypes warnings 2015-09-20 03:58:27 +00:00
rodrigc
4c66a735a8 Adding missing include to eliminate -Wmissing-prototypes warning 2015-09-20 03:56:57 +00:00
rodrigc
0fd58af262 Add declarations to eliminate -Wmissing-prototypes warnings 2015-09-20 03:55:03 +00:00
rodrigc
08c0b3cae7 Add declarations to eliminate -Wmissing-prototypes warnings. 2015-09-20 03:53:08 +00:00
rodrigc
0046fafdb2 Add declaration to eliminate -Wmissing-prototypes warning. 2015-09-20 03:51:15 +00:00
rodrigc
418ac8aebe Add missing include to eliminate -Wmissing-prototypes warnings 2015-09-20 03:49:08 +00:00
rodrigc
04f98ba6e2 Add missing includes to eliminate -Wmissing-prototypes warnings 2015-09-20 03:45:57 +00:00
hrs
a3fcca6713 Add PF_LOCAL support in getaddrinfo(3) and getnameinfo(3):
- In a PF_LOCAL address, "hostname" must begins with '/' and "servname"
  is always NULL.  All of ai_flags are ignored.

- PF_UNSPEC matches PF_LOCAL.  EAI_SERVICE is not returned to make
  AF-independent programming easier; "servname" is always ignored
  in PF_LOCAL.  In practice, PF_INET* and PF_LOCAL are
  mutually-exclusive because a hostname which begins with '/' is invalid
  in PF_INET*.  No domain name resolution is performed for a PF_LOCAL address.

Differential Revision:	https://reviews.freebsd.org/D3634
2015-09-20 01:09:23 +00:00