Compare commits

...
81 Commits
Author SHA1 Message Date
Colin Percival 7459678c59 Correct a bug in the handling of backslash characters in smbfs which can
allow an attacker to escape from a chroot(2).

Approved by:	so (cperciva)
Security:	FreeBSD-SA-06:16.smbfs
2006-05-31 22:35:32 +00:00
Colin Percival 16bd853276 MFC: Correct a local information leakage bug affecting AMD FPUs.
Security:	FreeBSD-SA-06:14.fpu
Approved by:	so (cperciva)
2006-04-19 07:03:14 +00:00
Colin Percival bf41e5cc4c Add missing code needed for the detection of IPSec packet replays. [1]
Correctly identify the user running opiepasswd(1) when the login name
differs from the account name. [2]

Modify timeout handling logic in sendmail(8) to correct a reported
signal handling race condition. [3]

Approved by:	so (cperciva)
Security:	FreeBSD-SA-06:11.ipsec [1]
Security:	FreeBSD-SA-06:12.opie [2]
Security:	FreeBSD-SA-06:13.sendmail [3]
2006-03-22 16:03:25 +00:00
Simon L. B. Nielsen bbc537055a Correct a remote kernel panic when processing zero-length RPC records
via TCP.

Security:	FreeBSD-SA-06:10.nfs
Approved by:	so (cperciva)
2006-03-01 14:23:07 +00:00
Colin Percival ff1a157c26 Correct insecure temporary file usage in texindex. [06:01]
Correct insecure temporary file usage in ee. [06:02]
Correct a race condition when setting file permissions, sanitize file
names by default, and fix a buffer overflow when handling files
larger than 4GB in cpio. [06:03]

Security:	FreeBSD-SA-06:01.texindex
Security:	FreeBSD-SA-06:02.ee
Security:	FreeBSD-SA-06:03.cpio
Approved by:	so (cperciva)
2006-01-11 08:08:08 +00:00
Colin Percival d6e136cae2 Correct a man-in-the-middle SSL version rollback vulnerability.
Security:       FreeBSD-SA-05:21.openssl
Approved by:	so@ (cperciva)
2005-10-11 11:51:45 +00:00
Colin Percival fe3079a86c Fix two more temporary file usage bogons which were apparently fixed
but not MFCed to RELENG_4_10 earlier.

Approved by:	so (cperciva)
Security:	FreeBSD-SA-05:20.cvsbug
2005-09-09 19:24:22 +00:00
Colin Percival 7154d546c5 MFC: Correct insecure temporary file usage.
Security:	FreeBSD-SA-05:20.cvsbug
Approved by:	so (cperciva)
2005-09-07 13:44:36 +00:00
Simon L. B. Nielsen 88185f5e12 Correct bzip2 denial of service and permission race vulnerabilities.
Obtained from:	Redhat, Steve Grubb via RedHat
Security:	CAN-2005-0953, CAN-2005-1260
Security:	FreeBSD-SA-05:14.bzip2
Approved by:	obrien

Correct TCP connection stall denial-of-service vulnerabilities.

MFC: rev 1.270 of tcp_input.c, rev 1.25 of tcp_seq.h by ps: When a TCP
packets containing a timestamp is received, inadequate checking of
sequence numbers is performed, allowing an attacker to artificially
increase the internal "recent" timestamp for a connection.

A TCP packets with the SYN flag set is accepted for established
connections, allowing an attacker to overwrite certain TCP options.

Security:	CAN-2005-0356, CAN-2005-2068
Security:	FreeBSD-SA-05:15.tcp

Approved by:	so (cperciva)
2005-06-29 21:46:15 +00:00
Simon L. B. Nielsen e06afa22f2 Correct directory traversal and race condition vulnerabilities in gzip.
Security:	FreeBSD-SA-05:11.gzip
Security:	CAN-2005-0988, CAN-2005-1228
Obtained from:	Steve Grubb via RedHat, Debian

Approved by:	so (nectar)
2005-06-08 21:31:16 +00:00
Jacques Vidrine 13f9d4c5bd Add a knob for disabling/enabling HTT, "machdep.hyperthreading_allowed".
Default off due to information disclosure on multi-user systems.

Submitted by:	cperciva
Reviewed by:	jhb
Approved by:	security-officer
2005-05-13 00:08:30 +00:00
Colin Percival 6dfe6003be MFC: Fix two issues which were missed in FreeBSD-SA-05:08.kmem.
Reported by:	Uwe Doering
Approved by:	so (cperciva)
2005-05-08 10:35:56 +00:00
Colin Percival 90ef8aa429 If we are going to
1. Copy a NULL-terminated string into a fixed-length buffer, and
2. copyout that buffer to userland,
we really ought to
0. Zero the entire buffer
first.

Security: FreeBSD-SA-05:08.kmem
Approved by: so (cperciva)
2005-05-06 02:50:35 +00:00
Colin Percival f31c46a0ae Correctly validate inputs to the i386_get_ldt syscall.
Security: FreeBSD-SA-05:07.ldt
Approved by: so (cperciva)
2005-05-06 02:40:32 +00:00
Colin Percival ed7804d51c Correct improper permissions on /dev/iir. The earlier permissions
of 0644 allowed for people to do Evil Things via ioctl(2).

Security: FreeBSD-SA-05:06.iir
Approved by: so (cperciva)
2005-05-06 02:34:01 +00:00
Simon L. B. Nielsen 7ec7a3928a MFC:
Correct multiple security related errors: a buffer overflow, NULL
pointer dereferences, possible use of uninitialized variables, and
memory leaks.

Security:	CAN-2005-0753
Security:	FreeBSD-SA-05:05.cvs
Approved by:	so (cperciva)
2005-04-22 18:17:22 +00:00
Colin Percival 2551235700 Zero the ifr.ifr_name buffer in ifconf() in order to avoid
accidental disclosure of kernel memory to userland.

Security:	FreeBSD-SA-05:04.ifconf
Approved by:	so (cperciva)
2005-04-15 01:53:14 +00:00
Colin Percival 3b4a130ca4 MFC revision 1.103.
Security:	FreeBSD-SA-05:02.sendfile
Approved by:	so (nectar)
2005-04-04 23:54:33 +00:00
Jacques Vidrine 11acc75adb MFC src/contrib/telnet/telnet.c 1.16: Correct buffer overflows in
telnet(1).
Security: CAN-2005-0468, CAN-2005-0469
Approved by:	security-officer
2005-03-28 15:58:28 +00:00
Colin Percival 623e7349f8 FreeBSD-SA-04:17.procfs:
MFC (in the spirit of) revision 1.54 of
src/sys/fs/procfs/procfs_status.c

Approved by:	so (nectar)
2004-12-01 21:35:57 +00:00
Colin Percival 07459c4cb3 FreeBSD-SA-04:16.fetch:
MFC revision 1.75 of src/usr.bin/fetch/fetch.c
Bump newvers.sh and document in UPDATING.

Approved by:	so
2004-11-18 12:06:51 +00:00
Jacques Vidrine 8f312a426c Correct several vulnerabilities in CVS 1.11.5 (CAN-2004-0414,
CAN-2004-0416, CAN-2004-0417, CAN-2004-0418, CAN-2004-0778 and
others).

Approved by:	so
2004-09-19 22:28:14 +00:00
Colin Percival 8f98508393 FreeBSD-SA-04:13.linux:
MFC revision 1.116 of sys/compat/linux/linux_ioctl.c
Bump newvers.sh and document in UPDATING.

Approved by:	so (des)
2004-06-30 17:34:38 +00:00
Ken Smith 91884d6198 Add note about p1 and what it fixes.
Caught by:	kuriyama
Approved by:	so (implicit)
2004-06-26 04:39:46 +00:00
Ken Smith ce61d1683a MFS of fix to twe(4) driver. Fixes problem seen on 6xxx series controllers
where driver repeatedly submits the same request if the cmd queue gets
full.  This will be handled as an Errata Notice.

Commits being MFS-ed:
	sys/dev/twe/twe.c		1.1.2.10
	sys/dev/twe/twe_freebsd.c	1.2.2.9
	sys/dev/te/twevar.h		1.1.2.8

Submitted by:	ps, vkashyap
Reviewed by:	re
Approved by:	so
2004-06-26 02:22:24 +00:00
cvs2svn afc18b6631 This commit was manufactured by cvs2svn to create branch 'RELENG_4_10'. 2004-06-16 09:47:28 +00:00
Ken Smith 18aaf2a363 MFS of rev 1.73.2.91, note 4.10-RELEASE date.
Approved by:	re (implicit)
2004-05-27 06:21:52 +00:00
Bruce A. Mah 71f42d7e75 Fix version number when referring to the current FreeBSD release.
Approved by:	re (scottl)
2004-05-25 15:47:50 +00:00
Scott Long a31b245266 Trim the package list down some due to overflow problems.
Approved by:	re
2004-05-25 15:20:10 +00:00
Scott Long 3bca303ce3 Add errata for the 4.10 release
Approved by:	re
2004-05-25 14:20:51 +00:00
Scott Long ce6b0610dc Update __FreeBSD_version for 4.10. Note that it is 491000.
Approved by:	re
2004-05-25 05:33:40 +00:00
Scott Long f48f6a3925 Update for 4.10-RELEASE
Approved by: re
2004-05-25 05:30:47 +00:00
Scott Long ba58b51ee5 Update for 4.10
Approved by:	re
2004-05-25 05:29:02 +00:00
Scott Long cc37a32a9f Update for 4.10
Approved by: re
2004-05-25 05:27:16 +00:00
Ken Smith 3163ff424e MFS of Rev. 1.187.2.29, adding sysctl "vm.old_msync" to allow users to
choose the old msync(... MS_INVALIDATE) heuristics if needed.

Approved by:	re (scottl)
2004-05-22 23:09:19 +00:00
Hiroki Sato fc800e684a Bump &release.current;.
Approved by:	re (implicitly)
2004-05-22 00:23:31 +00:00
Hiroki Sato e9983f17b8 Add a link to the errata document for convenience.
Approved by:	re (implicitly)
2004-05-22 00:22:41 +00:00
Hiten Pandya b859e04cf4 Merge from RELENG_4:
* Remove a long obsolete paragraph from the BUGS section.
	* Bump the date.

Requested by:	alc
Approved by: 	re@ (scottl)
2004-05-21 02:19:21 +00:00
Dag-Erling Smørgrav 63081fab05 Merge updated patch from vendor branch (1.1.1.17)
Approved by:	re
2004-05-20 13:17:42 +00:00
Paul Saab 1ee4fce8f9 MFC: rev 1.124. Fix "thundering herd" problem in accept.
Approved by:	re (scottl)
2004-05-19 19:40:17 +00:00
Scott Long ff6413d9b4 MFC: Add support for new chip Id's.
Submitted by:	gibbs
Approved by:	re (kensmith)
2004-05-19 18:25:46 +00:00
Dag-Erling Smørgrav f1402c7718 Merge parser fix from vendor branch (rev 1.1.1.16)
Approved by:	re
2004-05-19 06:16:53 +00:00
Scott Long d8bb4710a0 MFS: Wait 1 second after loading modules to let slow devices probe.
Approved by: re (implicit)
2004-05-16 04:21:59 +00:00
Ken Smith c6325d1067 MFS of rev 1.187.2.27: Change vm_map_clean(... MS_INVALIDATE) to not
delete dirty pages.

Approved by:	re (bmah)
2004-05-14 23:06:25 +00:00
Ken Smith 5e3f77db27 MFS of rev 1.65.2.15: Implement IO_INVAL in the vnode op for writing by
marking the buffer as "no cache".

Approved by:	re (bmah)
2004-05-14 23:05:23 +00:00
Ken Smith ce57821091 MFS of rev 1.64.2.4: Change ffs_realloccg() to set the valid bits for
the extended part of the fragment to zero the valid parts of a VM_IO
buffer.

Approved by:	re (bmah)
2004-05-14 23:03:50 +00:00
Kris Kennaway 1e2ade94cc MFC: Belatedly catch up to XFree86 4.3 layout
Approved by:	re@
2004-05-13 09:41:17 +00:00
Roman Kurakin abb49b2191 MFC: Use better way of hiding FR for sppp without fr support. We should hide
it since we do not have fr support in FreeBSD's sppp, but we have it in
	Cronyx's sppp.

Requested by: Dmitry Morozovsky <marck at rinet dot ru>
Tested by: rik, Dmitry Morozovsky <marck at rinet dot ru>

Approved by: re
2004-05-12 17:19:15 +00:00
Roman Kurakin b0a8e657ba Remove reference to hints file since we don't have it in RELENG_4
Correct information about kernel configuration for these devices.

Pointy hat:     rik
Pointed by:     Dmitry Morozovsky <marck at rinet dot ru>

Approved by:	re
2004-05-12 17:13:32 +00:00
Vinod Kashyap de44083139 1. Fixed potential problem that would cause out-of-order requests in twe_startio.
2. Fixed possible race condition in twe_start.
3. Changed version.

Submitted by: scottl
Reviewed by: vkashyap
Approved by: re
2004-05-12 03:37:43 +00:00
Tim J. Robbins c08e85f83e MFS rev. 1.8.2.5: Fix BSS buffer overflow in makeargv().
Approved by:	re (kensmith)
2004-05-12 03:30:00 +00:00
Tim J. Robbins ddfa5073e3 MFS rev. 1.13.2.13: Fix two buffer overflows caused by off-by-one errors:
avoid writing a null character 1 byte past the end of cmdline[] when
libedit is being used for input, and avoid writing a null pointer 1
element past the end of margv[].

Approved by:	re (kensmith)
2004-05-12 03:14:00 +00:00
Tim J. Robbins 1876502656 MFS rev. 1.3.2.1: Fix a BSS buffer overflow caused by makeargv() writing
past the end of margv[] when an input line contains 20 or more
space-separated words.

Approved by:	re (kensmith)
2004-05-12 03:05:19 +00:00
Bruce A. Mah f41238e126 MFC: SA-04:08, SA-04:09.
Approved by:	re (implicitly)
2004-05-09 22:45:54 +00:00
Bruce A. Mah 69fd68ba96 MFRELENG_4: Add 4.10 entry so that pkg_add -r fetches from the right
package set.

	main.c	1.29.2.21->1.29.2.22

PR:		66251
Submitted by:	eik
Approved by:	re
2004-05-08 23:59:16 +00:00
Josef Karthauser 14a3df0748 Regen.
Approved by:	re
2004-05-06 18:16:38 +00:00
Josef Karthauser 5f291eb343 MFS: Zire 31 support
Approved by:	re (kensmith)
2004-05-06 18:14:50 +00:00
MIHIRA Sanpei Yoshiro 531f796ae1 MFS umass.c 1.11.2.31:
Add support 2 devices(USB-DVD-R drives)
	- Logitec LDR-H443SU2
	- IO-DATA DVR-UEH8

Approved by:	re(kensmith)
2004-05-06 13:16:06 +00:00
John Polstra f389fa7e91 Merge from RELENG_4: Atomically load and clear the bge status block.
Approved by:	re (scottl)
2004-05-06 01:55:21 +00:00
Jacques Vidrine e70165aea7 Correct a heap buffer overflow in k5admind(8) when built with Kerberos
IV support.

Obtained from:	Heimdal CVS
Approved by:	re
2004-05-05 20:48:57 +00:00
Jacques Vidrine 72246289cf Merge from 4-STABLE 1.1.1.2.2.4 config.c, 1.1.1.2.2.5 kdc.8,
1.1.1.2.2.4 kdc_locl.h, 1.1.1.2.2.5 kerberos5.c,
  1.1.1.3.2.5 krb5-protos.h, 1.1.1.3.2.3 rd_req.c, 1.1.1.3.2.3 transited.c:
Correctly validate the transited field in Kerberos tickets.

Approved by:    re
2004-05-05 20:48:19 +00:00
Ken Smith 17fa1e6b71 MFS of rev. 1.187.2.26
Approved by:	re (scottl)
2004-05-05 19:38:28 +00:00
Hiroki Sato a45fe8894c MFS: Add URLS_ABSOLUTE=YES into the doc.1 target.
Approved by:	re (implicitly)
2004-05-05 13:14:19 +00:00
Colin Percival b68126411b MFS revision 1.8.2.2: Dereferencing NULL pointers considered harmful.
Approved by:	re (kensmith)
2004-05-04 13:34:30 +00:00
Ken Smith 836902c219 MF-RELENG_4 of rev 1.1.2.36. Adjustments to package sets for upcoming
release.

Approved by:	re (scottl)
2004-05-03 01:28:12 +00:00
Ken Smith 096e0914e6 Add information about new DISC?_LABEL and DISC?_NAME variables.
Caught by:	ru
Approved by:	re (scottl in principle)
2004-04-30 13:32:18 +00:00
Ken Smith 2f57c83ff6 Merge Warner's commit that added FreeBSD copyright notice.
Permission from:	imp
Approved by:		re (implicit)
2004-04-30 12:50:48 +00:00
Hiroki Sato 1fc7f5654c MFS:
mmap(2) security fix, and
	random ephemeral port allocation.

Update release note:
	KDE 3.2.2.

Approved by:	re (implicitly)
2004-04-30 11:58:51 +00:00
Ken Smith 614ff03681 MF-RELENG_4 of rev 1.536.2.113. Adding ability to tweak CD labels using
Makefile.

Approved by:	re (scottl)
2004-04-30 04:21:00 +00:00
Ken Smith 727c013e4f Merging Alan Cox's fixes to mmap(2) into the 4.10 release. RELENG_4
commit versions being merged:

  Revision    Changes    Path
  1.35.2.10   +2 -2      src/sys/alpha/alpha/pmap.c
  1.250.2.25  +3 -2      src/sys/i386/i386/pmap.c
  1.33.2.6    +2 -2      src/sys/vm/pmap.h
  1.187.2.25  +3 -2      src/sys/vm/vm_map.c

Approved by:	re (scottl)
2004-04-30 03:05:36 +00:00
Jacques Vidrine 7a0b8cb799 MFC 1.143-1.146: Randomize ephemeral source ports.
Approved by:	re
2004-04-24 23:03:14 +00:00
Hiroki Sato 17c235cdba Update various entities for 4.10-RELEASE.
Approved by:	re (implicitly)
2004-04-24 16:41:20 +00:00
cvs2svn e51d04b515 This commit was manufactured by cvs2svn to create branch 'RELENG_4_10'. 2004-04-24 13:56:22 +00:00
Hiroki Sato 4d12ae57ff Update copyright and version number for 4.10-RC.
Approved by:	re (implicitly)
2004-04-24 13:37:53 +00:00
Don Lewis 1bb66c13aa MFS tcp_usrreq.c 1.51.2.22:
Don't skip the splx() call in *_usr_bind() and *_usr_connect()
    if the socket address length check fails.

Submitted by:	pjd
Approved by:	re (kensmith)
2004-04-24 04:52:38 +00:00
Ken Smith 6f132fefd9 Update copyright date.
Approved by:	re (bmah)
2004-04-22 21:16:17 +00:00
Scott Long d430322bd2 We are at 4.10-RC now.
Approved by:	re (implicit)
2004-04-21 12:48:08 +00:00
cvs2svn e16674995c This commit was manufactured by cvs2svn to create branch 'RELENG_4_10'. 2004-04-21 11:08:56 +00:00
cvs2svn b7b2f5b0b8 This commit was manufactured by cvs2svn to create branch 'RELENG_4_10'. 2004-04-07 12:36:51 +00:00
cvs2svn bd1f338c99 This commit was manufactured by cvs2svn to create branch 'RELENG_4_10'. 2004-03-22 23:59:56 +00:00
cvs2svn bea6bf56fc This commit was manufactured by cvs2svn to create branch 'RELENG_4_10'. 2003-01-07 04:28:56 +00:00
157 changed files with 2569 additions and 3793 deletions

No files matched your search

+26
View File
@@ -1,6 +1,32 @@
# $FreeBSD$
# @(#)COPYRIGHT 8.2 (Berkeley) 3/21/94
The compilation of software known as FreeBSD is distributed under the
following terms:
Copyright (C) 1992-2004 The FreeBSD Project. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite
Releases is copyrighted by The Regents of the University of California.
+1 -1
View File
@@ -552,7 +552,7 @@ update:
@echo "--------------------------------------------------------------"
@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; cvs -R -q update -rRELENG_4 -P -d
cd ${.CURDIR}; cvs -R -q update -rRELENG_4_10 -P -d
.endif
#
+111
View File
@@ -8,6 +8,117 @@ A reverse chronology since 4.0 was released is included, followed by
the common items quick how-tos, followed by entries for versions of
-current prior to 4.0 Release.
This is for the 4.10 release branch. All entries since 4.10 are an
itemized list of commits to this branch, numbered from the beginning.
The security advisories related to various patches contain information
on how to build/install a minimal set of binaries and start/stop a
minimal number of processes, if possible, for that patch. For those
updates that don't have an advisory, or to be safe, you can do a full
build and install as described in the COMMON ITEMS section.
20060531: p24 FreeBSD-SA-06:16.smbfs
Correct a bug in the handling of backslash characters in smbfs
which can allow an attacker to escape from a chroot(2).
20060419: p23 FreeBSD-SA-06:14.fpu
Correct a local information leakage bug affecting AMD FPUs.
20060322: p22 FreeBSD-SA-06:11.ipsec, FreeBSD-SA-06:12.opie,
FreeBSD-SA-06:13.sendmail
Add missing code needed for the detection of IPSec packet
replays. [06:11]
Correctly identify the user running opiepasswd(1) when the login
name differs from the account name. [06:12]
Modify timeout handling logic in sendmail(8) to correct a reported
signal handling race condition. [06:13]
20060301: p21 FreeBSD-SA-06:10.nfs
Correct a remote kernel panic when processing zero-length RPC
records via TCP.
20060111: p20 FreeBSD-SA-06:01.texindex, FreeBSD-SA-06:02.ee,
FreeBSD-SA-06:03.cpio
Correct insecure temporary file usage in texindex. [06:01]
Correct insecure temporary file usage in ee. [06:02]
Correct a race condition when setting file permissions,
sanitize file names by default, and fix a buffer overflow
when handling files larger than 4GB in cpio. [06:03]
20051011: p19 FreeBSD-SA-05:21.openssl
Correct a man-in-the-middle SSL version rollback vulnerability.
20050909: p18 FreeBSD-SA-05:20.cvsbug [revised]
Correct additional temporary file usage issues.
20050907: p17 FreeBSD-SA-05:20.cvsbug
Correct insecure temporary file usage.
20050629: p16 FreeBSD-SA-05:14.bzip2, FreeBSD-SA-05:15.tcp
Correct bzip2 denial of service and permission race vulnerabilities.
Correct TCP connection stall denial of service vulnerabilities.
20050608: p15 FreeBSD-SA-05:11.gzip
Correct directory traversal and race condition vulnerabilities in gzip.
20050513: p14 FreeBSD-SA-05:09.htt
Add a knob for disabling/enabling HTT. Default off due to information
disclosure on multi-user systems.
20050508: p13 FreeBSD-SA-05:08.kmem
Correct two issues which were missed from the earlier commit.
20050506: p12 FreeBSD-SA-05:08.kmem
Correct several local kernel memory disclosure bugs.
20050506: p11 FreeBSD-SA-05:07.ldt
Correctly validate inputs to the i386_get_ldt syscall.
20050506: p10 FreeBSD-SA-05:06.iir
Correct overly liberal permissions on /dev/iir.
20050422: p9 FreeBSD-SA-05:05.cvs
Correct several vulnerabilities in CVS.
20050414: p8 FreeBSD-SA-05:04.ifconf
Zero a buffer in ifconf() in order to avoid accidental
disclosure of kernel memory to userland.
20050404: p7 FreeBSD-SA-05:02.sendfile
Correct kernel memory disclosure bug in sendfile(2).
20050328: p6 FreeBSD-SA-05:01.telnet
Correct buffer overflows in telnet(1).
20041201: p5 FreeBSD-SA-04:17.procfs
Fix a tainted pointer dereference in procfs(5) and linprocfs(5)
which could allow a local attacker to panic a system and/or read
from kernel memory.
20041118: p4 FreeBSD-SA-04:16.fetch
Correct a buffer overflow in fetch(1) which could allow a
mallicious server to execute arbitrary code on the client.
20040919: p3 FreeBSD-SA-04:14.cvs
Correct several vulnerabilities in CVS (CAN-2004-0414,
CAN-2004-0416, CAN-2004-0417, CAN-2004-0418, CAN-2004-0778).
20040630: p2 FreeBSD-SA-04:13.linux
Correct an input validation error in the linux binary
compatibility code.
20040626: p1 FreeBSD-EN-04:01.twe
Fix a bug in twe(4) that could cause kernel lockups.
20040527:
FreeBSD 4.10-RELEASE.
20031028:
FreeBSD 4.9-RELEASE.
+34 -9
View File
@@ -312,6 +312,7 @@ static void compressedStreamEOF ( void ) NORETURN;
static void copyFileName ( Char*, Char* );
static void* myMalloc ( Int32 );
static int applySavedFileAttrToOutputFile ( int fd );
@@ -457,6 +458,10 @@ void compressStream ( FILE *stream, FILE *zStream )
ret = fflush ( zStream );
if (ret == EOF) goto errhandler_io;
if (zStream != stdout) {
int fd = fileno ( zStream );
if (fd < 0) goto errhandler_io;
ret = applySavedFileAttrToOutputFile ( fd );
if (ret != 0) goto errhandler_io;
ret = fclose ( zStream );
outputHandleJustInCase = NULL;
if (ret == EOF) goto errhandler_io;
@@ -525,6 +530,7 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
UChar obuf[5000];
UChar unused[BZ_MAX_UNUSED];
Int32 nUnused;
void* unusedTmpV;
UChar* unusedTmp;
nUnused = 0;
@@ -554,9 +560,10 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
}
if (bzerr != BZ_STREAM_END) goto errhandler;
BZ2_bzReadGetUnused ( &bzerr, bzf, (void**)(&unusedTmp), &nUnused );
BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused );
if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" );
unusedTmp = (UChar*)unusedTmpV;
for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i];
BZ2_bzReadClose ( &bzerr, bzf );
@@ -567,6 +574,12 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
closeok:
if (ferror(zStream)) goto errhandler_io;
if ( stream != stdout) {
int fd = fileno ( stream );
if (fd < 0) goto errhandler_io;
ret = applySavedFileAttrToOutputFile ( fd );
if (ret != 0) goto errhandler_io;
}
ret = fclose ( zStream );
if (ret == EOF) goto errhandler_io;
@@ -639,6 +652,7 @@ Bool testStream ( FILE *zStream )
UChar obuf[5000];
UChar unused[BZ_MAX_UNUSED];
Int32 nUnused;
void* unusedTmpV;
UChar* unusedTmp;
nUnused = 0;
@@ -662,9 +676,10 @@ Bool testStream ( FILE *zStream )
}
if (bzerr != BZ_STREAM_END) goto errhandler;
BZ2_bzReadGetUnused ( &bzerr, bzf, (void**)(&unusedTmp), &nUnused );
BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused );
if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" );
unusedTmp = (UChar*)unusedTmpV;
for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i];
BZ2_bzReadClose ( &bzerr, bzf );
@@ -1125,7 +1140,7 @@ void saveInputFileMetaInfo ( Char *srcName )
static
void applySavedMetaInfoToOutputFile ( Char *dstName )
void applySavedTimeInfoToOutputFile ( Char *dstName )
{
# if BZ_UNIX
IntNative retVal;
@@ -1134,16 +1149,26 @@ void applySavedMetaInfoToOutputFile ( Char *dstName )
uTimBuf.actime = fileMetaInfo.st_atime;
uTimBuf.modtime = fileMetaInfo.st_mtime;
retVal = chmod ( dstName, fileMetaInfo.st_mode );
ERROR_IF_NOT_ZERO ( retVal );
retVal = utime ( dstName, &uTimBuf );
ERROR_IF_NOT_ZERO ( retVal );
# endif
}
retVal = chown ( dstName, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
static
int applySavedFileAttrToOutputFile ( int fd )
{
# if BZ_UNIX
IntNative retVal;
retVal = fchmod ( fd, fileMetaInfo.st_mode );
if (retVal != 0)
return retVal;
(void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
/* chown() will in many cases return with EPERM, which can
be safely ignored.
*/
return 0;
# endif
}
@@ -1366,7 +1391,7 @@ void compress ( Char *name )
/*--- If there was an I/O error, we won't get here. ---*/
if ( srcMode == SM_F2F ) {
applySavedMetaInfoToOutputFile ( outName );
applySavedTimeInfoToOutputFile ( outName );
deleteOutputOnInterrupt = False;
if ( !keepInputFiles ) {
IntNative retVal = remove ( inName );
@@ -1544,7 +1569,7 @@ void uncompress ( Char *name )
/*--- If there was an I/O error, we won't get here. ---*/
if ( magicNumberOK ) {
if ( srcMode == SM_F2F ) {
applySavedMetaInfoToOutputFile ( outName );
applySavedTimeInfoToOutputFile ( outName );
deleteOutputOnInterrupt = False;
if ( !keepInputFiles ) {
IntNative retVal = remove ( inName );
+37 -14
View File
@@ -574,8 +574,11 @@ int BZ_API(BZ2_bzDecompressInit)
/*---------------------------------------------------*/
/* Return True iff data corruption is discovered.
Returns False if there is no problem.
*/
static
void unRLE_obuf_to_output_FAST ( DState* s )
Bool unRLE_obuf_to_output_FAST ( DState* s )
{
UChar k1;
@@ -584,7 +587,7 @@ void unRLE_obuf_to_output_FAST ( DState* s )
while (True) {
/* try to finish existing run */
while (True) {
if (s->strm->avail_out == 0) return;
if (s->strm->avail_out == 0) return False;
if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
@@ -594,10 +597,13 @@ void unRLE_obuf_to_output_FAST ( DState* s )
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
/* can a new run be started? */
if (s->nblock_used == s->save_nblock+1) return;
if (s->nblock_used == s->save_nblock+1) return False;
/* Only caused by corrupt data stream? */
if (s->nblock_used > s->save_nblock+1)
return True;
s->state_out_len = 1;
s->state_out_ch = s->k0;
@@ -667,6 +673,10 @@ void unRLE_obuf_to_output_FAST ( DState* s )
cs_avail_out--;
}
}
/* Only caused by corrupt data stream? */
if (c_nblock_used > s_save_nblockPP)
return True;
/* can a new run be started? */
if (c_nblock_used == s_save_nblockPP) {
c_state_out_len = 0; goto return_notr;
@@ -712,6 +722,7 @@ void unRLE_obuf_to_output_FAST ( DState* s )
s->strm->avail_out = cs_avail_out;
/* end save */
}
return False;
}
@@ -732,8 +743,11 @@ __inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
/*---------------------------------------------------*/
/* Return True iff data corruption is discovered.
Returns False if there is no problem.
*/
static
void unRLE_obuf_to_output_SMALL ( DState* s )
Bool unRLE_obuf_to_output_SMALL ( DState* s )
{
UChar k1;
@@ -742,7 +756,7 @@ void unRLE_obuf_to_output_SMALL ( DState* s )
while (True) {
/* try to finish existing run */
while (True) {
if (s->strm->avail_out == 0) return;
if (s->strm->avail_out == 0) return False;
if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
@@ -754,8 +768,11 @@ void unRLE_obuf_to_output_SMALL ( DState* s )
}
/* can a new run be started? */
if (s->nblock_used == s->save_nblock+1) return;
if (s->nblock_used == s->save_nblock+1) return False;
/* Only caused by corrupt data stream? */
if (s->nblock_used > s->save_nblock+1)
return True;
s->state_out_len = 1;
s->state_out_ch = s->k0;
@@ -788,7 +805,7 @@ void unRLE_obuf_to_output_SMALL ( DState* s )
while (True) {
/* try to finish existing run */
while (True) {
if (s->strm->avail_out == 0) return;
if (s->strm->avail_out == 0) return False;
if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
@@ -800,7 +817,11 @@ void unRLE_obuf_to_output_SMALL ( DState* s )
}
/* can a new run be started? */
if (s->nblock_used == s->save_nblock+1) return;
if (s->nblock_used == s->save_nblock+1) return False;
/* Only caused by corrupt data stream? */
if (s->nblock_used > s->save_nblock+1)
return True;
s->state_out_len = 1;
s->state_out_ch = s->k0;
@@ -830,6 +851,7 @@ void unRLE_obuf_to_output_SMALL ( DState* s )
/*---------------------------------------------------*/
int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
{
Bool corrupt;
DState* s;
if (strm == NULL) return BZ_PARAM_ERROR;
s = strm->state;
@@ -840,12 +862,13 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
if (s->state == BZ_X_OUTPUT) {
if (s->smallDecompress)
unRLE_obuf_to_output_SMALL ( s ); else
unRLE_obuf_to_output_FAST ( s );
corrupt = unRLE_obuf_to_output_SMALL ( s ); else
corrupt = unRLE_obuf_to_output_FAST ( s );
if (corrupt) return BZ_DATA_ERROR;
if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
BZ_FINALISE_CRC ( s->calculatedBlockCRC );
if (s->verbosity >= 3)
VPrintf2 ( " {0x%x, 0x%x}", s->storedBlockCRC,
VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC,
s->calculatedBlockCRC );
if (s->verbosity >= 2) VPrintf0 ( "]" );
if (s->calculatedBlockCRC != s->storedBlockCRC)
@@ -863,7 +886,7 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
Int32 r = BZ2_decompress ( s );
if (r == BZ_STREAM_END) {
if (s->verbosity >= 3)
VPrintf2 ( "\n combined CRCs: stored = 0x%x, computed = 0x%x",
VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x",
s->storedCombinedCRC, s->calculatedCombinedCRC );
if (s->calculatedCombinedCRC != s->storedCombinedCRC)
return BZ_DATA_ERROR;
+7 -5
View File
@@ -488,9 +488,11 @@ void sendMTFValues ( EState* s )
/*--
Recompute the tables based on the accumulated frequencies.
--*/
/* maxLen was changed from 20 to 17 in bzip2-1.0.3. See
comment in huffman.c for details. */
for (t = 0; t < nGroups; t++)
BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]),
alphaSize, 20 );
alphaSize, 17 /*20*/ );
}
@@ -527,7 +529,7 @@ void sendMTFValues ( EState* s )
if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
if (s->len[t][i] < minLen) minLen = s->len[t][i];
}
AssertH ( !(maxLen > 20), 3004 );
AssertH ( !(maxLen > 17 /*20*/ ), 3004 );
AssertH ( !(minLen < 1), 3005 );
BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]),
minLen, maxLen, alphaSize );
@@ -651,8 +653,8 @@ void BZ2_compressBlock ( EState* s, Bool is_last_block )
if (s->blockNo > 1) s->numZ = 0;
if (s->verbosity >= 2)
VPrintf4( " block %d: crc = 0x%8x, "
"combined CRC = 0x%8x, size = %d\n",
VPrintf4( " block %d: crc = 0x%08x, "
"combined CRC = 0x%08x, size = %d\n",
s->blockNo, s->blockCRC, s->combinedCRC, s->nblock );
BZ2_blockSort ( s );
@@ -703,7 +705,7 @@ void BZ2_compressBlock ( EState* s, Bool is_last_block )
bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 );
bsPutUInt32 ( s, s->combinedCRC );
if (s->verbosity >= 2)
VPrintf1( " final combined CRC = 0x%x\n ", s->combinedCRC );
VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC );
bsFinishWrite ( s );
}
}
+11 -5
View File
@@ -524,17 +524,23 @@ Int32 BZ2_decompress ( DState* s )
if (s->origPtr < 0 || s->origPtr >= nblock)
RETURN(BZ_DATA_ERROR);
/*-- Set up cftab to facilitate generation of T^(-1) --*/
s->cftab[0] = 0;
for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
for (i = 0; i <= 256; i++) {
if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
/* s->cftab[i] can legitimately be == nblock */
RETURN(BZ_DATA_ERROR);
}
}
s->state_out_len = 0;
s->state_out_ch = 0;
BZ_INITIALISE_CRC ( s->calculatedBlockCRC );
s->state = BZ_X_OUTPUT;
if (s->verbosity >= 2) VPrintf0 ( "rt+rld" );
/*-- Set up cftab to facilitate generation of T^(-1) --*/
s->cftab[0] = 0;
for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
if (s->smallDecompress) {
/*-- Make a copy of cftab, used in generation of T --*/
+18 -1
View File
@@ -162,7 +162,24 @@ void BZ2_hbMakeCodeLengths ( UChar *len,
if (! tooLong) break;
for (i = 1; i < alphaSize; i++) {
/* 17 Oct 04: keep-going condition for the following loop used
to be 'i < alphaSize', which missed the last element,
theoretically leading to the possibility of the compressor
looping. However, this count-scaling step is only needed if
one of the generated Huffman code words is longer than
maxLen, which up to and including version 1.0.2 was 20 bits,
which is extremely unlikely. In version 1.0.3 maxLen was
changed to 17 bits, which has minimal effect on compression
ratio, but does mean this scaling step is used from time to
time, enough to verify that it works.
This means that bzip2-1.0.3 and later will only produce
Huffman codes with a maximum length of 17 bits. However, in
order to preserve backwards compatibility with bitstreams
produced by versions pre-1.0.3, the decompressor must still
handle lengths of up to 20. */
for (i = 1; i <= alphaSize; i++) {
j = weight[i] >> 8;
j = 1 + (j / 2);
weight[i] = j << 8;
+91 -26
View File
@@ -46,6 +46,19 @@ $FreeBSD$
#define lchown chown
#endif
# ifndef DIRECTORY_SEPARATOR
# define DIRECTORY_SEPARATOR '/'
# endif
# ifndef ISSLASH
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
# endif
# ifndef FILE_SYSTEM_PREFIX_LEN
# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
# endif
static void read_pattern_file ();
static void tape_skip_padding ();
static void defer_copyin ();
@@ -376,6 +389,54 @@ swab_array (ptr, count)
/* Current time for verbose table. */
static time_t current_time;
/* Return a safer suffix of FILE_NAME, or "." if it has no safer
suffix. Check for fully specified file names and other atrocities. */
static const char *
safer_name_suffix (char const *file_name)
{
char const *p;
/* Skip file system prefixes, leading file name components that contain
"..", and leading slashes. */
size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (file_name);
for (p = file_name + prefix_len; *p;)
{
if (p[0] == '.' && p[1] == '.' && (ISSLASH (p[2]) || !p[2]))
prefix_len = p + 2 - file_name;
do
{
char c = *p++;
if (ISSLASH (c))
break;
}
while (*p);
}
for (p = file_name + prefix_len; ISSLASH (*p); p++)
continue;
prefix_len = p - file_name;
if (prefix_len)
{
char *prefix = alloca (prefix_len + 1);
memcpy (prefix, file_name, prefix_len);
prefix[prefix_len] = '\0';
error (0, 0, "Removing leading `%s' from member names", prefix);
}
if (!*p)
p = ".";
return p;
}
/* Read the collection from standard input and create files
in the file system. */
@@ -396,6 +457,7 @@ process_copy_in ()
int in_file_des; /* Input file descriptor. */
char skip_file; /* Flag for use with patterns. */
int existing_dir; /* True if file is a dir & already exists. */
mode_t existing_mode;
int i; /* Loop index variable. */
char *link_name = NULL; /* Name of hard and symbolic links. */
#ifdef HPUX_CDF
@@ -494,18 +556,11 @@ process_copy_in ()
/* Do we have to ignore absolute paths, and if so, does the filename
have an absolute path? */
if (no_abs_paths_flag && file_hdr.c_name && file_hdr.c_name [0] == '/')
if (!abs_paths_flag && file_hdr.c_name && file_hdr.c_name[0])
{
char *p;
const char *p = safer_name_suffix (file_hdr.c_name);
p = file_hdr.c_name;
while (*p == '/')
++p;
if (*p == '\0')
{
strcpy (file_hdr.c_name, ".");
}
else
if (p != file_hdr.c_name)
{
char *non_abs_name;
@@ -642,6 +697,7 @@ process_copy_in ()
we are trying to create, don't complain about
it. */
existing_dir = TRUE;
existing_mode = file_stat.st_mode;
}
else if (!unconditional_flag
&& file_hdr.c_mtime <= file_stat.st_mtime)
@@ -778,8 +834,6 @@ process_copy_in ()
}
copy_files_tape_to_disk (in_file_des, out_file_des, file_hdr.c_filesize);
disk_empty_output_buffer (out_file_des);
if (close (out_file_des) < 0)
error (0, errno, "%s", file_hdr.c_name);
if (archive_format == arf_crcascii)
{
@@ -789,13 +843,15 @@ process_copy_in ()
}
/* File is now copied; set attributes. */
if (!no_chown_flag)
if ((chown (file_hdr.c_name,
if ((fchown (out_file_des,
set_owner_flag ? set_owner : file_hdr.c_uid,
set_group_flag ? set_group : file_hdr.c_gid) < 0)
&& errno != EPERM)
error (0, errno, "%s", file_hdr.c_name);
/* chown may have turned off some permissions we wanted. */
if (chmod (file_hdr.c_name, (int) file_hdr.c_mode) < 0)
if (fchmod (out_file_des, (int) file_hdr.c_mode) < 0)
error (0, errno, "%s", file_hdr.c_name);
if (close (out_file_des) < 0)
error (0, errno, "%s", file_hdr.c_name);
if (retain_time_flag)
{
@@ -847,14 +903,23 @@ process_copy_in ()
cdf_flag = 1;
}
#endif
res = mkdir (file_hdr.c_name, file_hdr.c_mode);
res = mkdir (file_hdr.c_name, file_hdr.c_mode & ~077);
}
else
res = 0;
{
if (!no_chown_flag && (existing_mode & 077) != 0
&& chmod (file_hdr.c_name, existing_mode & 07700) < 0)
{
error (0, errno, "%s: chmod", file_hdr.c_name);
return;
}
res = 0;
}
if (res < 0 && create_dir_flag)
{
create_all_directories (file_hdr.c_name);
res = mkdir (file_hdr.c_name, file_hdr.c_mode);
res = mkdir (file_hdr.c_name, file_hdr.c_mode & ~077);
}
if (res < 0)
{
@@ -936,20 +1001,20 @@ process_copy_in ()
#ifdef CP_IFIFO
if ((file_hdr.c_mode & CP_IFMT) == CP_IFIFO)
res = mkfifo (file_hdr.c_name, file_hdr.c_mode);
res = mkfifo (file_hdr.c_name, file_hdr.c_mode & ~077);
else
#endif
res = mknod (file_hdr.c_name, file_hdr.c_mode,
res = mknod (file_hdr.c_name, file_hdr.c_mode & ~077,
makedev (file_hdr.c_rdev_maj, file_hdr.c_rdev_min));
if (res < 0 && create_dir_flag)
{
create_all_directories (file_hdr.c_name);
#ifdef CP_IFIFO
if ((file_hdr.c_mode & CP_IFMT) == CP_IFIFO)
res = mkfifo (file_hdr.c_name, file_hdr.c_mode);
res = mkfifo (file_hdr.c_name, file_hdr.c_mode & ~077);
else
#endif
res = mknod (file_hdr.c_name, file_hdr.c_mode,
res = mknod (file_hdr.c_name, file_hdr.c_mode & ~077,
makedev (file_hdr.c_rdev_maj,
file_hdr.c_rdev_min));
}
@@ -1376,18 +1441,18 @@ create_final_defers ()
continue;
}
if (close (out_file_des) < 0)
error (0, errno, "%s", d->header.c_name);
/* File is now copied; set attributes. */
if (!no_chown_flag)
if ((chown (d->header.c_name,
if ((fchown (out_file_des,
set_owner_flag ? set_owner : d->header.c_uid,
set_group_flag ? set_group : d->header.c_gid) < 0)
&& errno != EPERM)
error (0, errno, "%s", d->header.c_name);
/* chown may have turned off some permissions we wanted. */
if (chmod (d->header.c_name, (int) d->header.c_mode) < 0)
if (fchmod (out_file_des, (int) d->header.c_mode) < 0)
error (0, errno, "%s", d->header.c_name);
if (close (out_file_des) < 0)
error (0, errno, "%s", d->header.c_name);
if (retain_time_flag)
{
+20 -2
View File
@@ -49,12 +49,13 @@ write_out_header (file_hdr, out_des)
{
char ascii_header[112];
char *magic_string;
int ret;
if (archive_format == arf_crcascii)
magic_string = "070702";
else
magic_string = "070701";
sprintf (ascii_header,
ret = snprintf (ascii_header, sizeof(ascii_header),
"%6s%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx",
magic_string,
file_hdr->c_ino, file_hdr->c_mode, file_hdr->c_uid,
@@ -62,6 +63,10 @@ write_out_header (file_hdr, out_des)
file_hdr->c_filesize, file_hdr->c_dev_maj, file_hdr->c_dev_min,
file_hdr->c_rdev_maj, file_hdr->c_rdev_min, file_hdr->c_namesize,
file_hdr->c_chksum);
if (ret >= sizeof(ascii_header)) {
fprintf(stderr, "Internal overflow, aborting\n");
exit (1);
}
tape_buffered_write (ascii_header, out_des, 110L);
/* Write file name to output. */
@@ -71,6 +76,7 @@ write_out_header (file_hdr, out_des)
else if (archive_format == arf_oldascii || archive_format == arf_hpoldascii)
{
char ascii_header[78];
int ret;
#ifndef __MSDOS__
dev_t dev;
dev_t rdev;
@@ -112,7 +118,7 @@ write_out_header (file_hdr, out_des)
if ((file_hdr->c_ino >> 16) != 0)
error (0, 0, "%s: truncating inode number", file_hdr->c_name);
sprintf (ascii_header,
ret = snprintf (ascii_header, sizeof(ascii_header),
"%06o%06o%06lo%06lo%06lo%06lo%06lo%06o%011lo%06lo%011lo",
file_hdr->c_magic & 0xFFFF, dev & 0xFFFF,
file_hdr->c_ino & 0xFFFF, file_hdr->c_mode & 0xFFFF,
@@ -120,6 +126,10 @@ write_out_header (file_hdr, out_des)
file_hdr->c_nlink & 0xFFFF, rdev & 0xFFFF,
file_hdr->c_mtime, file_hdr->c_namesize & 0xFFFF,
file_hdr->c_filesize);
if (ret >= sizeof(ascii_header)) {
fprintf(stderr, "Internal overflow, aborting\n");
exit (1);
}
tape_buffered_write (ascii_header, out_des, 76L);
/* Write file name to output. */
@@ -258,6 +268,14 @@ process_copy_out ()
file_hdr.c_dev_maj = major (file_stat.st_dev);
file_hdr.c_dev_min = minor (file_stat.st_dev);
file_hdr.c_ino = file_stat.st_ino;
/* Skip files larger than 4GB which will cause problems on
64bit platforms (and just not work on 32bit). */
if (file_stat.st_size > 0xffffffff) {
error (0, 0, "%s: skipping >4GB file", input_name.ds_string);
continue;
}
/* For POSIX systems that don't define the S_IF macros,
we can't assume that S_ISfoo means the standard Unix
S_IFfoo bit(s) are set. So do it manually, with a
+20 -11
View File
@@ -173,18 +173,18 @@ process_copy_pass ()
disk_empty_output_buffer (out_file_des);
if (close (in_file_des) < 0)
error (0, errno, "%s", input_name.ds_string);
if (close (out_file_des) < 0)
error (0, errno, "%s", output_name.ds_string);
/* Set the attributes of the new file. */
if (!no_chown_flag)
if ((chown (output_name.ds_string,
if ((fchown (out_file_des,
set_owner_flag ? set_owner : in_file_stat.st_uid,
set_group_flag ? set_group : in_file_stat.st_gid) < 0)
&& errno != EPERM)
error (0, errno, "%s", output_name.ds_string);
/* chown may have turned off some permissions we wanted. */
if (chmod (output_name.ds_string, in_file_stat.st_mode) < 0)
if (fchmod (out_file_des, in_file_stat.st_mode) < 0)
error (0, errno, "%s", output_name.ds_string);
if (close (out_file_des) < 0)
error (0, errno, "%s", output_name.ds_string);
if (reset_time_flag)
{
@@ -223,15 +223,24 @@ process_copy_pass ()
cdf_flag = 1;
}
#endif
res = mkdir (output_name.ds_string, in_file_stat.st_mode);
res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
}
else
res = 0;
{
if (!no_chown_flag && (out_file_stat.st_mode & 077) != 0
&& chmod (output_name.ds_string, out_file_stat.st_mode & 07700) < 0)
{
error (0, errno, "%s: chmod", output_name.ds_string);
continue;
}
res = 0;
}
if (res < 0 && create_dir_flag)
{
create_all_directories (output_name.ds_string);
res = mkdir (output_name.ds_string, in_file_stat.st_mode);
res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
}
if (res < 0)
{
@@ -297,20 +306,20 @@ process_copy_pass ()
{
#ifdef S_ISFIFO
if (S_ISFIFO (in_file_stat.st_mode))
res = mkfifo (output_name.ds_string, in_file_stat.st_mode);
res = mkfifo (output_name.ds_string, in_file_stat.st_mode & ~077);
else
#endif
res = mknod (output_name.ds_string, in_file_stat.st_mode,
res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
in_file_stat.st_rdev);
if (res < 0 && create_dir_flag)
{
create_all_directories (output_name.ds_string);
#ifdef S_ISFIFO
if (S_ISFIFO (in_file_stat.st_mode))
res = mkfifo (output_name.ds_string, in_file_stat.st_mode);
res = mkfifo (output_name.ds_string, in_file_stat.st_mode & ~077);
else
#endif
res = mknod (output_name.ds_string, in_file_stat.st_mode,
res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
in_file_stat.st_rdev);
}
if (res < 0)
+4 -4
View File
@@ -19,7 +19,7 @@ cpio \- copy files to and from archives
[\-\-unconditional] [\-\-verbose] [\-\-block-size=blocks] [\-\-swap-halfwords]
[\-\-io-size=bytes] [\-\-pattern-file=file] [\-\-format=format]
[\-\-owner=[user][:.][group]] [\-\-no-preserve-owner] [\-\-message=message]
[\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-sparse] [\-\-only\-verify\-crc]
[\-\-force\-local] [\-\-absolute\-filenames] [\-\-sparse] [\-\-only\-verify\-crc]
[\-\-quiet] [\-\-help] [\-\-version] [pattern...] [< archive]
.B cpio
@@ -251,9 +251,9 @@ current volume number (starting at 1).
In the verbose table of contents listing, show numeric UID and GID
instead of translating them into names.
.TP
.I " \-\-no-absolute-filenames"
In copy-in mode, create all files relative to the current directory,
even if they have an absolute file name in the archive.
.I " \-\-absolute-filenames"
Do not strip leading file name components that contain ".."
and leading slashes from file names in copy-in mode
.TP
.I " \-\-no-preserve-owner"
In copy-in mode and copy-pass mode, do not change the ownership of the
+1 -1
View File
@@ -46,7 +46,7 @@ extern int no_chown_flag;
extern int sparse_flag;
extern int quiet_flag;
extern int only_verify_crc_flag;
extern int no_abs_paths_flag;
extern int abs_paths_flag;
extern int last_header_start;
extern int copy_matching_files;
+2 -2
View File
@@ -98,8 +98,8 @@ int quiet_flag = FALSE;
actually extract the files. */
int only_verify_crc_flag = FALSE;
/* If TRUE, don't use any absolute paths, prefix them by `./'. */
int no_abs_paths_flag = FALSE;
/* If TRUE, allow any absolute paths */
int abs_paths_flag = FALSE;
#ifdef DEBUG_CPIO
/* If TRUE, print debugging information. */
+6 -6
View File
@@ -56,7 +56,7 @@ struct option long_opts[] =
{"list", 0, &table_flag, TRUE},
{"make-directories", 0, &create_dir_flag, TRUE},
{"message", 1, 0, 'M'},
{"no-absolute-filenames", 0, 0, 136},
{"absolute-filenames", 0, 0, 136},
{"no-preserve-owner", 0, 0, 134},
{"nonmatching", 0, &copy_matching_files, FALSE},
{"numeric-uid-gid", 0, &numeric_uid, TRUE},
@@ -105,7 +105,7 @@ Usage: %s {-o|--create} [-0acvABLV] [-C bytes] [-H format] [-M message]\n\
[--unconditional] [--verbose] [--block-size=blocks] [--swap-halfwords]\n\
[--io-size=bytes] [--pattern-file=file] [--format=format]\n\
[--owner=[user][:.][group]] [--no-preserve-owner] [--message=message]\n\
[--force-local] [--no-absolute-filenames] [--sparse] [--only-verify-crc]\n\
[--force-local] [--absolute-filenames] [--sparse] [--only-verify-crc]\n\
[--quiet] [--help] [--version] [pattern...] [< archive]\n",
program_name);
fprintf (fp, "\
@@ -266,8 +266,8 @@ crc newc odc bin ustar tar (all-caps also recognized)", optarg);
numeric_uid = TRUE;
break;
case 136: /* --no-absolute-filenames */
no_abs_paths_flag = TRUE;
case 136: /* --absolute-filenames */
abs_paths_flag = TRUE;
break;
case 134: /* --no-preserve-owner */
@@ -414,7 +414,7 @@ crc newc odc bin ustar tar (all-caps also recognized)", optarg);
|| retain_time_flag || no_chown_flag || set_owner_flag
|| set_group_flag || swap_bytes_flag || swap_halfwords_flag
|| (append_flag && !(archive_name || output_archive_name))
|| rename_batch_file || no_abs_paths_flag
|| rename_batch_file || abs_paths_flag
|| input_archive_name || (archive_name && output_archive_name))
usage (stderr, 2);
if (archive_format == arf_unknown)
@@ -429,7 +429,7 @@ crc newc odc bin ustar tar (all-caps also recognized)", optarg);
if (argc - 1 != optind || archive_format != arf_unknown
|| swap_bytes_flag || swap_halfwords_flag
|| table_flag || rename_flag || append_flag
|| rename_batch_file || no_abs_paths_flag)
|| rename_batch_file || abs_paths_flag)
usage (stderr, 2);
directory_name = argv[optind];
}
-106
View File
@@ -1,106 +0,0 @@
/* Copyright (C) 1992,93,94,95,96,97,98,99,2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif
#include <termios.h>
#include <unistd.h>
#include "getline.h"
/* It is desirable to use this bit on systems that have it.
The only bit of terminal state we want to twiddle is echoing, which is
done in software; there is no need to change the state of the terminal
hardware. */
#ifndef TCSASOFT
# define TCSASOFT 0
#endif
char *
getpass (const char *prompt)
{
FILE *in, *out;
struct termios s, t;
int tty_changed;
static char *buf;
static size_t bufsize;
ssize_t nread;
/* Try to write to and read from the terminal if we can.
If we can't open the terminal, use stderr and stdin. */
in = fopen ("/dev/tty", "w+");
if (in == NULL)
{
in = stdin;
out = stderr;
}
else
out = in;
/* Turn echoing off if it is on now. */
if (tcgetattr (fileno (in), &t) == 0)
{
/* Save the old one. */
s = t;
/* Tricky, tricky. */
t.c_lflag &= ~(ECHO|ISIG);
tty_changed = (tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &t) == 0);
}
else
tty_changed = 0;
/* Write the prompt. */
fputs (prompt, out);
fflush (out);
/* Read the password. */
nread = getline (&buf, &bufsize, in);
if (buf != NULL)
{
if (nread < 0)
buf[0] = '\0';
else if (buf[nread - 1] == '\n')
{
/* Remove the newline. */
buf[nread - 1] = '\0';
if (tty_changed)
{
/* Write the newline that was not echoed. */
if (out == in) fseek (out, 0, SEEK_CUR);
putc ('\n', out);
}
}
}
/* Restore the original setting. */
if (tty_changed)
(void) tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &s);
if (in != stdin)
/* We opened the terminal; now close it. */
fclose (in);
return buf;
}
+110
View File
@@ -0,0 +1,110 @@
/* xsize.h -- Checked size_t computations.
Copyright (C) 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _XSIZE_H
#define _XSIZE_H
/* Get size_t. */
#include <stddef.h>
/* Get SIZE_MAX. */
#include <limits.h>
#if HAVE_STDINT_H
# include <stdint.h>
#else
#define SIZE_MAX UINT_MAX /* XXX */
#endif
/* The size of memory objects is often computed through expressions of
type size_t. Example:
void* p = malloc (header_size + n * element_size).
These computations can lead to overflow. When this happens, malloc()
returns a piece of memory that is way too small, and the program then
crashes while attempting to fill the memory.
To avoid this, the functions and macros in this file check for overflow.
The convention is that SIZE_MAX represents overflow.
malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
implementation that uses mmap --, it's recommended to use size_overflow_p()
or size_in_bounds_p() before invoking malloc().
The example thus becomes:
size_t size = xsum (header_size, xtimes (n, element_size));
void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
*/
/* Convert an arbitrary value >= 0 to type size_t. */
#define xcast_size_t(N) \
((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
/* Sum of two sizes, with overflow check. */
static inline size_t
#if __GNUC__ >= 3
__attribute__ ((__pure__))
#endif
xsum (size_t size1, size_t size2)
{
size_t sum = size1 + size2;
return (sum >= size1 ? sum : SIZE_MAX);
}
/* Sum of three sizes, with overflow check. */
static inline size_t
#if __GNUC__ >= 3
__attribute__ ((__pure__))
#endif
xsum3 (size_t size1, size_t size2, size_t size3)
{
return xsum (xsum (size1, size2), size3);
}
/* Sum of four sizes, with overflow check. */
static inline size_t
#if __GNUC__ >= 3
__attribute__ ((__pure__))
#endif
xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
{
return xsum (xsum (xsum (size1, size2), size3), size4);
}
/* Maximum of two sizes, with overflow check. */
static inline size_t
#if __GNUC__ >= 3
__attribute__ ((__pure__))
#endif
xmax (size_t size1, size_t size2)
{
/* No explicit check is needed here, because for any n:
max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */
return (size1 >= size2 ? size1 : size2);
}
/* Multiplication of a count with an element size, with overflow check.
The count must be >= 0 and the element size must be > 0.
This is a macro, not an inline function, so that it works correctly even
when N is of a wider tupe and N > SIZE_MAX. */
#define xtimes(N, ELSIZE) \
((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
/* Check for overflow. */
#define size_overflow_p(SIZE) \
((SIZE) == SIZE_MAX)
/* Check against overflow. */
#define size_in_bounds_p(SIZE) \
((SIZE) != SIZE_MAX)
#endif /* _XSIZE_H */
-39
View File
@@ -1,39 +0,0 @@
# mktemp
# Copyright (c) Derek Price, Ximbiot <http://ximbiot.com>, and the
# Free Software Foundation, Inc. <http://gnu.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# This Bourne Shell scriptlet is intended as a simple replacement for
# the BSD mktemp function for systems that do not support mktemp. It
# currently does not check that the files it is creating did not exist
# previously and it does not verify that it successfully creates the
# files it returns the names of.
mktemp() {
if test x"$1" = x-d; then
tmp=`echo $2 |sed "s/XXXXXX/$$/"`
(umask 077 && exec mkdir $tmp) || return 1
else
tmp=`echo $1 |sed "s/XXXXXX/$$/"`
(umask 077 && touch $tmp) || return 1
fi
echo $tmp
return 0
}
+6 -1
View File
@@ -481,7 +481,12 @@ commit (argc, argv)
operate on, and only work with those files in the future.
This saves time--we don't want to search the file system
of the working directory twice. */
find_args.argv = (char **) xmalloc (find_args.argc * sizeof (char **));
if (size_overflow_p (xtimes (find_args.argc, sizeof (char **))))
{
find_args.argc = 0;
return 0;
}
find_args.argv = xmalloc (xtimes (find_args.argc, sizeof (char **)));
find_args.argc = 0;
walklist (find_args.ulist, copy_ulist, &find_args);
+4
View File
@@ -41,6 +41,10 @@
#include "popen.h"
#endif
/* Begin GNULIB headers. */
#include "xsize.h"
/* End GNULIB headers. */
#ifdef STDC_HEADERS
#include <stdlib.h>
#else
+3 -5
View File
@@ -85,9 +85,9 @@ fi
[ -z "$TMPDIR" ] && TMPDIR=/tmp
TEMP=$TMPDIR/p$$
BAD=$TMPDIR/pbad$$
REF=$TMPDIR/pf$$
TEMP="`/usr/bin/mktemp $TMPDIR/p.XXXXXX`"
BAD="`/usr/bin/mktemp $TMPDIR/pbad.XXXXXX`"
REF="`/usr/bin/mktemp $TMPDIR/pf.XXXXXX`"
if [ -z "$LOGNAME" -a -n "$USER" ]; then
LOGNAME=$USER
@@ -108,14 +108,12 @@ elif [ -f /bin/domainname ]; then
/usr/bin/ypcat passwd 2>/dev/null | cat - /etc/passwd | grep "^$LOGNAME:" |
cut -f5 -d':' | sed -e 's/,.*//' > $TEMP
ORIGINATOR="`cat $TEMP`"
rm -f $TEMP
fi
fi
if [ "$ORIGINATOR" = "" ]; then
grep "^$LOGNAME:" /etc/passwd | cut -f5 -d':' | sed -e 's/,.*//' > $TEMP
ORIGINATOR="`cat $TEMP`"
rm -f $TEMP
fi
if [ -n "$ORGANIZATION" ]; then
+7 -1
View File
@@ -988,8 +988,14 @@ expand_wild (argc, argv, pargc, pargv)
char ***pargv;
{
int i;
if (size_overflow_p (xtimes (argc, sizeof (char *)))) {
*pargc = 0;
*pargv = NULL;
error (0, 0, "expand_wild: too many arguments");
return;
}
*pargc = argc;
*pargv = (char **) xmalloc (argc * sizeof (char *));
*pargv = xmalloc (xtimes (argc, sizeof (char *)));
for (i = 0; i < argc; ++i)
(*pargv)[i] = xstrdup (argv[i]);
}
+24 -9
View File
@@ -414,8 +414,11 @@ history (argc, argv)
working = 1;
break;
case 'X': /* Undocumented debugging flag */
#ifdef DEBUG
histfile = optarg;
#endif
break;
case 'D': /* Since specified date */
if (*since_rev || *since_tag || *backto)
{
@@ -890,9 +893,13 @@ save_user (name)
{
if (user_count == user_max)
{
user_max += USER_INCREMENT;
user_list = (char **) xrealloc ((char *) user_list,
(int) user_max * sizeof (char *));
user_max = xsum (user_max, USER_INCREMENT);
if (size_overflow_p (xtimes (user_max, sizeof (char *))))
{
error (0, 0, "save_user: too many users");
return;
}
user_list = xrealloc (user_list, xtimes (user_max, sizeof (char *)));
}
user_list[user_count++] = xstrdup (name);
}
@@ -920,9 +927,13 @@ save_file (dir, name, module)
if (file_count == file_max)
{
file_max += FILE_INCREMENT;
file_list = (struct file_list_str *) xrealloc ((char *) file_list,
file_max * sizeof (*fl));
file_max = xsum (file_max, FILE_INCREMENT);
if (size_overflow_p (xtimes (file_max, sizeof (*fl))))
{
error (0, 0, "save_file: too many files");
return;
}
file_list = xrealloc (file_list, xtimes (file_max, sizeof (*fl)));
}
fl = &file_list[file_count++];
fl->l_file = cp = xmalloc (strlen (dir) + strlen (name) + 2);
@@ -961,9 +972,13 @@ save_module (module)
{
if (mod_count == mod_max)
{
mod_max += MODULE_INCREMENT;
mod_list = (char **) xrealloc ((char *) mod_list,
mod_max * sizeof (char *));
mod_max = xsum (mod_max, MODULE_INCREMENT);
if (size_overflow_p (xtimes (mod_max, sizeof (char *))))
{
error (0, 0, "save_module: too many modules");
return;
}
mod_list = xrealloc (mod_list, xtimes (mod_max, sizeof (char *)));
}
mod_list[mod_count++] = xstrdup (module);
}
-13
View File
@@ -1,13 +0,0 @@
/*
* Copyright (c) 2003, Derek Price, Ximbiot <http://ximbiot.com>,
* and the Free Software Foundation
*
* You may distribute under the terms of the GNU General Public License
* as specified in the README file that comes with the CVS source
* distribution.
*
* This is the header file for definitions and functions shared by history.c
* with other portions of CVS.
*/
#define ALL_HISTORY_REC_TYPES "TOEFWUPCGMAR"
+1 -1
View File
@@ -125,7 +125,7 @@ password_entry_parseline (cvsroot_canonical, warn, linenumber, linebuf)
if (isspace(*(linebuf + 1)))
/* special case since strtoul ignores leading white space */
entry_version = 0;
q = linebuf + 1;
else
entry_version = strtoul (linebuf + 1, &q, 10);
+18
View File
@@ -167,6 +167,24 @@ do_module (db, mname, m_type, msg, callback_proc, where, shorten,
mname);
/* Don't process absolute directories. Anything else could be a security
* problem. Before this check was put in place:
*
* $ cvs -d:fork:/cvsroot co /foo
* cvs server: warning: cannot make directory CVS in /: Permission denied
* cvs [server aborted]: cannot make directory /foo: Permission denied
* $
*/
if (isabsolute (mname))
error (1, 0, "Absolute module reference invalid: `%s'", mname);
/* Similarly for directories that attempt to step above the root of the
* repository.
*/
if (pathname_levels (mname) > 0)
error (1, 0, "up-level in module reference (`..') invalid: `%s'.",
mname);
/* if this is a directory to ignore, add it to that list */
if (mname[0] == '!' && mname[1] != '\0')
{
+4 -3
View File
@@ -375,6 +375,7 @@ patch_fileproc (callerdat, finfo)
struct utimbuf t;
char *vers_tag, *vers_head;
char *rcs = NULL;
char *rcs_orig = NULL;
RCSNode *rcsfile;
FILE *fp1, *fp2, *fp3;
int ret = 0;
@@ -404,7 +405,7 @@ patch_fileproc (callerdat, finfo)
if ((rcsfile->flags & VALID) && (rcsfile->flags & INATTIC))
isattic = 1;
rcs = xmalloc (strlen (finfo->file) + sizeof (RCSEXT) + 5);
rcs_orig = rcs = xmalloc (strlen (finfo->file) + sizeof (RCSEXT) + 5);
(void) sprintf (rcs, "%s%s", finfo->file, RCSEXT);
/* if vers_head is NULL, may have been removed from the release */
@@ -743,8 +744,8 @@ failed to read diff file header %s for %s: end of file", tmpfile3, rcs);
free (vers_tag);
if (vers_head != NULL)
free (vers_head);
if (rcs != NULL)
free (rcs);
if (rcs_orig)
free (rcs_orig);
return (ret);
}
+5 -4
View File
@@ -3034,8 +3034,7 @@ RCS_getdate (rcs, date, force_tag_match)
if (retval != NULL)
return (retval);
if (!force_tag_match ||
(vers != NULL && RCS_datecmp (vers->date, date) <= 0))
if (vers && (!force_tag_match || RCS_datecmp (vers->date, date) <= 0))
return (xstrdup (vers->version));
else
return (NULL);
@@ -4118,7 +4117,7 @@ RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat)
size_t len;
int free_value = 0;
char *log = NULL;
size_t loglen;
size_t loglen = 0;
Node *vp = NULL;
#ifdef PRESERVE_PERMISSIONS_SUPPORT
uid_t rcs_owner = (uid_t) -1;
@@ -7398,7 +7397,7 @@ RCS_deltas (rcs, fp, rcsbuf, version, op, text, len, log, loglen)
for (ln = 0; ln < headlines.nlines; ++ln)
{
char buf[80];
char *buf;
/* Period which separates year from month in date. */
char *ym;
/* Period which separates month from day in date. */
@@ -7409,10 +7408,12 @@ RCS_deltas (rcs, fp, rcsbuf, version, op, text, len, log, loglen)
if (prvers == NULL)
prvers = vers;
buf = xmalloc (strlen (prvers->version) + 24);
sprintf (buf, "%-12s (%-8.8s ",
prvers->version,
prvers->author);
cvs_output (buf, 0);
free (buf);
/* Now output the date. */
ym = strchr (prvers->date, '.');
+106 -10
View File
@@ -927,7 +927,7 @@ serve_max_dotdot (arg)
int i;
char *p;
if (lim < 0)
if (lim < 0 || lim > 10000)
return;
p = xmalloc (strlen (server_temp_dir) + 2 * lim + 10);
if (p == NULL)
@@ -1647,9 +1647,28 @@ serve_unchanged (arg)
&& strlen (arg) == cp - name
&& strncmp (arg, name, cp - name) == 0)
{
timefield = strchr (cp + 1, '/') + 1;
if (*timefield != '=')
if (!(timefield = strchr (cp + 1, '/')) || *++timefield == '\0')
{
/* We didn't find the record separator or it is followed by
* the end of the string, so just exit.
*/
if (alloc_pending (80))
sprintf (pending_error_text,
"E Malformed Entry encountered.");
return;
}
/* If the time field is not currently empty, then one of
* serve_modified, serve_is_modified, & serve_unchanged were
* already called for this file. We would like to ignore the
* reinvocation silently or, better yet, exit with an error
* message, but we just avoid the copy-forward and overwrite the
* value from the last invocation instead. See the comment below
* for more.
*/
if (*timefield == '/')
{
/* Copy forward one character. Space was allocated for this
* already in serve_entry(). */
cp = timefield + strlen (timefield);
cp[1] = '\0';
while (cp > timefield)
@@ -1657,8 +1676,17 @@ serve_unchanged (arg)
*cp = cp[-1];
--cp;
}
*timefield = '=';
}
/* If *TIMEFIELD wasn't "/", we assume that it was because of
* multiple calls to Is-Modified & Unchanged by the client and
* just overwrite the value from the last call. Technically, we
* should probably either ignore calls after the first or send the
* client an error, since the client/server protocol specification
* specifies that only one call to either Is-Modified or Unchanged
* is allowed, but broken versions of WinCVS & TortoiseCVS rely on
* this behavior.
*/
*timefield = '=';
break;
}
}
@@ -1691,9 +1719,28 @@ serve_is_modified (arg)
&& strlen (arg) == cp - name
&& strncmp (arg, name, cp - name) == 0)
{
timefield = strchr (cp + 1, '/') + 1;
if (!(timefield[0] == 'M' && timefield[1] == '/'))
if (!(timefield = strchr (cp + 1, '/')) || *++timefield == '\0')
{
/* We didn't find the record separator or it is followed by
* the end of the string, so just exit.
*/
if (alloc_pending (80))
sprintf (pending_error_text,
"E Malformed Entry encountered.");
return;
}
/* If the time field is not currently empty, then one of
* serve_modified, serve_is_modified, & serve_unchanged were
* already called for this file. We would like to ignore the
* reinvocation silently or, better yet, exit with an error
* message, but we just avoid the copy-forward and overwrite the
* value from the last invocation instead. See the comment below
* for more.
*/
if (*timefield == '/')
{
/* Copy forward one character. Space was allocated for this
* already in serve_entry(). */
cp = timefield + strlen (timefield);
cp[1] = '\0';
while (cp > timefield)
@@ -1701,8 +1748,17 @@ serve_is_modified (arg)
*cp = cp[-1];
--cp;
}
*timefield = 'M';
}
/* If *TIMEFIELD wasn't "/", we assume that it was because of
* multiple calls to Is-Modified & Unchanged by the client and
* just overwrite the value from the last call. Technically, we
* should probably either ignore calls after the first or send the
* client an error, since the client/server protocol specification
* specifies that only one call to either Is-Modified or Unchanged
* is allowed, but broken versions of WinCVS & TortoiseCVS rely on
* this behavior.
*/
*timefield = 'M';
if (kopt != NULL)
{
if (alloc_pending (strlen (name) + 80))
@@ -1757,8 +1813,29 @@ serve_entry (arg)
{
struct an_entry *p;
char *cp;
int i = 0;
if (error_pending()) return;
p = (struct an_entry *) xmalloc (sizeof (struct an_entry));
/* Verify that the entry is well-formed. This can avoid problems later.
* At the moment we only check that the Entry contains five slashes in
* approximately the correct locations since some of the code makes
* assumptions about this.
*/
cp = arg;
if (*cp == 'D') cp++;
while (i++ < 5)
{
if (!cp || *cp != '/')
{
if (alloc_pending (80))
sprintf (pending_error_text,
"E protocol error: Malformed Entry");
return;
}
cp = strchr (cp + 1, '/');
}
p = xmalloc (sizeof (struct an_entry));
if (p == NULL)
{
pending_error = ENOMEM;
@@ -1990,6 +2067,9 @@ serve_notify (arg)
{
char *cp;
if (!data[0])
goto error;
if (strchr (data, '+'))
goto error;
@@ -2122,6 +2202,14 @@ serve_argument (arg)
if (error_pending()) return;
if (argument_count >= 10000)
{
if (alloc_pending (80))
sprintf (pending_error_text,
"E Protocol error: too many arguments");
return;
}
if (argument_vector_size <= argument_count)
{
argument_vector_size *= 2;
@@ -2152,6 +2240,14 @@ serve_argumentx (arg)
if (error_pending()) return;
if (argument_count <= 1)
{
if (alloc_pending (80))
sprintf (pending_error_text,
"E Protocol error: called argumentx without prior call to argument");
return;
}
p = argument_vector[argument_count - 1];
p = xrealloc (p, strlen (p) + 1 + strlen (arg) + 1);
if (p == NULL)
@@ -2508,7 +2604,7 @@ check_command_legal_p (cmd_name)
save some code here... -kff */
/* Chop newline by hand, for strcmp()'s sake. */
if (linebuf[num_red - 1] == '\n')
if (num_red > 0 && linebuf[num_red - 1] == '\n')
linebuf[num_red - 1] = '\0';
if (strcmp (linebuf, CVS_Username) == 0)
@@ -2563,7 +2659,7 @@ check_command_legal_p (cmd_name)
while ((num_red = getline (&linebuf, &linebuf_len, fp)) >= 0)
{
/* Chop newline by hand, for strcmp()'s sake. */
if (linebuf[num_red - 1] == '\n')
if (num_red > 0 && linebuf[num_red - 1] == '\n')
linebuf[num_red - 1] = '\0';
if (strcmp (linebuf, CVS_Username) == 0)
-187
View File
@@ -1,187 +0,0 @@
/*
* Copyright (c) 2004, Free Software Foundation,
* Derek Price,
* & Ximbiot <http://ximbiot.com>.
*
* You may distribute under the terms of the GNU General Public License as
* specified in the README file that comes with the CVS source distribution.
*
* This module uses the hash.c module to implement a stack.
*/
#include "cvs.h"
#include <assert.h>
static void
do_push (stack, elem, isstring)
List *stack;
void *elem;
int isstring;
{
Node *p = getnode();
if (isstring)
p->key = elem;
else
p->data = elem;
addnode(stack, p);
}
void
push (stack, elem)
List *stack;
void *elem;
{
do_push (stack, elem, 0);
}
void
push_string (stack, elem)
List *stack;
char *elem;
{
do_push (stack, elem, 1);
}
static void *
do_pop (stack, isstring)
List *stack;
int isstring;
{
void *elem;
if (isempty (stack)) return NULL;
if (isstring)
{
elem = stack->list->prev->key;
stack->list->prev->key = NULL;
}
else
{
elem = stack->list->prev->data;
stack->list->prev->data = NULL;
}
delnode (stack->list->prev);
return elem;
}
void *
pop (stack)
List *stack;
{
return do_pop (stack, 0);
}
char *
pop_string (stack)
List *stack;
{
return do_pop (stack, 1);
}
static void
do_unshift (stack, elem, isstring)
List *stack;
void *elem;
int isstring;
{
Node *p = getnode();
if (isstring)
p->key = elem;
else
p->data = elem;
addnode_at_front(stack, p);
}
void
unshift (stack, elem)
List *stack;
void *elem;
{
do_unshift (stack, elem, 0);
}
void
unshift_string (stack, elem)
List *stack;
char *elem;
{
do_unshift (stack, elem, 1);
}
static void *
do_shift (stack, isstring)
List *stack;
int isstring;
{
void *elem;
if (isempty (stack)) return NULL;
if (isstring)
{
elem = stack->list->next->key;
stack->list->next->key = NULL;
}
else
{
elem = stack->list->next->data;
stack->list->next->data = NULL;
}
delnode (stack->list->next);
return elem;
}
void *
shift (stack)
List *stack;
{
return do_shift (stack, 0);
}
char *
shift_string (stack)
List *stack;
{
return do_shift (stack, 1);
}
int
isempty (stack)
List *stack;
{
if (stack->list == stack->list->next)
return 1;
return 0;
}
-18
View File
@@ -1,18 +0,0 @@
/*
* Copyright (c) 2004, Free Software Foundation,
* Derek Price,
* & Ximbiot <http://ximbiot.com>.
*
* You may distribute under the terms of the GNU General Public License as
* specified in the README file that comes with the CVS source distribution.
*/
void push PROTO((List *_stack, void *_elem));
void *pop PROTO((List *_stack));
void unshift PROTO((List *_stack, void *_elem));
void *shift PROTO((List *_stack));
void push_string PROTO((List *_stack, char *_elem));
char *pop_string PROTO((List *_stack));
void unshift_string PROTO((List *_stack, char *_elem));
char *shift_string PROTO((List *_stack));
int isempty PROTO((List *_stack));
+28 -6
View File
@@ -238,6 +238,30 @@ wrap_unparse_rcs_options (line, first_call_p)
}
#endif /* SERVER_SUPPORT || CLIENT_SUPPORT */
/*
* Remove fmt str specifier other than %% or %s. And allow
* only max_s %s specifiers
*/
wrap_clean_fmt_str(char *fmt, int max_s)
{
while (*fmt) {
if (fmt[0] == '%' && fmt[1])
{
if (fmt[1] == '%')
fmt++;
else
if (fmt[1] == 's' && max_s > 0)
{
max_s--;
fmt++;
} else
*fmt = ' ';
}
fmt++;
}
return;
}
/*
* Open a file and read lines, feeding each line to a line parser. Arrange
* for keeping a temporary list of wrappers at the end, if the "temp"
@@ -558,9 +582,8 @@ wrap_tocvs_process_file(fileName)
args = xmalloc (strlen (e->tocvsFilter)
+ strlen (fileName)
+ strlen (buf));
/* FIXME: sprintf will blow up if the format string contains items other
than %s, or contains too many %s's. We should instead be parsing
e->tocvsFilter ourselves and giving a real error. */
wrap_clean_fmt_str(e->tocvsFilter, 2);
sprintf (args, e->tocvsFilter, fileName, buf);
run_setup (args);
run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY );
@@ -592,9 +615,8 @@ wrap_fromcvs_process_file(fileName)
args = xmalloc (strlen (e->fromcvsFilter)
+ strlen (fileName));
/* FIXME: sprintf will blow up if the format string contains items other
than %s, or contains too many %s's. We should instead be parsing
e->fromcvsFilter ourselves and giving a real error. */
wrap_clean_fmt_str(e->fromcvsFilter, 1);
sprintf (args, e->fromcvsFilter, fileName);
run_setup (args);
run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL );
+8 -1
View File
@@ -118,11 +118,18 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
struct opie opie;
int rval, n = 499, i, mode = MODE_DEFAULT, force = 0;
char seed[OPIE_SEED_MAX+1];
char *username;
uid_t ruid;
struct passwd *pp;
memset(seed, 0, sizeof(seed));
if (!(pp = getpwnam(getlogin()))) {
ruid = getuid();
username = getlogin();
pp = getpwnam(username);
if (username == NULL || pp == NULL || pp->pw_uid != ruid)
pp = getpwuid(ruid);
if (pp == NULL) {
fprintf(stderr, "Who are you?");
return 1;
}
+1
View File
@@ -145,6 +145,7 @@ sm_flush(fp, timeout)
return SM_IO_EOF;
}
SM_IO_WR_TIMEOUT(fp, fd, *timeout);
t = 0;
}
}
return 0;
+10 -8
View File
@@ -192,7 +192,7 @@ extern const char SmFileMagic[];
else \
{ \
(time)->tv_sec = (val) / 1000; \
(time)->tv_usec = ((val) - ((time)->tv_sec * 1000)) * 10; \
(time)->tv_usec = ((val) - ((time)->tv_sec * 1000)) * 1000; \
} \
if ((val) == SM_TIME_FOREVER) \
{ \
@@ -276,7 +276,7 @@ extern const char SmFileMagic[];
else \
{ \
sm_io_to.tv_sec = (to) / 1000; \
sm_io_to.tv_usec = ((to) - (sm_io_to.tv_sec * 1000)) * 10; \
sm_io_to.tv_usec = ((to) - (sm_io_to.tv_sec * 1000)) * 1000; \
} \
if (FD_SETSIZE > 0 && (fd) >= FD_SETSIZE) \
{ \
@@ -289,8 +289,11 @@ extern const char SmFileMagic[];
FD_SET((fd), &sm_io_x_mask); \
if (gettimeofday(&sm_io_to_before, NULL) < 0) \
return SM_IO_EOF; \
sm_io_to_sel = select((fd) + 1, NULL, &sm_io_to_mask, &sm_io_x_mask, \
&sm_io_to); \
do \
{ \
sm_io_to_sel = select((fd) + 1, NULL, &sm_io_to_mask, \
&sm_io_x_mask, &sm_io_to); \
} while (sm_io_to_sel < 0 && errno == EINTR); \
if (sm_io_to_sel < 0) \
{ \
/* something went wrong, errno set */ \
@@ -305,10 +308,9 @@ extern const char SmFileMagic[];
/* else loop again */ \
if (gettimeofday(&sm_io_to_after, NULL) < 0) \
return SM_IO_EOF; \
timersub(&sm_io_to_before, &sm_io_to_after, &sm_io_to_diff); \
timersub(&sm_io_to, &sm_io_to_diff, &sm_io_to); \
(to) -= (sm_io_to.tv_sec * 1000); \
(to) -= (sm_io_to.tv_usec / 10); \
timersub(&sm_io_to_after, &sm_io_to_before, &sm_io_to_diff); \
(to) -= (sm_io_to_diff.tv_sec * 1000); \
(to) -= (sm_io_to_diff.tv_usec / 1000); \
if ((to) < 0) \
(to) = 0; \
}
+6 -3
View File
@@ -76,8 +76,11 @@ static int sm_lflush __P((SM_FILE_T *, int *));
FD_SET((fd), &sm_io_x_mask); \
if (gettimeofday(&sm_io_to_before, NULL) < 0) \
return SM_IO_EOF; \
(sel_ret) = select((fd) + 1, &sm_io_to_mask, NULL, \
&sm_io_x_mask, (to)); \
do \
{ \
(sel_ret) = select((fd) + 1, &sm_io_to_mask, NULL, \
&sm_io_x_mask, (to)); \
} while ((sel_ret) < 0 && errno == EINTR); \
if ((sel_ret) < 0) \
{ \
/* something went wrong, errno set */ \
@@ -94,7 +97,7 @@ static int sm_lflush __P((SM_FILE_T *, int *));
/* calulate wall-clock time used */ \
if (gettimeofday(&sm_io_to_after, NULL) < 0) \
return SM_IO_EOF; \
timersub(&sm_io_to_before, &sm_io_to_after, &sm_io_to_diff); \
timersub(&sm_io_to_after, &sm_io_to_before, &sm_io_to_diff); \
timersub((to), &sm_io_to_diff, (to)); \
}
+75 -86
View File
@@ -15,7 +15,6 @@
SM_RCSID("@(#)$Id: collect.c,v 8.242.2.8 2003/07/08 01:16:35 ca Exp $")
static void collecttimeout __P((time_t));
static void dferror __P((SM_FILE_T *volatile, char *, ENVELOPE *));
static void eatfrom __P((char *volatile, ENVELOPE *));
static void collect_doheader __P((ENVELOPE *));
@@ -264,10 +263,6 @@ collect_dfopen(e)
** If data file cannot be created, the process is terminated.
*/
static jmp_buf CtxCollectTimeout;
static bool volatile CollectProgress;
static SM_EVENT *volatile CollectTimeout = NULL;
/* values for input state machine */
#define IS_NORM 0 /* middle of line */
#define IS_BOL 1 /* beginning of line */
@@ -290,26 +285,30 @@ collect(fp, smtpmode, hdrp, e, rsetsize)
bool rsetsize;
{
register SM_FILE_T *volatile df;
volatile bool ignrdot;
volatile time_t dbto;
bool ignrdot;
int dbto;
register char *volatile bp;
volatile int c;
volatile bool inputerr;
int c;
bool inputerr;
bool headeronly;
char *volatile buf;
volatile int buflen;
volatile int istate;
volatile int mstate;
volatile int hdrslen;
volatile int numhdrs;
volatile int afd;
unsigned char *volatile pbp;
char *buf;
int buflen;
int istate;
int mstate;
int hdrslen;
int numhdrs;
int afd;
unsigned char *pbp;
unsigned char peekbuf[8];
char bufbuf[MAXLINE];
df = NULL;
ignrdot = smtpmode ? false : IgnrDot;
dbto = smtpmode ? TimeOuts.to_datablock : 0;
/* timeout for I/O functions is in milliseconds */
dbto = smtpmode ? ((int) TimeOuts.to_datablock * 1000)
: SM_TIME_FOREVER;
sm_io_setinfo(fp, SM_IO_WHAT_TIMEOUT, &dbto);
c = SM_IO_EOF;
inputerr = false;
headeronly = hdrp != NULL;
@@ -321,7 +320,6 @@ collect(fp, smtpmode, hdrp, e, rsetsize)
pbp = peekbuf;
istate = IS_BOL;
mstate = SaveFrom ? MS_HEADER : MS_UFROM;
CollectProgress = false;
/*
** Tell ARPANET to go ahead.
@@ -342,32 +340,6 @@ collect(fp, smtpmode, hdrp, e, rsetsize)
** the larger picture (e.g., header versus body).
*/
if (dbto != 0)
{
/* handle possible input timeout */
if (setjmp(CtxCollectTimeout) != 0)
{
if (LogLevel > 2)
sm_syslog(LOG_NOTICE, e->e_id,
"timeout waiting for input from %s during message collect",
CURHOSTNAME);
errno = 0;
if (smtpmode)
{
/*
** Override e_message in usrerr() as this
** is the reason for failure that should
** be logged for undelivered recipients.
*/
e->e_message = NULL;
}
usrerr("451 4.4.1 timeout waiting for input during message collect");
goto readerr;
}
CollectTimeout = sm_setevent(dbto, collecttimeout, dbto);
}
if (rsetsize)
e->e_msgsize = 0;
for (;;)
@@ -391,9 +363,26 @@ collect(fp, smtpmode, hdrp, e, rsetsize)
sm_io_clearerr(fp);
continue;
}
/* timeout? */
if (c == SM_IO_EOF && errno == EAGAIN
&& smtpmode)
{
/*
** Override e_message in
** usrerr() as this is the
** reason for failure that
** should be logged for
** undelivered recipients.
*/
e->e_message = NULL;
errno = 0;
inputerr = true;
goto readabort;
}
break;
}
CollectProgress = true;
if (TrafficLogFile != NULL && !headeronly)
{
if (istate == IS_BOL)
@@ -540,6 +529,18 @@ bufferchar:
buflen *= 2;
else
buflen += MEMCHUNKSIZE;
if (buflen <= 0)
{
sm_syslog(LOG_NOTICE, e->e_id,
"header overflow from %s during message collect",
CURHOSTNAME);
errno = 0;
e->e_flags |= EF_CLRQUEUE;
e->e_status = "5.6.0";
usrerrenh(e->e_status,
"552 Headers too large");
goto discard;
}
buf = xalloc(buflen);
memmove(buf, obuf, bp - obuf);
bp = &buf[bp - obuf];
@@ -583,6 +584,7 @@ bufferchar:
usrerrenh(e->e_status,
"552 Headers too large (%d max)",
MaxHeadersLength);
discard:
mstate = MS_DISCARD;
}
}
@@ -622,6 +624,24 @@ nextstate:
sm_io_clearerr(fp);
errno = 0;
c = sm_io_getc(fp, SM_TIME_DEFAULT);
/* timeout? */
if (c == SM_IO_EOF && errno == EAGAIN
&& smtpmode)
{
/*
** Override e_message in
** usrerr() as this is the
** reason for failure that
** should be logged for
** undelivered recipients.
*/
e->e_message = NULL;
errno = 0;
inputerr = true;
goto readabort;
}
} while (c == SM_IO_EOF && errno == EINTR);
if (c != SM_IO_EOF)
(void) sm_io_ungetc(fp, SM_TIME_DEFAULT, c);
@@ -631,8 +651,12 @@ nextstate:
continue;
}
/* trim off trailing CRLF or NL */
SM_ASSERT(bp > buf);
/* guaranteed by isheader(buf) */
SM_ASSERT(*(bp - 1) != '\n' || bp > buf + 1);
/* trim off trailing CRLF or NL */
if (*--bp != '\n' || *--bp != '\r')
bp++;
*bp = '\0';
@@ -698,10 +722,6 @@ readerr:
inputerr = true;
}
/* reset global timer */
if (CollectTimeout != NULL)
sm_clrevent(CollectTimeout);
if (headeronly)
return;
@@ -779,6 +799,7 @@ readerr:
}
/* An EOF when running SMTP is an error */
readabort:
if (inputerr && (OpMode == MD_SMTP || OpMode == MD_DAEMON))
{
char *host;
@@ -801,13 +822,14 @@ readerr:
problem, host,
shortenstring(e->e_from.q_paddr, MAXSHORTSTR));
if (sm_io_eof(fp))
usrerr("451 4.4.1 collect: %s on connection from %s, from=%s",
usrerr("421 4.4.1 collect: %s on connection from %s, from=%s",
problem, host,
shortenstring(e->e_from.q_paddr, MAXSHORTSTR));
else
syserr("451 4.4.1 collect: %s on connection from %s, from=%s",
syserr("421 4.4.1 collect: %s on connection from %s, from=%s",
problem, host,
shortenstring(e->e_from.q_paddr, MAXSHORTSTR));
flush_errors(true);
/* don't return an error indication */
e->e_to = NULL;
@@ -904,39 +926,6 @@ readerr:
}
}
static void
collecttimeout(timeout)
time_t timeout;
{
int save_errno = errno;
/*
** NOTE: THIS CAN BE CALLED FROM A SIGNAL HANDLER. DO NOT ADD
** ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
** DOING.
*/
if (CollectProgress)
{
/* reset the timeout */
CollectTimeout = sm_sigsafe_setevent(timeout, collecttimeout,
timeout);
CollectProgress = false;
}
else
{
/* event is done */
CollectTimeout = NULL;
}
/* if no progress was made or problem resetting event, die now */
if (CollectTimeout == NULL)
{
errno = ETIMEDOUT;
longjmp(CtxCollectTimeout, 1);
}
errno = save_errno;
}
/*
** DFERROR -- signal error on writing the data file.
**
+8 -11
View File
@@ -5210,8 +5210,8 @@ sm_syslog(level, id, fmt, va_alist)
va_dcl
#endif /* __STDC__ */
{
static char *buf = NULL;
static size_t bufsize;
char *buf;
size_t bufsize;
char *begin, *end;
int save_errno;
int seq = 1;
@@ -5235,11 +5235,8 @@ sm_syslog(level, id, fmt, va_alist)
else
idlen = strlen(id) + SyslogPrefixLen;
if (buf == NULL)
{
buf = buf0;
bufsize = sizeof buf0;
}
buf = buf0;
bufsize = sizeof buf0;
for (;;)
{
@@ -5281,8 +5278,8 @@ sm_syslog(level, id, fmt, va_alist)
(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
"%s: %s\n", id, newstring);
#endif /* LOG */
if (buf == buf0)
buf = NULL;
if (buf != buf0)
sm_free(buf);
errno = save_errno;
return;
}
@@ -5346,8 +5343,8 @@ sm_syslog(level, id, fmt, va_alist)
(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
"%s[%d]: %s\n", id, seq, begin);
#endif /* LOG */
if (buf == buf0)
buf = NULL;
if (buf != buf0)
sm_free(buf);
errno = save_errno;
}
/*
+88 -156
View File
@@ -3219,16 +3219,33 @@ do_transfer:
}
else if (!clever)
{
bool ok;
/*
** Format and send message.
*/
putfromline(mci, e);
(*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER);
(*e->e_putbody)(mci, e, NULL);
rcode = EX_OK;
errno = 0;
ok = putfromline(mci, e);
if (ok)
ok = (*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER);
if (ok)
ok = (*e->e_putbody)(mci, e, NULL);
/* get the exit status */
/*
** Ignore an I/O error that was caused by EPIPE.
** Some broken mailers don't read the entire body
** but just exit() thus causing an I/O error.
*/
if (!ok && (sm_io_error(mci->mci_out) && errno == EPIPE))
ok = true;
/* (always) get the exit status */
rcode = endmailer(mci, e, pv);
if (!ok)
rcode = EX_TEMPFAIL;
if (rcode == EX_TEMPFAIL && SmtpError[0] == '\0')
{
/*
@@ -4380,13 +4397,13 @@ logdelivery(m, mci, dsn, status, ctladdr, xstart, e)
** e -- the envelope.
**
** Returns:
** none
** true iff line was written successfully
**
** Side Effects:
** outputs some text to fp.
*/
void
bool
putfromline(mci, e)
register MCI *mci;
ENVELOPE *e;
@@ -4396,7 +4413,7 @@ putfromline(mci, e)
char xbuf[MAXLINE];
if (bitnset(M_NHDR, mci->mci_mailer->m_flags))
return;
return true;
mci->mci_flags |= MCIF_INHEADER;
@@ -4437,8 +4454,9 @@ putfromline(mci, e)
}
}
expand(template, buf, sizeof buf, e);
putxline(buf, strlen(buf), mci, PXLF_HEADER);
return putxline(buf, strlen(buf), mci, PXLF_HEADER);
}
/*
** PUTBODY -- put the body of a message.
**
@@ -4449,7 +4467,7 @@ putfromline(mci, e)
** not be permitted in the resulting message.
**
** Returns:
** none.
** true iff message was written successfully
**
** Side Effects:
** The message is written onto fp.
@@ -4460,13 +4478,15 @@ putfromline(mci, e)
#define OS_CR 1 /* read a carriage return */
#define OS_INLINE 2 /* putting rest of line */
void
bool
putbody(mci, e, separator)
register MCI *mci;
register ENVELOPE *e;
char *separator;
{
bool dead = false;
bool ioerr = false;
int save_errno;
char buf[MAXLINE];
#if MIME8TO7
char *boundaries[MAXMIMENESTING + 1];
@@ -4496,10 +4516,12 @@ putbody(mci, e, separator)
{
if (bitset(MCIF_INHEADER, mci->mci_flags))
{
putline("", mci);
if (!putline("", mci))
goto writeerr;
mci->mci_flags &= ~MCIF_INHEADER;
}
putline("<<< No Message Collected >>>", mci);
if (!putline("<<< No Message Collected >>>", mci))
goto writeerr;
goto endofmessage;
}
@@ -4528,26 +4550,31 @@ putbody(mci, e, separator)
*/
/* make sure it looks like a MIME message */
if (hvalue("MIME-Version", e->e_header) == NULL)
putline("MIME-Version: 1.0", mci);
if (hvalue("MIME-Version", e->e_header) == NULL &&
!putline("MIME-Version: 1.0", mci))
goto writeerr;
if (hvalue("Content-Type", e->e_header) == NULL)
{
(void) sm_snprintf(buf, sizeof buf,
"Content-Type: text/plain; charset=%s",
defcharset(e));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
/* now do the hard work */
boundaries[0] = NULL;
mci->mci_flags |= MCIF_INHEADER;
(void) mime8to7(mci, e->e_header, e, boundaries, M87F_OUTER);
if (mime8to7(mci, e->e_header, e, boundaries, M87F_OUTER) ==
SM_IO_EOF)
goto writeerr;
}
# if MIME7TO8
else if (bitset(MCIF_CVT7TO8, mci->mci_flags))
{
(void) mime7to8(mci, e->e_header, e);
if (!mime7to8(mci, e->e_header, e))
goto writeerr;
}
# endif /* MIME7TO8 */
else if (MaxMimeHeaderLength > 0 || MaxMimeFieldLength > 0)
@@ -4569,8 +4596,9 @@ putbody(mci, e, separator)
if (bitset(EF_DONT_MIME, e->e_flags))
SuprErrs = true;
(void) mime8to7(mci, e->e_header, e, boundaries,
M87F_OUTER|M87F_NO8TO7);
if (mime8to7(mci, e->e_header, e, boundaries,
M87F_OUTER|M87F_NO8TO7) == SM_IO_EOF)
goto writeerr;
/* restore SuprErrs */
SuprErrs = oldsuprerrs;
@@ -4590,7 +4618,8 @@ putbody(mci, e, separator)
if (bitset(MCIF_INHEADER, mci->mci_flags))
{
putline("", mci);
if (!putline("", mci))
goto writeerr;
mci->mci_flags &= ~MCIF_INHEADER;
}
@@ -4681,11 +4710,6 @@ putbody(mci, e, separator)
dead = true;
continue;
}
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
pos++;
}
for (xp = buf; xp < bp; xp++)
@@ -4698,11 +4722,6 @@ putbody(mci, e, separator)
dead = true;
break;
}
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
}
if (dead)
continue;
@@ -4713,11 +4732,6 @@ putbody(mci, e, separator)
mci->mci_mailer->m_eol)
== SM_IO_EOF)
break;
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
pos = 0;
}
else
@@ -4751,11 +4765,6 @@ putbody(mci, e, separator)
mci->mci_mailer->m_eol)
== SM_IO_EOF)
continue;
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
if (TrafficLogFile != NULL)
{
@@ -4817,11 +4826,6 @@ putch:
dead = true;
continue;
}
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
pos++;
continue;
}
@@ -4837,11 +4841,6 @@ putch:
dead = true;
continue;
}
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
if (TrafficLogFile != NULL)
{
@@ -4867,11 +4866,6 @@ putch:
mci->mci_mailer->m_eol)
== SM_IO_EOF)
continue;
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
pos = 0;
ostate = OS_HEAD;
}
@@ -4889,11 +4883,6 @@ putch:
dead = true;
continue;
}
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
pos++;
ostate = OS_INLINE;
}
@@ -4920,11 +4909,6 @@ putch:
dead = true;
break;
}
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
}
pos += bp - buf;
}
@@ -4934,11 +4918,9 @@ putch:
(void) sm_io_fputs(TrafficLogFile,
SM_TIME_DEFAULT,
mci->mci_mailer->m_eol);
(void) sm_io_fputs(mci->mci_out, SM_TIME_DEFAULT,
mci->mci_mailer->m_eol);
/* record progress for DATA timeout */
DataProgress = true;
if (sm_io_fputs(mci->mci_out, SM_TIME_DEFAULT,
mci->mci_mailer->m_eol) == SM_IO_EOF)
goto writeerr;
}
}
@@ -4948,6 +4930,7 @@ putch:
qid_printqueue(e->e_dfqgrp, e->e_dfqdir),
DATAFL_LETTER, e->e_id);
ExitStat = EX_IOERR;
ioerr = true;
}
endofmessage:
@@ -4962,23 +4945,35 @@ endofmessage:
** offset to match.
*/
save_errno = errno;
if (e->e_dfp != NULL)
(void) bfrewind(e->e_dfp);
/* some mailers want extra blank line at end of message */
if (!dead && bitnset(M_BLANKEND, mci->mci_mailer->m_flags) &&
buf[0] != '\0' && buf[0] != '\n')
putline("", mci);
(void) sm_io_flush(mci->mci_out, SM_TIME_DEFAULT);
if (sm_io_error(mci->mci_out) && errno != EPIPE)
{
syserr("putbody: write error");
ExitStat = EX_IOERR;
if (!putline("", mci))
goto writeerr;
}
errno = 0;
if (!dead &&
(sm_io_flush(mci->mci_out, SM_TIME_DEFAULT) == SM_IO_EOF ||
(sm_io_error(mci->mci_out) && errno != EPIPE)))
{
save_errno = errno;
syserr("putbody: write error");
ExitStat = EX_IOERR;
ioerr = true;
}
errno = save_errno;
return !dead && !ioerr;
writeerr:
return false;
}
/*
** MAILFILE -- Send a message to a file.
**
@@ -5503,14 +5498,14 @@ mailfile(filename, mailer, ctladdr, sfflags, e)
}
#endif /* MIME7TO8 */
putfromline(&mcibuf, e);
(*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER);
(*e->e_putbody)(&mcibuf, e, NULL);
putline("\n", &mcibuf);
if (sm_io_flush(f, SM_TIME_DEFAULT) != 0 ||
if (!putfromline(&mcibuf, e) ||
!(*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER) ||
!(*e->e_putbody)(&mcibuf, e, NULL) ||
!putline("\n", &mcibuf) ||
(sm_io_flush(f, SM_TIME_DEFAULT) != 0 ||
(SuperSafe != SAFE_NO &&
fsync(sm_io_getinfo(f, SM_IO_WHAT_FD, NULL)) < 0) ||
sm_io_error(f))
sm_io_error(f)))
{
setstat(EX_IOERR);
#if !NOFTRUNCATE
@@ -6066,86 +6061,23 @@ starttls(m, mci, e)
ssl_retry:
if ((result = SSL_connect(clt_ssl)) <= 0)
{
int i;
bool timedout;
time_t left;
time_t now = curtime();
struct timeval tv;
int i, ssl_err;
/* what to do in this case? */
i = SSL_get_error(clt_ssl, result);
ssl_err = SSL_get_error(clt_ssl, result);
i = tls_retry(clt_ssl, rfd, wfd, tlsstart,
TimeOuts.to_starttls, ssl_err, "client");
if (i > 0)
goto ssl_retry;
/*
** For SSL_ERROR_WANT_{READ,WRITE}:
** There is not a complete SSL record available yet
** or there is only a partial SSL record removed from
** the network (socket) buffer into the SSL buffer.
** The SSL_connect will only succeed when a full
** SSL record is available (assuming a "real" error
** doesn't happen). To handle when a "real" error
** does happen the select is set for exceptions too.
** The connection may be re-negotiated during this time
** so both read and write "want errors" need to be handled.
** A select() exception loops back so that a proper SSL
** error message can be gotten.
*/
left = TimeOuts.to_starttls - (now - tlsstart);
timedout = left <= 0;
if (!timedout)
{
tv.tv_sec = left;
tv.tv_usec = 0;
}
if (!timedout && FD_SETSIZE > 0 &&
(rfd >= FD_SETSIZE ||
(i == SSL_ERROR_WANT_WRITE && wfd >= FD_SETSIZE)))
{
if (LogLevel > 5)
{
sm_syslog(LOG_ERR, e->e_id,
"STARTTLS=client, error: fd %d/%d too large",
rfd, wfd);
if (LogLevel > 8)
tlslogerr("client");
}
errno = EINVAL;
goto tlsfail;
}
if (!timedout && i == SSL_ERROR_WANT_READ)
{
fd_set ssl_maskr, ssl_maskx;
FD_ZERO(&ssl_maskr);
FD_SET(rfd, &ssl_maskr);
FD_ZERO(&ssl_maskx);
FD_SET(rfd, &ssl_maskx);
if (select(rfd + 1, &ssl_maskr, NULL, &ssl_maskx, &tv)
> 0)
goto ssl_retry;
}
if (!timedout && i == SSL_ERROR_WANT_WRITE)
{
fd_set ssl_maskw, ssl_maskx;
FD_ZERO(&ssl_maskw);
FD_SET(wfd, &ssl_maskw);
FD_ZERO(&ssl_maskx);
FD_SET(rfd, &ssl_maskx);
if (select(wfd + 1, NULL, &ssl_maskw, &ssl_maskx, &tv)
> 0)
goto ssl_retry;
}
if (LogLevel > 5)
{
sm_syslog(LOG_ERR, e->e_id,
"STARTTLS=client, error: connect failed=%d, SSL_error=%d, timedout=%d, errno=%d",
result, i, (int) timedout, errno);
sm_syslog(LOG_WARNING, NOQID,
"STARTTLS=client, error: connect failed=%d, SSL_error=%d, errno=%d, retry=%d",
result, ssl_err, errno, i);
if (LogLevel > 8)
tlslogerr("client");
}
tlsfail:
SSL_free(clt_ssl);
clt_ssl = NULL;
return EX_SOFTWARE;
+39 -26
View File
@@ -18,7 +18,7 @@ SM_RCSID("@(#)$Id: headers.c,v 8.266.4.9 2003/10/30 00:17:22 gshapiro Exp $")
static size_t fix_mime_header __P((HDR *, ENVELOPE *));
static int priencode __P((char *));
static void put_vanilla_header __P((HDR *, char *, MCI *));
static bool put_vanilla_header __P((HDR *, char *, MCI *));
/*
** SETUPHEADERS -- initialize headers in symbol table
@@ -870,7 +870,6 @@ logsender(e, msgid)
char *name;
register char *sbp;
register char *p;
int l;
char hbuf[MAXNAME + 1];
char sbuf[MAXLINE + 1];
char mbuf[MAXNAME + 1];
@@ -879,6 +878,8 @@ logsender(e, msgid)
/* XXX do we still need this? sm_syslog() replaces control chars */
if (msgid != NULL)
{
size_t l;
l = strlen(msgid);
if (l > sizeof mbuf - 1)
l = sizeof mbuf - 1;
@@ -1422,13 +1423,13 @@ crackaddr(addr, e)
** flags -- MIME conversion flags.
**
** Returns:
** none.
** success
**
** Side Effects:
** none.
*/
void
bool
putheader(mci, hdr, e, flags)
register MCI *mci;
HDR *hdr;
@@ -1563,7 +1564,8 @@ putheader(mci, hdr, e, flags)
{
if (tTd(34, 11))
sm_dprintf("\n");
put_vanilla_header(h, p, mci);
if (!put_vanilla_header(h, p, mci))
goto writeerr;
continue;
}
@@ -1622,7 +1624,8 @@ putheader(mci, hdr, e, flags)
/* no other recipient headers: truncate value */
(void) sm_strlcpyn(obuf, sizeof obuf, 2,
h->h_field, ":");
putline(obuf, mci);
if (!putline(obuf, mci))
goto writeerr;
}
continue;
}
@@ -1641,7 +1644,8 @@ putheader(mci, hdr, e, flags)
}
else
{
put_vanilla_header(h, p, mci);
if (!put_vanilla_header(h, p, mci))
goto writeerr;
}
}
@@ -1658,18 +1662,25 @@ putheader(mci, hdr, e, flags)
!bitset(MCIF_CVT8TO7|MCIF_CVT7TO8|MCIF_INMIME, mci->mci_flags) &&
hvalue("MIME-Version", e->e_header) == NULL)
{
putline("MIME-Version: 1.0", mci);
if (!putline("MIME-Version: 1.0", mci))
goto writeerr;
if (hvalue("Content-Type", e->e_header) == NULL)
{
(void) sm_snprintf(obuf, sizeof obuf,
"Content-Type: text/plain; charset=%s",
defcharset(e));
putline(obuf, mci);
if (!putline(obuf, mci))
goto writeerr;
}
if (hvalue("Content-Transfer-Encoding", e->e_header) == NULL)
putline("Content-Transfer-Encoding: 8bit", mci);
if (hvalue("Content-Transfer-Encoding", e->e_header) == NULL
&& !putline("Content-Transfer-Encoding: 8bit", mci))
goto writeerr;
}
#endif /* MIME8TO7 */
return true;
writeerr:
return false;
}
/*
** PUT_VANILLA_HEADER -- output a fairly ordinary header
@@ -1680,10 +1691,10 @@ putheader(mci, hdr, e, flags)
** mci -- the connection info for output
**
** Returns:
** none.
** success
*/
static void
static bool
put_vanilla_header(h, v, mci)
HDR *h;
char *v;
@@ -1714,7 +1725,8 @@ put_vanilla_header(h, v, mci)
l = SPACELEFT(obuf, obp) - 1;
(void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.*s", l, v);
putxline(obuf, strlen(obuf), mci, putflags);
if (!putxline(obuf, strlen(obuf), mci, putflags))
goto writeerr;
v += l + 1;
obp = obuf;
if (*v != ' ' && *v != '\t')
@@ -1724,7 +1736,10 @@ put_vanilla_header(h, v, mci)
/* XXX This is broken for SPACELEFT()==0 */
(void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.*s",
(int) (SPACELEFT(obuf, obp) - 1), v);
putxline(obuf, strlen(obuf), mci, putflags);
return putxline(obuf, strlen(obuf), mci, putflags);
writeerr:
return false;
}
/*
** COMMAIZE -- output a header field, making a comma-translated list.
@@ -1737,13 +1752,13 @@ put_vanilla_header(h, v, mci)
** e -- the envelope containing the message.
**
** Returns:
** none.
** success
**
** Side Effects:
** outputs "p" to file "fp".
*/
void
bool
commaize(h, p, oldstyle, mci, e)
register HDR *h;
register char *p;
@@ -1882,13 +1897,6 @@ commaize(h, p, oldstyle, mci, e)
}
name = denlstring(name, false, true);
/*
** record data progress so DNS timeouts
** don't cause DATA timeouts
*/
DataProgress = true;
/* output the name with nice formatting */
opos += strlen(name);
if (!firstone)
@@ -1896,7 +1904,8 @@ commaize(h, p, oldstyle, mci, e)
if (opos > omax && !firstone)
{
(void) sm_strlcpy(obp, ",\n", SPACELEFT(obuf, obp));
putxline(obuf, strlen(obuf), mci, putflags);
if (!putxline(obuf, strlen(obuf), mci, putflags))
goto writeerr;
obp = obuf;
(void) sm_strlcpy(obp, " ", sizeof obuf);
opos = strlen(obp);
@@ -1918,8 +1927,12 @@ commaize(h, p, oldstyle, mci, e)
*obp = '\0';
else
obuf[sizeof obuf - 1] = '\0';
putxline(obuf, strlen(obuf), mci, putflags);
return putxline(obuf, strlen(obuf), mci, putflags);
writeerr:
return false;
}
/*
** COPYHEADER -- copy header list
**
+82 -40
View File
@@ -86,6 +86,7 @@ static bool MapNLtoCRLF;
** MBT_FINAL -- the final boundary
** MBT_INTERMED -- an intermediate boundary
** MBT_NOTSEP -- an end of file
** SM_IO_EOF -- I/O error occurred
*/
struct args
@@ -298,7 +299,8 @@ mime8to7(mci, header, e, boundaries, flags)
mci->mci_flags |= MCIF_INMIME;
/* skip the early "comment" prologue */
putline("", mci);
if (!putline("", mci))
goto writeerr;
mci->mci_flags &= ~MCIF_INHEADER;
bt = MBT_FINAL;
while (sm_io_fgets(e->e_dfp, SM_TIME_DEFAULT, buf, sizeof buf)
@@ -307,8 +309,9 @@ mime8to7(mci, header, e, boundaries, flags)
bt = mimeboundary(buf, boundaries);
if (bt != MBT_NOTSEP)
break;
putxline(buf, strlen(buf), mci,
PXLF_MAPFROM|PXLF_STRIP8BIT);
if (!putxline(buf, strlen(buf), mci,
PXLF_MAPFROM|PXLF_STRIP8BIT))
goto writeerr;
if (tTd(43, 99))
sm_dprintf(" ...%s", buf);
}
@@ -319,19 +322,24 @@ mime8to7(mci, header, e, boundaries, flags)
auto HDR *hdr = NULL;
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", bbuf);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
if (tTd(43, 35))
sm_dprintf(" ...%s\n", buf);
collect(e->e_dfp, false, &hdr, e, false);
if (tTd(43, 101))
putline("+++after collect", mci);
putheader(mci, hdr, e, flags);
if (!putheader(mci, hdr, e, flags))
goto writeerr;
if (tTd(43, 101))
putline("+++after putheader", mci);
bt = mime8to7(mci, hdr, e, boundaries, flags);
if (bt == SM_IO_EOF)
goto writeerr;
}
(void) sm_strlcpyn(buf, sizeof buf, 3, "--", bbuf, "--");
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
if (tTd(43, 35))
sm_dprintf(" ...%s\n", buf);
boundaries[i] = NULL;
@@ -344,8 +352,9 @@ mime8to7(mci, header, e, boundaries, flags)
bt = mimeboundary(buf, boundaries);
if (bt != MBT_NOTSEP)
break;
putxline(buf, strlen(buf), mci,
PXLF_MAPFROM|PXLF_STRIP8BIT);
if (!putxline(buf, strlen(buf), mci,
PXLF_MAPFROM|PXLF_STRIP8BIT))
goto writeerr;
if (tTd(43, 99))
sm_dprintf(" ...%s", buf);
}
@@ -373,18 +382,21 @@ mime8to7(mci, header, e, boundaries, flags)
{
auto HDR *hdr = NULL;
putline("", mci);
if (!putline("", mci))
goto writeerr;
mci->mci_flags |= MCIF_INMIME;
collect(e->e_dfp, false, &hdr, e, false);
if (tTd(43, 101))
putline("+++after collect", mci);
putheader(mci, hdr, e, flags);
if (!putheader(mci, hdr, e, flags))
goto writeerr;
if (tTd(43, 101))
putline("+++after putheader", mci);
if (hvalue("MIME-Version", hdr) == NULL &&
!bitset(M87F_NO8TO7, flags))
putline("MIME-Version: 1.0", mci);
!bitset(M87F_NO8TO7, flags) &&
!putline("MIME-Version: 1.0", mci))
goto writeerr;
bt = mime8to7(mci, hdr, e, boundaries, flags);
mci->mci_flags &= ~MCIF_INMIME;
return bt;
@@ -480,11 +492,13 @@ mime8to7(mci, header, e, boundaries, flags)
(void) sm_snprintf(buf, sizeof buf,
"Content-Transfer-Encoding: %.200s", cte);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
if (tTd(43, 36))
sm_dprintf(" ...%s\n", buf);
}
putline("", mci);
if (!putline("", mci))
goto writeerr;
mci->mci_flags &= ~MCIF_INHEADER;
while (sm_io_fgets(e->e_dfp, SM_TIME_DEFAULT, buf, sizeof buf)
!= NULL)
@@ -492,7 +506,8 @@ mime8to7(mci, header, e, boundaries, flags)
bt = mimeboundary(buf, boundaries);
if (bt != MBT_NOTSEP)
break;
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
if (sm_io_eof(e->e_dfp))
bt = MBT_FINAL;
@@ -505,12 +520,13 @@ mime8to7(mci, header, e, boundaries, flags)
if (tTd(43, 36))
sm_dprintf(" ...Content-Transfer-Encoding: base64\n");
putline("Content-Transfer-Encoding: base64", mci);
if (!putline("Content-Transfer-Encoding: base64", mci))
goto writeerr;
(void) sm_snprintf(buf, sizeof buf,
"X-MIME-Autoconverted: from 8bit to base64 by %s id %s",
MyHostName, e->e_id);
putline(buf, mci);
putline("", mci);
if (!putline(buf, mci) || !putline("", mci))
goto writeerr;
mci->mci_flags &= ~MCIF_INHEADER;
while ((c1 = mime_getchar_crlf(e->e_dfp, boundaries, &bt)) !=
SM_IO_EOF)
@@ -518,7 +534,8 @@ mime8to7(mci, header, e, boundaries, flags)
if (linelen > 71)
{
*bp = '\0';
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
linelen = 0;
bp = buf;
}
@@ -548,7 +565,8 @@ mime8to7(mci, header, e, boundaries, flags)
*bp++ = Base64Code[c2 & 0x3f];
}
*bp = '\0';
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
else
{
@@ -571,12 +589,14 @@ mime8to7(mci, header, e, boundaries, flags)
if (tTd(43, 36))
sm_dprintf(" ...Content-Transfer-Encoding: quoted-printable\n");
putline("Content-Transfer-Encoding: quoted-printable", mci);
if (!putline("Content-Transfer-Encoding: quoted-printable",
mci))
goto writeerr;
(void) sm_snprintf(buf, sizeof buf,
"X-MIME-Autoconverted: from 8bit to quoted-printable by %s id %s",
MyHostName, e->e_id);
putline(buf, mci);
putline("", mci);
if (!putline(buf, mci) || !putline("", mci))
goto writeerr;
mci->mci_flags &= ~MCIF_INHEADER;
fromstate = 0;
c2 = '\n';
@@ -598,7 +618,8 @@ mime8to7(mci, header, e, boundaries, flags)
*bp++ = Base16Code['.' & 0x0f];
}
*bp = '\0';
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
linelen = fromstate = 0;
bp = buf;
c2 = c1;
@@ -627,7 +648,8 @@ mime8to7(mci, header, e, boundaries, flags)
c2 = '\n';
*bp++ = '=';
*bp = '\0';
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
linelen = fromstate = 0;
bp = buf;
if (c2 == '.')
@@ -665,13 +687,17 @@ mime8to7(mci, header, e, boundaries, flags)
if (linelen > 0 || boundaries[0] != NULL)
{
*bp = '\0';
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
}
if (tTd(43, 3))
sm_dprintf("\t\t\tmime8to7=>%s (basic)\n", MimeBoundaryNames[bt]);
return bt;
writeerr:
return SM_IO_EOF;
}
/*
** MIME_GETCHAR -- get a character for MIME processing
@@ -954,7 +980,7 @@ static int mime_fromqp __P((unsigned char *, unsigned char **, int));
** e -- envelope.
**
** Returns:
** none.
** true iff body was written successfully
*/
static char index_64[128] =
@@ -971,7 +997,7 @@ static char index_64[128] =
# define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)])
void
bool
mime7to8(mci, header, e)
register MCI *mci;
HDR *header;
@@ -1004,25 +1030,31 @@ mime7to8(mci, header, e)
{
(void) sm_snprintf(buf, sizeof buf,
"Content-Transfer-Encoding: %s", p);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
putline("", mci);
if (!putline("", mci))
goto writeerr;
mci->mci_flags &= ~MCIF_INHEADER;
while (sm_io_fgets(e->e_dfp, SM_TIME_DEFAULT, buf, sizeof buf)
!= NULL)
putline(buf, mci);
return;
{
if (!putline(buf, mci))
goto writeerr;
}
return true;
}
cataddr(pvp, NULL, buf, sizeof buf, '\0');
cte = sm_rpool_strdup_x(e->e_rpool, buf);
mci->mci_flags |= MCIF_INHEADER;
putline("Content-Transfer-Encoding: 8bit", mci);
if (!putline("Content-Transfer-Encoding: 8bit", mci))
goto writeerr;
(void) sm_snprintf(buf, sizeof buf,
"X-MIME-Autoconverted: from %.200s to 8bit by %s id %s",
cte, MyHostName, e->e_id);
putline(buf, mci);
putline("", mci);
if (!putline(buf, mci) || !putline("", mci))
goto writeerr;
mci->mci_flags &= ~MCIF_INHEADER;
/*
@@ -1086,7 +1118,8 @@ mime7to8(mci, header, e)
if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE]) \
{ \
CHK_EOL; \
putxline((char *) fbuf, fbufp - fbuf, mci, pxflags); \
if (!putxline((char *) fbuf, fbufp - fbuf, mci, pxflags)) \
goto writeerr; \
pxflags &= ~PXLF_NOADDEOL; \
fbufp = fbuf; \
} \
@@ -1123,8 +1156,11 @@ again:
continue;
if (fbufp - fbuf > 0)
putxline((char *) fbuf, fbufp - fbuf - 1, mci,
pxflags);
{
if (!putxline((char *) fbuf, fbufp - fbuf - 1,
mci, pxflags))
goto writeerr;
}
fbufp = fbuf;
if (off >= 0 && buf[off] != '\0')
{
@@ -1140,7 +1176,8 @@ again:
if (fbufp > fbuf)
{
*fbufp = '\0';
putxline((char *) fbuf, fbufp - fbuf, mci, pxflags);
if (!putxline((char *) fbuf, fbufp - fbuf, mci, pxflags))
goto writeerr;
}
/*
@@ -1150,10 +1187,15 @@ again:
** but so is auto-converting MIME in the first place.
*/
putline("", mci);
if (!putline("", mci))
goto writeerr;
if (tTd(43, 3))
sm_dprintf("\t\t\tmime7to8 => %s to 8bit done\n", cte);
return true;
writeerr:
return false;
}
/*
** The following is based on Borenstein's "codes.c" module, with simplifying
+6 -6
View File
@@ -1328,7 +1328,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
/* $&{x} replacement */
char *mval = macvalue(rp[1], e);
char **xpvp;
int trsize = 0;
size_t trsize = 0;
static size_t pvpb1_size = 0;
static char **pvpb1 = NULL;
char pvpbuf[PSBUFSIZE];
@@ -1343,7 +1343,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
/* save the remainder of the input */
for (xpvp = pvp; *xpvp != NULL; xpvp++)
trsize += sizeof *xpvp;
if ((size_t) trsize > pvpb1_size)
if (trsize > pvpb1_size)
{
if (pvpb1 != NULL)
sm_free(pvpb1);
@@ -1398,7 +1398,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
{
char **hbrvp;
char **xpvp;
int trsize;
size_t trsize;
char *replac;
int endtoken;
STAB *map;
@@ -1500,7 +1500,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
*++arg_rvp = NULL;
/* save the remainder of the input string */
trsize = (int) (avp - rvp + 1) * sizeof *rvp;
trsize = (avp - rvp + 1) * sizeof *rvp;
memmove((char *) pvpb1, (char *) rvp, trsize);
/* look it up */
@@ -2933,7 +2933,7 @@ rscheck(rwset, p1, p2, e, flags, logl, host, logid)
char *logid;
{
char *volatile buf;
int bufsize;
size_t bufsize;
int saveexitstat;
int volatile rstat = EX_OK;
char **pvp;
@@ -3152,7 +3152,7 @@ rscap(rwset, p1, p2, e, pvp, pvpbuf, size)
int size;
{
char *volatile buf;
int bufsize;
size_t bufsize;
int volatile rstat = EX_OK;
int rsno;
bool saveQuickAbort = QuickAbort;
+160 -95
View File
@@ -15,7 +15,7 @@
SM_RCSID("@(#)$Id: savemail.c,v 8.299.2.1 2002/10/23 15:08:47 ca Exp $")
static void errbody __P((MCI *, ENVELOPE *, char *));
static bool errbody __P((MCI *, ENVELOPE *, char *));
static bool pruneroute __P((char *));
/*
@@ -427,12 +427,13 @@ savemail(e, sendbody)
p = macvalue('g', e);
macdefine(&e->e_macro, A_PERM, 'g', e->e_sender);
putfromline(&mcibuf, e);
(*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER);
(*e->e_putbody)(&mcibuf, e, NULL);
putline("\n", &mcibuf); /* XXX EOL from FileMailer? */
(void) sm_io_flush(fp, SM_TIME_DEFAULT);
if (sm_io_error(fp) ||
if (!putfromline(&mcibuf, e) ||
!(*e->e_puthdr)(&mcibuf, e->e_header, e,
M87F_OUTER) ||
!(*e->e_putbody)(&mcibuf, e, NULL) ||
!putline("\n", &mcibuf) ||
sm_io_flush(fp, SM_TIME_DEFAULT) == SM_IO_EOF ||
sm_io_error(fp) ||
sm_io_close(fp, SM_TIME_DEFAULT) < 0)
state = ESM_PANIC;
else
@@ -727,14 +728,14 @@ returntosender(msg, returnq, flags, e)
** separator -- any possible MIME separator (unused).
**
** Returns:
** none
** success
**
** Side Effects:
** Outputs the body of an error message.
*/
/* ARGSUSED2 */
static void
static bool
errbody(mci, e, separator)
register MCI *mci;
register ENVELOPE *e;
@@ -752,14 +753,16 @@ errbody(mci, e, separator)
if (bitset(MCIF_INHEADER, mci->mci_flags))
{
putline("", mci);
if (!putline("", mci))
goto writeerr;
mci->mci_flags &= ~MCIF_INHEADER;
}
if (e->e_parent == NULL)
{
syserr("errbody: null parent");
putline(" ----- Original message lost -----\n", mci);
return;
if (!putline(" ----- Original message lost -----\n", mci))
goto writeerr;
return true;
}
/*
@@ -768,11 +771,12 @@ errbody(mci, e, separator)
if (e->e_msgboundary != NULL)
{
putline("This is a MIME-encapsulated message", mci);
putline("", mci);
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary);
putline(buf, mci);
putline("", mci);
if (!putline("This is a MIME-encapsulated message", mci) ||
!putline("", mci) ||
!putline(buf, mci) ||
!putline("", mci))
goto writeerr;
}
/*
@@ -794,31 +798,36 @@ errbody(mci, e, separator)
if (!pm_notify && q == NULL &&
!bitset(EF_FATALERRS|EF_SENDRECEIPT, e->e_parent->e_flags))
{
putline(" **********************************************",
mci);
putline(" ** THIS IS A WARNING MESSAGE ONLY **",
mci);
putline(" ** YOU DO NOT NEED TO RESEND YOUR MESSAGE **",
mci);
putline(" **********************************************",
mci);
putline("", mci);
if (!putline(" **********************************************",
mci) ||
!putline(" ** THIS IS A WARNING MESSAGE ONLY **",
mci) ||
!putline(" ** YOU DO NOT NEED TO RESEND YOUR MESSAGE **",
mci) ||
!putline(" **********************************************",
mci) ||
!putline("", mci))
goto writeerr;
}
(void) sm_snprintf(buf, sizeof buf,
"The original message was received at %s",
arpadate(ctime(&e->e_parent->e_ctime)));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
expand("from \201_", buf, sizeof buf, e->e_parent);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
/* include id in postmaster copies */
if (pm_notify && e->e_parent->e_id != NULL)
{
(void) sm_strlcpyn(buf, sizeof buf, 2, "with id ",
e->e_parent->e_id);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
putline("", mci);
if (!putline("", mci))
goto writeerr;
/*
** Output error message header (if specified and available).
@@ -844,17 +853,19 @@ errbody(mci, e, separator)
{
translate_dollars(buf);
expand(buf, buf, sizeof buf, e);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
(void) sm_io_close(xfile, SM_TIME_DEFAULT);
putline("\n", mci);
if (!putline("\n", mci))
goto writeerr;
}
}
else
{
expand(ErrMsgFile, buf, sizeof buf, e);
putline(buf, mci);
putline("", mci);
if (!putline(buf, mci) || !putline("", mci))
goto writeerr;
}
}
@@ -872,21 +883,24 @@ errbody(mci, e, separator)
if (printheader)
{
putline(" ----- The following addresses had permanent fatal errors -----",
mci);
if (!putline(" ----- The following addresses had permanent fatal errors -----",
mci))
goto writeerr;
printheader = false;
}
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR),
sizeof buf);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
if (q->q_rstatus != NULL)
{
(void) sm_snprintf(buf, sizeof buf,
" (reason: %s)",
shortenstring(exitstat(q->q_rstatus),
MAXSHORTSTR));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
if (q->q_alias != NULL)
{
@@ -894,11 +908,12 @@ errbody(mci, e, separator)
" (expanded from: %s)",
shortenstring(q->q_alias->q_paddr,
MAXSHORTSTR));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
}
if (!printheader)
putline("", mci);
if (!printheader && !putline("", mci))
goto writeerr;
/* transient non-fatal errors */
printheader = true;
@@ -912,25 +927,28 @@ errbody(mci, e, separator)
if (printheader)
{
putline(" ----- The following addresses had transient non-fatal errors -----",
mci);
if (!putline(" ----- The following addresses had transient non-fatal errors -----",
mci))
goto writeerr;
printheader = false;
}
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR),
sizeof buf);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
if (q->q_alias != NULL)
{
(void) sm_snprintf(buf, sizeof buf,
" (expanded from: %s)",
shortenstring(q->q_alias->q_paddr,
MAXSHORTSTR));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
}
if (!printheader)
putline("", mci);
if (!printheader && !putline("", mci))
goto writeerr;
/* successful delivery notifications */
printheader = true;
@@ -963,25 +981,28 @@ errbody(mci, e, separator)
if (printheader)
{
putline(" ----- The following addresses had successful delivery notifications -----",
mci);
if (!putline(" ----- The following addresses had successful delivery notifications -----",
mci))
goto writeerr;
printheader = false;
}
(void) sm_snprintf(buf, sizeof buf, "%s (%s)",
shortenstring(q->q_paddr, MAXSHORTSTR), p);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
if (q->q_alias != NULL)
{
(void) sm_snprintf(buf, sizeof buf,
" (expanded from: %s)",
shortenstring(q->q_alias->q_paddr,
MAXSHORTSTR));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
}
if (!printheader)
putline("", mci);
if (!printheader && !putline("", mci))
goto writeerr;
/*
** Output transcript of errors
@@ -990,8 +1011,9 @@ errbody(mci, e, separator)
(void) sm_io_flush(smioout, SM_TIME_DEFAULT);
if (e->e_parent->e_xfp == NULL)
{
putline(" ----- Transcript of session is unavailable -----\n",
mci);
if (!putline(" ----- Transcript of session is unavailable -----\n",
mci))
goto writeerr;
}
else
{
@@ -1002,11 +1024,12 @@ errbody(mci, e, separator)
while (sm_io_fgets(e->e_parent->e_xfp, SM_TIME_DEFAULT, buf,
sizeof buf) != NULL)
{
if (printheader)
putline(" ----- Transcript of session follows -----\n",
mci);
if (printheader && !putline(" ----- Transcript of session follows -----\n",
mci))
goto writeerr;
printheader = false;
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
}
errno = 0;
@@ -1018,11 +1041,12 @@ errbody(mci, e, separator)
if (e->e_msgboundary != NULL)
{
putline("", mci);
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary);
putline(buf, mci);
putline("Content-Type: message/delivery-status", mci);
putline("", mci);
if (!putline("", mci) ||
!putline(buf, mci) ||
!putline("Content-Type: message/delivery-status", mci) ||
!putline("", mci))
goto writeerr;
/*
** Output per-message information.
@@ -1034,13 +1058,15 @@ errbody(mci, e, separator)
(void) sm_snprintf(buf, sizeof buf,
"Original-Envelope-Id: %.800s",
xuntextify(e->e_parent->e_envid));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
/* Reporting-MTA: is us (required) */
(void) sm_snprintf(buf, sizeof buf,
"Reporting-MTA: dns; %.800s", MyHostName);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
/* DSN-Gateway: not relevant since we are not translating */
@@ -1054,13 +1080,15 @@ errbody(mci, e, separator)
(void) sm_snprintf(buf, sizeof buf,
"Received-From-MTA: %s; %.800s",
p, RealHostName);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
/* Arrival-Date: -- when it arrived here */
(void) sm_strlcpyn(buf, sizeof buf, 2, "Arrival-Date: ",
arpadate(ctime(&e->e_parent->e_ctime)));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
/* Deliver-By-Date: -- when it should have been delivered */
if (IS_DLVR_BY(e->e_parent))
@@ -1071,7 +1099,8 @@ errbody(mci, e, separator)
(void) sm_strlcpyn(buf, sizeof buf, 2,
"Deliver-By-Date: ",
arpadate(ctime(&dbyd)));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
/*
@@ -1114,7 +1143,8 @@ errbody(mci, e, separator)
else
continue;
putline("", mci);
if (!putline("", mci))
goto writeerr;
/* Original-Recipient: -- passed from on high */
if (q->q_orcpt != NULL)
@@ -1122,7 +1152,8 @@ errbody(mci, e, separator)
(void) sm_snprintf(buf, sizeof buf,
"Original-Recipient: %.800s",
q->q_orcpt);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
/* Figure out actual recipient */
@@ -1171,7 +1202,8 @@ errbody(mci, e, separator)
(void) sm_snprintf(buf, sizeof buf,
"Final-Recipient: %s",
q->q_finalrcpt);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
/* X-Actual-Recipient: -- the real problem address */
@@ -1182,13 +1214,15 @@ errbody(mci, e, separator)
(void) sm_snprintf(buf, sizeof buf,
"X-Actual-Recipient: %s",
actual);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
/* Action: -- what happened? */
(void) sm_strlcpyn(buf, sizeof buf, 2, "Action: ",
action);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
/* Status: -- what _really_ happened? */
if (q->q_status != NULL)
@@ -1200,7 +1234,8 @@ errbody(mci, e, separator)
else
p = "2.0.0";
(void) sm_strlcpyn(buf, sizeof buf, 2, "Status: ", p);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
/* Remote-MTA: -- who was I talking to? */
if (q->q_statmta != NULL)
@@ -1214,7 +1249,8 @@ errbody(mci, e, separator)
p = &buf[strlen(buf) - 1];
if (*p == '.')
*p = '\0';
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
/* Diagnostic-Code: -- actual result from other end */
@@ -1226,7 +1262,8 @@ errbody(mci, e, separator)
(void) sm_snprintf(buf, sizeof buf,
"Diagnostic-Code: %s; %.800s",
p, q->q_rstatus);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
/* Last-Attempt-Date: -- fine granularity */
@@ -1235,7 +1272,8 @@ errbody(mci, e, separator)
(void) sm_strlcpyn(buf, sizeof buf, 2,
"Last-Attempt-Date: ",
arpadate(ctime(&q->q_statdate)));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
/* Will-Retry-Until: -- for delayed messages only */
if (QS_IS_QUEUEUP(q->q_state))
@@ -1247,7 +1285,8 @@ errbody(mci, e, separator)
(void) sm_strlcpyn(buf, sizeof buf, 2,
"Will-Retry-Until: ",
arpadate(ctime(&xdate)));
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
}
}
@@ -1257,7 +1296,8 @@ errbody(mci, e, separator)
** Output text of original message
*/
putline("", mci);
if (!putline("", mci))
goto writeerr;
if (bitset(EF_HAS_DF, e->e_parent->e_flags))
{
sendbody = !bitset(EF_NO_BODY_RETN, e->e_parent->e_flags) &&
@@ -1265,21 +1305,27 @@ errbody(mci, e, separator)
if (e->e_msgboundary == NULL)
{
if (sendbody)
putline(" ----- Original message follows -----\n", mci);
else
putline(" ----- Message header follows -----\n", mci);
if (!putline(
sendbody
? " ----- Original message follows -----\n"
: " ----- Message header follows -----\n",
mci))
{
goto writeerr;
}
}
else
{
(void) sm_strlcpyn(buf, sizeof buf, 2, "--",
e->e_msgboundary);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
(void) sm_strlcpyn(buf, sizeof buf, 2, "Content-Type: ",
sendbody ? "message/rfc822"
: "text/rfc822-headers");
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
p = hvalue("Content-Transfer-Encoding",
e->e_parent->e_header);
@@ -1293,43 +1339,62 @@ errbody(mci, e, separator)
(void) sm_snprintf(buf, sizeof buf,
"Content-Transfer-Encoding: %s",
p);
putline(buf, mci);
if (!putline(buf, mci))
goto writeerr;
}
}
putline("", mci);
if (!putline("", mci))
goto writeerr;
save_errno = errno;
putheader(mci, e->e_parent->e_header, e->e_parent, M87F_OUTER);
if (!putheader(mci, e->e_parent->e_header, e->e_parent,
M87F_OUTER))
goto writeerr;
errno = save_errno;
if (sendbody)
putbody(mci, e->e_parent, e->e_msgboundary);
{
if (!putbody(mci, e->e_parent, e->e_msgboundary))
goto writeerr;
}
else if (e->e_msgboundary == NULL)
{
putline("", mci);
putline(" ----- Message body suppressed -----", mci);
if (!putline("", mci) ||
!putline(" ----- Message body suppressed -----",
mci))
{
goto writeerr;
}
}
}
else if (e->e_msgboundary == NULL)
{
putline(" ----- No message was collected -----\n", mci);
if (!putline(" ----- No message was collected -----\n", mci))
goto writeerr;
}
if (e->e_msgboundary != NULL)
{
putline("", mci);
(void) sm_strlcpyn(buf, sizeof buf, 3, "--", e->e_msgboundary,
"--");
putline(buf, mci);
if (!putline("", mci) || !putline(buf, mci))
goto writeerr;
}
putline("", mci);
(void) sm_io_flush(mci->mci_out, SM_TIME_DEFAULT);
if (!putline("", mci) ||
sm_io_flush(mci->mci_out, SM_TIME_DEFAULT) == SM_IO_EOF)
goto writeerr;
/*
** Cleanup and exit
*/
if (errno != 0)
{
writeerr:
syserr("errbody: I/O error");
return false;
}
return true;
}
/*
** SMTPTODSN -- convert SMTP to DSN status code
**
+9 -10
View File
@@ -804,12 +804,12 @@ extern struct hdrinfo HdrInfo[];
/* functions */
extern void addheader __P((char *, char *, int, ENVELOPE *));
extern unsigned long chompheader __P((char *, int, HDR **, ENVELOPE *));
extern void commaize __P((HDR *, char *, bool, MCI *, ENVELOPE *));
extern bool commaize __P((HDR *, char *, bool, MCI *, ENVELOPE *));
extern HDR *copyheader __P((HDR *, SM_RPOOL_T *));
extern void eatheader __P((ENVELOPE *, bool, bool));
extern char *hvalue __P((char *, HDR *));
extern bool isheader __P((char *));
extern void putfromline __P((MCI *, ENVELOPE *));
extern bool putfromline __P((MCI *, ENVELOPE *));
extern void setupheaders __P((void));
/*
@@ -864,9 +864,9 @@ struct envelope
short e_sendmode; /* message send mode */
short e_errormode; /* error return mode */
short e_timeoutclass; /* message timeout class */
void (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *, int));
bool (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *, int));
/* function to put header of message */
void (*e_putbody)__P((MCI *, ENVELOPE *, char *));
bool (*e_putbody)__P((MCI *, ENVELOPE *, char *));
/* function to put body of message */
ENVELOPE *e_parent; /* the message this one encloses */
ENVELOPE *e_sibling; /* the next envelope of interest */
@@ -965,8 +965,8 @@ extern void dropenvelope __P((ENVELOPE *, bool, bool));
extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *, SM_RPOOL_T *));
extern void clrsessenvelope __P((ENVELOPE *));
extern void printenvflags __P((ENVELOPE *));
extern void putbody __P((MCI *, ENVELOPE *, char *));
extern void putheader __P((MCI *, HDR *, ENVELOPE *, int));
extern bool putbody __P((MCI *, ENVELOPE *, char *));
extern bool putheader __P((MCI *, HDR *, ENVELOPE *, int));
/*
** Message priority classes.
@@ -1591,7 +1591,7 @@ EXTERN unsigned long PrivacyFlags; /* privacy flags */
#define M87F_NO8TO7 0x0004 /* don't do 8->7 bit conversions */
/* functions */
extern void mime7to8 __P((MCI *, HDR *, ENVELOPE *));
extern bool mime7to8 __P((MCI *, HDR *, ENVELOPE *));
extern int mime8to7 __P((MCI *, HDR *, ENVELOPE *, char **, int));
/*
@@ -2148,7 +2148,6 @@ EXTERN bool ColonOkInAddr; /* single colon legal in address */
#if !defined(_USE_SUN_NSSWITCH_) && !defined(_USE_DEC_SVC_CONF_)
EXTERN bool ConfigFileRead; /* configuration file has been read */
#endif /* !defined(_USE_SUN_NSSWITCH_) && !defined(_USE_DEC_SVC_CONF_) */
EXTERN bool volatile DataProgress; /* have we sent anything since last check */
EXTERN bool DisConnected; /* running with OutChannel redirect to transcript file */
EXTERN bool DontExpandCnames; /* do not $[...$] expand CNAMEs */
EXTERN bool DontInitGroups; /* avoid initgroups() because of NIS cost */
@@ -2513,8 +2512,8 @@ extern void printopenfds __P((bool));
extern void printqueue __P((void));
extern void printrules __P((void));
extern pid_t prog_open __P((char **, int *, ENVELOPE *));
extern void putline __P((char *, MCI *));
extern void putxline __P((char *, size_t, MCI *, int));
extern bool putline __P((char *, MCI *));
extern bool putxline __P((char *, size_t, MCI *, int));
extern void queueup_macros __P((int, SM_FILE_T *, ENVELOPE *));
extern void readcf __P((char *, bool, ENVELOPE *));
extern SIGFUNC_DECL reapchild __P((int));
+181 -41
View File
@@ -515,6 +515,125 @@ tls_close(fp)
/* maximum number of retries for TLS related I/O due to handshakes */
# define MAX_TLS_IOS 4
/*
** TLS_RETRY -- check whether a failed SSL operation can be retried
**
** Parameters:
** ssl -- TLS structure
** rfd -- read fd
** wfd -- write fd
** tlsstart -- start time of TLS operation
** timeout -- timeout for TLS operation
** err -- SSL error
** where -- description of operation
**
** Results:
** >0 on success
** 0 on timeout
** <0 on error
*/
int
tls_retry(ssl, rfd, wfd, tlsstart, timeout, err, where)
SSL *ssl;
int rfd;
int wfd;
time_t tlsstart;
int timeout;
int err;
const char *where;
{
int ret;
time_t left;
time_t now = curtime();
struct timeval tv;
ret = -1;
/*
** For SSL_ERROR_WANT_{READ,WRITE}:
** There is not a complete SSL record available yet
** or there is only a partial SSL record removed from
** the network (socket) buffer into the SSL buffer.
** The SSL_connect will only succeed when a full
** SSL record is available (assuming a "real" error
** doesn't happen). To handle when a "real" error
** does happen the select is set for exceptions too.
** The connection may be re-negotiated during this time
** so both read and write "want errors" need to be handled.
** A select() exception loops back so that a proper SSL
** error message can be gotten.
*/
left = timeout - (now - tlsstart);
if (left <= 0)
return 0; /* timeout */
tv.tv_sec = left;
tv.tv_usec = 0;
if (LogLevel > 14)
{
sm_syslog(LOG_INFO, NOQID,
"STARTTLS=%s, info: fds=%d/%d, err=%d",
where, rfd, wfd, err);
}
if (FD_SETSIZE > 0 &&
((err == SSL_ERROR_WANT_READ && rfd >= FD_SETSIZE) ||
(err == SSL_ERROR_WANT_WRITE && wfd >= FD_SETSIZE)))
{
if (LogLevel > 5)
{
sm_syslog(LOG_ERR, NOQID,
"STARTTLS=%s, error: fd %d/%d too large",
where, rfd, wfd);
if (LogLevel > 8)
tlslogerr(where);
}
errno = EINVAL;
}
else if (err == SSL_ERROR_WANT_READ)
{
fd_set ssl_maskr, ssl_maskx;
FD_ZERO(&ssl_maskr);
FD_SET(rfd, &ssl_maskr);
FD_ZERO(&ssl_maskx);
FD_SET(rfd, &ssl_maskx);
do
{
ret = select(rfd + 1, &ssl_maskr, NULL, &ssl_maskx,
&tv);
} while (ret < 0 && errno == EINTR);
if (ret < 0 && errno > 0)
ret = -errno;
}
else if (err == SSL_ERROR_WANT_WRITE)
{
fd_set ssl_maskw, ssl_maskx;
FD_ZERO(&ssl_maskw);
FD_SET(wfd, &ssl_maskw);
FD_ZERO(&ssl_maskx);
FD_SET(rfd, &ssl_maskx);
do
{
ret = select(wfd + 1, NULL, &ssl_maskw, &ssl_maskx,
&tv);
} while (ret < 0 && errno == EINTR);
if (ret < 0 && errno > 0)
ret = -errno;
}
return ret;
}
/* errno to force refill() etc to stop (see IS_IO_ERROR()) */
#ifdef ETIMEDOUT
# define SM_ERR_TIMEOUT ETIMEDOUT
#else /* ETIMEDOUT */
# define SM_ERR_TIMEOUT EIO
#endif /* ETIMEDOUT */
/*
** TLS_READ -- read secured information for the caller
**
@@ -536,38 +655,42 @@ tls_read(fp, buf, size)
char *buf;
size_t size;
{
int r;
static int again = MAX_TLS_IOS;
int r, rfd, wfd, try, ssl_err;
struct tls_obj *so = (struct tls_obj *) fp->f_cookie;
time_t tlsstart;
char *err;
try = 99;
err = NULL;
tlsstart = curtime();
retry:
r = SSL_read(so->con, (char *) buf, size);
if (r > 0)
{
again = MAX_TLS_IOS;
return r;
}
err = NULL;
switch (SSL_get_error(so->con, r))
switch (ssl_err = SSL_get_error(so->con, r))
{
case SSL_ERROR_NONE:
case SSL_ERROR_ZERO_RETURN:
again = MAX_TLS_IOS;
break;
case SSL_ERROR_WANT_WRITE:
if (--again <= 0)
err = "read W BLOCK";
else
errno = EAGAIN;
break;
err = "read W BLOCK";
/* FALLTHROUGH */
case SSL_ERROR_WANT_READ:
if (--again <= 0)
if (err == NULL)
err = "read R BLOCK";
else
errno = EAGAIN;
rfd = SSL_get_rfd(so->con);
wfd = SSL_get_wfd(so->con);
try = tls_retry(so->con, rfd, wfd, tlsstart,
TimeOuts.to_datablock, ssl_err, "read");
if (try > 0)
goto retry;
errno = SM_ERR_TIMEOUT;
break;
case SSL_ERROR_WANT_X509_LOOKUP:
err = "write X BLOCK";
break;
@@ -600,15 +723,22 @@ tls_read(fp, buf, size)
int save_errno;
save_errno = (errno == 0) ? EIO : errno;
again = MAX_TLS_IOS;
if (LogLevel > 9)
if (try == 0 && save_errno == SM_ERR_TIMEOUT)
{
if (LogLevel > 7)
sm_syslog(LOG_WARNING, NOQID,
"STARTTLS: read error=timeout");
}
else if (LogLevel > 8)
sm_syslog(LOG_WARNING, NOQID,
"STARTTLS: read error=%s (%d), errno=%d, get_error=%s",
"STARTTLS: read error=%s (%d), errno=%d, get_error=%s, retry=%d, ssl_err=%d",
err, r, errno,
ERR_error_string(ERR_get_error(), NULL));
ERR_error_string(ERR_get_error(), NULL), try,
ssl_err);
else if (LogLevel > 7)
sm_syslog(LOG_WARNING, NOQID,
"STARTTLS: read error=%s (%d)", err, r);
"STARTTLS: read error=%s (%d), retry=%d, ssl_err=%d",
err, r, errno, try, ssl_err);
errno = save_errno;
}
return r;
@@ -635,36 +765,39 @@ tls_write(fp, buf, size)
const char *buf;
size_t size;
{
int r;
static int again = MAX_TLS_IOS;
int r, rfd, wfd, try, ssl_err;
struct tls_obj *so = (struct tls_obj *) fp->f_cookie;
time_t tlsstart;
char *err;
try = 99;
err = NULL;
tlsstart = curtime();
retry:
r = SSL_write(so->con, (char *) buf, size);
if (r > 0)
{
again = MAX_TLS_IOS;
return r;
}
err = NULL;
switch (SSL_get_error(so->con, r))
switch (ssl_err = SSL_get_error(so->con, r))
{
case SSL_ERROR_NONE:
case SSL_ERROR_ZERO_RETURN:
again = MAX_TLS_IOS;
break;
case SSL_ERROR_WANT_WRITE:
if (--again <= 0)
err = "write W BLOCK";
else
errno = EAGAIN;
break;
err = "read W BLOCK";
/* FALLTHROUGH */
case SSL_ERROR_WANT_READ:
if (--again <= 0)
err = "write R BLOCK";
else
errno = EAGAIN;
if (err == NULL)
err = "read R BLOCK";
rfd = SSL_get_rfd(so->con);
wfd = SSL_get_wfd(so->con);
try = tls_retry(so->con, rfd, wfd, tlsstart,
DATA_PROGRESS_TIMEOUT, ssl_err, "write");
if (try > 0)
goto retry;
errno = SM_ERR_TIMEOUT;
break;
case SSL_ERROR_WANT_X509_LOOKUP:
err = "write X BLOCK";
@@ -697,15 +830,22 @@ tls_write(fp, buf, size)
int save_errno;
save_errno = (errno == 0) ? EIO : errno;
again = MAX_TLS_IOS;
if (LogLevel > 9)
if (try == 0 && save_errno == SM_ERR_TIMEOUT)
{
if (LogLevel > 7)
sm_syslog(LOG_WARNING, NOQID,
"STARTTLS: write error=timeout");
}
else if (LogLevel > 8)
sm_syslog(LOG_WARNING, NOQID,
"STARTTLS: write error=%s (%d), errno=%d, get_error=%s",
"STARTTLS: write error=%s (%d), errno=%d, get_error=%s, retry=%d, ssl_err=%d",
err, r, errno,
ERR_error_string(ERR_get_error(), NULL));
ERR_error_string(ERR_get_error(), NULL), try,
ssl_err);
else if (LogLevel > 7)
sm_syslog(LOG_WARNING, NOQID,
"STARTTLS: write error=%s (%d)", err, r);
"STARTTLS: write error=%s (%d), errno=%d, retry=%d, ssl_err=%d",
err, r, errno, try, ssl_err);
errno = save_errno;
}
return r;
+2
View File
@@ -17,6 +17,8 @@ extern int sfdcsasl __P((SM_FILE_T **, SM_FILE_T **, sasl_conn_t *));
#endif /* SASL */
# if STARTTLS
extern int tls_retry __P((SSL *, int, int, time_t, int, int,
const char *));
extern int sfdctls __P((SM_FILE_T **, SM_FILE_T **, SSL *));
# endif /* STARTTLS */
+9 -77
View File
@@ -1603,91 +1603,23 @@ smtp(nullserver, d_flags, e)
ssl_retry:
if ((r = SSL_ACC(srv_ssl)) <= 0)
{
int i;
bool timedout;
time_t left;
time_t now = curtime();
struct timeval tv;
int i, ssl_err;
/* what to do in this case? */
i = SSL_get_error(srv_ssl, r);
ssl_err = SSL_get_error(srv_ssl, r);
i = tls_retry(srv_ssl, rfd, wfd, tlsstart,
TimeOuts.to_starttls, ssl_err,
"server");
if (i > 0)
goto ssl_retry;
/*
** For SSL_ERROR_WANT_{READ,WRITE}:
** There is no SSL record available yet
** or there is only a partial SSL record
** removed from the network (socket) buffer
** into the SSL buffer. The SSL_accept will
** only succeed when a full SSL record is
** available (assuming a "real" error
** doesn't happen). To handle when a "real"
** error does happen the select is set for
** exceptions too.
** The connection may be re-negotiated
** during this time so both read and write
** "want errors" need to be handled.
** A select() exception loops back so that
** a proper SSL error message can be gotten.
*/
left = TimeOuts.to_starttls - (now - tlsstart);
timedout = left <= 0;
if (!timedout)
{
tv.tv_sec = left;
tv.tv_usec = 0;
}
if (!timedout && FD_SETSIZE > 0 &&
(rfd >= FD_SETSIZE ||
(i == SSL_ERROR_WANT_WRITE &&
wfd >= FD_SETSIZE)))
{
if (LogLevel > 5)
{
sm_syslog(LOG_ERR, NOQID,
"STARTTLS=server, error: fd %d/%d too large",
rfd, wfd);
if (LogLevel > 8)
tlslogerr("server");
}
goto tlsfail;
}
/* XXX what about SSL_pending() ? */
if (!timedout && i == SSL_ERROR_WANT_READ)
{
fd_set ssl_maskr, ssl_maskx;
FD_ZERO(&ssl_maskr);
FD_SET(rfd, &ssl_maskr);
FD_ZERO(&ssl_maskx);
FD_SET(rfd, &ssl_maskx);
if (select(rfd + 1, &ssl_maskr, NULL,
&ssl_maskx, &tv) > 0)
goto ssl_retry;
}
if (!timedout && i == SSL_ERROR_WANT_WRITE)
{
fd_set ssl_maskw, ssl_maskx;
FD_ZERO(&ssl_maskw);
FD_SET(wfd, &ssl_maskw);
FD_ZERO(&ssl_maskx);
FD_SET(rfd, &ssl_maskx);
if (select(wfd + 1, NULL, &ssl_maskw,
&ssl_maskx, &tv) > 0)
goto ssl_retry;
}
if (LogLevel > 5)
{
sm_syslog(LOG_WARNING, NOQID,
"STARTTLS=server, error: accept failed=%d, SSL_error=%d, timedout=%d, errno=%d",
r, i, (int) timedout, errno);
"STARTTLS=server, error: accept failed=%d, SSL_error=%d, errno=%d, retry=%d",
r, ssl_err, errno, i);
if (LogLevel > 8)
tlslogerr("server");
}
tlsfail:
tls_ok_srv = false;
SSL_free(srv_ssl);
srv_ssl = NULL;
+25 -72
View File
@@ -19,7 +19,6 @@ SM_RCSID("@(#)$Id: usersmtp.c,v 8.437.2.10 2003/05/05 23:51:47 ca Exp $")
extern void markfailure __P((ENVELOPE *, ADDRESS *, MCI *, int, bool));
static void datatimeout __P((void));
static void esmtp_check __P((char *, bool, MAILER *, MCI *, ENVELOPE *));
static void helo_options __P((char *, bool, MAILER *, MCI *, ENVELOPE *));
static int smtprcptstat __P((ADDRESS *, MAILER *, MCI *, ENVELOPE *));
@@ -2495,9 +2494,6 @@ smtprcptstat(to, m, mci, e)
** exit status corresponding to DATA command.
*/
static jmp_buf CtxDataTimeout;
static SM_EVENT *volatile DataTimeout = NULL;
int
smtpdata(m, mci, e, ctladdr, xstart)
MAILER *m;
@@ -2509,7 +2505,7 @@ smtpdata(m, mci, e, ctladdr, xstart)
register int r;
int rstat;
int xstat;
time_t timeout;
int timeout;
char *enhsc;
/*
@@ -2619,43 +2615,22 @@ smtpdata(m, mci, e, ctladdr, xstart)
** factor. The main thing is that it should not be infinite.
*/
if (setjmp(CtxDataTimeout) != 0)
{
mci->mci_errno = errno;
mci->mci_state = MCIS_ERROR;
mci_setstat(mci, EX_TEMPFAIL, "4.4.2", NULL);
/*
** If putbody() couldn't finish due to a timeout,
** rewind it here in the timeout handler. See
** comments at the end of putbody() for reasoning.
*/
if (e->e_dfp != NULL)
(void) bfrewind(e->e_dfp);
errno = mci->mci_errno;
syserr("451 4.4.1 timeout writing message to %s", CurHostName);
smtpquit(m, mci, e);
return EX_TEMPFAIL;
}
if (tTd(18, 101))
{
/* simulate a DATA timeout */
timeout = 1;
timeout = 10;
}
else
timeout = DATA_PROGRESS_TIMEOUT;
DataTimeout = sm_setevent(timeout, datatimeout, 0);
timeout = DATA_PROGRESS_TIMEOUT * 1000;
sm_io_setinfo(mci->mci_out, SM_IO_WHAT_TIMEOUT, &timeout);
/*
** Output the actual message.
*/
(*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER);
if (!(*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER))
goto writeerr;
if (tTd(18, 101))
{
@@ -2663,14 +2638,13 @@ smtpdata(m, mci, e, ctladdr, xstart)
(void) sleep(2);
}
(*e->e_putbody)(mci, e, NULL);
if (!(*e->e_putbody)(mci, e, NULL))
goto writeerr;
/*
** Cleanup after sending message.
*/
if (DataTimeout != NULL)
sm_clrevent(DataTimeout);
#if PIPELINING
}
@@ -2710,7 +2684,9 @@ smtpdata(m, mci, e, ctladdr, xstart)
}
/* terminate the message */
(void) sm_io_fprintf(mci->mci_out, SM_TIME_DEFAULT, ".%s", m->m_eol);
if (sm_io_fprintf(mci->mci_out, SM_TIME_DEFAULT, ".%s", m->m_eol) ==
SM_IO_EOF)
goto writeerr;
if (TrafficLogFile != NULL)
(void) sm_io_fprintf(TrafficLogFile, SM_TIME_DEFAULT,
"%05d >>> .\n", (int) CurrentPid);
@@ -2760,50 +2736,27 @@ smtpdata(m, mci, e, ctladdr, xstart)
shortenstring(SmtpReplyBuffer, 403));
}
return rstat;
}
static void
datatimeout()
{
int save_errno = errno;
writeerr:
mci->mci_errno = errno;
mci->mci_state = MCIS_ERROR;
mci_setstat(mci, EX_TEMPFAIL, "4.4.2", NULL);
/*
** NOTE: THIS CAN BE CALLED FROM A SIGNAL HANDLER. DO NOT ADD
** ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
** DOING.
** If putbody() couldn't finish due to a timeout,
** rewind it here in the timeout handler. See
** comments at the end of putbody() for reasoning.
*/
if (DataProgress)
{
time_t timeout;
if (e->e_dfp != NULL)
(void) bfrewind(e->e_dfp);
/* check back again later */
if (tTd(18, 101))
{
/* simulate a DATA timeout */
timeout = 1;
}
else
timeout = DATA_PROGRESS_TIMEOUT;
/* reset the timeout */
DataTimeout = sm_sigsafe_setevent(timeout, datatimeout, 0);
DataProgress = false;
}
else
{
/* event is done */
DataTimeout = NULL;
}
/* if no progress was made or problem resetting event, die now */
if (DataTimeout == NULL)
{
errno = ETIMEDOUT;
longjmp(CtxDataTimeout, 1);
}
errno = save_errno;
errno = mci->mci_errno;
syserr("451 4.4.1 timeout writing message to %s", CurHostName);
smtpquit(m, mci, e);
return EX_TEMPFAIL;
}
/*
** SMTPGETSTAT -- get status code from DATA in LMTP
**
+16 -49
View File
@@ -910,18 +910,18 @@ fixcrlf(line, stripnl)
** mci -- the mailer connection information.
**
** Returns:
** none
** true iff line was written successfully
**
** Side Effects:
** output of l to mci->mci_out.
*/
void
bool
putline(l, mci)
register char *l;
register MCI *mci;
{
putxline(l, strlen(l), mci, PXLF_MAPFROM);
return putxline(l, strlen(l), mci, PXLF_MAPFROM);
}
/*
** PUTXLINE -- putline with flags bits.
@@ -940,13 +940,13 @@ putline(l, mci)
** PXLF_NOADDEOL -- don't add an EOL if one wasn't present.
**
** Returns:
** none
** true iff line was written successfully
**
** Side Effects:
** output of l to mci->mci_out.
*/
void
bool
putxline(l, len, mci, pxflags)
register char *l;
size_t len;
@@ -998,11 +998,6 @@ putxline(l, len, mci, pxflags)
if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT,
'.') == SM_IO_EOF)
dead = true;
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
if (TrafficLogFile != NULL)
(void) sm_io_putc(TrafficLogFile,
SM_TIME_DEFAULT, '.');
@@ -1015,11 +1010,6 @@ putxline(l, len, mci, pxflags)
if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT,
'>') == SM_IO_EOF)
dead = true;
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
if (TrafficLogFile != NULL)
(void) sm_io_putc(TrafficLogFile,
SM_TIME_DEFAULT,
@@ -1031,16 +1021,11 @@ putxline(l, len, mci, pxflags)
while (l < q)
{
if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT,
(unsigned char) *l++) == SM_IO_EOF)
(unsigned char) *l++) == SM_IO_EOF)
{
dead = true;
break;
}
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
}
if (dead)
break;
@@ -1056,11 +1041,6 @@ putxline(l, len, mci, pxflags)
dead = true;
break;
}
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
if (TrafficLogFile != NULL)
{
for (l = l_base; l < q; l++)
@@ -1084,11 +1064,9 @@ putxline(l, len, mci, pxflags)
{
if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT, '.') ==
SM_IO_EOF)
break;
else
{
/* record progress for DATA timeout */
DataProgress = true;
dead = true;
break;
}
if (TrafficLogFile != NULL)
(void) sm_io_putc(TrafficLogFile,
@@ -1101,11 +1079,9 @@ putxline(l, len, mci, pxflags)
{
if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT, '>') ==
SM_IO_EOF)
break;
else
{
/* record progress for DATA timeout */
DataProgress = true;
dead = true;
break;
}
if (TrafficLogFile != NULL)
(void) sm_io_putc(TrafficLogFile,
@@ -1123,11 +1099,6 @@ putxline(l, len, mci, pxflags)
dead = true;
break;
}
else
{
/* record progress for DATA timeout */
DataProgress = true;
}
}
if (dead)
break;
@@ -1138,11 +1109,9 @@ putxline(l, len, mci, pxflags)
if ((!bitset(PXLF_NOADDEOL, pxflags) || !noeol) &&
sm_io_fputs(mci->mci_out, SM_TIME_DEFAULT,
mci->mci_mailer->m_eol) == SM_IO_EOF)
break;
else
{
/* record progress for DATA timeout */
DataProgress = true;
dead = true;
break;
}
if (l < end && *l == '\n')
{
@@ -1151,11 +1120,9 @@ putxline(l, len, mci, pxflags)
{
if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT,
' ') == SM_IO_EOF)
break;
else
{
/* record progress for DATA timeout */
DataProgress = true;
dead = true;
break;
}
if (TrafficLogFile != NULL)
@@ -1164,10 +1131,10 @@ putxline(l, len, mci, pxflags)
}
}
/* record progress for DATA timeout */
DataProgress = true;
} while (l < end);
return !dead;
}
/*
** XUNLINK -- unlink a file, doing logging as appropriate.
**
+63 -2
View File
@@ -386,6 +386,21 @@ For more information about these matters, see the files named COPYING.\n"),
usage (1);
}
static char **tv;
static int tv_alloc;
static int tv_used;
static int
findtempname (char *tempname)
{
int i;
for (i = 0; i < tv_used; i++)
if (strcmp (tv[i], tempname) == 0)
return (1);
return (0);
}
/* Return a name for temporary file COUNT. */
static char *
@@ -393,11 +408,12 @@ maketempname (count)
int count;
{
static char *tempbase = NULL;
char *tempname;
char tempsuffix[10];
int fd;
if (!tempbase)
{
int fd;
tempbase = concat (tempdir, "txidxXXXXXX");
fd = mkstemp (tempbase);
@@ -406,7 +422,52 @@ maketempname (count)
}
sprintf (tempsuffix, ".%d", count);
return concat (tempbase, tempsuffix);
tempname = concat (tempbase, tempsuffix);
/*
* The open logic becomes a bit convoluted. If open(2) fails due to EEXIST,
* it's likely because somebody attempted to race us, or because we have
* already created this file.
*/
fd = open (tempname, O_CREAT|O_EXCL|O_WRONLY, 0600);
if (fd == -1)
{
/*
* If errno is not EEXIST, then open failed for some other reason, so
* we should terminate. If errno == EEXIST AND we didn't create this
* file, terminate. Otherwise, it's safe to say that errno == EEXIST
* because we already created it, in this event, we can just return.
*/
if (errno != EEXIST ||
(errno == EEXIST && findtempname (tempname) == 0))
pfatal_with_name (tempname);
return (tempname);
}
else if (fd > 0)
{
close (fd);
}
if (tv == NULL)
{
tv_alloc = 16;
tv = calloc (tv_alloc, sizeof (char *));
if (tv == NULL)
{
fprintf (stderr, "calloc failed\n");
exit (1);
}
}
else if (tv_used == tv_alloc)
{
tv_alloc += 4;
tv = realloc (tv, tv_alloc * sizeof (char *));
if (tv == NULL)
{
fprintf (stderr, "realloc failed");
exit (1);
}
}
tv[tv_used++] = strdup (tempname);
return tempname;
}
+24 -6
View File
@@ -1294,6 +1294,7 @@ slc_check()
unsigned char slc_reply[128];
unsigned char const * const slc_reply_eom = &slc_reply[sizeof(slc_reply)];
unsigned char *slc_replyp;
void
@@ -1309,6 +1310,14 @@ slc_start_reply()
void
slc_add_reply(unsigned char func, unsigned char flags, cc_t value)
{
/* A sequence of up to 6 bytes my be written for this member of the SLC
* suboption list by this function. The end of negotiation command,
* which is written by slc_end_reply(), will require 2 additional
* bytes. Do not proceed unless there is sufficient space for these
* items.
*/
if (&slc_replyp[6+2] > slc_reply_eom)
return;
if ((*slc_replyp++ = func) == IAC)
*slc_replyp++ = IAC;
if ((*slc_replyp++ = flags) == IAC)
@@ -1322,6 +1331,9 @@ slc_end_reply()
{
int len;
/* The end of negotiation command requires 2 bytes. */
if (&slc_replyp[2] > slc_reply_eom)
return;
*slc_replyp++ = IAC;
*slc_replyp++ = SE;
len = slc_replyp - slc_reply;
@@ -1415,8 +1427,8 @@ env_opt(unsigned char *buf, int len)
}
}
#define OPT_REPLY_SIZE 256
unsigned char *opt_reply;
#define OPT_REPLY_SIZE (2 * SUBBUFSIZE)
unsigned char *opt_reply = NULL;
unsigned char *opt_replyp;
unsigned char *opt_replyend;
@@ -1475,9 +1487,9 @@ env_opt_add(unsigned char *ep)
return;
}
vp = env_getvalue(ep);
if (opt_replyp + (vp ? strlen((char *)vp) : 0) +
strlen((char *)ep) + 6 > opt_replyend)
{
if (opt_replyp + (vp ? 2 * strlen((char *)vp) : 0) +
2 * strlen((char *)ep) + 6 > opt_replyend)
{
int len;
void *tmp;
opt_replyend += OPT_REPLY_SIZE;
@@ -1503,6 +1515,8 @@ env_opt_add(unsigned char *ep)
*opt_replyp++ = ENV_USERVAR;
for (;;) {
while ((c = *ep++)) {
if (opt_replyp + (2 + 2) > opt_replyend)
return;
switch(c&0xff) {
case IAC:
*opt_replyp++ = IAC;
@@ -1517,6 +1531,8 @@ env_opt_add(unsigned char *ep)
*opt_replyp++ = c;
}
if ((ep = vp)) {
if (opt_replyp + (1 + 2 + 2) > opt_replyend)
return;
#ifdef OLD_ENVIRON
if (telopt_environ == TELOPT_OLD_ENVIRON)
*opt_replyp++ = old_env_value;
@@ -1547,7 +1563,9 @@ env_opt_end(int emptyok)
{
int len;
len = opt_replyp - opt_reply + 2;
if (opt_replyp + 2 > opt_replyend)
return;
len = opt_replyp + 2 - opt_reply;
if (emptyok || len > 6) {
*opt_replyp++ = IAC;
*opt_replyp++ = SE;
+2
View File
@@ -964,6 +964,8 @@ handle_v4(krb5_context context,
if(term_flag)
exit(0);
if(first) {
if (len < 2)
krb5_errx(context, 1, "received too short len (%d < 2)", len);
/* first time around, we have already read len, and two
bytes of the version string */
krb5_data_alloc(&message, len);
+20 -2
View File
@@ -64,6 +64,8 @@ krb5_boolean encode_as_rep_as_tgs_rep; /* bug compatibility */
krb5_boolean check_ticket_addresses;
krb5_boolean allow_null_ticket_addresses;
krb5_boolean allow_anonymous;
int trpolicy;
static const char *trpolicy_str;
static struct getarg_strings addresses_str; /* addresses to listen on */
krb5_addresses explicit_addresses;
@@ -287,9 +289,8 @@ configure(int argc, char **argv)
get_dbinfo();
if(max_request_str){
if(max_request_str)
max_request = parse_bytes(max_request_str, NULL);
}
if(max_request == 0){
p = krb5_config_get_string (context,
@@ -352,6 +353,23 @@ configure(int argc, char **argv)
allow_anonymous =
krb5_config_get_bool(context, NULL, "kdc",
"allow-anonymous", NULL);
trpolicy_str =
krb5_config_get_string_default(context, NULL, "always-check", "kdc",
"transited-policy", NULL);
if(strcasecmp(trpolicy_str, "always-check") == 0)
trpolicy = TRPOLICY_ALWAYS_CHECK;
else if(strcasecmp(trpolicy_str, "allow-per-principal") == 0)
trpolicy = TRPOLICY_ALLOW_PER_PRINCIPAL;
else if(strcasecmp(trpolicy_str, "always-honour-request") == 0)
trpolicy = TRPOLICY_ALWAYS_HONOUR_REQUEST;
else {
kdc_log(0, "unknown transited-policy: %s, reverting to always-check",
trpolicy_str);
trpolicy = TRPOLICY_ALWAYS_CHECK;
}
krb5_config_get_bool_default(context, NULL, TRUE, "kdc",
"enforce-transited-policy", NULL);
#ifdef KRB4
if(v4_realm == NULL){
p = krb5_config_get_string (context, NULL,
+22 -1
View File
@@ -1,6 +1,6 @@
.\" $Id: kdc.8,v 1.17 2002/08/28 21:09:05 joda Exp $
.\"
.Dd August 22, 2002
.Dd October 22, 2003
.Dt KDC 8
.Os HEIMDAL
.Sh NAME
@@ -128,6 +128,27 @@ Permit tickets with no addresses. This option is only relevant when
check-ticket-addresses is TRUE.
.It Li allow-anonymous = Va boolean
Permit anonymous tickets with no addresses.
.It Li transited-policy = Xo
.Li always-check \*(Ba
.Li allow-per-principal |
.Li always-honour-request
.Xc
This controls how KDC requests with the
.Li disable-transited-check
flag are handled. It can be one of:
.Bl -tag -width "xxx" -offset indent
.It Li always-check
Always check transited encoding, this is the default.
.It Li allow-per-principal
Currently this is identical to
.Li always-check .
In a future release, it will be possible to mark a principal as able
to handle unchecked requests.
.It Li always-honour-request
Always do what the client asked.
In a future release, it will be possible to force a check per
principal.
.El
.It encode_as_rep_as_tgs_rep = Va boolean
Encode AS-Rep as TGS-Rep to be bug-compatible with old DCE code. The
Heimdal clients allow both.
+5
View File
@@ -62,6 +62,11 @@ extern krb5_boolean encode_as_rep_as_tgs_rep;
extern krb5_boolean check_ticket_addresses;
extern krb5_boolean allow_null_ticket_addresses;
extern krb5_boolean allow_anonymous;
enum { TRPOLICY_ALWAYS_CHECK,
TRPOLICY_ALLOW_PER_PRINCIPAL,
TRPOLICY_ALWAYS_HONOUR_REQUEST };
extern int trpolicy;
extern int enable_v4_cross_realm;
#ifdef KRB4
extern char *v4_realm;
+159 -79
View File
@@ -355,10 +355,13 @@ get_pa_etype_info(METHOD_DATA *md, hdb_entry *client,
if(n != pa.len) {
char *name;
krb5_unparse_name(context, client->principal, &name);
ret = krb5_unparse_name(context, client->principal, &name);
if (ret)
name = "<unparse_name failed>";
kdc_log(0, "internal error in get_pa_etype_info(%s): %d != %d",
name, n, pa.len);
free(name);
if (ret == 0)
free(name);
pa.len = n;
}
@@ -496,8 +499,8 @@ as_rep(KDC_REQ *req,
krb5_enctype cetype, setype;
EncTicketPart et;
EncKDCRepPart ek;
krb5_principal client_princ, server_princ;
char *client_name, *server_name;
krb5_principal client_princ = NULL, server_princ = NULL;
char *client_name = NULL, *server_name = NULL;
krb5_error_code ret = 0;
const char *e_text = NULL;
krb5_crypto crypto;
@@ -506,28 +509,32 @@ as_rep(KDC_REQ *req,
memset(&rep, 0, sizeof(rep));
if(b->sname == NULL){
server_name = "<unknown server>";
ret = KRB5KRB_ERR_GENERIC;
e_text = "No server in request";
} else{
principalname2krb5_principal (&server_princ, *(b->sname), b->realm);
krb5_unparse_name(context, server_princ, &server_name);
ret = krb5_unparse_name(context, server_princ, &server_name);
}
if (ret) {
kdc_log(0, "AS-REQ malformed server name from %s", from);
goto out;
}
if(b->cname == NULL){
client_name = "<unknown client>";
ret = KRB5KRB_ERR_GENERIC;
e_text = "No client in request";
} else {
principalname2krb5_principal (&client_princ, *(b->cname), b->realm);
krb5_unparse_name(context, client_princ, &client_name);
ret = krb5_unparse_name(context, client_princ, &client_name);
}
if (ret) {
kdc_log(0, "AS-REQ malformed client name from %s", from);
goto out;
}
kdc_log(0, "AS-REQ %s from %s for %s",
client_name, from, server_name);
if(ret)
goto out;
ret = db_fetch(client_princ, &client);
if(ret){
kdc_log(0, "UNKNOWN -- %s: %s", client_name,
@@ -559,7 +566,6 @@ as_rep(KDC_REQ *req,
while((pa = find_padata(req, &i, KRB5_PADATA_ENC_TIMESTAMP))){
krb5_data ts_data;
PA_ENC_TS_ENC p;
time_t patime;
size_t len;
EncryptedData enc_data;
Key *pa_key;
@@ -635,7 +641,6 @@ as_rep(KDC_REQ *req,
client_name);
continue;
}
patime = p.patimestamp;
free_PA_ENC_TS_ENC(&p);
if (abs(kdc_time - p.patimestamp) > context->max_skew) {
ret = KRB5KDC_ERR_PREAUTH_FAILED;
@@ -716,9 +721,10 @@ as_rep(KDC_REQ *req,
if (ret == 0) {
kdc_log(5, "Using %s/%s", cet, set);
free(set);
} else
free(cet);
} else
}
free(cet);
}
if (ret != 0)
kdc_log(5, "Using e-types %d/%d", cetype, setype);
}
@@ -841,13 +847,8 @@ as_rep(KDC_REQ *req,
copy_HostAddresses(b->addresses, et.caddr);
}
{
krb5_data empty_string;
krb5_data_zero(&empty_string);
et.transited.tr_type = DOMAIN_X500_COMPRESS;
et.transited.contents = empty_string;
}
et.transited.tr_type = DOMAIN_X500_COMPRESS;
krb5_data_zero(&et.transited.contents);
copy_EncryptionKey(&et.key, &ek.key);
@@ -914,8 +915,8 @@ as_rep(KDC_REQ *req,
client->kvno, &ckey->key, &e_text, reply);
free_EncTicketPart(&et);
free_EncKDCRepPart(&ek);
free_AS_REP(&rep);
out:
free_AS_REP(&rep);
if(ret){
krb5_mk_error(context,
ret,
@@ -929,9 +930,11 @@ as_rep(KDC_REQ *req,
ret = 0;
}
out2:
krb5_free_principal(context, client_princ);
if (client_princ)
krb5_free_principal(context, client_princ);
free(client_name);
krb5_free_principal(context, server_princ);
if (server_princ)
krb5_free_principal(context, server_princ);
free(server_name);
if(client)
free_ent(client);
@@ -1054,33 +1057,35 @@ check_tgs_flags(KDC_REQ_BODY *b, EncTicketPart *tgt, EncTicketPart *et)
}
static krb5_error_code
fix_transited_encoding(TransitedEncoding *tr,
fix_transited_encoding(krb5_boolean check_policy,
TransitedEncoding *tr,
EncTicketPart *et,
const char *client_realm,
const char *server_realm,
const char *tgt_realm)
{
krb5_error_code ret = 0;
if(strcmp(client_realm, tgt_realm) && strcmp(server_realm, tgt_realm)){
char **realms = NULL, **tmp;
int num_realms = 0;
int i;
if(tr->tr_type && tr->contents.length != 0) {
if(tr->tr_type != DOMAIN_X500_COMPRESS){
kdc_log(0, "Unknown transited type: %u",
tr->tr_type);
return KRB5KDC_ERR_TRTYPE_NOSUPP;
}
ret = krb5_domain_x500_decode(context,
tr->contents,
&realms,
&num_realms,
client_realm,
server_realm);
if(ret){
krb5_warn(context, ret, "Decoding transited encoding");
return ret;
}
}
char **realms, **tmp;
int num_realms;
int i;
if(tr->tr_type != DOMAIN_X500_COMPRESS) {
kdc_log(0, "Unknown transited type: %u", tr->tr_type);
return KRB5KDC_ERR_TRTYPE_NOSUPP;
}
ret = krb5_domain_x500_decode(context,
tr->contents,
&realms,
&num_realms,
client_realm,
server_realm);
if(ret){
krb5_warn(context, ret, "Decoding transited encoding");
return ret;
}
if(strcmp(client_realm, tgt_realm) && strcmp(server_realm, tgt_realm)) {
/* not us, so add the previous realm to transited set */
if (num_realms < 0 || num_realms + 1 > UINT_MAX/sizeof(*realms)) {
ret = ERANGE;
goto free_realms;
@@ -1097,16 +1102,46 @@ fix_transited_encoding(TransitedEncoding *tr,
goto free_realms;
}
num_realms++;
free_TransitedEncoding(tr);
tr->tr_type = DOMAIN_X500_COMPRESS;
ret = krb5_domain_x500_encode(realms, num_realms, &tr->contents);
if(ret)
krb5_warn(context, ret, "Encoding transited encoding");
free_realms:
for(i = 0; i < num_realms; i++)
free(realms[i]);
free(realms);
}
if(num_realms == 0) {
if(strcmp(client_realm, server_realm))
kdc_log(0, "cross-realm %s -> %s", client_realm, server_realm);
} else {
size_t l = 0;
char *rs;
for(i = 0; i < num_realms; i++)
l += strlen(realms[i]) + 2;
rs = malloc(l);
if(rs != NULL) {
*rs = '\0';
for(i = 0; i < num_realms; i++) {
if(i > 0)
strlcat(rs, ", ", l);
strlcat(rs, realms[i], l);
}
kdc_log(0, "cross-realm %s -> %s via [%s]", client_realm, server_realm, rs);
free(rs);
}
}
if(check_policy) {
ret = krb5_check_transited(context, client_realm,
server_realm,
realms, num_realms, NULL);
if(ret) {
krb5_warn(context, ret, "cross-realm %s -> %s",
client_realm, server_realm);
goto free_realms;
}
et->flags.transited_policy_checked = 1;
}
et->transited.tr_type = DOMAIN_X500_COMPRESS;
ret = krb5_domain_x500_encode(realms, num_realms, &et->transited.contents);
if(ret)
krb5_warn(context, ret, "Encoding transited encoding");
free_realms:
for(i = 0; i < num_realms; i++)
free(realms[i]);
free(realms);
return ret;
}
@@ -1172,18 +1207,35 @@ tgs_make_reply(KDC_REQ_BODY *b,
ret = check_tgs_flags(b, tgt, &et);
if(ret)
return ret;
goto out;
copy_TransitedEncoding(&tgt->transited, &et.transited);
ret = fix_transited_encoding(&et.transited,
/* We should check the transited encoding if:
1) the request doesn't ask not to be checked
2) globally enforcing a check
3) principal requires checking
4) we allow non-check per-principal, but principal isn't marked as allowing this
5) we don't globally allow this
*/
#define GLOBAL_FORCE_TRANSITED_CHECK (trpolicy == TRPOLICY_ALWAYS_CHECK)
#define GLOBAL_ALLOW_PER_PRINCIPAL (trpolicy == TRPOLICY_ALLOW_PER_PRINCIPAL)
#define GLOBAL_ALLOW_DISABLE_TRANSITED_CHECK (trpolicy == TRPOLICY_ALWAYS_HONOUR_REQUEST)
/* these will consult the database in future release */
#define PRINCIPAL_FORCE_TRANSITED_CHECK(P) 0
#define PRINCIPAL_ALLOW_DISABLE_TRANSITED_CHECK(P) 0
ret = fix_transited_encoding(!f.disable_transited_check ||
GLOBAL_FORCE_TRANSITED_CHECK ||
PRINCIPAL_FORCE_TRANSITED_CHECK(server) ||
!((GLOBAL_ALLOW_PER_PRINCIPAL &&
PRINCIPAL_ALLOW_DISABLE_TRANSITED_CHECK(server)) ||
GLOBAL_ALLOW_DISABLE_TRANSITED_CHECK),
&tgt->transited, &et,
*krb5_princ_realm(context, client_principal),
*krb5_princ_realm(context, server->principal),
*krb5_princ_realm(context, krbtgt->principal));
if(ret){
free_TransitedEncoding(&et.transited);
return ret;
}
if(ret)
goto out;
copy_Realm(krb5_princ_realm(context, server->principal),
&rep.ticket.realm);
@@ -1278,7 +1330,7 @@ tgs_make_reply(KDC_REQ_BODY *b,
DES3? */
ret = encode_reply(&rep, &et, &ek, etype, adtkt ? 0 : server->kvno, ekey,
0, &tgt->key, e_text, reply);
out:
out:
free_TGS_REP(&rep);
free_TransitedEncoding(&et.transited);
if(et.starttime)
@@ -1380,13 +1432,13 @@ get_krbtgt_realm(const PrincipalName *p)
}
static Realm
find_rpath(Realm r)
find_rpath(Realm crealm, Realm srealm)
{
const char *new_realm = krb5_config_get_string(context,
NULL,
"libdefaults",
"capath",
r,
"capaths",
crealm,
srealm,
NULL);
return (Realm)new_realm;
}
@@ -1456,10 +1508,14 @@ tgs_rep2(KDC_REQ_BODY *b,
if(ret) {
char *p;
krb5_unparse_name(context, princ, &p);
ret = krb5_unparse_name(context, princ, &p);
if (ret != 0)
p = "<unparse_name failed>";
krb5_free_principal(context, princ);
kdc_log(0, "Ticket-granting ticket not found in database: %s: %s",
p, krb5_get_err_text(context, ret));
free(p);
if (ret == 0)
free(p);
ret = KRB5KRB_AP_ERR_NOT_US;
goto out2;
}
@@ -1468,12 +1524,16 @@ tgs_rep2(KDC_REQ_BODY *b,
*ap_req.ticket.enc_part.kvno != krbtgt->kvno){
char *p;
krb5_unparse_name (context, princ, &p);
ret = krb5_unparse_name (context, princ, &p);
krb5_free_principal(context, princ);
if (ret != 0)
p = "<unparse_name failed>";
kdc_log(0, "Ticket kvno = %d, DB kvno = %d (%s)",
*ap_req.ticket.enc_part.kvno,
krbtgt->kvno,
p);
free (p);
if (ret == 0)
free (p);
ret = KRB5KRB_AP_ERR_BADKEYVER;
goto out2;
}
@@ -1657,9 +1717,13 @@ tgs_rep2(KDC_REQ_BODY *b,
}
principalname2krb5_principal(&sp, *s, r);
krb5_unparse_name(context, sp, &spn);
ret = krb5_unparse_name(context, sp, &spn);
if (ret)
goto out;
principalname2krb5_principal(&cp, tgt->cname, tgt->crealm);
krb5_unparse_name(context, cp, &cpn);
ret = krb5_unparse_name(context, cp, &cpn);
if (ret)
goto out;
unparse_flags (KDCOptions2int(b->kdc_options), KDCOptions_units,
opt_str, sizeof(opt_str));
if(*opt_str)
@@ -1676,7 +1740,7 @@ tgs_rep2(KDC_REQ_BODY *b,
if ((req_rlm = get_krbtgt_realm(&sp->name)) != NULL) {
if(loop++ < 2) {
new_rlm = find_rpath(req_rlm);
new_rlm = find_rpath(tgt->crealm, req_rlm);
if(new_rlm) {
kdc_log(5, "krbtgt for realm %s not found, trying %s",
req_rlm, new_rlm);
@@ -1684,7 +1748,9 @@ tgs_rep2(KDC_REQ_BODY *b,
free(spn);
krb5_make_principal(context, &sp, r,
KRB5_TGS_NAME, new_rlm, NULL);
krb5_unparse_name(context, sp, &spn);
ret = krb5_unparse_name(context, sp, &spn);
if (ret)
goto out;
goto server_lookup;
}
}
@@ -1697,7 +1763,9 @@ tgs_rep2(KDC_REQ_BODY *b,
free(spn);
krb5_make_principal(context, &sp, r, KRB5_TGS_NAME,
realms[0], NULL);
krb5_unparse_name(context, sp, &spn);
ret = krb5_unparse_name(context, sp, &spn);
if (ret)
goto out;
krb5_free_host_realm(context, realms);
goto server_lookup;
}
@@ -1725,6 +1793,18 @@ tgs_rep2(KDC_REQ_BODY *b,
}
#endif
if(strcmp(krb5_principal_get_realm(context, sp),
krb5_principal_get_comp_string(context, krbtgt->principal, 1)) != 0) {
char *tpn;
ret = krb5_unparse_name(context, krbtgt->principal, &tpn);
kdc_log(0, "Request with wrong krbtgt: %s", (ret == 0) ? tpn : "<unknown>");
if(ret == 0)
free(tpn);
ret = KRB5KRB_AP_ERR_NOT_US;
goto out;
}
ret = check_flags(client, cpn, server, spn, FALSE);
if(ret)
goto out;
+9
View File
@@ -520,6 +520,15 @@ krb5_change_password (
krb5_data */*result_code_string*/,
krb5_data */*result_string*/);
krb5_error_code
krb5_check_transited (
krb5_context /*context*/,
krb5_const_realm /*client_realm*/,
krb5_const_realm /*server_realm*/,
krb5_realm */*realms*/,
int /*num_realms*/,
int */*bad_realm*/);
krb5_error_code
krb5_check_transited_realms (
krb5_context /*context*/,
+34 -23
View File
@@ -129,6 +129,32 @@ krb5_decode_ap_req(krb5_context context,
return 0;
}
static krb5_error_code
check_transited(krb5_context context, Ticket *ticket, EncTicketPart *enc)
{
char **realms;
int num_realms;
krb5_error_code ret;
if(enc->transited.tr_type != DOMAIN_X500_COMPRESS)
return KRB5KDC_ERR_TRTYPE_NOSUPP;
if(enc->transited.contents.length == 0)
return 0;
ret = krb5_domain_x500_decode(context, enc->transited.contents,
&realms, &num_realms,
enc->crealm,
ticket->realm);
if(ret)
return ret;
ret = krb5_check_transited(context, enc->crealm,
ticket->realm,
realms, num_realms, NULL);
free(realms);
return ret;
}
krb5_error_code
krb5_decrypt_ticket(krb5_context context,
Ticket *ticket,
@@ -161,6 +187,14 @@ krb5_decrypt_ticket(krb5_context context,
krb5_clear_error_string (context);
return KRB5KRB_AP_ERR_TKT_EXPIRED;
}
if(!t.flags.transited_policy_checked) {
ret = check_transited(context, ticket, &t);
if(ret) {
free_EncTicketPart(&t);
return ret;
}
}
}
if(out)
@@ -209,29 +243,6 @@ out:
return ret;
}
#if 0
static krb5_error_code
check_transited(krb5_context context,
krb5_ticket *ticket)
{
char **realms;
int num_realms;
krb5_error_code ret;
if(ticket->ticket.transited.tr_type != DOMAIN_X500_COMPRESS)
return KRB5KDC_ERR_TRTYPE_NOSUPP;
ret = krb5_domain_x500_decode(ticket->ticket.transited.contents,
&realms, &num_realms,
ticket->client->realm,
ticket->server->realm);
if(ret)
return ret;
ret = krb5_check_transited_realms(context, realms, num_realms, NULL);
free(realms);
return ret;
}
#endif
krb5_error_code
krb5_verify_ap_req(krb5_context context,
+49
View File
@@ -304,6 +304,12 @@ krb5_domain_x500_decode(krb5_context context,
struct tr_realm *p, **q;
int ret;
if(tr.length == 0) {
*realms = NULL;
*num_realms = 0;
return 0;
}
/* split string in components */
ret = decode_realms(context, tr.data, tr.length, &r);
if(ret)
@@ -358,6 +364,9 @@ krb5_domain_x500_encode(char **realms, int num_realms, krb5_data *encoding)
char *s = NULL;
int len = 0;
int i;
krb5_data_zero(encoding);
if (num_realms == 0)
return 0;
for(i = 0; i < num_realms; i++){
len += strlen(realms[i]);
if(realms[i][0] == '/')
@@ -365,6 +374,8 @@ krb5_domain_x500_encode(char **realms, int num_realms, krb5_data *encoding)
}
len += num_realms - 1;
s = malloc(len + 1);
if (s == NULL)
return ENOMEM;
*s = '\0';
for(i = 0; i < num_realms; i++){
if(i && i < num_realms - 1)
@@ -378,6 +389,44 @@ krb5_domain_x500_encode(char **realms, int num_realms, krb5_data *encoding)
return 0;
}
krb5_error_code
krb5_check_transited(krb5_context context,
krb5_const_realm client_realm,
krb5_const_realm server_realm,
krb5_realm *realms,
int num_realms,
int *bad_realm)
{
char **tr_realms;
char **p;
int i;
if(num_realms == 0)
return 0;
tr_realms = krb5_config_get_strings(context, NULL,
"capaths",
client_realm,
server_realm,
NULL);
for(i = 0; i < num_realms; i++) {
for(p = tr_realms; p && *p; p++) {
if(strcmp(*p, realms[i]) == 0)
break;
}
if(p == NULL || *p == NULL) {
krb5_config_free_strings(tr_realms);
krb5_set_error_string (context, "no transit through realm %s",
realms[i]);
if(bad_realm)
*bad_realm = i;
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
}
krb5_config_free_strings(tr_realms);
return 0;
}
krb5_error_code
krb5_check_transited_realms(krb5_context context,
const char *const *realms,
+24 -6
View File
@@ -1285,6 +1285,7 @@ slc_check()
unsigned char slc_reply[128];
unsigned char const * const slc_reply_eom = &slc_reply[sizeof(slc_reply)];
unsigned char *slc_replyp;
void
@@ -1300,6 +1301,14 @@ slc_start_reply()
void
slc_add_reply(unsigned char func, unsigned char flags, cc_t value)
{
/* A sequence of up to 6 bytes my be written for this member of the SLC
* suboption list by this function. The end of negotiation command,
* which is written by slc_end_reply(), will require 2 additional
* bytes. Do not proceed unless there is sufficient space for these
* items.
*/
if (&slc_replyp[6+2] > slc_reply_eom)
return;
if ((*slc_replyp++ = func) == IAC)
*slc_replyp++ = IAC;
if ((*slc_replyp++ = flags) == IAC)
@@ -1313,6 +1322,9 @@ slc_end_reply()
{
int len;
/* The end of negotiation command requires 2 bytes. */
if (&slc_replyp[2] > slc_reply_eom)
return;
*slc_replyp++ = IAC;
*slc_replyp++ = SE;
len = slc_replyp - slc_reply;
@@ -1406,8 +1418,8 @@ env_opt(unsigned char *buf, int len)
}
}
#define OPT_REPLY_SIZE 256
unsigned char *opt_reply;
#define OPT_REPLY_SIZE (2 * SUBBUFSIZE)
unsigned char *opt_reply = NULL;
unsigned char *opt_replyp;
unsigned char *opt_replyend;
@@ -1460,9 +1472,9 @@ env_opt_add(unsigned char *ep)
return;
}
vp = env_getvalue(ep);
if (opt_replyp + (vp ? strlen((char *)vp) : 0) +
strlen((char *)ep) + 6 > opt_replyend)
{
if (opt_replyp + (vp ? 2 * strlen((char *)vp) : 0) +
2 * strlen((char *)ep) + 6 > opt_replyend)
{
int len;
opt_replyend += OPT_REPLY_SIZE;
len = opt_replyend - opt_reply;
@@ -1486,6 +1498,8 @@ env_opt_add(unsigned char *ep)
*opt_replyp++ = ENV_USERVAR;
for (;;) {
while ((c = *ep++)) {
if (opt_replyp + (2 + 2) > opt_replyend)
return;
switch(c&0xff) {
case IAC:
*opt_replyp++ = IAC;
@@ -1500,6 +1514,8 @@ env_opt_add(unsigned char *ep)
*opt_replyp++ = c;
}
if ((ep = vp)) {
if (opt_replyp + (1 + 2 + 2) > opt_replyend)
return;
#ifdef OLD_ENVIRON
if (telopt_environ == TELOPT_OLD_ENVIRON)
*opt_replyp++ = old_env_value;
@@ -1530,7 +1546,9 @@ env_opt_end(int emptyok)
{
int len;
len = opt_replyp - opt_reply + 2;
if (opt_replyp + 2 > opt_replyend)
return;
len = opt_replyp + 2 - opt_reply;
if (emptyok || len > 6) {
*opt_replyp++ = IAC;
*opt_replyp++ = SE;
+1 -1
View File
@@ -26,7 +26,7 @@
* major minor fix final patch/beta)
*/
#define OPENSSL_VERSION_NUMBER 0x0090704fL
#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7d 17 Mar 2004"
#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7d-p1 17 Mar 2004"
#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
+1 -6
View File
@@ -268,9 +268,6 @@ int ssl23_get_client_hello(SSL *s)
int n=0,j;
int type=0;
int v[2];
#ifndef OPENSSL_NO_RSA
int use_sslv2_strong=0;
#endif
if (s->state == SSL23_ST_SR_CLNT_HELLO_A)
{
@@ -519,9 +516,7 @@ int ssl23_get_client_hello(SSL *s)
}
s->state=SSL2_ST_GET_CLIENT_HELLO_A;
if ((s->options & SSL_OP_MSIE_SSLV2_RSA_PADDING) ||
use_sslv2_strong ||
(s->options & SSL_OP_NO_TLSv1 && s->options & SSL_OP_NO_SSLv3))
if (s->options & SSL_OP_NO_TLSv1 && s->options & SSL_OP_NO_SSLv3)
s->s2->ssl2_rollback=0;
else
/* reject SSL 2.0 session if client supports SSL 3.0 or TLS 1.0
+24 -6
View File
@@ -1318,6 +1318,7 @@ slc_check(void)
}
unsigned char slc_reply[128];
unsigned char const * const slc_reply_eom = &slc_reply[sizeof(slc_reply)];
unsigned char *slc_replyp;
void
@@ -1333,6 +1334,14 @@ slc_start_reply(void)
void
slc_add_reply(unsigned char func, unsigned char flags, cc_t value)
{
/* A sequence of up to 6 bytes my be written for this member of the SLC
* suboption list by this function. The end of negotiation command,
* which is written by slc_end_reply(), will require 2 additional
* bytes. Do not proceed unless there is sufficient space for these
* items.
*/
if (&slc_replyp[6+2] > slc_reply_eom)
return;
if ((*slc_replyp++ = func) == IAC)
*slc_replyp++ = IAC;
if ((*slc_replyp++ = flags) == IAC)
@@ -1346,6 +1355,9 @@ slc_end_reply(void)
{
int len;
/* The end of negotiation command requires 2 bytes. */
if (&slc_replyp[2] > slc_reply_eom)
return;
*slc_replyp++ = IAC;
*slc_replyp++ = SE;
len = slc_replyp - slc_reply;
@@ -1463,8 +1475,8 @@ env_opt(unsigned char *buf, int len)
}
}
#define OPT_REPLY_SIZE 256
unsigned char *opt_reply;
#define OPT_REPLY_SIZE (2 * SUBBUFSIZE)
unsigned char *opt_reply = NULL;
unsigned char *opt_replyp;
unsigned char *opt_replyend;
@@ -1517,9 +1529,9 @@ env_opt_add(unsigned char *ep)
return;
}
vp = env_getvalue(ep);
if (opt_replyp + (vp ? strlen((char *)vp) : 0) +
strlen((char *)ep) + 6 > opt_replyend)
{
if (opt_replyp + (vp ? 2 * strlen((char *)vp) : 0) +
2 * strlen((char *)ep) + 6 > opt_replyend)
{
int len;
opt_replyend += OPT_REPLY_SIZE;
len = opt_replyend - opt_reply;
@@ -1543,6 +1555,8 @@ env_opt_add(unsigned char *ep)
*opt_replyp++ = ENV_USERVAR;
for (;;) {
while ((c = *ep++)) {
if (opt_replyp + (2 + 2) > opt_replyend)
return;
switch(c&0xff) {
case IAC:
*opt_replyp++ = IAC;
@@ -1557,6 +1571,8 @@ env_opt_add(unsigned char *ep)
*opt_replyp++ = c;
}
if ((ep = vp)) {
if (opt_replyp + (1 + 2 + 2) > opt_replyend)
return;
#ifdef OLD_ENVIRON
if (telopt_environ == TELOPT_OLD_ENVIRON)
*opt_replyp++ = old_env_value;
@@ -1587,7 +1603,9 @@ env_opt_end(int emptyok)
{
int len;
len = opt_replyp - opt_reply + 2;
if (opt_replyp + 2 > opt_replyend)
return;
len = opt_replyp + 2 - opt_reply;
if (emptyok || len > 6) {
*opt_replyp++ = IAC;
*opt_replyp++ = SE;
+28
View File
@@ -27,6 +27,8 @@
..
Xaw
..
Xcursor
..
Xft
..
Xmu
@@ -115,6 +117,8 @@
..
fs
..
icons
..
lbxproxy
..
locale
@@ -124,6 +128,8 @@
..
common
..
el_GR.UTF-8
..
en_US.UTF-8
..
en_US.utf
@@ -142,6 +148,8 @@
..
iso8859-10
..
iso8859-11
..
iso8859-13
..
iso8859-14
@@ -172,14 +180,22 @@
..
ja.SJIS
..
ja_JP.UTF-8
..
ko
..
ko_KR.UTF-8
..
koi8-c
..
koi8-r
..
koi8-u
..
lib
common
..
..
microsoft-cp1251
..
microsoft-cp1255
@@ -200,6 +216,8 @@
..
th_TH.TACTIS
..
th_TH.UTF-8
..
tscii-0
..
vi_VN.tcvn
@@ -220,6 +238,10 @@
..
zh_TW.Big5
..
zh_TW.UTF-8
..
zh_TW.big5
..
..
proxymngr
..
@@ -241,6 +263,8 @@
..
xedit
lisp
progmodes
..
..
..
xinit
@@ -285,6 +309,8 @@
..
nec
..
pc
..
sgi
..
sony
@@ -322,6 +348,8 @@
..
..
libdata
pkgconfig
..
..
libexec
..
+1 -1
View File
@@ -248,7 +248,7 @@
#define HAVE_SIGVEC 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* #undef HAVE_STDINT_H */
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
+10 -8
View File
@@ -830,8 +830,11 @@ local void treat_file(iname)
}
close(ifd);
if (!to_stdout && close(ofd)) {
write_error();
if (!to_stdout) {
/* Copy modes, times, ownership, and remove the input file */
copy_stat(&istat);
if (close(ofd))
write_error();
}
if (method == -1) {
if (!to_stdout) unlink (ofname);
@@ -851,10 +854,6 @@ local void treat_file(iname)
}
fprintf(stderr, "\n");
}
/* Copy modes, times, ownership, and remove the input file */
if (!to_stdout) {
copy_stat(&istat);
}
}
/* ========================================================================
@@ -1257,6 +1256,7 @@ local int get_method(in)
/* Copy the base name. Keep a directory prefix intact. */
char *p = basename(ofname);
char *base = p;
char *base2;
for (;;) {
*p = (char)get_char();
if (*p++ == '\0') break;
@@ -1264,6 +1264,8 @@ local int get_method(in)
error("corrupted input -- file name too large");
}
}
base2 = basename (base);
strcpy(base, base2);
/* If necessary, adapt the name to local OS conventions: */
if (!list) {
MAKE_LEGAL_NAME(base);
@@ -1636,12 +1638,12 @@ local void copy_stat(ifstat)
reset_times(ofname, ifstat);
#endif
/* Copy the protection modes */
if (chmod(ofname, ifstat->st_mode & 07777)) {
if (fchmod(ofd, ifstat->st_mode & 07777)) {
WARN((stderr, "%s: ", progname));
if (!quiet) perror(ofname);
}
#ifndef NO_CHOWN
chown(ofname, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
(void) fchown(ofd, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
#endif
remove_ofname = 0;
/* It's now safe to remove the input file: */
+1 -1
View File
@@ -262,7 +262,7 @@ TEMP=`mktemp -t pf` || exit 1
# Catch some signals. ($xs kludge needed by Sun /bin/sh)
xs=0
trap 'rm -f $REF $TEMP; exit $xs' 0
trap 'echo "$COMMAND: Aborting ... saving unfinished PR into /tmp/pr.$$"; rm -f $REF ; mv $TEMP /tmp/pr.$$; xs=1; exit' 1 2 3 13 15
trap 'SAV=`mktemp -t pr`;echo "$COMMAND: Aborting ... saving unfinished PR into $SAV"; rm -f $REF ; mv $TEMP $SAV; xs=1; exit' 1 2 3 13 15
# If they told us to use a specific file, then do so.
if [ -n "$IN_FILE" ]; then
+1 -10
View File
@@ -32,7 +32,7 @@
.\" @(#)mlock.2 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
.Dd June 2, 1993
.Dd May 18, 2004
.Dt MLOCK 2
.Os
.Sh NAME
@@ -145,15 +145,6 @@ Some portion of the indicated address range is not locked.
.Xr setrlimit 2 ,
.Xr getpagesize 3
.Sh BUGS
Unlike The Sun implementation, multiple
.Fn mlock
calls on the same address range require the corresponding number of
.Fn munlock
calls to actually unlock the pages, i.e.\&
.Fn mlock
nests.
This should be considered a consequence of the implementation
and not a feature.
.Pp
The per-process resource limit is a limit on the amount of virtual
memory locked, while the system-wide limit is for the number of locked
+15 -4
View File
@@ -25,7 +25,7 @@
#
# Automatic SNAP versioning:
DATE != date +%Y%m%d
BASE = 4.9
BASE = 4.10
BUILDNAME?=${BASE}-${DATE}-STABLE
#
#CHROOTDIR=/junk/release
@@ -106,6 +106,13 @@ DOMINIMALDOCPORTS= YES
.include "Makefile.inc.docports"
.endif
# Make changing names of disc1 CD possible. Usually disc1 directory
# contents is used for creating both miniinst and disc1.
DISC1_LABEL?= fbsd_miniinst
DISC1_NAME?= miniinst
DISC2_LABEL?= fbsd_livefs
DISC2_NAME?= disc2
# Helper variable
.if defined(NOPORTS)
.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
@@ -363,6 +370,10 @@ rerelease release:
BOOT_CONFIG \
BUILDNAME \
CD_EXTRA_BITS \
DISC1_LABEL \
DISC1_NAME \
DISC2_LABEL \
DISC2_NAME \
DISTRIBUTIONS \
DOC_LANG \
DOMINIMALDOCPORTS \
@@ -811,9 +822,9 @@ iso.1:
@if [ -r ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ]; then \
echo "Creating ISO images..."; \
sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
fbsd_miniinst ${CD}/${BUILDNAME}-${TARGET}-miniinst.iso ${CD_DISC1}; \
${DISC1_LABEL} ${CD}/${BUILDNAME}-${TARGET}-${DISC1_NAME}.iso ${CD_DISC1}; \
sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
fbsd_livefs ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2}; \
${DISC2_LABEL} ${CD}/${BUILDNAME}-${TARGET}-${DISC2_NAME}.iso ${CD_DISC2}; \
if [ "x${CD_EXTRA_BITS}" != "x" ]; then \
sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
fbsd_boot ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} ${CD_EXTRA_BITS}; \
@@ -834,7 +845,7 @@ doc.1:
make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
done
@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc
@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc URLS_ABSOLUTE=YES
touch doc.1
#
+31 -95
View File
@@ -46,6 +46,7 @@
<year>2001</year>
<year>2002</year>
<year>2003</year>
<year>2004</year>
<holder role="mailto:[email protected]">The FreeBSD Documentation Project</holder>
</copyright>
@@ -125,44 +126,7 @@
]]>
<![ %release.type.snapshot [
<para>(5 Dec 2003) <application>BIND</application> contains the potential for a
denial-of-service attack. This vulnerability has been addressed
by a vendor patch on the &release.prev; security fix branch and
by the import of a new version to the &release.branch;
development branch. For more information, see
<ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:19.bind.asc">FreeBSD-SA-03:19</ulink>.</para>
<para>(8 Feb 2004) A bug with the System V Shared Memory interface
(specifically the &man.shmat.2; system call)
can cause a shared memory segment to reference
unallocated kernel memory. In turn, this can permit a local
attacker to gain unauthorized access to parts of kernel memory,
possibly resulting in disclosure of sensitive information,
bypass of access control mechanisms, or privilege escalation.
More details, including bugfix and workaround information,
can be found in security advisory <ulink
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-04:02.shmat.asc">FreeBSD-SA-04:02</ulink>.</para>
<para>(4 Mar 2004) It is possible for a remote attacker to conduct
a low-bandwidth denial-of-service attack against a machine
providing TCP-based services, filling up the target's memory
buffers and potentially leading to a system crash. This
vulnerability has been addressed on the &os; &release.prev;
security fix branch. Security advisory <ulink
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-04:04.tcp.asc">FreeBSD-SA-04:04</ulink>
contains more details, as well as information on patching
existing systems.</para>
<para>(17 Mar 2004) By performing a specially crafted SSL/TLS
handshake with an application that uses OpenSSL a null pointer
may be dereferenced. This may in turn cause the application to
crash, resulting in a denial of service attack. For more information
see the Security Advisory <ulink
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-04:05.openssl.asc">FreeBSD-SA-04:05</ulink>
which contains more details and instructions on how to patch existing
systems.</para>
<para>No active security advisories.</para>
]]>
</sect1>
@@ -171,66 +135,38 @@
<title>Late-Breaking News</title>
<![ %release.type.release [
<para>No news.</para>
<para>(20 May 2004) A security problem was discovered
in <application>CVS</application> but the release notes
did not state that since it was very late in the release cycle.
&os; &release.current; includes a fix for it and is not vulnerable.
For the details, see the security advisory
<ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-04:10.cvs.asc">FreeBSD-SA-04:10</ulink>.</para>
<para>(23 May 2004) As a side effect of closing a security problem
related to &man.msync.2;, the <literal>MS_INVALIDATE</literal>
flag no longer guarantees that all pages in the range are
invalidated. This can cause problems when pages are backed by a remote file
(e.g. via NFS) where other machines can write to the permanent storage since
the local pages not being invalidated might then contain stale data. The
security problem being addressed is a strictly local exploit, and only
allows a local user to block the writing of data to a file under certain
circumstances. Users who require the old semantics of
<literal>MS_INVALIDATE</literal> and are not concerned with
the security issue being fixed can set the
<literal>vm.old_msync</literal> sysctl to <literal>1</literal>
which will revert to the old (insecure) behavior.</para>
<para>(25 May 2004) The &man.twe.4; driver was recently updated by the
vendor. Problems have been reported in rare circumstances under
conditions that are hard to reproduce. Work is ongoing to isolate
these problems and determine their source.</para>
]]>
<![ %release.type.snapshot [
<para>(28 Oct 2003) Very late in the release cycle, a change was made to the
HyperThreading (HTT) support on &intel; processors. HTT support
is now enabled by default on SMP-capable kernels; as a result,
the <literal>HTT</literal> kernel option is unnecessary and has
been removed. The extra logical CPUs are always started so that
they can handle interrupts, but are prevented from executing
user processes by default. To enable the logical CPUs, change
the value of the <varname>machdep.hlt_logical_cpus</varname>
&man.sysctl.8; variable from <literal>1</literal> to
<literal>0</literal>. This value can also be set from the
loader as a tunable of the same name. This behavior is now
identical to &os; 5.<replaceable>X</replaceable>.</para>
<para>(29 Oct 2003) Some of the packages contained in the first CD-ROM depend on
different versions of the <application>OpenLDAP</application>
packages, which cannot co-exist on the same host. One
manifestation of this problem is that it is not possible to
install both the <filename role="package">x11/gnome2</filename>
and <filename role="package">x11/kde3</filename>
packages.</para>
<para>(30 Oct 2003) It appears that the
<filename>crypto</filename> distribution is required for correct
functioning of the &os; base system. At the very least, the
libraries contained in the <filename>crypto</filename>
distribution are required for &man.pkg.add.1;.</para>
<para>(30 Oct 2003) There are known cases of fairly-recent i386
machines with BIOSes that do not support booting from emulation
mode El Torito CDROMs. This prevents booting from the &os;
&release.current; CDROMs. As a workaround, download the floppy
disk images, use them to boot the machine into
&man.sysinstall.8;, and then do a CDROM install. This problem
does not seem to be wide-spread as of this writing.
<note>
<para>&os; 5.<replaceable>X</replaceable> uses non-emulation
El Torito booting on its CDROM releases by default. These,
of course, cannot be booted on very old i386 machines that
only support emulation mode.</para>
</note>
</para>
<para>(10 Nov 2003) An update was made to the
<literal>xterm</literal> entry in the &man.termcap.5; database
which, among other things, removed the (already deprecated)
<literal>bs</literal> backspacing capability. The &man.hack.6;
game appears to depend on this capability and hence fails when
run from inside a window with a terminal type of
<literal>xterm</literal>.</para>
<para>(10 Nov 2003) Tagged queueing in the &man.ata.4; driver
is broken and appears to cause kernel panics.</para>
<para>No news.</para>
]]>
</sect1>
</article>
@@ -10,6 +10,7 @@
<year>2001</year>
<year>2002</year>
<year>2003</year>
<year>2004</year>
<holder role="mailto:[email protected]">The FreeBSD Documentation Project</holder>
</copyright>
</articleinfo>
@@ -12,6 +12,7 @@
<year>2001</year>
<year>2002</year>
<year>2003</year>
<year>2004</year>
<holder role="mailto:[email protected]">The FreeBSD Documentation Project</holder>
</copyright>
</articleinfo>
@@ -24,6 +24,7 @@
<year>2001</year>
<year>2002</year>
<year>2003</year>
<year>2004</year>
<holder role="mailto:[email protected]">The FreeBSD Documentation Project</holder>
</copyright>
</articleinfo>
@@ -55,6 +55,11 @@
url="http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/">FreeBSD
Handbook</ulink>.</para>
<para>For significant information discovered after the release
or last-minute changes in the release cycle to be otherwise
included in the release documentation, please read
<ulink url="http://www.FreeBSD.org/releases/4.10R/errata.html">Errata</ulink>
document.</para>
]]>
</sect1>
@@ -129,6 +134,16 @@
on the server when accessing remote CVS repositories.
More details can be found in security advisory <ulink
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-04:07.cvs.asc">FreeBSD-SA-04:07</ulink>.</para>
<para>A bugfix for <application>Heimdal</application> rectifies a
problem in which it would not perform adequate checking of
authentication across autonomous realms. For more information,
see security advisory <ulink
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-04:08.heimdal.asc">FreeBSD-SA-04:08</ulink>.</para>
<para>A fix in &man.kadmind.8; closes a potential buffer overflow.
Details can be found in security advisory <ulink
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-04:09.kadmind.asc">FreeBSD-SA-04:09</ulink>.</para>
</sect2>
<sect2 id="kernel">
@@ -153,6 +168,9 @@
&man.dconschat.8; utility provides user access to &man.dcons.4;
devices.</para>
<para>A bug in &man.mmap.2; that pages marked as <literal>PROT_NONE</literal>
may become readable under certain circumstances, has been fixed.</para>
<para>The &man.stl.4; driver has been updated to version 5.6.0b1.</para>
<para>The &man.umct.4; driver, which provides support for USB to RS-232
@@ -221,6 +239,11 @@
for authenticating TCP sessions. &man.setkey.8; now includes
support for the TCP-MD5 class of security associations.</para>
<para>The random ephemeral port allocation, which come from OpenBSD
has been implemented. This is enabled by default and can be disabled
using the <varname>net.inet.ip.portrange.randomized</varname>
sysctl.</para>
<para>The &man.ng.vlan.4; NetGraph node type, which supports
IEEE 802.1Q VLAN tagging has been added.</para>
</sect3>
@@ -386,7 +409,7 @@
</para>
<para>The supported release of <application>KDE</application>
has been updated from 3.1.4 to 3.2.1.</para>
has been updated from 3.1.4 to 3.2.2.</para>
</sect2>
</sect1>
@@ -35,16 +35,6 @@
(list (list "HREF" "mailto:[email protected]"))
(literal "[email protected]"))
(literal ">.")
(make element gi: "p"
attributes: (list (list "align" "center"))
(make element gi: "small"
(literal "All users of FreeBSD ")
(literal (entity-text "release.branch"))
(literal " should subscribe to the ")
(literal "<")
(create-link (list (list "HREF" "mailto:[email protected]"))
(literal "[email protected]"))
(literal "> mailing list.")))
(make element gi: "p"
attributes: (list (list "align" "center"))
-14
View File
@@ -1,14 +0,0 @@
# $FreeBSD$
# Original revision: 1.6
RELN_ROOT?= ${.CURDIR}/../..
SUBDIR = alpha
SUBDIR+= amd64
SUBDIR+= ia64
SUBDIR+= i386
SUBDIR+= sparc64
SUBDIR+= pc98
.include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
.include "${DOC_PREFIX}/share/mk/doc.project.mk"
@@ -1,19 +0,0 @@
<!-- -*- sgml -*- -->
<!--
$FreeBSD$
Original revision: 1.5
-->
<!-- Text constants which probably don't need to be changed.-->
<!-- Files to be included -->
<!ENTITY artheader SYSTEM "../common/artheader.sgml">
<!ENTITY sect.intro SYSTEM "../common/intro.sgml">
<!ENTITY sect.proc.alpha SYSTEM "../alpha/proc-alpha.sgml">
<!ENTITY sect.proc.amd64 SYSTEM "../amd64/proc-amd64.sgml">
<!ENTITY sect.proc.i386 SYSTEM "../i386/proc-i386.sgml">
<!ENTITY sect.proc.ia64 SYSTEM "../ia64/proc-ia64.sgml">
<!ENTITY sect.proc.sparc64 SYSTEM "../sparc64/proc-sparc64.sgml">
<!ENTITY sect.proc.pc98 SYSTEM "../pc98/proc-pc98.sgml">
<!ENTITY sect.dev SYSTEM "../common/dev.sgml">
@@ -12,7 +12,7 @@ UNITEXTS= readme errata
IMAGEDIR= .imagedir
RHOST= freefall.freebsd.org
RDIR= public_html/relnotes/4-STABLE
RDIR= public_html/relnotes/4.10-RELEASE
DOCDIR= ./release/doc
LANG= en_US.ISO8859-1
+7 -7
View File
@@ -6,7 +6,7 @@
<!-- Version of the OS we're describing. This needs to be updated
with each new release. -->
<!ENTITY release.current "4.10-BETA">
<!ENTITY release.current "4.10-RELEASE">
<!-- The previous version used for comparison in the "What's New"
section. For -CURRENT, we might point back to the last
@@ -14,26 +14,26 @@
<!ENTITY release.prev "4.9-RELEASE">
<!-- The next version to be released, usually used for snapshots. -->
<!ENTITY release.next "4.10-RELEASE">
<!ENTITY release.next "4.11-RELEASE">
<!-- The name of this branch. -->
<!ENTITY release.branch "4-STABLE">
<!-- The URL for obtaining this version of FreeBSD. -->
<!ENTITY release.url "http://snapshots.jp.FreeBSD.org/">
<!ENTITY release.url "ftp://ftp.FreeBSD.org/">
<!-- The type of release (usually this will be either "snapshot"
or "release" -->
<!ENTITY release.type "snapshot">
<!ENTITY % release.type.snapshot "INCLUDE">
<!ENTITY % release.type.release "IGNORE">
<!ENTITY release.type "release">
<!ENTITY % release.type.snapshot "IGNORE">
<!ENTITY % release.type.release "INCLUDE">
<!-- The manpaths for man page references -->
<!ENTITY release.man.url "http://www.FreeBSD.org/cgi/man.cgi">
<!ENTITY release.manpath.xfree86 "4.3.0">
<!ENTITY release.manpath.netbsd "1.6.1">
<!ENTITY release.manpath.freebsd-ports "Ports">
<!ENTITY release.manpath.freebsd "4.8-stable">
<!ENTITY release.manpath.freebsd "4.10-RELEASE">
<!-- Text constants which probably don't need to be changed.-->
+4 -21
View File
@@ -89,9 +89,11 @@ CDROM_SET_1="${CDROM_SET_1} x11-servers/XFree86-4-PrintServer"
CDROM_SET_1="${CDROM_SET_1} x11-servers/XFree86-4-Server"
CDROM_SET_1="${CDROM_SET_1} x11-servers/XFree86-4-VirtualFramebufferServer"
CDROM_SET_1="${CDROM_SET_1} x11-wm/afterstep"
if [ "X${PKG_ARCH}" != "Xalpha" ]; then
CDROM_SET_1="${CDROM_SET_1} x11-wm/enlightenment"
CDROM_SET_1="${CDROM_SET_1} x11-wm/fvwm2"
CDROM_SET_1="${CDROM_SET_1} x11-wm/sawfish2"
fi
CDROM_SET_1="${CDROM_SET_1} x11-wm/fvwm2"
CDROM_SET_1="${CDROM_SET_1} x11-wm/windowmaker"
CDROM_SET_1="${CDROM_SET_1} x11/XFree86-4"
CDROM_SET_1="${CDROM_SET_1} x11/XFree86-4-clients"
@@ -107,16 +109,13 @@ CDROM_SET_1="${CDROM_SET_1} www/links"
CDROM_SET_1="${CDROM_SET_1} astro/xearth"
CDROM_SET_1="${CDROM_SET_1} editors/emacs"
CDROM_SET_1="${CDROM_SET_1} editors/vim-lite"
CDROM_SET_1="${CDROM_SET_1} editors/vim"
#CDROM_SET_1="${CDROM_SET_1} editors/vim"
CDROM_SET_1="${CDROM_SET_1} emulators/mtools"
CDROM_SET_1="${CDROM_SET_1} graphics/xv"
CDROM_SET_1="${CDROM_SET_1} irc/xchat2"
CDROM_SET_1="${CDROM_SET_1} mail/fetchmail"
CDROM_SET_1="${CDROM_SET_1} mail/mutt"
CDROM_SET_1="${CDROM_SET_1} mail/pine4"
CDROM_SET_1="${CDROM_SET_1} mail/popd"
CDROM_SET_1="${CDROM_SET_1} mail/xfmail"
CDROM_SET_1="${CDROM_SET_1} misc/bsdiff"
CDROM_SET_1="${CDROM_SET_1} misc/screen"
CDROM_SET_1="${CDROM_SET_1} net/cvsup"
CDROM_SET_1="${CDROM_SET_1} net/rsync"
@@ -124,12 +123,6 @@ CDROM_SET_1="${CDROM_SET_1} net/samba"
CDROM_SET_1="${CDROM_SET_1} news/slrn"
CDROM_SET_1="${CDROM_SET_1} news/tin"
CDROM_SET_1="${CDROM_SET_1} print/a2ps-letter"
if [ "X${PKG_ARCH}" = "Xalpha" ]; then
CDROM_SET_1="${CDROM_SET_1} print/acroread4"
fi
if [ "X${PKG_ARCH}" = "Xi386" ]; then
CDROM_SET_1="${CDROM_SET_1} print/acroread5"
fi
CDROM_SET_1="${CDROM_SET_1} print/apsfilter"
CDROM_SET_1="${CDROM_SET_1} print/ghostscript-gnu-nox11"
CDROM_SET_1="${CDROM_SET_1} print/gv"
@@ -143,22 +136,12 @@ CDROM_SET_1="${CDROM_SET_1} shells/pdksh"
CDROM_SET_1="${CDROM_SET_1} shells/zsh"
CDROM_SET_1="${CDROM_SET_1} sysutils/portupgrade"
CDROM_SET_1="${CDROM_SET_1} www/lynx"
CDROM_SET_1="${CDROM_SET_1} www/mozilla"
CDROM_SET_1="${CDROM_SET_1} www/netscape-remote"
CDROM_SET_1="${CDROM_SET_1} www/netscape-wrapper"
CDROM_SET_1="${CDROM_SET_1} www/netscape48-communicator"
CDROM_SET_1="${CDROM_SET_1} www/opera"
CDROM_SET_1="${CDROM_SET_1} x11/rxvt"
# VERY common build dependencies
CDROM_SET_1="${CDROM_SET_1} archivers/unzip"
CDROM_SET_1="${CDROM_SET_1} devel/gmake"
CDROM_SET_1="${CDROM_SET_1} graphics/png"
if [ "X${PKG_ARCH}" = "Xi386" ]; then
CDROM_SET_1="${CDROM_SET_1} misc/compat22"
fi
if [ "X${PKG_ARCH}" = "Xi386" -o "X${PKG_ARCH}" = "Xalpha" ]; then
CDROM_SET_1="${CDROM_SET_1} misc/compat3x"
CDROM_SET_1="${CDROM_SET_1} misc/compat4x"
fi
+3
View File
@@ -93,6 +93,9 @@ moduleInitialize(void)
}
}
closedir(dirp);
msgDebug("Sleeping to allow device discovery...\n");
sleep(1);
msgDebug("Finished sleeping to allow device discovery\n");
}
}
+1 -1
View File
@@ -51,7 +51,7 @@
*default host=CHANGE_THIS.FreeBSD.org
*default base=/usr
*default prefix=/usr
*default release=cvs tag=RELENG_4
*default release=cvs tag=RELENG_4_10
*default delete use-rel-suffix
# If your network link is a T1 or faster, comment out the following line.
-99
View File
@@ -1,99 +0,0 @@
.\" Copyright (c) 2004
.\" Ivan Sharov <[email protected]>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Ivan Sharov.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY Ivan Sharov AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL Ivan Sharov OR THE VOICES IN HIS HEAD
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 26, 2003
.Dt ARL 4 i386
.Os
.Sh NAME
.Nm arl
.Nd "Aironet Arlan 655 wireless network adapter driver"
.Sh SYNOPSIS
.Cd "device arl"
.Sh DESCRIPTION
The
.Nm
driver provides support for Aironet Arlan 655
wireless network adapters.
The Arlan 655 series adapters operate at 354kbps, 512kbps, 1Mbps and 2Mbps.
.Pp
The Aironet Arlan 655 devices support Aironet TMA, Aironet Non-TMA
and PSP operating modes.
.Pp
By default, the
.Nm
driver configures the Aironet Arlan 655 card for TMA operation.
.Pp
To set up Radio Network parameters, use
.Xr arlconfig 8 .
.Sh SEE ALSO
.Xr arp 4 ,
.Xr netintro 4 ,
.Xr arlconfig 8 ,
.Xr ifconfig 8
.Sh LIMITATIONS
When using
.Xr ifconfig 8
for setting
.Ar SSID
you must use a 4-byte even hexadecimal digit value and it must start with
00 or 02.
.Pp
You can change
.Ar channel
for current
.Ar country
only through
.Xr ifconfig 8 .
You must use
.Xr arlconfig 8
for changing
.Ar country .
.Pp
Can't change lladdr.
.Sh HISTORY
The
.Nm
device driver first appeared in
.Fx 5.3 .
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was initially written by
.An Ivan Sharov Aq [email protected] .
.Aq [email protected]
wrote the arlconfig utility and added ioctl support to the driver.
.An Stanislav Svirid Aq [email protected]
ported this driver to the new ISA architecture, merged some al driver changes,
fixed some bugs and made it a module.
.An Yuri Kurenkov Aq [email protected]
wrote this manpage.
+6 -16
View File
@@ -31,37 +31,27 @@
.Nm ct
.Nd "WD33C93[ABC] based CBUS SCSI host adapter driver"
.Sh SYNOPSIS
.Cd "device ct"
.Cd "device scbus"
.Pp
In
.Pa /boot/device.hints:
.Pp
For most PC-9801-55, -92 and compatibles:
.Cd hint.ct.0.at="isa"
.Cd "device ct0 at isa?"
.Pp
For ELECOM bus-master
.Tn SCSI
adapters:
.Cd hint.ct.0.at="isa"
.Cd hint.ct.0.flags="0x30000"
.Cd "device ct0 at isa? flags=0x30000"
.Pp
For I-O DATA SC98 adapters:
.Cd hint.ct.0.at="isa"
.Cd hint.ct.0.flags="0x10000"
.Cd "device ct0 at isa? flags=0x10000"
.Pp
For LOGITEC adapters:
.Cd hint.ct.0.at="isa"
.Cd hint.ct.0.flags="0x50000"
.Cd "device ct0 at isa? flags=0x50000"
.Pp
For TEXA adapters:
.Cd hint.ct.0.at="isa"
.Cd hint.ct.0.flags="0x20000"
.Cd "device ct0 at isa? flags=0x20000"
.Pp
For adapters with SMIT transfer mode to enable SMIT transfer:
.Cd hint.ct.0.at="isa"
.Cd hint.ct.0.flags="0x40000"
.Cd hint.ct.0.maddr="0xdc000"
.Cd "device ct0 at isa? iomem 0xdc000 flags=0x40000"
.Pp
.Ar Flag
meaning:
+4 -8
View File
@@ -20,19 +20,15 @@
.Nm ctau
.Nd driver for synchronous Cronyx Tau WAN adapters
.Sh SYNOPSIS
.Cd "device ctau0 at isa? port 0x240 irq 15 drq 7"
or
.Cd "device ctau"
for autodetection.
.Pp
Additional options:
.Cd "device sppp"
.Cd "options NETGRAPH"
.Cd "options NETGRAPH_CRONYX"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.ctau.0.at="isa"
.Cd hint.ctau.0.port="0x240"
.Cd hint.ctau.0.irq="15"
.Cd hint.ctau.0.drq="7"
.Sh DESCRIPTION
The
.Nm
@@ -51,7 +47,7 @@ Otherwise, it will be compiled with
support.
.Pp
The base I/O port address specified in
.Pa /boot/device.hints
.Pa /sys/i386/conf/<YOUR_KERN_CONF>
must match the port address set by the jumpers on the board.
The DMA I/O channel and interrupt request numbers are configured
by software at adapter initialization.
+5 -8
View File
@@ -20,19 +20,15 @@
.Nm cx
.Nd driver for synchronous/asynchronous Cronyx Sigma WAN adapters
.Sh SYNOPSIS
.Cd "device cx0 at isa? port 0x240 irq 5 drq 7"
or
.Cd "device cx"
for autodetection.
.Pp
Additional options:
.Cd "device sppp"
.Cd "options NETGRAPH"
.Cd "options NETGRAPH_CRONYX"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.cx.0.at="isa"
.Cd hint.cx.0.port="0x240"
.Cd hint.cx.0.irq="15"
.Cd hint.cx.0.drq="7"
.Sh DESCRIPTION
The
.Nm
@@ -51,7 +47,7 @@ Otherwise, it will be compiled with
support.
.Pp
The base I/O port address specified in
.Pa /boot/device.hints
.Pa /sys/i386/conf/<YOUR_KERN_CONF>
must match the port address set by the jumpers on the board.
The DMA I/O channel and interrupt request numbers are configured
by software at adapter initialization.
@@ -80,6 +76,7 @@ for information about the
.Nm
adapter configuration.
.Sh SEE ALSO
.Xr ctau 4 ,
.Xr sppp 4 ,
.Xr ifconfig 8 ,
.Xr sconfig 8 ,
-66
View File
@@ -1,66 +0,0 @@
.\" Copyright (c) 2004 Ruslan Ermilov
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 17, 2004
.Dt NG_HUB 4
.Os
.Sh NAME
.Nm ng_hub
.Nd packet distribution netgraph node type
.Sh SYNOPSIS
.In netgraph/ng_hub.h
.Sh DESCRIPTION
The
.Nm hub
node type provides a simple mechanism for distributing packets over
several links.
Packets received on any of the hooks are forwarded out the other hooks.
Packets are not altered in any way.
.Sh HOOKS
A
.Nm hub
node accepts any request to connect, regardless of the hook name,
as long as the name is unique.
.Sh CONTROL MESSAGES
This node type supports only the generic control messages.
.Sh SHUTDOWN
This node shuts down upon receipt of a
.Dv NGM_SHUTDOWN
control message, or when all hooks have been disconnected.
.Sh SEE ALSO
.Xr netgraph 4 ,
.Xr ng_bridge 4 ,
.Xr ng_ether 4 ,
.Xr ng_one2many 4 ,
.Xr ngctl 8 ,
.Xr nghook 8
.Sh HISTORY
The
.Nm
node type appeared in
.Fx 5.3 .
.Sh AUTHORS
.An Ruslan Ermilov Aq [email protected]
+16
View File
@@ -251,6 +251,22 @@ environment immediately after any local patches are applied.
.It Va MAKE_ISOS
If defined, bootable ISO CD-ROM images will be created from the
contents of the CD-ROM stage directory.
.It Va DISC1_LABEL
The label used for the CD-ROM created from the disc1 contents, the
default label will be
.Dq fbsd_miniinst .
.It Va DISC1_NAME
The name used as part of the ISO file name for the CD-ROM created from
the disc1 contents, the default will be
.Dq miniinst .
.It Va DISC2_LABEL
The label used for the CD-ROM created from the disc2 contents, the
default label will be
.Dq fbsd_livefs .
.It Va DISC2_NAME
The name used as part of the ISO file name for the CD-ROM created from
the disc2 contents, the default will be
.Dq disc2 .
.It Va NODOC
If set to
.Dq Li YES ,
+2 -2
View File
@@ -2232,7 +2232,7 @@ pmap_kenter_temporary(vm_offset_t pa, int i)
* faults on process startup and immediately after an mmap.
*/
void
pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_prot_t prot,
vm_object_t object, vm_pindex_t pindex,
vm_size_t size, int limit)
{
@@ -2241,7 +2241,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
vm_page_t p, mpte;
int objpgs;
if (pmap == NULL || object == NULL)
if ((prot & VM_PROT_READ) == 0 || pmap == NULL || object == NULL)
return;
psize = alpha_btop(size);
+44
View File
@@ -54,6 +54,48 @@ void atomic_clear_64(u_int64_t *, u_int64_t);
void atomic_add_64(u_int64_t *, u_int64_t);
void atomic_subtract_64(u_int64_t *, u_int64_t);
static __inline u_int32_t
atomic_readandclear_32(volatile u_int32_t *addr)
{
u_int32_t result,temp;
__asm __volatile (
"wmb\n" /* ensure pending writes have drained */
"1:\tldl_l %0,%3\n\t" /* load current value, asserting lock */
"ldiq %1,0\n\t" /* value to store */
"stl_c %1,%2\n\t" /* attempt to store */
"beq %1,2f\n\t" /* if the store failed, spin */
"br 3f\n" /* it worked, exit */
"2:\tbr 1b\n" /* *addr not updated, loop */
"3:\tmb\n" /* it worked */
: "=&r"(result), "=&r"(temp), "=m" (*addr)
: "m"(*addr)
: "memory");
return result;
}
static __inline u_int64_t
atomic_readandclear_64(volatile u_int64_t *addr)
{
u_int64_t result,temp;
__asm __volatile (
"wmb\n" /* ensure pending writes have drained */
"1:\tldq_l %0,%3\n\t" /* load current value, asserting lock */
"ldiq %1,0\n\t" /* value to store */
"stq_c %1,%2\n\t" /* attempt to store */
"beq %1,2f\n\t" /* if the store failed, spin */
"br 3f\n" /* it worked, exit */
"2:\tbr 1b\n" /* *addr not updated, loop */
"3:\tmb\n" /* it worked */
: "=&r"(result), "=&r"(temp), "=m" (*addr)
: "m"(*addr)
: "memory");
return result;
}
#define atomic_set_char atomic_set_8
#define atomic_clear_char atomic_clear_8
#define atomic_add_char atomic_add_8
@@ -68,10 +110,12 @@ void atomic_subtract_64(u_int64_t *, u_int64_t);
#define atomic_clear_int atomic_clear_32
#define atomic_add_int atomic_add_32
#define atomic_subtract_int atomic_subtract_32
#define atomic_readandclear_int atomic_readandclear_32
#define atomic_set_long atomic_set_64
#define atomic_clear_long atomic_clear_64
#define atomic_add_long atomic_add_64
#define atomic_subtract_long atomic_subtract_64
#define atomic_readandclear_long atomic_readandclear_64
#endif /* ! _MACHINE_ATOMIC_H_ */
+18 -10
View File
@@ -933,19 +933,21 @@ linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args)
}
case LINUX_CDROMREADTOCENTRY: {
struct linux_cdrom_tocentry lte, *ltep =
(struct linux_cdrom_tocentry *)args->arg;
struct linux_cdrom_tocentry lte;
struct ioc_read_toc_single_entry irtse;
irtse.address_format = ltep->cdte_format;
irtse.track = ltep->cdte_track;
error = copyin((caddr_t)args->arg, &lte, sizeof(lte));
if (error)
return (error);
irtse.address_format = lte.cdte_format;
irtse.track = lte.cdte_track;
error = fo_ioctl(fp, CDIOREADTOCENTRY, (caddr_t)&irtse, p);
if (!error) {
lte = *ltep;
lte.cdte_ctrl = irtse.entry.control;
lte.cdte_adr = irtse.entry.addr_type;
bsd_to_linux_msf_lba(irtse.address_format,
&irtse.entry.addr, &lte.cdte_addr);
copyout(&lte, (caddr_t)args->arg, sizeof(lte));
error = copyout(&lte, (caddr_t)args->arg, sizeof(lte));
}
return (error);
}
@@ -1268,6 +1270,7 @@ static int
linux_ioctl_console(struct proc *p, struct linux_ioctl_args *args)
{
struct file *fp = p->p_fd->fd_ofiles[args->fd];
int error;
switch (args->cmd & 0xffff) {
@@ -1326,11 +1329,16 @@ linux_ioctl_console(struct proc *p, struct linux_ioctl_args *args)
return (ioctl(p, (struct ioctl_args *)args));
case LINUX_VT_SETMODE: {
struct vt_mode *mode;
struct vt_mode mode;
error = copyin((caddr_t)args->arg, &mode, sizeof(mode));
if (error)
return (error);
if (!ISSIGVALID(mode.frsig) && ISSIGVALID(mode.acqsig))
mode.frsig = mode.acqsig;
error = copyout(&mode, (caddr_t)args->arg, sizeof(mode));
if (error)
return (error);
args->cmd = VT_SETMODE;
mode = (struct vt_mode *)args->arg;
if (!ISSIGVALID(mode->frsig) && ISSIGVALID(mode->acqsig))
mode->frsig = mode->acqsig;
return (ioctl(p, (struct ioctl_args *)args));
}
+1 -1
View File
@@ -36,7 +36,7 @@
TYPE="FreeBSD"
REVISION="4.10"
BRANCH="BETA"
BRANCH="RELEASE-p24"
RELEASE="${REVISION}-${BRANCH}"
VERSION="${TYPE} ${RELEASE}"
+8 -1
View File
@@ -83,6 +83,7 @@ ahd_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
#define ID_AHA_29320 0x8012900500429005ull
#define ID_AHA_29320B 0x8013900500439005ull
#define ID_AHA_39320_B 0x8015900500409005ull
#define ID_AHA_39320_B_DELL 0x8015900501681028ull
#define ID_AHA_39320A 0x8016900500409005ull
#define ID_AHA_39320D 0x8011900500419005ull
#define ID_AHA_39320D_B 0x801C900500419005ull
@@ -167,6 +168,12 @@ struct ahd_pci_identity ahd_pci_ident_table [] =
"Adaptec 39320 Ultra320 SCSI adapter",
ahd_aic7902_setup
},
{
ID_AHA_39320_B_DELL,
ID_ALL_MASK,
"Adaptec (Dell OEM) 39320 Ultra320 SCSI adapter",
ahd_aic7902_setup
},
{
ID_AHA_39320A,
ID_ALL_MASK,
@@ -200,7 +207,7 @@ struct ahd_pci_identity ahd_pci_ident_table [] =
/* Generic chip probes for devices we don't know 'exactly' */
{
ID_AIC7901 & ID_9005_GENERIC_MASK,
ID_DEV_VENDOR_MASK,
ID_9005_GENERIC_MASK,
"Adaptec AIC7901 Ultra320 SCSI adapter",
ahd_aic7901_setup
},
-335
View File
@@ -1,335 +0,0 @@
/*
* $RISS: if_arl/dev/arl/if_arl_isa.c,v 1.7 2004/03/16 05:30:38 count Exp $
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_inet.h"
#ifdef INET
#define ARLCACHE
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/socket.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/rman.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_mib.h>
#include <net/if_media.h>
#include <isa/isavar.h>
#include <isa/pnpvar.h>
#include <isa/isa_common.h>
#include <machine/clock.h>
#include <machine/md_var.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_param.h>
#include <dev/arl/if_arlreg.h>
static void arl_isa_identify(driver_t *, device_t);
static int arl_isa_probe (device_t);
static int arl_isa_attach (device_t);
static int arl_isa_detach (device_t);
static char* arl_make_desc (u_int8_t, u_int8_t);
#define ARL_MAX_ATYPE_LEN 10
static struct arl_type {
u_int8_t type;
char* desc;
}
arl_type_list[] = {
{ 0, "450" },
{ 1, "650" },
{ 0xb, "670" },
{ 0xc, "670E" },
{ 0xd, "650E" },
{ 0xe, "440LT" },
{ 0x2e, "655" },
{ 0x6b, "IC2200" },
{ 0, 0 }
};
#define ARL_MAX_RTYPE_LEN 10
struct radio_type {
u_int8_t type;
char* desc;
} radio_type_list [] = {
{ 1, "092/094" },
{ 2, "020" },
{ 3, "092A" },
{ 4, "020B" },
{ 5, "095" },
{ 6, "024" },
{ 7, "025B" },
{ 8, "024B" },
{ 9, "024C" },
{10, "025C" },
{11, "024-1A" },
{12, "025-1A" },
};
static char*
arl_make_desc(hw_type, radio_mod)
u_int8_t hw_type;
u_int8_t radio_mod;
{
static char desc[80];
char atype[ARL_MAX_ATYPE_LEN], rtype[ARL_MAX_RTYPE_LEN];
int i;
*atype = *rtype = 0;
/* arl type */
for(i = 0; arl_type_list[i].desc; i++) {
if (arl_type_list[i].type == hw_type)
break;
}
if (arl_type_list[i].desc)
strncpy(atype, arl_type_list[i].desc, ARL_MAX_ATYPE_LEN);
else
snprintf(atype, ARL_MAX_ATYPE_LEN, "(0x%x)", hw_type);
/* radio type */
for(i = 0; radio_type_list[i].desc; i++)
if (radio_type_list[i].type == radio_mod)
break;
if (radio_type_list[i].desc)
strncpy(rtype, radio_type_list[i].desc, ARL_MAX_RTYPE_LEN);
else
snprintf(rtype, ARL_MAX_RTYPE_LEN, "(0x%x)", radio_mod);
snprintf(desc, 80, "ArLan type %s, radio module %s", atype, rtype);
return desc;
}
#define ARL_ADDR2VEC(addr) (1 << ((addr - ARL_BASE_START) / ARL_BASE_STEP))
static void
arl_isa_identify (driver_t *driver, device_t parent)
{
device_t child;
struct arl_softc *sc;
int chunk, found, i;
u_int16_t free_mem = 0xFFFF;
if (bootverbose)
printf("arl: in identify\n");
/* Try avoid already added devices */
for (i = 0; (child = device_find_child(parent, "arl", i)) != NULL; i++) {
chunk = bus_get_resource_start(child, SYS_RES_MEMORY, 0);
if (bootverbose)
device_printf(child, "found at iomem = 0x%0x\n", chunk);
if (chunk >= ARL_BASE_START && chunk <= ARL_BASE_END)
free_mem ^= ARL_ADDR2VEC(chunk);
}
if (bootverbose)
printf("arl: free mem vector = 0x%x\n", free_mem);
for (chunk = ARL_BASE_START; chunk <= ARL_BASE_END; chunk += ARL_BASE_STEP) {
/* If device 'arl' with this chunk was found early - skip it */
if ( !(free_mem & ARL_ADDR2VEC(chunk)) )
continue;
found = 0;
child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "arl", -1);
device_set_driver(child, driver);
sc = device_get_softc(child);
bzero(sc, sizeof(*sc));
bus_set_resource(child, SYS_RES_MEMORY, sc->mem_rid, chunk,
ARL_BASE_STEP);
if (arl_alloc_memory(child, sc->mem_rid, ARL_BASE_STEP) == 0) {
ar = (struct arl_private *) rman_get_virtual(sc->mem_res);
if (!bcmp(ar->textRegion, ARLAN_SIGN, sizeof(ARLAN_SIGN) - 1))
found++;
}
if (bootverbose)
device_printf(child, "%sfound at 0x%x\n",
!found ? "not " : "", chunk);
arl_release_resources(child);
if (!found) {
bus_delete_resource(child, SYS_RES_MEMORY, sc->mem_rid);
device_delete_child(parent, child);
}
}
}
static int
arl_isa_probe (device_t dev)
{
struct arl_softc *sc = device_get_softc(dev);
int error;
u_char *ptr;
u_int8_t irq;
if (isa_get_vendorid(dev))
return (ENXIO);
if (bootverbose)
device_printf(dev, "in probe\n");
bzero(sc, sizeof(struct arl_softc));
sc->arl_unit = device_get_unit(dev);
error = arl_alloc_memory(dev, 0, ARL_BASE_STEP);
if (error) {
if (bootverbose)
device_printf(dev, "Error allocating memory (%d)\n", error);
return (error);
}
ar = (struct arl_private *) rman_get_virtual(sc->mem_res);
if (bcmp(ar->textRegion, ARLAN_SIGN, sizeof(ARLAN_SIGN) - 1)) {
if (bootverbose)
device_printf(dev, "not found\n");
error = ENOENT;
goto bad;
}
irq = ar->irqLevel;
if (irq == 2)
irq = 9;
error = bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1);
if (error)
goto bad;
error = arl_alloc_irq(dev, 0, 0);
if (error) {
if (bootverbose)
device_printf(dev, "Can't allocate IRQ %d\n", irq);
goto bad;
}
ar->controlRegister = 1; /* freeze board */
/* Memory test */
for (ptr = (u_char *) ar;
ptr < ((u_char *) ar + ARL_BASE_STEP - 1); ptr++) {
u_char c;
c = *ptr; *ptr = ~(*ptr);
if (*ptr != (u_char)~c) {
device_printf(dev, "board memory failed at [%lx]\n",
rman_get_start(sc->mem_res) + (ptr - (u_char *)ar));
break; /* skip memory test */
}
}
bzero((void *) ar, ARL_BASE_STEP - 1); /* clear board ram */
if (arl_wait_reset(sc, 100, ARDELAY)) {
error = ENXIO;
goto bad;
}
if (ar->diagnosticInfo == 0xFF) {
/* Copy arp to arpcom struct */
bcopy(ar->lanCardNodeId, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
device_set_desc_copy(dev, arl_make_desc(ar->hardwareType,
ar->radioModule));
error = 0;
} else {
if (bootverbose)
device_printf(dev, "board self-test failed (0x%x)!\n",
ar->diagnosticInfo);
error = ENXIO;
}
bad:
arl_release_resources(dev);
return (error);
}
static int
arl_isa_attach (device_t dev)
{
struct arl_softc *sc = device_get_softc(dev);
int error;
if (bootverbose)
device_printf(dev, "in attach\n");
arl_alloc_memory(dev, sc->mem_rid, ARL_BASE_STEP);
arl_alloc_irq(dev, sc->irq_rid, 0);
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET,
arl_intr, sc, &sc->irq_handle);
if (error) {
arl_release_resources(dev);
return (error);
}
#if __FreeBSD_version < 502108
device_printf(dev, "Ethernet address %6D\n", sc->arpcom.ac_enaddr, ":");
#endif
return arl_attach(dev);
}
static int
arl_isa_detach(device_t dev)
{
struct arl_softc *sc = device_get_softc(dev);
arl_stop(sc);
ifmedia_removeall(&sc->arl_ifmedia);
#if __FreeBSD_version < 500100
ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
#else
ether_ifdetach(&sc->arpcom.ac_if);
#endif
bus_teardown_intr(dev, sc->irq_res, sc->irq_handle);
arl_release_resources(dev);
return (0);
}
static device_method_t arl_isa_methods[] = {
/* Device interface */
DEVMETHOD(device_identify, arl_isa_identify),
DEVMETHOD(device_probe, arl_isa_probe),
DEVMETHOD(device_attach, arl_isa_attach),
DEVMETHOD(device_detach, arl_isa_detach),
{ 0, 0 }
};
static driver_t arl_isa_driver = {
"arl",
arl_isa_methods,
sizeof(struct arl_softc)
};
extern devclass_t arl_devclass;
DRIVER_MODULE(arl, isa, arl_isa_driver, arl_devclass, 0, 0);
MODULE_DEPEND(arl, isa, 1, 1, 1);
MODULE_DEPEND(arl, ether, 1, 1, 1);
-313
View File
@@ -1,313 +0,0 @@
/*
* $RISS: if_arl/dev/arl/if_arlreg.h,v 1.4 2004/03/16 04:43:27 count Exp $
* $FreeBSD$
*/
#ifndef _IF_ARLREG_H
#define _IF_ARLREG_H
#define ARL_BASE_START 0xC0000
#define ARL_BASE_END 0xDE000
#define ARL_BASE_STEP 0x2000
#define ARLAN_NAME_SIZE 16
#define ARLAN_NAME "ArLan655-SCT"
/*
* Statistics
*/
struct arl_stats {
u_int32_t numDatagramsTransmitted;
u_int32_t numReTransmissions;
u_int32_t numFramesDiscarded;
u_int32_t numDatagramsReceived;
u_int32_t numDuplicateReceivedFrames;
u_int32_t numDatagramsDiscarded;
u_int16_t maxNumReTransmitDatagram;
u_int16_t maxNumReTransmitFrames;
u_int16_t maxNumConsecutiveDuplicateFrames;
u_int32_t numBytesTransmitted;
u_int32_t numBytesReceived;
u_int32_t numCRCErrors;
u_int32_t numLengthErrors;
u_int32_t numAbortErrors;
u_int32_t numTXUnderruns;
u_int32_t numRXOverruns;
u_int32_t numHoldOffs;
u_int32_t numFramesTransmitted;
u_int32_t numFramesReceived;
u_int32_t numReceiveFramesLost;
u_int32_t numRXBufferOverflows;
u_int32_t numFramesDiscardedAddrMismatch;
u_int32_t numFramesDiscardedSIDMismatch;
u_int32_t numPollsTransmistted;
u_int32_t numPollAcknowledges;
u_int32_t numStatusVectorTimeouts;
u_int32_t numNACKReceived;
} __attribute__((packed));
/*
* Arlan private structure in memomory
*/
struct arl_private {
/* Header Signature */
char textRegion[48];
u_int8_t resetFlag;
u_int8_t diagnosticInfo;
u_int16_t diagnosticOffset;
u_int8_t _1[12];
u_int8_t lanCardNodeId[6];
u_int8_t broadcastAddress[6];
u_int8_t hardwareType;
u_int8_t majorHardwareVersion;
u_int8_t minorHardwareVersion;
u_int8_t radioModule;
u_int8_t defaultChannelSet;
u_int8_t _2[47];
/* Control/Status Block - 0x0080 */
u_int8_t interruptInProgress;
u_int8_t cntrlRegImage;
u_int8_t _3[14];
u_int8_t commandByte;
u_int8_t commandParameter[15];
/* Receive Status - 0x00a0 */
u_int8_t rxStatusVector;
u_int8_t rxFrmType;
u_int16_t rxOffset;
u_int16_t rxLength;
u_int8_t rxSrc[6];
u_int8_t rxBroadcastFlag;
u_int8_t rxQuality;
u_int8_t scrambled;
u_int8_t _4[1];
/* Transmit Status - 0x00b0 */
u_int8_t txStatusVector;
u_int8_t txAckQuality;
u_int8_t numRetries;
u_int8_t _5[14];
u_int8_t registeredRouter[6];
u_int8_t backboneRouter[6];
u_int8_t registrationStatus;
u_int8_t configuredStatusFlag;
u_int8_t _6[1];
u_int8_t ultimateDestAddress[6];
u_int8_t immedDestAddress[6];
u_int8_t immedSrcAddress[6];
u_int16_t rxSequenceNumber;
u_int8_t assignedLocaltalkAddress;
u_int8_t _7[27];
/* System Parameter Block */
/* - Driver Parameters (Novell Specific) */
u_int16_t txTimeout;
u_int16_t transportTime;
u_int8_t _8[4];
/* - Configuration Parameters */
u_int8_t irqLevel;
u_int8_t spreadingCode;
u_int8_t channelSet;
u_int8_t channelNumber;
u_int16_t radioNodeId;
u_int8_t _9[2];
u_int8_t scramblingDisable;
u_int8_t radioType;
u_int16_t routerId;
u_int8_t _10[9];
u_int8_t txAttenuation;
u_int8_t systemId[4]; /* on an odd address for a long !!! */
u_int16_t globalChecksum;
u_int8_t _11[4];
u_int16_t maxDatagramSize;
u_int16_t maxFrameSize;
u_int8_t maxRetries;
u_int8_t receiveMode;
u_int8_t priority;
u_int8_t rootOrRepeater;
u_int8_t specifiedRouter[6];
u_int16_t fastPollPeriod;
u_int8_t pollDecay;
u_int8_t fastPollDelay[2];
u_int8_t arlThreshold;
u_int8_t arlDecay;
u_int8_t _12[1];
u_int16_t specRouterTimeout;
u_int8_t _13[5];
/* Scrambled Area */
u_int8_t SID[4];
u_int8_t encryptionKey[12];
u_int8_t _14[2];
u_int8_t waitTime[2];
u_int8_t lParameter[2];
u_int8_t _15[3];
u_int16_t headerSize;
u_int16_t sectionChecksum;
u_int8_t registrationMode;
u_int8_t registrationFill;
u_int16_t pollPeriod;
u_int16_t refreshPeriod;
u_int8_t name[ARLAN_NAME_SIZE];
u_int8_t NID[6];
u_int8_t localTalkAddress;
u_int8_t codeFormat;
u_int8_t SSCode[64];
u_int8_t _16[0x140];
/* Statistics Block - 0x0300 */
u_int8_t hostcpuLock;
u_int8_t lancpuLock;
u_int8_t resetTime[18];
struct arl_stats stat;
u_int8_t _17[0x86];
u_int8_t txBuffer[0x800];
u_int8_t rxBuffer[0x800];
u_int8_t _18[0x0bfd];
u_int8_t resetFlag1;
u_int8_t _19;
u_int8_t controlRegister;
};
/*
* Transmit parametrs
*/
struct arl_tx_param {
u_int16_t offset;
u_int16_t length;
u_int8_t dest[6];
u_int8_t clear;
u_int8_t retries;
u_int8_t routing;
u_int8_t scrambled;
};
#define ARL_HARDWARE_RESET 0x01
#define ARL_CHANNEL_ATTENTION 0x02
#define ARL_INTERRUPT_ENABLE 0x04
#define ARL_CLEAR_INTERRUPT 0x08
/* additions for sys/sockio.h ( socket ioctl parameters for arlan card ) */
#define SIOCGARLQLT _IOWR('i', 70, struct ifreq) /* get QUALITY */
#define SIOCGARLALL _IOWR('i', 71, struct ifreq) /* get ALL */
#define SIOCSARLALL _IOWR('i', 72, struct ifreq) /* set paramter (who_set) */
#define SIOCGARLSTB _IOWR('i', 73, struct ifreq) /* get statistic block */
/*
* Arlan request struct via ioctl
*/
struct arl_cfg_param {
u_char name[ARLAN_NAME_SIZE];
u_int8_t sid[4];
u_int8_t channelSet;
u_int8_t channelNumber;
u_int8_t spreadingCode;
u_int8_t registrationMode;
u_int8_t lanCardNodeId[6];
u_int8_t specifiedRouter[6];
u_int8_t hardwareType;
u_int8_t majorHardwareVersion;
u_int8_t minorHardwareVersion;
u_int8_t radioModule;
u_int8_t priority;
u_int8_t receiveMode;
u_int8_t txRetry;
};
struct arl_req {
u_int32_t what_set;
struct arl_cfg_param cfg;
};
#ifdef ARLCACHE
#define MAXARLCACHE 16
#define ARLCACHE_RX 0
#define ARLCACHE_TX 1
struct arl_sigcache {
u_int8_t macsrc[6]; /* unique MAC address for entry */
u_int8_t level[2];
u_int8_t quality[2];
};
#endif
#define ARLAN_SET_name 0x0001
#define ARLAN_SET_sid 0x0002
#define ARLAN_SET_channelSet 0x0004
#define ARLAN_SET_channelNumber 0x0008
#define ARLAN_SET_spreadingCode 0x0010
#define ARLAN_SET_registrationMode 0x0020
#define ARLAN_SET_lanCardNodeId 0x0040
#define ARLAN_SET_specifiedRouter 0x0080
#define ARLAN_SET_priority 0x0100
#define ARLAN_SET_receiveMode 0x0200
#define ARLAN_SET_txRetry 0x0400
#ifdef _KERNEL
struct arl_softc {
struct arpcom arpcom; /* Ethernet common */
int arl_unit;
struct arl_private * arl_mem; /* arlan data */
struct arl_cfg_param arl_cfg; /* arlan vars in our mem */
u_char arl_control;
int mem_rid; /* resource id for mem */
struct resource* mem_res; /* resource for mem */
int irq_rid; /* resource id for irq */
struct resource* irq_res; /* resource for irq */
void* irq_handle; /* handle for irq handler */
u_char arl_tx[2048];
int tx_len;
u_char arl_rx[2048];
int rx_len;
#ifdef ARLCACHE
struct arl_sigcache arl_sigcache[MAXARLCACHE];
#endif
struct ifmedia arl_ifmedia;
};
#endif
#define ARLAN_SIGN "TELESYSTEM"
#define ARLAN_HEADER_SIZE 0x0C
#define ar sc->arl_mem
#define arcfg sc->arl_cfg
#define ARDELAY 10000
#define ARDELAY1 50000
#define WAIT_RESET(cnt, delay) \
do { \
int i; \
for (i = cnt; i && ar->resetFlag; i--) { \
DELAY(delay); \
} \
} while (0);
#ifdef _KERNEL
void arl_release_resources (device_t);
int arl_alloc_memory (device_t, int, int);
int arl_alloc_irq (device_t, int, int);
int arl_attach (device_t);
int arl_wait_reset (struct arl_softc *, int, int);
void arl_stop (struct arl_softc *);
driver_intr_t arl_intr;
#endif
#endif /* _IF_ARLREG_H */
+5 -7
View File
@@ -96,6 +96,7 @@
#include <vm/vm.h> /* for vtophys */
#include <vm/pmap.h> /* for vtophys */
#include <machine/atomic.h> /* for atomic_readandclear_32 */
#include <machine/clock.h> /* for DELAY */
#include <machine/bus_memio.h>
#include <machine/bus.h>
@@ -2232,11 +2233,14 @@ bge_intr(xsc)
{
struct bge_softc *sc;
struct ifnet *ifp;
u_int32_t statusword;
u_int32_t status;
sc = xsc;
ifp = &sc->arpcom.ac_if;
statusword =
atomic_readandclear_32(&sc->bge_rdata->bge_status_block.bge_status);
#ifdef notdef
/* Avoid this for now -- checking this register is expensive. */
@@ -2273,13 +2277,7 @@ bge_intr(xsc)
BRGPHY_INTRS);
}
} else {
if ((sc->bge_rdata->bge_status_block.bge_status &
BGE_STATFLAG_UPDATED) &&
(sc->bge_rdata->bge_status_block.bge_status &
BGE_STATFLAG_LINKSTATE_CHANGED)) {
sc->bge_rdata->bge_status_block.bge_status &=
~(BGE_STATFLAG_UPDATED|
BGE_STATFLAG_LINKSTATE_CHANGED);
if (statusword & BGE_STATFLAG_LINKSTATE_CHANGED) {
/*
* Sometimes PCS encoding errors are detected in
* TBI mode (on fiber NICs), and for some reason
+12 -7
View File
@@ -107,6 +107,11 @@ __FBSDID("$FreeBSD$");
#endif
#endif
/* If we don't have Cronyx's sppp version, we don't have fr support via sppp */
#ifndef PP_FR
#define PP_FR 0
#endif
#define CT_DEBUG(d,s) ({if (d->chan->debug) {\
printf ("%s: ", d->name); printf s;}})
#define CT_DEBUG2(d,s) ({if (d->chan->debug>1) {\
@@ -1333,7 +1338,7 @@ static int ct_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
#ifndef NETGRAPH
case SERIAL_GETPROTO:
strcpy ((char*)data, /*(d->pp.pp_flags & PP_FR) ? "fr" :*/
strcpy ((char*)data, (d->pp.pp_flags & PP_FR) ? "fr" :
(d->pp.pp_if.if_flags & PP_CISCO) ? "cisco" : "ppp");
return 0;
@@ -1351,21 +1356,21 @@ static int ct_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
if (d->pp.pp_if.if_flags & IFF_RUNNING)
return EBUSY;
if (! strcmp ("cisco", (char*)data)) {
/* d->pp.pp_flags &= ~(PP_FR);*/
d->pp.pp_flags &= ~(PP_FR);
d->pp.pp_flags |= PP_KEEPALIVE;
d->pp.pp_if.if_flags |= PP_CISCO;
/* } else if (! strcmp ("fr", (char*)data)) {
} else if (! strcmp ("fr", (char*)data)) {
d->pp.pp_if.if_flags &= ~(PP_CISCO);
d->pp.pp_flags |= PP_FR | PP_KEEPALIVE;*/
d->pp.pp_flags |= PP_FR | PP_KEEPALIVE;
} else if (! strcmp ("ppp", (char*)data)) {
d->pp.pp_flags &= ~(/*PP_FR | */PP_KEEPALIVE);
d->pp.pp_flags &= ~(PP_FR | PP_KEEPALIVE);
d->pp.pp_if.if_flags &= ~(PP_CISCO);
} else
return EINVAL;
return 0;
case SERIAL_GETKEEPALIVE:
if (/*(d->pp.pp_flags & PP_FR) ||*/
if ((d->pp.pp_flags & PP_FR) ||
(d->pp.pp_if.if_flags & PP_CISCO))
return EINVAL;
*(int*)data = (d->pp.pp_flags & PP_KEEPALIVE) ? 1 : 0;
@@ -1382,7 +1387,7 @@ static int ct_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
#endif /* __FreeBSD_version >= 500000 */
if (error)
return error;
if (/*(d->pp.pp_flags & PP_FR) ||*/
if ((d->pp.pp_flags & PP_FR) ||
(d->pp.pp_if.if_flags & PP_CISCO))
return EINVAL;
if (*(int*)data)
+13 -12
View File
@@ -110,6 +110,11 @@ __FBSDID("$FreeBSD$");
#endif
#endif
/* If we don't have Cronyx's sppp version, we don't have fr support via sppp */
#ifndef PP_FR
#define PP_FR 0
#endif
#define CX_DEBUG(d,s) ({if (d->chan->debug) {\
printf ("%s: ", d->name); printf s;}})
#define CX_DEBUG2(d,s) ({if (d->chan->debug>1) {\
@@ -226,7 +231,6 @@ static void disc_optim(struct tty *tp, struct termios *t);
static swihand_t cx_softintr;
#else
static void cx_softintr (void *);
static void *cx_slow_ih;
static void *cx_fast_ih;
#endif
static void cx_down (drv_t *d);
@@ -1810,7 +1814,7 @@ static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
CX_DEBUG2 (d, ("ioctl: getproto\n"));
s = splhigh ();
strcpy ((char*)data, (c->mode == M_ASYNC) ? "async" :
/*(d->pp.pp_flags & PP_FR) ? "fr" :*/
(d->pp.pp_flags & PP_FR) ? "fr" :
(d->pp.pp_if.if_flags & PP_CISCO) ? "cisco" : "ppp");
splx (s);
return 0;
@@ -1832,14 +1836,14 @@ static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
if (d->pp.pp_if.if_flags & IFF_RUNNING)
return EBUSY;
if (! strcmp ("cisco", (char*)data)) {
/* d->pp.pp_flags &= ~(PP_FR);*/
d->pp.pp_flags &= ~(PP_FR);
d->pp.pp_flags |= PP_KEEPALIVE;
d->pp.pp_if.if_flags |= PP_CISCO;
/* } else if (! strcmp ("fr", (char*)data)) {*/
/* d->pp.pp_if.if_flags &= ~(PP_CISCO);*/
/* d->pp.pp_flags |= PP_FR | PP_KEEPALIVE;*/
} else if (! strcmp ("fr", (char*)data)) {
d->pp.pp_if.if_flags &= ~(PP_CISCO);
d->pp.pp_flags |= PP_FR | PP_KEEPALIVE;
} else if (! strcmp ("ppp", (char*)data)) {
d->pp.pp_flags &= ~(/*PP_FR |*/ PP_KEEPALIVE);
d->pp.pp_flags &= ~(PP_FR | PP_KEEPALIVE);
d->pp.pp_if.if_flags &= ~(PP_CISCO);
} else
return EINVAL;
@@ -1847,7 +1851,7 @@ static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
case SERIAL_GETKEEPALIVE:
CX_DEBUG2 (d, ("ioctl: getkeepalive\n"));
if (/*(d->pp.pp_flags & PP_FR) ||*/
if ((d->pp.pp_flags & PP_FR) ||
(d->pp.pp_if.if_flags & PP_CISCO) ||
(c->mode == M_ASYNC))
return EINVAL;
@@ -1868,7 +1872,7 @@ static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
#endif /* __FreeBSD_version >= 500000 */
if (error)
return error;
if (/*(d->pp.pp_flags & PP_FR) ||*/
if ((d->pp.pp_flags & PP_FR) ||
(d->pp.pp_if.if_flags & PP_CISCO))
return EINVAL;
s = splhigh ();
@@ -3145,8 +3149,6 @@ static int cx_modevent (module_t mod, int type, void *unused)
#else
swi_add(&tty_ithd, "tty:cx", cx_softintr, NULL, SWI_TTY, 0,
&cx_fast_ih);
swi_add(&clk_ithd, "tty:cx", cx_softintr, NULL, SWI_TTY, 0,
&cx_slow_ih);
#endif
break;
case MOD_UNLOAD:
@@ -3163,7 +3165,6 @@ static int cx_modevent (module_t mod, int type, void *unused)
untimeout (cx_timeout, 0, timeout_handle);
#if __FreeBSD_version >= 500000
ithread_remove_handler (cx_fast_ih);
ithread_remove_handler (cx_slow_ih);
#else
unregister_swi (SWI_TTY, cx_softintr);
#endif
+2 -2
View File
@@ -104,12 +104,12 @@ gdt_make_dev(int unit)
#ifdef SDEV_PER_HBA
dev = make_dev(&iir_cdevsw, hba2minor(unit), UID_ROOT, GID_OPERATOR,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, "iir%d", unit);
S_IRUSR | S_IWUSR, "iir%d", unit);
#else
if (sdev_made)
return (0);
dev = make_dev(&iir_cdevsw, 0, UID_ROOT, GID_OPERATOR,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, "iir");
S_IRUSR | S_IWUSR, "iir");
sdev_made = 1;
#endif
return (dev);
-170
View File
@@ -1,170 +0,0 @@
/*-
* Written by: David Jeffery
* Copyright (c) 2002 Adaptec Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <dev/ips/ips.h>
#include <dev/ips/ips_disk.h>
#include <sys/stat.h>
static int ipsd_probe(device_t dev);
static int ipsd_attach(device_t dev);
static int ipsd_detach(device_t dev);
static disk_open_t ipsd_open;
static disk_close_t ipsd_close;
static disk_strategy_t ipsd_strategy;
static device_method_t ipsd_methods[] = {
DEVMETHOD(device_probe, ipsd_probe),
DEVMETHOD(device_attach, ipsd_attach),
DEVMETHOD(device_detach, ipsd_detach),
{ 0, 0 }
};
static driver_t ipsd_driver = {
"ipsd",
ipsd_methods,
sizeof(ipsdisk_softc_t)
};
static devclass_t ipsd_devclass;
DRIVER_MODULE(ipsd, ips, ipsd_driver, ipsd_devclass, 0, 0);
/* handle opening of disk device. It must set up all
information about the geometry and size of the disk */
static int ipsd_open(struct disk *dp)
{
ipsdisk_softc_t *dsc = dp->d_drv1;
dsc->state |= IPS_DEV_OPEN;
DEVICE_PRINTF(2, dsc->dev, "I'm open\n");
return 0;
}
static int ipsd_close(struct disk *dp)
{
ipsdisk_softc_t *dsc = dp->d_drv1;
dsc->state &= ~IPS_DEV_OPEN;
DEVICE_PRINTF(2, dsc->dev, "I'm closed for the day\n");
return 0;
}
/* ipsd_finish is called to clean up and return a completed IO request */
void ipsd_finish(struct bio *iobuf)
{
ipsdisk_softc_t *dsc;
dsc = iobuf->bio_disk->d_drv1;
if (iobuf->bio_flags & BIO_ERROR) {
ipsdisk_softc_t *dsc;
dsc = iobuf->bio_disk->d_drv1;
device_printf(dsc->dev, "iobuf error %d\n", iobuf->bio_error);
} else
iobuf->bio_resid = 0;
biodone(iobuf);
ips_start_io_request(dsc->sc);
}
static void ipsd_strategy(struct bio *iobuf)
{
ipsdisk_softc_t *dsc;
dsc = iobuf->bio_disk->d_drv1;
DEVICE_PRINTF(8,dsc->dev,"in strategy\n");
iobuf->bio_driver1 = (void *)(uintptr_t)dsc->sc->drives[dsc->disk_number].drivenum;
mtx_lock(&dsc->sc->queue_mtx);
bioq_disksort(&dsc->sc->queue, iobuf);
mtx_unlock(&dsc->sc->queue_mtx);
ips_start_io_request(dsc->sc);
}
static int ipsd_probe(device_t dev)
{
DEVICE_PRINTF(2,dev, "in probe\n");
device_set_desc(dev, "Logical Drive");
return 0;
}
static int ipsd_attach(device_t dev)
{
device_t adapter;
ipsdisk_softc_t *dsc;
u_int totalsectors;
DEVICE_PRINTF(2,dev, "in attach\n");
dsc = (ipsdisk_softc_t *)device_get_softc(dev);
bzero(dsc, sizeof(ipsdisk_softc_t));
adapter = device_get_parent(dev);
dsc->dev = dev;
dsc->sc = device_get_softc(adapter);
dsc->unit = device_get_unit(dev);
dsc->disk_number = (uintptr_t) device_get_ivars(dev);
dsc->ipsd_disk = disk_alloc();
dsc->ipsd_disk->d_drv1 = dsc;
dsc->ipsd_disk->d_name = "ipsd";
dsc->ipsd_disk->d_maxsize = IPS_MAX_IO_SIZE;
dsc->ipsd_disk->d_open = ipsd_open;
dsc->ipsd_disk->d_close = ipsd_close;
dsc->ipsd_disk->d_strategy = ipsd_strategy;
totalsectors = dsc->sc->drives[dsc->disk_number].sector_count;
if ((totalsectors > 0x400000) &&
((dsc->sc->adapter_info.miscflags & 0x8) == 0)) {
dsc->ipsd_disk->d_fwheads = IPS_NORM_HEADS;
dsc->ipsd_disk->d_fwsectors = IPS_NORM_SECTORS;
} else {
dsc->ipsd_disk->d_fwheads = IPS_COMP_HEADS;
dsc->ipsd_disk->d_fwsectors = IPS_COMP_SECTORS;
}
dsc->ipsd_disk->d_sectorsize = IPS_BLKSIZE;
dsc->ipsd_disk->d_mediasize = (off_t)totalsectors * IPS_BLKSIZE;
dsc->ipsd_disk->d_unit = dsc->unit;
dsc->ipsd_disk->d_flags = DISKFLAG_NEEDSGIANT;
disk_create(dsc->ipsd_disk, DISK_VERSION);
device_printf(dev, "Logical Drive (%dMB)\n",
dsc->sc->drives[dsc->disk_number].sector_count >> 11);
return 0;
}
static int ipsd_detach(device_t dev)
{
ipsdisk_softc_t *dsc;
DEVICE_PRINTF(2, dev,"in detach\n");
dsc = (ipsdisk_softc_t *)device_get_softc(dev);
if(dsc->state & IPS_DEV_OPEN)
return (EBUSY);
disk_destroy(dsc->ipsd_disk);
return 0;
}
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff. Show more