mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 19:34:43 +01:00
Compare commits
239
Commits
stable/14
...
releng/5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02bbf3743b | ||
|
|
4526ebb48c | ||
|
|
ab543a61d7 | ||
|
|
bf2ec5c140 | ||
|
|
950dff4647 | ||
|
|
976135f9e4 | ||
|
|
bcb617c756 | ||
|
|
d3ef18af69 | ||
|
|
23df981d66 | ||
|
|
ebdea8551c | ||
|
|
94d7dea578 | ||
|
|
fb6209c427 | ||
|
|
9e1ddfe3c9 | ||
|
|
abcf474963 | ||
|
|
83f0aa230c | ||
|
|
ca59393ddb | ||
|
|
a6411f70ca | ||
|
|
9ecf1aee2d | ||
|
|
04c9e3572e | ||
|
|
41b91afdc2 | ||
|
|
ebe53c53fe | ||
|
|
d873fa2ebe | ||
|
|
114d479577 | ||
|
|
a6f227a812 | ||
|
|
4ed8fdd9b5 | ||
|
|
a3ffaa9b79 | ||
|
|
f8bf448616 | ||
|
|
1aa5093e0c | ||
|
|
175b7923ab | ||
|
|
81dad2e2de | ||
|
|
954e957f9a | ||
|
|
75c2c9f78b | ||
|
|
4373f1b748 | ||
|
|
89f6d277b8 | ||
|
|
2c3e98f60f | ||
|
|
191d6519b5 | ||
|
|
5c0bdf492e | ||
|
|
6b2449dc01 | ||
|
|
84506e425e | ||
|
|
47227ef0ef | ||
|
|
aed3a60833 | ||
|
|
79d45b722e | ||
|
|
18d292b3f5 | ||
|
|
fd22bdcda3 | ||
|
|
f262080726 | ||
|
|
437023caac | ||
|
|
324410b130 | ||
|
|
81a2629ab4 | ||
|
|
d70e9e371f | ||
|
|
9bb7658d3b | ||
|
|
b319e9bb13 | ||
|
|
62693d7940 | ||
|
|
e163a73881 | ||
|
|
9344c6b1bb | ||
|
|
a1d5b922ad | ||
|
|
bec33ea3a3 | ||
|
|
eb88eabdbb | ||
|
|
7e061d8005 | ||
|
|
f06eec9bf3 | ||
|
|
e1aa00c762 | ||
|
|
3e4c096bc1 | ||
|
|
e857d511bb | ||
|
|
c77fe6a237 | ||
|
|
77da1dfed4 | ||
|
|
0d6d19d669 | ||
|
|
f520d6dd49 | ||
|
|
92084877a3 | ||
|
|
dd0236acfd | ||
|
|
f7fb6f7ed3 | ||
|
|
9517481705 | ||
|
|
aed56b6ced | ||
|
|
d5af844125 | ||
|
|
b457f2f130 | ||
|
|
1bde07251c | ||
|
|
8e6b153634 | ||
|
|
f94476e5b7 | ||
|
|
7f5c2313df | ||
|
|
9546d4a42d | ||
|
|
e331b72f54 | ||
|
|
283c506c2c | ||
|
|
c43e032c92 | ||
|
|
7dd9999442 | ||
|
|
89defd3f99 | ||
|
|
3c2bea0e49 | ||
|
|
c6e5df378a | ||
|
|
ee6a06f37b | ||
|
|
040e3b6595 | ||
|
|
223eec4c15 | ||
|
|
dc57b6568e | ||
|
|
d9450c1939 | ||
|
|
cb99a1ad27 | ||
|
|
fcecd0304d | ||
|
|
2b1928c5d2 | ||
|
|
3441df89b5 | ||
|
|
1ef5e4d32c | ||
|
|
ce54a5b9e8 | ||
|
|
6a0d99bf1c | ||
|
|
f3a7906554 | ||
|
|
b4ab92d026 | ||
|
|
d27a01d7b5 | ||
|
|
290df984e5 | ||
|
|
6cda28d739 | ||
|
|
abe7be067e | ||
|
|
79f9eca778 | ||
|
|
be0cee63ce | ||
|
|
7e04c6cf84 | ||
|
|
32332a216d | ||
|
|
37b40b4061 | ||
|
|
f77b5da9f8 | ||
|
|
2a8efd9a44 | ||
|
|
7c1794b81c | ||
|
|
d4980ad3fb | ||
|
|
7e5e754428 | ||
|
|
a703141641 | ||
|
|
6b932c64d3 | ||
|
|
f88fe1e93d | ||
|
|
1fad86d85b | ||
|
|
15cb47f783 | ||
|
|
539c394543 | ||
|
|
8ecdf38d5b | ||
|
|
23f2b21b5e | ||
|
|
19df117329 | ||
|
|
7da16554d8 | ||
|
|
cf9eda65db | ||
|
|
0adb32c5ed | ||
|
|
90dbfae419 | ||
|
|
4b4771f2e4 | ||
|
|
46bbb47ba2 | ||
|
|
8228174916 | ||
|
|
5771c65cbe | ||
|
|
a766cc23d1 | ||
|
|
55f85f29b3 | ||
|
|
739acab266 | ||
|
|
8af2bba4f5 | ||
|
|
04ad4f79cc | ||
|
|
13188342ca | ||
|
|
fe6e1a8d67 | ||
|
|
bf804df44d | ||
|
|
624a20b9bc | ||
|
|
a2ddb52669 | ||
|
|
6159064f20 | ||
|
|
4d1f402422 | ||
|
|
967e3e21e0 | ||
|
|
2a8fae3a02 | ||
|
|
3624b178df | ||
|
|
214881131f | ||
|
|
6fe2f22cd5 | ||
|
|
700d7701b1 | ||
|
|
8165ef981d | ||
|
|
bf1f67af46 | ||
|
|
8acc78086a | ||
|
|
61f90fd666 | ||
|
|
d41601c813 | ||
|
|
9d65f158fa | ||
|
|
016d3502d1 | ||
|
|
162a81637c | ||
|
|
14a12e05b1 | ||
|
|
8cb4999ffc | ||
|
|
b68297fa98 | ||
|
|
d1d99d8616 | ||
|
|
b45f4c1bd9 | ||
|
|
1118f8a560 | ||
|
|
31f7cca7a3 | ||
|
|
9daa5377cb | ||
|
|
a289a8f0da | ||
|
|
f2e01533ff | ||
|
|
7965b9f938 | ||
|
|
a9550f8238 | ||
|
|
7975a3066c | ||
|
|
78d18610c0 | ||
|
|
96376e110b | ||
|
|
4e62a22554 | ||
|
|
3375f90bf3 | ||
|
|
7e213158d1 | ||
|
|
3f62057b18 | ||
|
|
47651c8d3f | ||
|
|
95a5855916 | ||
|
|
2c2f985768 | ||
|
|
7ed9881d0e | ||
|
|
da52b5a854 | ||
|
|
fa7125615d | ||
|
|
d95d90eaf9 | ||
|
|
e9fbc636b2 | ||
|
|
d5bb058973 | ||
|
|
6fb0f92a97 | ||
|
|
1cfb9c2ad1 | ||
|
|
299fa84985 | ||
|
|
5227a62176 | ||
|
|
87c0ee0655 | ||
|
|
6c644fd482 | ||
|
|
c68d136000 | ||
|
|
9488f399ee | ||
|
|
c3e6538507 | ||
|
|
4a60485476 | ||
|
|
e76efebf7f | ||
|
|
75576f2747 | ||
|
|
90c9740639 | ||
|
|
58d80b808e | ||
|
|
8b3b79d41e | ||
|
|
e6497bb9f9 | ||
|
|
aae80a515c | ||
|
|
8bd7926344 | ||
|
|
ba49cd32cf | ||
|
|
162b3c2c36 | ||
|
|
7b43ea3ba2 | ||
|
|
fd265063ba | ||
|
|
58faebbb91 | ||
|
|
881fe6c7b1 | ||
|
|
96220312f4 | ||
|
|
b29039f9b4 | ||
|
|
02a397014e | ||
|
|
1025424b6d | ||
|
|
b704eed9e7 | ||
|
|
41d8aae2a1 | ||
|
|
e53e5a3acd | ||
|
|
500e6e618e | ||
|
|
3bfcb5e4e4 | ||
|
|
dac257bde8 | ||
|
|
e987334db4 | ||
|
|
46739d293f | ||
|
|
18b8177666 | ||
|
|
a1d4fa3b47 | ||
|
|
35d4c61a1e | ||
|
|
90c2d988df | ||
|
|
856dee1564 | ||
|
|
9ae603343e | ||
|
|
f1a97ac65b | ||
|
|
82f43bb6fc | ||
|
|
d610afcd3b | ||
|
|
60e4ee643a | ||
|
|
bdc25cd63c | ||
|
|
de1e262021 | ||
|
|
444aa2b3ac | ||
|
|
55b07c02f6 | ||
|
|
b7d513c629 | ||
|
|
d60cb4530b | ||
|
|
5f514a505e | ||
|
|
91ce9b18bd | ||
|
|
d2f155c07e |
No files matched your search
+1
-1
@@ -555,7 +555,7 @@ update:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR}; ${CVS} -q update -A -P -d
|
||||
cd ${.CURDIR}; ${CVS} -q update -rRELENG_5_0 -P -d
|
||||
.endif
|
||||
|
||||
#
|
||||
|
||||
@@ -1,21 +1,116 @@
|
||||
Updating Information for FreeBSD current users
|
||||
Updating Information for FreeBSD 5.0 Security Branch (RELENG_5_0) users.
|
||||
|
||||
This file is maintained and copyrighted by M. Warner Losh
|
||||
<[email protected]>. See end of file for further details. For commonly
|
||||
done items, please see the COMMON ITEMS: section later in the file.
|
||||
|
||||
NOTE TO PEOPLE WHO THINK THAT 5.0-CURRENT IS SLOW:
|
||||
FreeBSD 5.0-CURRENT has many debugging features turned on, in
|
||||
both the kernel and userland. These features attempt to detect
|
||||
incorrect use of system primitives, and encourage loud failure
|
||||
through extra sanity checking and fail stop semantics. They
|
||||
also substantially impact system performance. If you want to
|
||||
do performance measurement, benchmarking, and optimization,
|
||||
you'll want to turn them off. This includes various WITNESS-
|
||||
related kernel options, INVARIANTS, malloc debugging flags
|
||||
in userland, and various verbose features in the kernel. Many
|
||||
developers choose to disable these features on build machines
|
||||
to maximize performance.
|
||||
A reverse chronology since 5.0 was released is included, followed by
|
||||
the common items quick how-tos, followed by entries for versions of
|
||||
-current prior to 5.0 Release.
|
||||
|
||||
This is for the 5.0 release branch. All entries since 5.0 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.
|
||||
|
||||
20041118: p22 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.
|
||||
|
||||
20040519: p21 FreeBSD-SA-04:10.cvs
|
||||
Correct a heap overflow in cvs's pserver protocol parser.
|
||||
|
||||
20040205: p20 FreeBSD-SA-04:02.shmat
|
||||
Correct a reference counting bug in shmat(2).
|
||||
|
||||
20031126: p19 FreeBSD-SA-03:19.bind
|
||||
Corrected remote denial-of-service vulnerability in named(8).
|
||||
|
||||
20031003: p18 FreeBSD-SA-03:18.openssl
|
||||
Corrected vulnerabilities in OpenSSL ASN.1 parsing.
|
||||
|
||||
20031003: p17 FreeBSD-SA-03:17.procfs
|
||||
Correct integer underflows/overflows in procfs(5) and linprocfs(5).
|
||||
|
||||
20030924: p16 FreeBSD-SA-03:14.arp
|
||||
Updated fix for arplookup bug.
|
||||
|
||||
20030923: p15 FreeBSD-SA-03:14.arp
|
||||
Fix a bug in arplookup(), whereby a hostile party on a locally
|
||||
attached network could exhaust kernel memory, and cause a system
|
||||
panic, by sending a flood of spoofed ARP requests.
|
||||
|
||||
20030917: p14 FreeBSD-SA-03:13.sendmail
|
||||
Fix another address parsing buffer overflow.
|
||||
|
||||
20030916: p13 FreeBSD-SA-03:12.openssh
|
||||
Follow-up fixes for OpenSSH oversized packet buffer handling.
|
||||
|
||||
20030916: p12 FreeBSD-SA-03:12.openssh
|
||||
OpenSSH oversized packet buffer handling corrected.
|
||||
|
||||
20030825: p11 FreeBSD-SA-03:11.sendmail
|
||||
Sendmail DNS map problem corrected.
|
||||
|
||||
20030810: p10 FreeBSD-SA-03:10.iBCS2
|
||||
iBCS2 system call translator for statfs leaked information.
|
||||
|
||||
20030810: p9 FreeBSD-SA-03:09.signal
|
||||
Repair range-checking errors in signal handling.
|
||||
|
||||
20030804: p8 FreeBSD-SA-03:08.realpath
|
||||
Correct a single byte buffer overflow in realpath(3).
|
||||
|
||||
20030329: p7 FreeBSD-SA-03:07.sendmail
|
||||
sendmail address parsing buffer overflow.
|
||||
|
||||
20030321: p6 FreeBSD-SA-03:06.openssl
|
||||
enable RSA blinding by default
|
||||
fix PKCS #1 v1.5 padding vulnerability
|
||||
|
||||
20030320: p5 FreeBSD-SA-03:05.xdr
|
||||
integer overflow errors in the Sun XDR library.
|
||||
|
||||
20030303: p4 FreeBSD-SA-03:04.sendmail
|
||||
sendmail header parsing buffer overflow, ident parsing bug.
|
||||
|
||||
20030223: p3 FreeBSD-SA-03:03.syncookies
|
||||
Make brute force attacks on syncookies much more difficult.
|
||||
|
||||
20030220: p2 FreeBSD-SA-03:02.openssl
|
||||
Update to OpenSSL 0.9.6i in order to correct `Timing-based
|
||||
attacks on SSL/TLS with CBC encryption' vulnerability.
|
||||
|
||||
20030204: p1 FreeBSD-SA-03:01.cvs
|
||||
Correct a double-free bug and disable a dangerous feature in
|
||||
cvs.
|
||||
|
||||
20030129:
|
||||
Correct a bug where the xe(4) driver would discard a full-sized
|
||||
(1500-byte) Ethernet frame.
|
||||
|
||||
20030117:
|
||||
FreeBSD 5.0-RELEASE
|
||||
|
||||
20021222:
|
||||
For a period after the GCC 3.2.1 import (from 12/04 to 12/22), GCC
|
||||
used an incompatible form of ABI for returning structures and unions
|
||||
which FreeBSD's GCC maintainers were not aware of relative to previous
|
||||
versions of FreeBSD. We have gone back to the ABI for now, and any
|
||||
code compiled which is required to interoperate with other code (not
|
||||
built at the same time) returning structs or unions should be
|
||||
rebuilt.
|
||||
|
||||
20021216:
|
||||
A name change in /etc/netconfig has been reverted to stay
|
||||
compatible with with suns TIRPC and also with NetBSD. You need
|
||||
to run mergemaster after make world. A new libc does still work
|
||||
with a outdated /etc/netconfig for some time, but you'll get
|
||||
a warning. This warning will be removed in 20030301.
|
||||
|
||||
20021202:
|
||||
The recent binutils upgrade marks a kernel flag day on
|
||||
@@ -1131,7 +1226,7 @@ previous releases if your system is older than this.
|
||||
|
||||
Copyright information:
|
||||
|
||||
Copyright 1998, 2002 M. Warner Losh. All Rights Reserved.
|
||||
Copyright 1998-2003 M. Warner Losh. All Rights Reserved.
|
||||
|
||||
Redistribution, publication, translation and use, with or without
|
||||
modification, in full or in part, in any form or format of this
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= chflags
|
||||
SRCS= chflags.c
|
||||
|
||||
BINDIR= /bin
|
||||
NOSHARED?=yes
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -1,151 +0,0 @@
|
||||
.\" Copyright (c) 1989, 1990, 1993, 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to Berkeley by
|
||||
.\" the Institute of Electrical and Electronics Engineers, Inc.
|
||||
.\"
|
||||
.\" 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 the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
.\"
|
||||
.\" @(#)chflags.1 8.4 (Berkeley) 5/2/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 2, 1995
|
||||
.Dt CHFLAGS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm chflags
|
||||
.Nd change file flags
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Oo
|
||||
.Fl R
|
||||
.Op Fl H | Fl L | Fl P
|
||||
.Oc
|
||||
.Ar flags
|
||||
.Ar
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility modifies the file flags of the listed files
|
||||
as specified by the
|
||||
.Ar flags
|
||||
operand.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width indent
|
||||
.It Fl H
|
||||
If the
|
||||
.Fl R
|
||||
option is specified, symbolic links on the command line are followed.
|
||||
(Symbolic links encountered in the tree traversal are not followed.)
|
||||
.It Fl L
|
||||
If the
|
||||
.Fl R
|
||||
option is specified, all symbolic links are followed.
|
||||
.It Fl P
|
||||
If the
|
||||
.Fl R
|
||||
option is specified, no symbolic links are followed.
|
||||
This is the default.
|
||||
.It Fl R
|
||||
Change the file flags for the file hierarchies rooted
|
||||
in the files instead of just the files themselves.
|
||||
.El
|
||||
.Pp
|
||||
The flags are specified as an octal number or a comma separated list
|
||||
of keywords.
|
||||
The following keywords are currently defined:
|
||||
.Pp
|
||||
.Bl -tag -offset indent -width "opaque" -compact
|
||||
.It Ar arch
|
||||
set the archived flag (super-user only)
|
||||
.It Ar opaque
|
||||
set the opaque flag (owner or super-user only)
|
||||
.It Ar nodump
|
||||
set the nodump flag (owner or super-user only)
|
||||
.It Ar sappnd
|
||||
set the system append-only flag (super-user only)
|
||||
.It Ar schg
|
||||
set the system immutable flag (super-user only)
|
||||
.It Ar sunlnk
|
||||
set the system undeletable flag (super-user only)
|
||||
.It Ar uappnd
|
||||
set the user append-only flag (owner or super-user only)
|
||||
.It Ar uchg
|
||||
set the user immutable flag (owner or super-user only)
|
||||
.It Ar uunlnk
|
||||
set the user undeletable flag (owner or super-user only)
|
||||
.It Ar archived , sappend , schange , Xo
|
||||
.Ar simmutable , uappend , uchange , uimmutable ,
|
||||
.Ar sunlink , uunlink
|
||||
.Xc
|
||||
aliases for the above
|
||||
.El
|
||||
.Pp
|
||||
Putting the letters
|
||||
.Dq Ar no
|
||||
before an option causes the flag to be turned off.
|
||||
For example:
|
||||
.Bl -tag -offset indent -width "nouchg"
|
||||
.It Ar nouchg
|
||||
the immutable bit should be cleared
|
||||
.El
|
||||
.Pp
|
||||
Symbolic links do not have flags, so unless the
|
||||
.Fl H
|
||||
or
|
||||
.Fl L
|
||||
option is set,
|
||||
.Nm
|
||||
on a symbolic link always succeeds and has no effect.
|
||||
The
|
||||
.Fl H ,
|
||||
.Fl L
|
||||
and
|
||||
.Fl P
|
||||
options are ignored unless the
|
||||
.Fl R
|
||||
option is specified.
|
||||
In addition, these options override each other and the
|
||||
command's actions are determined by the last one specified.
|
||||
.Pp
|
||||
You can use "ls -lo" to see the flags of existing files.
|
||||
.Sh DIAGNOSTICS
|
||||
.Ex -std
|
||||
.Sh SEE ALSO
|
||||
.Xr ls 1 ,
|
||||
.Xr chflags 2 ,
|
||||
.Xr stat 2 ,
|
||||
.Xr fts 3 ,
|
||||
.Xr symlink 7
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command first appeared in
|
||||
.Bx 4.4 .
|
||||
@@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char copyright[] =
|
||||
"@(#) Copyright (c) 1992, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)chflags.c 8.5 (Berkeley) 4/1/94";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fts.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void usage(void);
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FTS *ftsp;
|
||||
FTSENT *p;
|
||||
u_long clear, set;
|
||||
long val;
|
||||
int Hflag, Lflag, Pflag, Rflag, ch, fts_options, oct, rval;
|
||||
char *flags, *ep;
|
||||
|
||||
Hflag = Lflag = Pflag = Rflag = 0;
|
||||
while ((ch = getopt(argc, argv, "HLPR")) != -1)
|
||||
switch (ch) {
|
||||
case 'H':
|
||||
Hflag = 1;
|
||||
Lflag = Pflag = 0;
|
||||
break;
|
||||
case 'L':
|
||||
Lflag = 1;
|
||||
Hflag = Pflag = 0;
|
||||
break;
|
||||
case 'P':
|
||||
Pflag = 1;
|
||||
Hflag = Lflag = 0;
|
||||
break;
|
||||
case 'R':
|
||||
Rflag = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
if (Rflag) {
|
||||
fts_options = FTS_PHYSICAL;
|
||||
if (Hflag)
|
||||
fts_options |= FTS_COMFOLLOW;
|
||||
if (Lflag) {
|
||||
fts_options &= ~FTS_PHYSICAL;
|
||||
fts_options |= FTS_LOGICAL;
|
||||
}
|
||||
} else
|
||||
fts_options = FTS_LOGICAL;
|
||||
|
||||
flags = *argv;
|
||||
if (*flags >= '0' && *flags <= '7') {
|
||||
errno = 0;
|
||||
val = strtol(flags, &ep, 8);
|
||||
if (val < 0)
|
||||
errno = ERANGE;
|
||||
if (errno)
|
||||
err(1, "invalid flags: %s", flags);
|
||||
if (*ep)
|
||||
errx(1, "invalid flags: %s", flags);
|
||||
set = val;
|
||||
oct = 1;
|
||||
} else {
|
||||
if (strtofflags(&flags, &set, &clear))
|
||||
errx(1, "invalid flag: %s", flags);
|
||||
clear = ~clear;
|
||||
oct = 0;
|
||||
}
|
||||
|
||||
if ((ftsp = fts_open(++argv, fts_options , 0)) == NULL)
|
||||
err(1, NULL);
|
||||
|
||||
for (rval = 0; (p = fts_read(ftsp)) != NULL;) {
|
||||
switch (p->fts_info) {
|
||||
case FTS_D:
|
||||
if (Rflag) /* Change it at FTS_DP. */
|
||||
continue;
|
||||
fts_set(ftsp, p, FTS_SKIP);
|
||||
break;
|
||||
case FTS_DNR: /* Warn, chflag, continue. */
|
||||
warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
|
||||
rval = 1;
|
||||
break;
|
||||
case FTS_ERR: /* Warn, continue. */
|
||||
case FTS_NS:
|
||||
warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
|
||||
rval = 1;
|
||||
continue;
|
||||
case FTS_SL: /* Ignore. */
|
||||
case FTS_SLNONE:
|
||||
/*
|
||||
* The only symlinks that end up here are ones that
|
||||
* don't point to anything and ones that we found
|
||||
* doing a physical walk.
|
||||
*/
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (oct) {
|
||||
if (!chflags(p->fts_accpath, set))
|
||||
continue;
|
||||
} else {
|
||||
p->fts_statp->st_flags |= set;
|
||||
p->fts_statp->st_flags &= clear;
|
||||
if (!chflags(p->fts_accpath, (u_long)p->fts_statp->st_flags))
|
||||
continue;
|
||||
}
|
||||
warn("%s", p->fts_path);
|
||||
rval = 1;
|
||||
}
|
||||
if (errno)
|
||||
err(1, "fts_read");
|
||||
exit(rval);
|
||||
}
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: chflags [-R [-H | -L | -P]] flags file ...\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
/* config.h. Generated automatically by configure. */
|
||||
/*
|
||||
* config.h -- configure various defines for tcsh
|
||||
*
|
||||
* All source files should #include this FIRST.
|
||||
*
|
||||
* Edit this to match your system type.
|
||||
*/
|
||||
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _h_config
|
||||
#define _h_config
|
||||
/****************** System dependant compilation flags ****************/
|
||||
/*
|
||||
* POSIX This system supports IEEE Std 1003.1-1988 (POSIX).
|
||||
*/
|
||||
#define POSIX
|
||||
|
||||
/*
|
||||
* POSIXJOBS This system supports the optional IEEE Std 1003.1-1988 (POSIX)
|
||||
* job control facilities.
|
||||
*/
|
||||
#define POSIXJOBS
|
||||
|
||||
/*
|
||||
* POSIXSIGS Use the POSIX signal facilities to emulate BSD signals.
|
||||
*/
|
||||
/* #undef POSIXSIGS */
|
||||
|
||||
/*
|
||||
* VFORK This machine has a vfork().
|
||||
* It used to be that for job control to work, this define
|
||||
* was mandatory. This is not the case any more.
|
||||
* If you think you still need it, but you don't have vfork,
|
||||
* define this anyway and then do #define vfork fork.
|
||||
* I do this anyway on a Sun because of yellow pages brain damage,
|
||||
* [should not be needed under 4.1]
|
||||
* and on the iris4d cause SGI's fork is sufficiently "virtual"
|
||||
* that vfork isn't necessary. (Besides, SGI's vfork is weird).
|
||||
* Note that some machines eg. rs6000 have a vfork, but not
|
||||
* with the berkeley semantics, so we cannot use it there either.
|
||||
*/
|
||||
#define VFORK
|
||||
|
||||
/*
|
||||
* BSDJOBS You have BSD-style job control (both process groups and
|
||||
* a tty that deals correctly
|
||||
*/
|
||||
#define BSDJOBS
|
||||
|
||||
/*
|
||||
* BSDSIGS You have 4.2-style signals, rather than USG style.
|
||||
* Note: POSIX systems should not define this unless they
|
||||
* have sigvec() and friends (ie: 4.3BSD-RENO, HP-UX).
|
||||
*/
|
||||
#define BSDSIGS
|
||||
|
||||
/*
|
||||
* BSDTIMES You have BSD-style process time stuff (like rusage)
|
||||
* This may or may not be true. For example, Apple Unix
|
||||
* (OREO) has BSDJOBS and BSDSIGS but not BSDTIMES.
|
||||
*/
|
||||
#define BSDTIMES
|
||||
|
||||
/*
|
||||
* BSDLIMIT You have BSD-style resource limit stuff (getrlimit/setrlimit)
|
||||
*/
|
||||
#define BSDLIMIT
|
||||
|
||||
/*
|
||||
* BSDNICE Your system uses setpriority() instead of nice, to
|
||||
* change a processes scheduling priority
|
||||
*/
|
||||
#define BSDNICE
|
||||
|
||||
/*
|
||||
* TERMIO You have struct termio instead of struct sgttyb.
|
||||
* This is usually the case for SYSV systems, where
|
||||
* BSD uses sgttyb. POSIX systems should define this
|
||||
* anyway, even though they use struct termios.
|
||||
*/
|
||||
#define TERMIO
|
||||
|
||||
/*
|
||||
* SYSVREL Your machine is SYSV based (HPUX, A/UX)
|
||||
* NOTE: don't do this if you are on a Pyramid -- tcsh is
|
||||
* built in a BSD universe.
|
||||
* Set SYSVREL to 1, 2, 3, or 4, depending the version of System V
|
||||
* you are running. Or set it to 0 if you are not SYSV based
|
||||
*/
|
||||
#define SYSVREL 0
|
||||
|
||||
/*
|
||||
* YPBUGS Work around Sun YP bugs that cause expansion of ~username
|
||||
* to send command output to /dev/null
|
||||
*/
|
||||
/* #undef YPBUGS */
|
||||
|
||||
/*
|
||||
* SIGVOID Define this if your signal handlers return void. On older
|
||||
* systems, signal returns int, but on newer ones, it returns void.
|
||||
*/
|
||||
#define SIGVOID
|
||||
|
||||
/*
|
||||
* HAVEDUP2 Define this if your system supports dup2().
|
||||
*/
|
||||
#define HAVEDUP2
|
||||
|
||||
/*
|
||||
* UTHOST Does the utmp file have a host field?
|
||||
*/
|
||||
#define UTHOST
|
||||
|
||||
/*
|
||||
* DIRENT Your system has <dirent.h> instead of <sys/dir.h>
|
||||
*/
|
||||
#define DIRENT
|
||||
/****************** local defines *********************/
|
||||
/****************** configurable hacks ****************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* have been moved to config_f.h */
|
||||
#include "config_f.h"
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#define NLS_BUGS
|
||||
/* we want to use the system malloc when we install as /bin/csh */
|
||||
#define SYSMALLOC
|
||||
#define BSD_STYLE_COLORLS
|
||||
#endif
|
||||
|
||||
#if defined(__bsdi__)
|
||||
/*
|
||||
* _PATH_TCSHELL if you've change the installation location (vix)
|
||||
*/
|
||||
# if _BSDI_VERSION >= 199701
|
||||
# define _PATH_TCSHELL "/bin/tcsh"
|
||||
/* # undef SYSMALLOC */
|
||||
# define SYSMALLOC
|
||||
# else
|
||||
# define _PATH_TCSHELL "/usr/contrib/bin/tcsh"
|
||||
# endif
|
||||
|
||||
# undef NLS
|
||||
# undef NLS_CATALOGS
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define SYSMALLOC
|
||||
|
||||
#else
|
||||
# define NLS_CATALOGS
|
||||
#endif
|
||||
|
||||
#define KANJI
|
||||
#define DSPMBYTE
|
||||
|
||||
#endif /* _h_config */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
+3
-4
@@ -381,8 +381,7 @@ static void
|
||||
prtstat(struct statfs *sfsp, struct maxwidths *mwp)
|
||||
{
|
||||
static long blocksize;
|
||||
static int timesthrough;
|
||||
static size_t headerlen;
|
||||
static int headerlen, timesthrough;
|
||||
static const char *header;
|
||||
long used, availblks, inodes;
|
||||
|
||||
@@ -393,7 +392,7 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
|
||||
mwp->total = mwp->used = mwp->avail = strlen(header);
|
||||
} else {
|
||||
header = getbsize(&headerlen, &blocksize);
|
||||
mwp->total = imax(mwp->total, (int)headerlen);
|
||||
mwp->total = imax(mwp->total, headerlen);
|
||||
}
|
||||
mwp->used = imax(mwp->used, strlen("Used"));
|
||||
mwp->avail = imax(mwp->avail, strlen("Avail"));
|
||||
@@ -442,7 +441,7 @@ static void
|
||||
update_maxwidths(struct maxwidths *mwp, struct statfs *sfsp)
|
||||
{
|
||||
static long blocksize;
|
||||
size_t dummy;
|
||||
int dummy;
|
||||
|
||||
if (blocksize == 0)
|
||||
getbsize(&dummy, &blocksize);
|
||||
|
||||
+13
-6
@@ -448,7 +448,8 @@ traverse(int argc, char *argv[], int options)
|
||||
* If not recursing down this tree and don't need stat info, just get
|
||||
* the names.
|
||||
*/
|
||||
ch_options = !f_recursive && options & FTS_NOSTAT ? FTS_NAMEONLY : 0;
|
||||
ch_options = !f_recursive && !f_label &&
|
||||
options & FTS_NOSTAT ? FTS_NAMEONLY : 0;
|
||||
|
||||
while ((p = fts_read(ftsp)) != NULL)
|
||||
switch (p->fts_info) {
|
||||
@@ -691,7 +692,9 @@ display(FTSENT *p, FTSENT *list, int options)
|
||||
|
||||
error = mac_prepare_file_label(&label);
|
||||
if (error == -1) {
|
||||
warn("%s", cur->fts_name);
|
||||
warn("MAC label for %s/%s",
|
||||
cur->fts_parent->fts_path,
|
||||
cur->fts_name);
|
||||
goto label_out;
|
||||
}
|
||||
|
||||
@@ -700,8 +703,8 @@ display(FTSENT *p, FTSENT *list, int options)
|
||||
"%s", cur->fts_name);
|
||||
else
|
||||
snprintf(name, sizeof(name),
|
||||
"%s/%s", cur->fts_parent->fts_accpath,
|
||||
cur->fts_name);
|
||||
"%s/%s", cur->fts_parent->
|
||||
fts_accpath, cur->fts_name);
|
||||
|
||||
if (options & FTS_LOGICAL)
|
||||
error = mac_get_file(name,
|
||||
@@ -710,7 +713,9 @@ display(FTSENT *p, FTSENT *list, int options)
|
||||
error = mac_get_link(name,
|
||||
label);
|
||||
if (error == -1) {
|
||||
warn("%s", cur->fts_name);
|
||||
warn("MAC label for %s/%s",
|
||||
cur->fts_parent->fts_path,
|
||||
cur->fts_name);
|
||||
mac_free(label);
|
||||
goto label_out;
|
||||
}
|
||||
@@ -718,7 +723,9 @@ display(FTSENT *p, FTSENT *list, int options)
|
||||
error = mac_to_text(label,
|
||||
&labelstr);
|
||||
if (error == -1) {
|
||||
warn("%s", cur->fts_name);
|
||||
warn("MAC label for %s/%s",
|
||||
cur->fts_parent->fts_path,
|
||||
cur->fts_name);
|
||||
mac_free(label);
|
||||
goto label_out;
|
||||
}
|
||||
|
||||
@@ -674,6 +674,14 @@ aclmode(char *buf, FTSENT *p, int *haveacls)
|
||||
else
|
||||
snprintf(name, sizeof(name), "%s/%s",
|
||||
p->fts_parent->fts_accpath, p->fts_name);
|
||||
/*
|
||||
* We have no way to tell whether a symbolic link has an ACL since
|
||||
* pathconf() and acl_get_file() both follow them.
|
||||
*/
|
||||
if (S_ISLNK(p->fts_statp->st_mode)) {
|
||||
*haveacls = 1;
|
||||
return;
|
||||
}
|
||||
if ((ret = pathconf(name, _PC_ACL_EXTENDED)) <= 0) {
|
||||
if (ret < 0 && errno != EINVAL)
|
||||
warn("%s", name);
|
||||
|
||||
@@ -49,12 +49,9 @@ main(int argc, char *argv[])
|
||||
char buf[PATH_MAX];
|
||||
char *p;
|
||||
|
||||
if (argc == 1) {
|
||||
if ((p = getcwd(NULL, 0)) == NULL)
|
||||
err(1, "getcwd()");
|
||||
} else if (argc == 2) {
|
||||
if (argc == 2) {
|
||||
if ((p = realpath(argv[1], buf)) == NULL)
|
||||
err(1, "%s", argv[1]);
|
||||
err(1, "%s", buf);
|
||||
} else
|
||||
usage();
|
||||
(void)printf("%s\n", p);
|
||||
@@ -65,6 +62,6 @@ static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "usage: realpath [path]\n");
|
||||
(void)fprintf(stderr, "usage: realpath path\n");
|
||||
exit(1);
|
||||
}
|
||||
+4
-1
@@ -1790,7 +1790,10 @@ Cause the shell to parse and execute
|
||||
when any specified
|
||||
.Ar signal
|
||||
is received.
|
||||
The signals are specified by signal number.
|
||||
The signals are specified by name or number.
|
||||
In addition, the pseudo-signal
|
||||
.Ic EXIT
|
||||
may be used to specify an action that is performed when the shell terminates.
|
||||
The
|
||||
.Ar action
|
||||
may be null or omitted;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= uuidgen
|
||||
WARNS?= 4
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -1,74 +0,0 @@
|
||||
.\" Copyright (c) 2002 Marcel Moolenaar
|
||||
.\" 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 ``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 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 May 23, 2002
|
||||
.Dt UUIDGEN 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm uuidgen
|
||||
.Nd generate universally unique identifiers
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl 1
|
||||
.Op Fl n Ar count
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility by default generates a single universally unique identifier (UUID),
|
||||
also known as a globally unique identifier (GUID).
|
||||
The UUID is written to stdout.
|
||||
The following options can be used to change the number of identifiers
|
||||
and the method used:
|
||||
.Bl -tag -width indent
|
||||
.It Fl 1
|
||||
This option only has effect if multiple identifiers are to be generated and
|
||||
instructs
|
||||
.Nm
|
||||
to not generate them in batch, but one at a time.
|
||||
.It Fl n
|
||||
This option controls the number of identifiers generated.
|
||||
By default, multiple
|
||||
identifiers are generated in batch.
|
||||
.El
|
||||
.Pp
|
||||
Batched generation yields a dense set of identifiers in such a way that there
|
||||
is no identifier that is larger than the smallest identifier in the set and
|
||||
smaller than the largest identifier in the set and that is not already in the
|
||||
set.
|
||||
.Pp
|
||||
When generating the identifiers one at a time, the identifiers will be close
|
||||
to each other, but operating system latency and processing time will be
|
||||
reflected in the distance between two successive identifiers.
|
||||
.Sh DIAGNOSTICS
|
||||
.Ex -std
|
||||
.Sh SEE ALSO
|
||||
.Xr uuidgen 2 ,
|
||||
.Xr uuid 3
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command first appeared in
|
||||
.Fx 5.0 .
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002 Marcel Moolenaar
|
||||
* 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 ``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 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 <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <uuid.h>
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, "usage: uuidgen [-1] [-n count]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
uuid_t *store, *uuid;
|
||||
char *p;
|
||||
int ch, count, i, iterate;
|
||||
|
||||
count = -1; /* no count yet */
|
||||
iterate = 0; /* not one at a time */
|
||||
while ((ch = getopt(argc, argv, "1n:")) != -1)
|
||||
switch (ch) {
|
||||
case '1':
|
||||
iterate = 1;
|
||||
break;
|
||||
case 'n':
|
||||
if (count > 0)
|
||||
usage();
|
||||
count = strtol(optarg, &p, 10);
|
||||
if (*p != 0 || count < 1)
|
||||
usage();
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if (argc)
|
||||
usage();
|
||||
|
||||
if (count == -1)
|
||||
count = 1;
|
||||
|
||||
store = (uuid_t*)malloc(sizeof(uuid_t) * count);
|
||||
if (store == NULL)
|
||||
err(1, "malloc()");
|
||||
|
||||
if (!iterate) {
|
||||
/* Get them all in a single batch */
|
||||
if (uuidgen(store, count) != 0)
|
||||
err(1, "uuidgen()");
|
||||
} else {
|
||||
uuid = store;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (uuidgen(uuid++, 1) != 0)
|
||||
err(1, "uuidgen()");
|
||||
}
|
||||
}
|
||||
|
||||
uuid = store;
|
||||
while (count--) {
|
||||
uuid_to_string(uuid++, &p, NULL);
|
||||
printf("%s\n", p);
|
||||
free(p);
|
||||
}
|
||||
|
||||
free(store);
|
||||
return (0);
|
||||
}
|
||||
@@ -580,7 +580,7 @@ extern char *haseq(char *);
|
||||
extern int is_network_member(const char *net);
|
||||
extern int islocalnet(u_long);
|
||||
extern int make_nfs_auth(void);
|
||||
extern int make_rpc_packet(char *, int, u_long, struct rpc_msg *, voidp, XDRPROC_T_TYPE, AUTH *);
|
||||
extern int make_rpc_packet(char *, int, u_int, struct rpc_msg *, voidp, XDRPROC_T_TYPE, AUTH *);
|
||||
extern int mapc_keyiter(mnt_map *, void(*)(char *, voidp), voidp);
|
||||
extern int mapc_search(mnt_map *, char *, char **);
|
||||
extern int mapc_type_exists(const char *type);
|
||||
|
||||
@@ -123,7 +123,7 @@ drop:
|
||||
|
||||
|
||||
int
|
||||
make_rpc_packet(char *buf, int buflen, u_long proc, struct rpc_msg *mp, voidp arg, XDRPROC_T_TYPE arg_xdr, AUTH *auth)
|
||||
make_rpc_packet(char *buf, int buflen, u_int proc, struct rpc_msg *mp, voidp arg, XDRPROC_T_TYPE arg_xdr, AUTH *auth)
|
||||
{
|
||||
XDR msg_xdr;
|
||||
int len;
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.3.3-REL
|
||||
8.3.3-REL-p1
|
||||
@@ -272,7 +272,7 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
|
||||
u_int qtype, qclass;
|
||||
int restart; /* flag for processing cname response */
|
||||
int validanswer, dbflags;
|
||||
int cname, lastwascname, externalcname;
|
||||
int cname, lastwascname, externalcname, cachenegative;
|
||||
int count, founddata, foundname;
|
||||
int buflen;
|
||||
int newmsglen;
|
||||
@@ -912,6 +912,7 @@ tcp_retry:
|
||||
cname = 0;
|
||||
lastwascname = 0;
|
||||
externalcname = 0;
|
||||
cachenegative = 1;
|
||||
strcpy(aname, qname);
|
||||
|
||||
if (count) {
|
||||
@@ -981,6 +982,7 @@ tcp_retry:
|
||||
name);
|
||||
db_detach(&dp);
|
||||
validanswer = 0;
|
||||
cachenegative = 0;
|
||||
continue;
|
||||
}
|
||||
if (type == T_CNAME &&
|
||||
@@ -1011,6 +1013,7 @@ tcp_retry:
|
||||
"last was cname, ignoring auth. and add.");
|
||||
db_detach(&dp);
|
||||
validanswer = 0;
|
||||
cachenegative = 0;
|
||||
break;
|
||||
}
|
||||
if (i < arfirst) {
|
||||
@@ -1026,6 +1029,7 @@ tcp_retry:
|
||||
sin_ntoa(from));
|
||||
db_detach(&dp);
|
||||
validanswer = 0;
|
||||
cachenegative = 0;
|
||||
continue;
|
||||
} else if (!ns_samedomain(name,
|
||||
qp->q_domain)) {
|
||||
@@ -1039,6 +1043,7 @@ tcp_retry:
|
||||
sin_ntoa(from));
|
||||
db_detach(&dp);
|
||||
validanswer = 0;
|
||||
cachenegative = 0;
|
||||
continue;
|
||||
}
|
||||
if (type == T_NS) {
|
||||
@@ -1231,8 +1236,9 @@ tcp_retry:
|
||||
)
|
||||
)
|
||||
{
|
||||
cache_n_resp(msg, msglen, from, qp->q_name,
|
||||
qp->q_class, qp->q_type);
|
||||
if (cachenegative)
|
||||
cache_n_resp(msg, msglen, from, qp->q_name,
|
||||
qp->q_class, qp->q_type);
|
||||
|
||||
if (!qp->q_cmsglen && validanswer) {
|
||||
ns_debug(ns_log_default, 3,
|
||||
|
||||
@@ -978,9 +978,6 @@ dirswitch (dir, repos)
|
||||
return;
|
||||
}
|
||||
|
||||
if (dir_name != NULL)
|
||||
free (dir_name);
|
||||
|
||||
dir_len = strlen (dir);
|
||||
|
||||
/* Check for a trailing '/'. This is not ISDIRSEP because \ in the
|
||||
@@ -996,6 +993,9 @@ dirswitch (dir, repos)
|
||||
return;
|
||||
}
|
||||
|
||||
if (dir_name != NULL)
|
||||
free (dir_name);
|
||||
|
||||
dir_name = malloc (strlen (server_temp_dir) + dir_len + 40);
|
||||
if (dir_name == NULL)
|
||||
{
|
||||
@@ -1648,8 +1648,18 @@ serve_unchanged (arg)
|
||||
&& strncmp (arg, name, cp - name) == 0)
|
||||
{
|
||||
timefield = strchr (cp + 1, '/') + 1;
|
||||
if (*timefield != '=')
|
||||
/* 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 +1667,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;
|
||||
}
|
||||
}
|
||||
@@ -1692,8 +1711,18 @@ serve_is_modified (arg)
|
||||
&& strncmp (arg, name, cp - name) == 0)
|
||||
{
|
||||
timefield = strchr (cp + 1, '/') + 1;
|
||||
if (!(timefield[0] == 'M' && timefield[1] == '/'))
|
||||
/* 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 +1730,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))
|
||||
@@ -4752,8 +4790,8 @@ struct request requests[] =
|
||||
REQ_LINE("Max-dotdot", serve_max_dotdot, 0),
|
||||
REQ_LINE("Static-directory", serve_static_directory, 0),
|
||||
REQ_LINE("Sticky", serve_sticky, 0),
|
||||
REQ_LINE("Checkin-prog", serve_checkin_prog, 0),
|
||||
REQ_LINE("Update-prog", serve_update_prog, 0),
|
||||
REQ_LINE("Checkin-prog", serve_noop, 0),
|
||||
REQ_LINE("Update-prog", serve_noop, 0),
|
||||
REQ_LINE("Entry", serve_entry, RQ_ESSENTIAL),
|
||||
REQ_LINE("Kopt", serve_kopt, 0),
|
||||
REQ_LINE("Checkin-time", serve_checkin_time, 0),
|
||||
|
||||
@@ -1244,7 +1244,6 @@ optimization_options (level, size)
|
||||
specifying them, we will set the defaults in override_options. */
|
||||
if (optimize >= 1)
|
||||
flag_omit_frame_pointer = 2;
|
||||
flag_pcc_struct_return = 2;
|
||||
flag_asynchronous_unwind_tables = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -688,6 +688,7 @@
|
||||
.ds doc-str-Lb-libposix \*[Px] Compatibility Library (libposix, \-lposix)
|
||||
.ds doc-str-Lb-libresolv DNS Resolver Library (libresolv, \-lresolv)
|
||||
.ds doc-str-Lb-libtermcap Termcap Access Library (libtermcap, \-ltermcap)
|
||||
.ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw)
|
||||
.ds doc-str-Lb-libutil System Utilities Library (libutil, \-lutil)
|
||||
.ds doc-str-Lb-libz Compression Library (libz, \-lz)
|
||||
.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2003 Internet Software Consortium.
|
||||
* Use is subject to license terms which appear in the file named
|
||||
* ISC-LICENSE that should have accompanied this file when you
|
||||
* received it. If a file named ISC-LICENSE did not accompany this
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# ex:ts=8
|
||||
$FreeBSD$
|
||||
|
||||
ISC DHCP client 3.0.1rc8
|
||||
ISC DHCP client 3.0.1rc11
|
||||
originals can be found at: ftp://ftp.isc.org/isc/dhcp/
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ For the import of ISC-dhclient the following files were removed:
|
||||
nextstep solaris openbsd
|
||||
|
||||
contrib/
|
||||
dhcp.spec solaris.init
|
||||
dhcp.spec solaris.init ms2isc/
|
||||
|
||||
include/cf/
|
||||
aix.h alphaosf.h bsdos.h
|
||||
@@ -24,12 +24,12 @@ For the import of ISC-dhclient the following files were removed:
|
||||
sample.h sco.h sunos4.h
|
||||
sunos5-5.h ultrix.h
|
||||
|
||||
`find . -name '.cvsignore'`
|
||||
`find . -name '.cvsignore' -delete`
|
||||
|
||||
Imported by:
|
||||
|
||||
cvs import -m 'Import ISC DHCP 3.0.1 RC8 client.' \
|
||||
src/contrib/isc-dhcp ISC isc_dhcp_3_0_1_rc8
|
||||
cvs import -m 'Import ISC DHCP 3.0.1 RC11 client.' \
|
||||
src/contrib/isc-dhcp ISC isc_dhcp_3_0_1_rc11
|
||||
|
||||
|
||||
To make local changes to isc-dhcp, simply patch and commit to the main
|
||||
@@ -60,4 +60,4 @@ Local Changes:
|
||||
|
||||
[email protected]
|
||||
[email protected]
|
||||
01-Apr-2002
|
||||
15-Jan-2003
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile
|
||||
#
|
||||
# Copyright (c) 2000 Internet Software Consortium.
|
||||
# Copyright (c) 2002 Internet Software Consortium.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.conf
|
||||
#
|
||||
# Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
# Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
# Use is subject to license terms which appear in the file named
|
||||
# ISC-LICENSE that should have accompanied this file when you
|
||||
# received it. If a file named ISC-LICENSE did not accompany this
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.dist
|
||||
#
|
||||
# Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
# Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
# Use is subject to license terms which appear in the file named
|
||||
# ISC-LICENSE that should have accompanied this file when you
|
||||
# received it. If a file named ISC-LICENSE did not accompany this
|
||||
|
||||
+3
-13
@@ -97,7 +97,7 @@ system.
|
||||
|
||||
RELEASE STATUS
|
||||
|
||||
This is the ninth release candidate of version 3.0.1 of the ISC DHCP
|
||||
This is the tenth release candidate of version 3.0.1 of the ISC DHCP
|
||||
Distribution. Development of this release is approaching the point at
|
||||
which it will be frozen, and no significant new features will be
|
||||
added.
|
||||
@@ -143,14 +143,14 @@ information. On Digital Unix, type ``man pfilt''.
|
||||
To build the DHCP Distribution, unpack the compressed tar file using
|
||||
the tar utility and the gzip command - type something like:
|
||||
|
||||
zcat dhcp-3.0.1rc9.tar.gz |tar xvf -
|
||||
zcat dhcp-3.0.1rc11.tar.gz |tar xvf -
|
||||
|
||||
On BSD/OS, you have to type gzcat, not zcat, and you may run into
|
||||
similar problems on other operating systems.
|
||||
|
||||
CONFIGURING IT
|
||||
|
||||
Now, cd to the dhcp-3.0.1rc9 subdirectory that you've just
|
||||
Now, cd to the dhcp-3.0.1rc11 subdirectory that you've just
|
||||
created and configure the source tree by typing:
|
||||
|
||||
./configure
|
||||
@@ -244,16 +244,6 @@ network interface. There are also two potential compilation/runtime
|
||||
problems for Linux 2.1/2.2: the "SO_ATTACH_FILTER undeclared" problem
|
||||
and the "protocol not configured" problem.
|
||||
|
||||
LINUX: IF_TR.H NOT FOUND
|
||||
|
||||
When you compile the distribution on Linux, you may get an error
|
||||
message indicating that the include file if_tr.h could not be found.
|
||||
If this happens, go into includes/cf/linux.h and delete the line that
|
||||
defined HAVE_TR_SUPPORT, or look into installing a new version of libc
|
||||
that includes the if_tr.h file. We will be working on removing this
|
||||
problem in the future, but for now, if you run into it, this should be
|
||||
a viable workaround.
|
||||
|
||||
LINUX: SO_ATTACH_FILTER UNDECLARED
|
||||
|
||||
In addition, there is a minor issue that we will mention here because
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Internet Software Consortium DHCP Distribution
|
||||
Version 3.0.1
|
||||
Release Candidate 9
|
||||
April 30, 2002
|
||||
Release Candidate 10
|
||||
June, 2002
|
||||
|
||||
Release Notes
|
||||
|
||||
@@ -46,6 +46,72 @@ Murrell at BC Tel Advanced Communications. I'd like to express my
|
||||
thanks to all of these good people here, both for working on the code
|
||||
and for prodding me into improving it.
|
||||
|
||||
Changes since 3.0.1rc10
|
||||
|
||||
- Potential buffer overflows in minires repaired.
|
||||
|
||||
- A change to the linux client script to use /bin/bash, since /bin/sh may
|
||||
not be bash.
|
||||
|
||||
- Some missing va_end cleanups thanks to a patch from Thomas Klausner.
|
||||
|
||||
- A correction of boolean parsing syntax validation - some illegal syntaxes
|
||||
that worked before are now detected and produce errs, some legal syntaxes
|
||||
that errored before will now work properly.
|
||||
|
||||
- Some search-and-replace errors that caused some options to change their
|
||||
names was repaired.
|
||||
|
||||
- Shu-min Chang of the Intel corporation has contributed a perl script and
|
||||
module that converts the MS NT4 DHCP configuration to a ISC DHCP3
|
||||
configuration file.
|
||||
|
||||
- Applied the remainder of the dhcpctl memory leak patch provided by Bill
|
||||
Squier at ReefEdge, Inc. ([email protected]).
|
||||
|
||||
- Missing non-optional failover peer configurations will now result in a soft
|
||||
error rather than a null dereference.
|
||||
|
||||
Changes since 3.0.1rc9
|
||||
|
||||
- A format string was corrected to fix compiler warnings.
|
||||
|
||||
- A number of spelling corrections were made in the man pages.
|
||||
|
||||
- The dhclient.conf.5 man page was changed to refer to do-forward-updates
|
||||
rather than a configuration option that doesn't exist.
|
||||
|
||||
- A FreeBSD-specific bug in the interface removal handling was fixed.
|
||||
|
||||
- A Linux-specific Token Ring detection problem was fixed.
|
||||
|
||||
- Hashes removed from as-yet-unknown agent options, having those options
|
||||
appear in reality before we know about them will no longer produce
|
||||
self-corrupting lease databases.
|
||||
|
||||
- dhclient will use the proper port numbers now when using the -g option.
|
||||
|
||||
- A order-of-operations bug with 2 match clauses in 1 class statement is
|
||||
fixed thanks to a patch from Andrew Matheson.
|
||||
|
||||
- Compilation problems on Solaris were fixed.
|
||||
|
||||
- Compilation problems when built with DEBUG or DEBUG_PACKET were repaired.
|
||||
|
||||
- A fix to the dhcp ack process which makes certain group options will be
|
||||
included in the first DHCPOFFER message was made thanks to a patch from
|
||||
Ling Gou.
|
||||
|
||||
- A few memory leaks were repaired thanks to patches from Bill Squier at
|
||||
ReefEdge, Inc. ([email protected]).
|
||||
|
||||
- A fix for shared-networks that sometimes give clients options for the
|
||||
wrong subnets (in particular, 'option routers') was applied, thanks to
|
||||
Ted Lemon for the patch.
|
||||
|
||||
- Omshell's handling of dotted octets as values was changed such that dots
|
||||
one after the other produce zero values in the integer string.
|
||||
|
||||
Changes since 3.0.1rc8
|
||||
|
||||
- Fix a format string vulnerability in the server that could lead to a
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.dist
|
||||
#
|
||||
# Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
# Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
# Use is subject to license terms which appear in the file named
|
||||
# ISC-LICENSE that should have accompanied this file when you
|
||||
# received it. If a file named ISC-LICENSE did not accompany this
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: clparse.c,v 1.62.2.2 2002/02/09 03:13:17 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n"
|
||||
"$Id: clparse.c,v 1.62.2.3 2002/11/17 02:25:43 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n"
|
||||
"$FreeBSD$\n";
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" dhclient-script.8
|
||||
.\"
|
||||
.\" Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
.\" Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
@@ -35,6 +35,7 @@
|
||||
.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see
|
||||
.\" ``http://www.nominum.com''.
|
||||
.\"
|
||||
.\" $Id: dhclient-script.8,v 1.8.2.4 2002/11/17 02:25:43 dhankins Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.TH dhclient-script 8
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" dhclient.8
|
||||
.\"
|
||||
.\" Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
.\" Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
.\" Use is subject to license terms which appear in the file named
|
||||
.\" ISC-LICENSE that should have accompanied this file when you
|
||||
.\" received it. If a file named ISC-LICENSE did not accompany this
|
||||
@@ -16,6 +16,8 @@
|
||||
.\" Support and other services are available for ISC products - see
|
||||
.\" http://www.isc.org for more information.
|
||||
.\"
|
||||
.\" $Id: dhclient.8,v 1.12.2.7 2002/11/17 02:25:43 dhankins Exp $
|
||||
.\"
|
||||
.\" Portions copyright (c) 2000 David E. O'Brien.
|
||||
.\" All rights reserved.
|
||||
.\" $FreeBSD$
|
||||
@@ -143,7 +145,7 @@ than cycling through the list of old leases.
|
||||
The names of the network interfaces that dhclient should attempt to
|
||||
configure may be specified on the command line. If no interface names
|
||||
are specified on the command line dhclient will normally identify all
|
||||
network interfaces, elimininating non-broadcast interfaces if
|
||||
network interfaces, eliminating non-broadcast interfaces if
|
||||
possible, and attempt to configure each interface.
|
||||
.PP
|
||||
It is also possible to specify interfaces by name in the
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char ocopyright[] =
|
||||
"$Id: dhclient.c,v 1.129.2.10 2002/04/26 23:33:05 murray Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n"
|
||||
"$Id: dhclient.c,v 1.129.2.12 2002/11/07 23:26:38 dhankins Exp $ Copyright (c) 1995-2002 Internet Software Consortium. All rights reserved.\n"
|
||||
"$FreeBSD$\n";
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -72,20 +72,19 @@ struct in_addr giaddr;
|
||||
assert (state_is == state_shouldbe). */
|
||||
#define ASSERT_STATE(state_is, state_shouldbe) {}
|
||||
|
||||
static char copyright[] = "Copyright 1995-2001 Internet Software Consortium.";
|
||||
static char copyright[] = "Copyright 1995-2002 Internet Software Consortium.";
|
||||
static char arr [] = "All rights reserved.";
|
||||
static char message [] = "Internet Software Consortium DHCP Client";
|
||||
static char url [] = "For info, please visit http://www.isc.org/products/DHCP";
|
||||
|
||||
u_int16_t local_port;
|
||||
u_int16_t remote_port;
|
||||
int no_daemon;
|
||||
int save_scripts;
|
||||
struct string_list *client_env;
|
||||
int client_env_count;
|
||||
int onetry;
|
||||
int quiet = 1;
|
||||
int nowait;
|
||||
u_int16_t local_port=0;
|
||||
u_int16_t remote_port=0;
|
||||
int no_daemon=0;
|
||||
struct string_list *client_env=NULL;
|
||||
int client_env_count=0;
|
||||
int onetry=0;
|
||||
int quiet=1;
|
||||
int nowait=0;
|
||||
|
||||
static void usage PROTO ((void));
|
||||
|
||||
@@ -291,8 +290,10 @@ int main (argc, argv, envp)
|
||||
|
||||
/* Default to the DHCP/BOOTP port. */
|
||||
if (!local_port) {
|
||||
/* If we're faking a relay agent, and we're not using loopback,
|
||||
use the server port, not the client port. */
|
||||
if (relay && giaddr.s_addr != htonl (INADDR_LOOPBACK)) {
|
||||
local_port = htons (67);
|
||||
local_port = htons(67);
|
||||
} else {
|
||||
ent = getservbyname ("dhcpc", "udp");
|
||||
if (!ent)
|
||||
@@ -306,13 +307,12 @@ int main (argc, argv, envp)
|
||||
}
|
||||
|
||||
/* If we're faking a relay agent, and we're not using loopback,
|
||||
use the server port, not the client port. */
|
||||
we're using the server port, not the client port. */
|
||||
if (relay && giaddr.s_addr != htonl (INADDR_LOOPBACK)) {
|
||||
local_port = htons (ntohs (local_port) - 1);
|
||||
remote_port = local_port;
|
||||
} else
|
||||
remote_port = htons (ntohs (local_port) - 1); /* XXX */
|
||||
|
||||
|
||||
/* Get the current time... */
|
||||
GET_TIME (&cur_time);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" dhclient.conf.5
|
||||
.\"
|
||||
.\" Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
.\" Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
@@ -35,6 +35,7 @@
|
||||
.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see
|
||||
.\" ``http://www.nominum.com''.
|
||||
.\"
|
||||
.\" $Id: dhclient.conf.5,v 1.12.2.8 2002/11/17 02:25:43 dhankins Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.TH dhclient.conf 5
|
||||
@@ -252,19 +253,19 @@ updated. The \fIfqdn.encoded\fR option may need to be set to
|
||||
\fIon\fR or \fIoff\fR, depending on the DHCP server you are using.
|
||||
.PP
|
||||
.I The
|
||||
.B no-client-updates
|
||||
.B do-forward-updates
|
||||
.I statement
|
||||
.PP
|
||||
\fBno-client-updates [ \fIflag\fR ] \fB;\fR
|
||||
\fBdo-forward-updates [ \fIflag\fR ] \fB;\fR
|
||||
.PP
|
||||
If you want to do DNS updates in the DHCP client
|
||||
script (see \fBdhclient-script(8)\fR) rather than having the
|
||||
DHCP client do the update directly (for example, if you want to
|
||||
use SIG(0) authentication, which is not supported directly by the
|
||||
DHCP client, you can instruct the client not to do the update using
|
||||
the \fBno-client-updates\fR statement. \fIFlag\fR should be \fBtrue\fR
|
||||
if you don't want the DHCP client to do the update, and \fBfalse\fR if
|
||||
you want the DHCP client to do the update. By default, the DHCP
|
||||
the \fBdo-forward-updates\fR statement. \fIFlag\fR should be \fBtrue\fR
|
||||
if you want the DHCP client to do the update, and \fBfalse\fR if
|
||||
you don't want the DHCP client to do the update. By default, the DHCP
|
||||
client will do the DNS update.
|
||||
.SH OPTION MODIFIERS
|
||||
In some cases, a client may receive option data from the server which
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" dhclient.conf.5
|
||||
.\"
|
||||
.\" Copyright (c) 1997 The Internet Software Consortium.
|
||||
.\" Copyright (c) 1997-2002 The Internet Software Consortium.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
@@ -36,6 +36,7 @@
|
||||
.\" see ``http://www.isc.org/isc''. To learn more about Vixie
|
||||
.\" Enterprises, see ``http://www.vix.com''.
|
||||
.\"
|
||||
.\" $Id: dhclient.leases.5,v 1.2.4.3 2002/11/17 02:25:44 dhankins Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.TH dhclient.leases 5
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# $Id: freebsd,v 1.13.2.4 2002/06/09 22:37:55 murray Exp $
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
if [ -x /usr/bin/logger ]; then
|
||||
@@ -9,8 +11,12 @@ else
|
||||
fi
|
||||
|
||||
make_resolv_conf() {
|
||||
if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
|
||||
echo search $new_domain_name >/etc/resolv.conf
|
||||
if [ x"$new_domain_name_servers" != x ]; then
|
||||
if [ "x$new_domain_name" != x ]; then
|
||||
echo search $new_domain_name >/etc/resolv.conf
|
||||
else
|
||||
rm /etc/resolv.conf
|
||||
fi
|
||||
for nameserver in $new_domain_name_servers; do
|
||||
echo nameserver $nameserver >>/etc/resolv.conf
|
||||
done
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Memory allocation... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: alloc.c,v 1.53.2.8 2001/10/18 20:30:02 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: alloc.c,v 1.53.2.9 2002/11/17 02:26:56 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
BPF socket interface code, originally contributed by Archie Cobbs. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: bpf.c,v 1.48.2.1 2002/04/30 05:12:53 murray Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: bpf.c,v 1.48.2.3 2002/11/17 02:26:56 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -423,7 +423,11 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
|
||||
interface -> rbuf,
|
||||
(size_t)interface -> rbuf_max);
|
||||
if (length <= 0) {
|
||||
#ifdef __FreeBSD__
|
||||
if (errno == ENXIO) {
|
||||
#else
|
||||
if (errno == EIO) {
|
||||
#endif
|
||||
dhcp_interface_remove
|
||||
((omapi_object_t *)interface,
|
||||
(omapi_object_t *)0);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
OMAPI object interfaces for the DHCP server. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1999-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: comapi.c,v 1.9.2.5 2001/10/18 20:09:59 mellon Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: comapi.c,v 1.9.2.6 2002/11/17 02:26:56 dhankins Exp $ Copyright (c) 1999-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: conflex.c,v 1.92.2.5 2002/02/09 03:15:17 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: conflex.c,v 1.92.2.6 2002/11/17 02:26:56 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Subroutines that support dhcp tracing... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Internet Software Consortium.
|
||||
* Copyright (c) 2001-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" dhcp-eval.5
|
||||
.\"
|
||||
.\" Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
.\" Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" dhcp-options.5
|
||||
.\"
|
||||
.\" Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
.\" Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
@@ -35,6 +35,7 @@
|
||||
.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see
|
||||
.\" ``http://www.nominum.com''.
|
||||
.\"
|
||||
.\" $Id: dhcp-options.5,v 1.19.2.9 2002/11/17 02:26:57 dhankins Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.TH dhcpd-options 5
|
||||
@@ -247,7 +248,7 @@ server reply (DHCPOFFER), a DHCP server uses this option to specify
|
||||
the lease time it is willing to offer.
|
||||
.PP
|
||||
This option is not directly user configurable in the server; refer to the
|
||||
\fImax-lease-time\fR and \fidefault-lease-time\fR server options in
|
||||
\fImax-lease-time\fR and \fIdefault-lease-time\fR server options in
|
||||
.B dhcpd.conf(5).
|
||||
.RE
|
||||
.PP
|
||||
@@ -519,7 +520,7 @@ respond.
|
||||
.RS 0.25i
|
||||
.PP
|
||||
This option specifies the maximum size datagram that the client
|
||||
should be prepared to reassemble. The minimum value legal value is
|
||||
should be prepared to reassemble. The minimum legal value is
|
||||
576.
|
||||
.RE
|
||||
.PP
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Network input dispatcher... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: discover.c,v 1.42.2.9 2002/03/12 06:46:17 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: discover.c,v 1.42.2.13 2002/11/17 02:26:57 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -540,8 +540,12 @@ void discover_interfaces (state)
|
||||
if (tmp -> next)
|
||||
interface_reference (&next, tmp -> next, MDL);
|
||||
/* skip interfaces that are running already */
|
||||
if (tmp -> flags & INTERFACE_RUNNING)
|
||||
if (tmp -> flags & INTERFACE_RUNNING) {
|
||||
interface_dereference(&tmp, MDL);
|
||||
if(next)
|
||||
interface_reference(&tmp, next, MDL);
|
||||
continue;
|
||||
}
|
||||
if ((tmp -> flags & INTERFACE_AUTOMATIC) &&
|
||||
state == DISCOVER_REQUESTED)
|
||||
tmp -> flags &= ~(INTERFACE_AUTOMATIC |
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Network input dispatcher... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: dispatch.c,v 1.63.2.2 2001/06/21 16:47:15 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: dispatch.c,v 1.63.2.3 2002/11/17 02:26:57 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Data Link Provider Interface (DLPI) network interface code. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -88,7 +88,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: dlpi.c,v 1.28 2001/04/05 20:53:01 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: dlpi.c,v 1.28.2.1 2002/11/17 02:26:57 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Domain Name Service subroutines. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Internet Software Consortium.
|
||||
* Copyright (c) 2001-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: dns.c,v 1.35.2.12 2002/02/20 22:28:17 mellon Exp $ Copyright (c) 2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: dns.c,v 1.35.2.13 2002/11/17 02:26:57 dhankins Exp $ Copyright (c) 2001-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Packet assembly code, originally contributed by Archie Cobbs. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: ethernet.c,v 1.6.2.1 2001/06/14 19:15:27 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: ethernet.c,v 1.6.2.2 2002/11/17 02:26:57 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Support for executable statements. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1998-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: execute.c,v 1.44.2.8 2001/10/18 20:10:58 mellon Exp $ Copyright (c) 1998-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: execute.c,v 1.44.2.9 2002/11/17 02:26:58 dhankins Exp $ Copyright (c) 1998-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Packet assembly code, originally contributed by Archie Cobbs. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: fddi.c,v 1.3 2000/04/18 23:02:09 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: fddi.c,v 1.3.2.1 2002/11/17 02:26:58 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
responses. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: icmp.c,v 1.30.2.3 2001/10/18 20:11:24 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: icmp.c,v 1.30.2.5 2002/11/17 02:26:58 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -164,6 +164,7 @@ int icmp_echorequest (addr)
|
||||
if (!icmp_state)
|
||||
log_fatal ("ICMP protocol used before initialization.");
|
||||
|
||||
memset (&to, 0, sizeof(to));
|
||||
#ifdef HAVE_SA_LEN
|
||||
to.sin_len = sizeof to;
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
way... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: inet.c,v 1.8.2.3 2001/06/21 16:59:00 mellon Exp $ Copyright (c) 1995-1999 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: inet.c,v 1.8.2.4 2002/11/17 02:26:58 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Support Services in Vancouver, B.C. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: lpf.c,v 1.29 2001/04/24 00:36:00 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: lpf.c,v 1.29.2.1 2002/11/17 02:26:58 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Memory-resident database... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: memory.c,v 1.66.2.3 2001/10/17 03:25:10 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: memory.c,v 1.66.2.4 2002/11/17 02:26:58 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
with one crucial tidbit of help from Stu Grossmen. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: nit.c,v 1.34 2001/02/17 21:17:25 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: nit.c,v 1.34.2.1 2002/11/17 02:26:58 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: options.c,v 1.85.2.8 2002/02/19 20:36:52 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: options.c,v 1.85.2.9 2002/11/17 02:26:58 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#define DHCP_OPTION_DATA
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Packet assembly code, originally contributed by Archie Cobbs. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: packet.c,v 1.40.2.1 2001/05/31 19:28:51 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: packet.c,v 1.40.2.2 2002/11/17 02:26:59 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Common parser code for dhcpd and dhclient. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: parse.c,v 1.104.2.9 2002/04/27 05:30:02 murray Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: parse.c,v 1.104.2.12 2002/11/17 02:58:34 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -329,7 +329,7 @@ int parse_ip_addr (cfile, addr)
|
||||
|
||||
/*
|
||||
* hardware-parameter :== HARDWARE hardware-type colon-seperated-hex-list SEMI
|
||||
* hardware-type :== ETHERNET | TOKEN_RING
|
||||
* hardware-type :== ETHERNET | TOKEN_RING | FDDI
|
||||
*/
|
||||
|
||||
void parse_hardware_param (cfile, hardware)
|
||||
@@ -3973,83 +3973,51 @@ int parse_expression (expr, cfile, lose, context, plhs, binop)
|
||||
case AND:
|
||||
next_op = expr_and;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_boolean) {
|
||||
needbool:
|
||||
parse_warn (cfile, "expecting boolean expressions");
|
||||
skip_to_semi (cfile);
|
||||
expression_dereference (&rhs, MDL);
|
||||
*lose = 1;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OR:
|
||||
next_op = expr_or;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_boolean)
|
||||
goto needbool;
|
||||
break;
|
||||
|
||||
case PLUS:
|
||||
next_op = expr_add;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_numeric) {
|
||||
neednum:
|
||||
parse_warn (cfile, "expecting numeric expressions");
|
||||
skip_to_semi (cfile);
|
||||
expression_dereference (&rhs, MDL);
|
||||
*lose = 1;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case MINUS:
|
||||
next_op = expr_subtract;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_numeric)
|
||||
goto neednum;
|
||||
break;
|
||||
|
||||
case SLASH:
|
||||
next_op = expr_divide;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_numeric)
|
||||
goto neednum;
|
||||
break;
|
||||
|
||||
case ASTERISK:
|
||||
next_op = expr_multiply;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_numeric)
|
||||
goto neednum;
|
||||
break;
|
||||
|
||||
case PERCENT:
|
||||
next_op = expr_remainder;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_numeric)
|
||||
goto neednum;
|
||||
break;
|
||||
|
||||
case AMPERSAND:
|
||||
next_op = expr_binary_and;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_numeric)
|
||||
goto neednum;
|
||||
break;
|
||||
|
||||
case PIPE:
|
||||
next_op = expr_binary_or;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_numeric)
|
||||
goto neednum;
|
||||
break;
|
||||
|
||||
case CARET:
|
||||
next_op = expr_binary_xor;
|
||||
context = expression_context (rhs);
|
||||
if (context != context_numeric)
|
||||
goto neednum;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -4071,6 +4039,63 @@ int parse_expression (expr, cfile, lose, context, plhs, binop)
|
||||
goto new_rhs;
|
||||
}
|
||||
|
||||
if (binop != expr_none) {
|
||||
if (expression_context (rhs) != expression_context (lhs)) {
|
||||
parse_warn (cfile, "illegal expression relating different types");
|
||||
skip_to_semi (cfile);
|
||||
expression_dereference (&rhs, MDL);
|
||||
expression_dereference (&lhs, MDL);
|
||||
*lose = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(binop) {
|
||||
case expr_not_equal:
|
||||
case expr_equal:
|
||||
if ((expression_context(rhs) != context_data_or_numeric) &&
|
||||
(expression_context(rhs) != context_data) &&
|
||||
(expression_context(rhs) != context_numeric)) {
|
||||
parse_warn (cfile, "expecting data/numeric expression");
|
||||
skip_to_semi (cfile);
|
||||
expression_dereference (&rhs, MDL);
|
||||
*lose = 1;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case expr_and:
|
||||
case expr_or:
|
||||
if (expression_context(rhs) != context_boolean) {
|
||||
parse_warn (cfile, "expecting boolean expressions");
|
||||
skip_to_semi (cfile);
|
||||
expression_dereference (&rhs, MDL);
|
||||
*lose = 1;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case expr_add:
|
||||
case expr_subtract:
|
||||
case expr_divide:
|
||||
case expr_multiply:
|
||||
case expr_remainder:
|
||||
case expr_binary_and:
|
||||
case expr_binary_or:
|
||||
case expr_binary_xor:
|
||||
if (expression_context(rhs) != context_numeric) {
|
||||
parse_warn (cfile, "expecting numeric expressions");
|
||||
skip_to_semi (cfile);
|
||||
expression_dereference (&rhs, MDL);
|
||||
*lose = 1;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now, if we didn't find a binary operator, we're done parsing
|
||||
this subexpression, so combine it with the preceding binary
|
||||
operator and return the result. */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Turn data structures into printable text. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: print.c,v 1.53.2.6 2002/04/26 20:17:06 murray Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: print.c,v 1.53.2.7 2002/11/17 02:26:59 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
Sigh. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: raw.c,v 1.17 2000/03/17 03:59:01 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: raw.c,v 1.17.2.1 2002/11/17 02:26:59 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Parser for /etc/resolv.conf file. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: resolv.c,v 1.16 2001/05/02 06:39:43 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: resolv.c,v 1.16.2.1 2002/11/17 02:26:59 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
BSD socket interface code... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: socket.c,v 1.55.2.1 2002/01/17 19:42:55 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: socket.c,v 1.55.2.3 2002/11/17 02:26:59 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -114,11 +114,11 @@ int if_register_socket (info)
|
||||
once = 1;
|
||||
#endif
|
||||
|
||||
memset (&name, 0, sizeof (name));
|
||||
/* Set up the address we're going to bind to. */
|
||||
name.sin_family = AF_INET;
|
||||
name.sin_port = local_port;
|
||||
name.sin_addr = local_address;
|
||||
memset (name.sin_zero, 0, sizeof (name.sin_zero));
|
||||
|
||||
/* Make a socket... */
|
||||
if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Tables of information... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,8 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: tables.c,v 1.51.2.5 2002/02/09 03:23:54 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n"
|
||||
"$FreeBSD$\n";
|
||||
"$Id: tables.c,v 1.51.2.6 2002/11/17 02:26:59 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Contributed in May of 1999 by Andrew Chittenden */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: tr.c,v 1.7 2001/04/27 22:23:02 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: tr.c,v 1.7.2.1 2002/11/17 02:27:00 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Routines for manipulating parse trees... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1995-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: tree.c,v 1.101.2.6 2001/10/18 20:12:16 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: tree.c,v 1.101.2.7 2002/11/17 02:27:00 dhankins Exp $ Copyright (c) 1995-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Ultrix PacketFilter interface code. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: upf.c,v 1.21 2000/09/01 23:03:39 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: upf.c,v 1.21.2.1 2002/11/17 02:27:00 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.dist
|
||||
#
|
||||
# Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
# Copyright (c) 1996-2002 Internet Software Consortium.
|
||||
# Use is subject to license terms which appear in the file named
|
||||
# ISC-LICENSE that should have accompanied this file when you
|
||||
# received it. If a file named ISC-LICENSE did not accompany this
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LINT
|
||||
static const char rcsid[] = "$Header: /proj/cvs/isc/DHCP/dst/dst_api.c,v 1.1 2001/02/22 07:22:08 mellon Exp $";
|
||||
static const char rcsid[] = "$Header: /rc0/proj/cvs/isc/DHCP/dst/dst_api.c,v 1.1 2001/02/22 07:22:08 mellon Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
static const char rcsid[] = "$Header: /proj/cvs/isc/DHCP/dst/dst_support.c,v 1.1 2001/02/22 07:22:08 mellon Exp $";
|
||||
static const char rcsid[] = "$Header: /rc0/proj/cvs/isc/DHCP/dst/dst_support.c,v 1.1 2001/02/22 07:22:08 mellon Exp $";
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifdef HMAC_MD5
|
||||
#ifndef LINT
|
||||
static const char rcsid[] = "$Header: /proj/cvs/isc/DHCP/dst/hmac_link.c,v 1.1 2001/02/22 07:22:08 mellon Exp $";
|
||||
static const char rcsid[] = "$Header: /rc0/proj/cvs/isc/DHCP/dst/hmac_link.c,v 1.1 2001/02/22 07:22:08 mellon Exp $";
|
||||
#endif
|
||||
/*
|
||||
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LINT
|
||||
static const char rcsid[] = "$Header: /proj/cvs/isc/DHCP/dst/prandom.c,v 1.1 2001/02/22 07:22:09 mellon Exp $";
|
||||
static const char rcsid[] = "$Header: /rc0/proj/cvs/isc/DHCP/dst/prandom.c,v 1.1 2001/02/22 07:22:09 mellon Exp $";
|
||||
#endif
|
||||
/*
|
||||
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
|
||||
|
||||
@@ -271,7 +271,7 @@ typedef enum {
|
||||
FTS_RELEASED = 4,
|
||||
FTS_ABANDONED = 5,
|
||||
FTS_RESET = 6,
|
||||
FTS_BACKUP = 7,
|
||||
FTS_BACKUP = 7
|
||||
} binding_state_t;
|
||||
|
||||
/* FTS_LAST is the highest value that is valid for a lease binding state. */
|
||||
@@ -648,7 +648,7 @@ struct client_lease {
|
||||
struct auth_key *key; /* Key used in basic DHCP authentication. */
|
||||
|
||||
unsigned int is_static : 1; /* If set, lease is from config file. */
|
||||
unsigned int is_bootp: 1; /* If set, lease was aquired with BOOTP. */
|
||||
unsigned int is_bootp: 1; /* If set, lease was acquired with BOOTP. */
|
||||
|
||||
struct option_state *options; /* Options supplied with lease. */
|
||||
};
|
||||
@@ -903,6 +903,8 @@ typedef unsigned char option_mask [16];
|
||||
#define _PATH_DHCPD_CONF "dhcpd.conf"
|
||||
#undef _PATH_DHCPD_DB
|
||||
#define _PATH_DHCPD_DB "dhcpd.leases"
|
||||
#undef _PATH_DHCPD_PID
|
||||
#define _PATH_DHCPD_PID "dhcpd.pid"
|
||||
#else
|
||||
#ifndef _PATH_DHCPD_CONF
|
||||
#define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
|
||||
|
||||
@@ -276,6 +276,10 @@
|
||||
# define HAVE_ARPHRD_IEEE802
|
||||
#endif
|
||||
|
||||
#if defined (ARPHRD_IEEE802_TR) && !defined (HAVE_ARPHRD_IEEE802_TR)
|
||||
# define HAVE_ARPHRD_IEEE802_TR
|
||||
#endif
|
||||
|
||||
#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI)
|
||||
# define HAVE_ARPHRD_FDDI
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
/* Current version of ISC DHCP Distribution. */
|
||||
|
||||
#define DHCP_VERSION "V3.0.1rc9"
|
||||
#define DHCP_VERSION "V3.0.1rc11"
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996,1999 by Internet Software Consortium.
|
||||
* Copyright (c) 1996,1999-2003 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] = "$Id: ns_name.c,v 1.1 2000/02/02 07:28:14 mellon Exp $";
|
||||
static const char rcsid[] = "$Id: ns_name.c,v 1.1.2.4 2003/01/14 23:15:06 dhankins Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -255,6 +255,10 @@ ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz) {
|
||||
dn = dst;
|
||||
eom = dst + dstsiz;
|
||||
|
||||
if (dn >= eom) {
|
||||
errno = EMSGSIZE;
|
||||
return (-1);
|
||||
}
|
||||
while ((n = *cp++) != 0) {
|
||||
if ((n & NS_CMPRSFLGS) != 0) {
|
||||
/* Some kind of compression pointer. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995,1999 by Internet Software Consortium.
|
||||
* Copyright (c) 1995,1999-2003 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] = "$Id: ns_samedomain.c,v 1.3 2001/01/16 22:33:09 mellon Exp $";
|
||||
static const char rcsid[] = "$Id: ns_samedomain.c,v 1.3.2.3 2003/01/14 23:15:06 dhankins Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -168,7 +168,7 @@ ns_makecanon(const char *src, char *dst, size_t dstsize) {
|
||||
size_t n = strlen(src);
|
||||
|
||||
if (n + sizeof "." > dstsize) {
|
||||
ISC_R_NOSPACE;
|
||||
return ISC_R_NOSPACE;
|
||||
}
|
||||
strcpy(dst, src);
|
||||
while (n > 0 && dst[n - 1] == '.') /* Ends in "." */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2001 by Internet Software Consortium, Inc.
|
||||
* Copyright (c) 1999-2003 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] = "$Id: ns_sign.c,v 1.4.2.1 2001/05/17 20:47:33 mellon Exp $";
|
||||
static const char rcsid[] = "$Id: ns_sign.c,v 1.4.2.3 2003/01/14 23:15:06 dhankins Exp $";
|
||||
#endif
|
||||
|
||||
#if defined (TRACING)
|
||||
@@ -87,7 +87,7 @@ ns_sign(u_char *msg, unsigned *msglen, unsigned msgsize, int error, void *k,
|
||||
|
||||
dst_init();
|
||||
if (msg == NULL || msglen == NULL || sig == NULL || siglen == NULL)
|
||||
ISC_R_INVALIDARG;
|
||||
return ISC_R_INVALIDARG;
|
||||
|
||||
/* Name. */
|
||||
if (key != NULL && error != ns_r_badsig && error != ns_r_badkey)
|
||||
@@ -118,7 +118,7 @@ ns_sign(u_char *msg, unsigned *msglen, unsigned msgsize, int error, void *k,
|
||||
else
|
||||
n = dn_comp("", cp, (unsigned)(eob - cp), NULL, NULL);
|
||||
if (n < 0)
|
||||
ISC_R_NOSPACE;
|
||||
return ISC_R_NOSPACE;
|
||||
alg = cp;
|
||||
cp += n;
|
||||
|
||||
@@ -190,7 +190,7 @@ ns_sign(u_char *msg, unsigned *msglen, unsigned msgsize, int error, void *k,
|
||||
n = dst_sign_data(SIG_MODE_FINAL, key, &ctx, NULL, 0,
|
||||
sig, *siglen);
|
||||
if (n < 0)
|
||||
ISC_R_BADKEY;
|
||||
return ISC_R_BADKEY;
|
||||
*siglen = n;
|
||||
} else
|
||||
*siglen = 0;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: res_findzonecut.c,v 1.14.2.1 2001/05/17 20:47:35 mellon Exp $";
|
||||
static const char rcsid[] = "$Id: res_findzonecut.c,v 1.14.2.3 2003/01/14 23:15:06 dhankins Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 by Internet Software Consortium.
|
||||
* Copyright (c) 1999-2003 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -355,7 +355,7 @@ get_soa(res_state statp, const char *dname, ns_class class,
|
||||
while (*dname != '.') {
|
||||
if (*dname == '\\')
|
||||
if (*++dname == '\0') {
|
||||
ISC_R_NOSPACE;
|
||||
return ISC_R_NOSPACE;
|
||||
}
|
||||
dname++;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
|
||||
static const char rcsid[] = "$Id: res_send.c,v 1.7 2001/02/22 07:28:25 mellon Exp $";
|
||||
static const char rcsid[] = "$Id: res_send.c,v 1.7.2.1 2002/11/03 04:34:24 dhankins Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* Rename the I/O functions in case we're tracing. */
|
||||
@@ -600,7 +600,7 @@ res_nsend(res_state statp,
|
||||
(unsigned)len);
|
||||
}
|
||||
Dprint(statp->options & RES_DEBUG,
|
||||
(stdout, ";; new DG socket\n"))
|
||||
(stdout, ";; new DG socket\n"));
|
||||
#endif /* CAN_RECONNECT */
|
||||
statp->_flags &= ~RES_F_CONN;
|
||||
errno = 0;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
protocol... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2001 Internet Software Consortium.
|
||||
* Copyright (c) 1999-2003 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -820,8 +820,10 @@ isc_result_t omapi_typed_data_new (const char *file, int line,
|
||||
obj = va_arg (l, omapi_object_t *);
|
||||
break;
|
||||
default:
|
||||
va_end (l);
|
||||
return ISC_R_INVALIDARG;
|
||||
}
|
||||
va_end (l);
|
||||
|
||||
new = dmalloc (len, file, line);
|
||||
if (!new)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Subroutines for dealing with message objects. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2000 Internet Software Consortium.
|
||||
* Copyright (c) 1999-2003 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -327,6 +327,7 @@ isc_result_t omapi_message_unregister (omapi_object_t *mo)
|
||||
omapi_object_reference ((omapi_object_t **)&n,
|
||||
(omapi_object_t *)m -> next, MDL);
|
||||
omapi_object_dereference ((omapi_object_t **)&m -> next, MDL);
|
||||
omapi_object_dereference ((omapi_object_t **)&n -> prev, MDL);
|
||||
}
|
||||
if (m -> prev) {
|
||||
omapi_message_object_t *tmp = (omapi_message_object_t *)0;
|
||||
@@ -707,10 +708,15 @@ omapi_message_process_internal (omapi_object_t *mo, omapi_object_t *po)
|
||||
status = omapi_protocol_send_status
|
||||
(po, message -> id_object, ISC_R_SUCCESS,
|
||||
message -> id, (char *)0);
|
||||
if (m)
|
||||
if (m) {
|
||||
omapi_signal ((omapi_object_t *)m,
|
||||
"status", ISC_R_SUCCESS,
|
||||
(omapi_typed_data_t *)0);
|
||||
omapi_message_unregister ((omapi_object_t *)m);
|
||||
}
|
||||
|
||||
omapi_object_dereference (&object, MDL);
|
||||
|
||||
return status;
|
||||
|
||||
case OMAPI_OP_NOTIFY:
|
||||
@@ -740,6 +746,9 @@ omapi_message_process_internal (omapi_object_t *mo, omapi_object_t *po)
|
||||
omapi_signal ((omapi_object_t *)m, "status", waitstatus, tv);
|
||||
if (status == ISC_R_SUCCESS)
|
||||
omapi_value_dereference (&tv, MDL);
|
||||
|
||||
omapi_message_unregister((omapi_object_t *)m);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
|
||||
case OMAPI_OP_DELETE:
|
||||
|
||||
@@ -56,6 +56,9 @@ int main(int argc, char *argv[])
|
||||
const char *fs = NULL;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
setlocale(LC_COLLATE, "");
|
||||
setlocale(LC_CTYPE, "");
|
||||
setlocale(LC_MESSAGES, "");
|
||||
cmdname = argv[0];
|
||||
if (argc == 1) {
|
||||
fprintf(stderr, "Usage: %s [-f programfile | 'program'] [-Ffieldsep] [-v var=value] [files]\n", cmdname);
|
||||
|
||||
@@ -332,6 +332,8 @@ setdefaults(e)
|
||||
DontProbeInterfaces = DPI_PROBEALL;
|
||||
DoubleBounceAddr = "postmaster";
|
||||
MaxHeadersLength = MAXHDRSLEN;
|
||||
MaxMimeHeaderLength = MAXLINE;
|
||||
MaxMimeFieldLength = MaxMimeHeaderLength / 2;
|
||||
MaxForwardEntries = 0;
|
||||
FastSplit = 1;
|
||||
#if SASL
|
||||
|
||||
@@ -3508,7 +3508,7 @@ getauthinfo(fd, may_be_forged)
|
||||
if (i < 0 || p == &ibuf[0])
|
||||
goto noident;
|
||||
|
||||
if (*--p == '\n' && *--p == '\r')
|
||||
if (p >= &ibuf[2] && *--p == '\n' && *--p == '\r')
|
||||
p--;
|
||||
*++p = '\0';
|
||||
|
||||
|
||||
+129
-84
@@ -678,8 +678,8 @@ eatheader(e, full, log)
|
||||
if (buf[0] != '\0')
|
||||
{
|
||||
if (bitset(H_FROM, h->h_flags))
|
||||
expand(crackaddr(buf), buf, sizeof buf,
|
||||
e);
|
||||
expand(crackaddr(buf, e),
|
||||
buf, sizeof buf, e);
|
||||
h->h_value = sm_rpool_strdup_x(e->e_rpool, buf);
|
||||
h->h_flags &= ~H_DEFAULT;
|
||||
}
|
||||
@@ -1000,7 +1000,11 @@ priencode(p)
|
||||
** it and replaces it with "$g". The parse is totally ad hoc
|
||||
** and isn't even guaranteed to leave something syntactically
|
||||
** identical to what it started with. However, it does leave
|
||||
** something semantically identical.
|
||||
** something semantically identical if possible, else at least
|
||||
** syntactically correct.
|
||||
**
|
||||
** For example, it changes "Real Name <[email protected]> (Comment)"
|
||||
** to "Real Name <$g> (Comment)".
|
||||
**
|
||||
** This algorithm has been cleaned up to handle a wider range
|
||||
** of cases -- notably quoted and backslash escaped strings.
|
||||
@@ -1009,6 +1013,7 @@ priencode(p)
|
||||
**
|
||||
** Parameters:
|
||||
** addr -- the address to be cracked.
|
||||
** e -- the current envelope.
|
||||
**
|
||||
** Returns:
|
||||
** a pointer to the new version.
|
||||
@@ -1021,28 +1026,50 @@ priencode(p)
|
||||
** be copied if it is to be reused.
|
||||
*/
|
||||
|
||||
#define SM_HAVE_ROOM ((bp < buflim) && (buflim <= bufend))
|
||||
|
||||
/*
|
||||
** Append a character to bp if we have room.
|
||||
** If not, punt and return $g.
|
||||
*/
|
||||
|
||||
#define SM_APPEND_CHAR(c) \
|
||||
do \
|
||||
{ \
|
||||
if (SM_HAVE_ROOM) \
|
||||
*bp++ = (c); \
|
||||
else \
|
||||
goto returng; \
|
||||
} while (0)
|
||||
|
||||
#if MAXNAME < 10
|
||||
ERROR MAXNAME must be at least 10
|
||||
#endif /* MAXNAME < 10 */
|
||||
|
||||
char *
|
||||
crackaddr(addr)
|
||||
crackaddr(addr, e)
|
||||
register char *addr;
|
||||
ENVELOPE *e;
|
||||
{
|
||||
register char *p;
|
||||
register char c;
|
||||
int cmtlev;
|
||||
int realcmtlev;
|
||||
int anglelev, realanglelev;
|
||||
int copylev;
|
||||
int bracklev;
|
||||
bool qmode;
|
||||
bool realqmode;
|
||||
bool skipping;
|
||||
bool putgmac = false;
|
||||
bool quoteit = false;
|
||||
bool gotangle = false;
|
||||
bool gotcolon = false;
|
||||
int cmtlev; /* comment level in input string */
|
||||
int realcmtlev; /* comment level in output string */
|
||||
int anglelev; /* angle level in input string */
|
||||
int copylev; /* 0 == in address, >0 copying */
|
||||
int bracklev; /* bracket level for IPv6 addr check */
|
||||
bool addangle; /* put closing angle in output */
|
||||
bool qmode; /* quoting in original string? */
|
||||
bool realqmode; /* quoting in output string? */
|
||||
bool putgmac = false; /* already wrote $g */
|
||||
bool quoteit = false; /* need to quote next character */
|
||||
bool gotangle = false; /* found first '<' */
|
||||
bool gotcolon = false; /* found a ':' */
|
||||
register char *bp;
|
||||
char *buflim;
|
||||
char *bufhead;
|
||||
char *addrhead;
|
||||
char *bufend;
|
||||
static char buf[MAXNAME + 1];
|
||||
|
||||
if (tTd(33, 1))
|
||||
@@ -1057,25 +1084,22 @@ crackaddr(addr)
|
||||
** adjusted later if we find them.
|
||||
*/
|
||||
|
||||
buflim = bufend = &buf[sizeof(buf) - 1];
|
||||
bp = bufhead = buf;
|
||||
buflim = &buf[sizeof buf - 7];
|
||||
p = addrhead = addr;
|
||||
copylev = anglelev = realanglelev = cmtlev = realcmtlev = 0;
|
||||
copylev = anglelev = cmtlev = realcmtlev = 0;
|
||||
bracklev = 0;
|
||||
qmode = realqmode = false;
|
||||
qmode = realqmode = addangle = false;
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
{
|
||||
/*
|
||||
** If the buffer is overful, go into a special "skipping"
|
||||
** mode that tries to keep legal syntax but doesn't actually
|
||||
** output things.
|
||||
** Try to keep legal syntax using spare buffer space
|
||||
** (maintained by buflim).
|
||||
*/
|
||||
|
||||
skipping = bp >= buflim;
|
||||
|
||||
if (copylev > 0 && !skipping)
|
||||
*bp++ = c;
|
||||
if (copylev > 0)
|
||||
SM_APPEND_CHAR(c);
|
||||
|
||||
/* check for backslash escapes */
|
||||
if (c == '\\')
|
||||
@@ -1090,8 +1114,8 @@ crackaddr(addr)
|
||||
p--;
|
||||
goto putg;
|
||||
}
|
||||
if (copylev > 0 && !skipping)
|
||||
*bp++ = c;
|
||||
if (copylev > 0)
|
||||
SM_APPEND_CHAR(c);
|
||||
goto putg;
|
||||
}
|
||||
|
||||
@@ -1099,8 +1123,14 @@ crackaddr(addr)
|
||||
if (c == '"' && cmtlev <= 0)
|
||||
{
|
||||
qmode = !qmode;
|
||||
if (copylev > 0 && !skipping)
|
||||
if (copylev > 0 && SM_HAVE_ROOM)
|
||||
{
|
||||
if (realqmode)
|
||||
buflim--;
|
||||
else
|
||||
buflim++;
|
||||
realqmode = !realqmode;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (qmode)
|
||||
@@ -1112,15 +1142,15 @@ crackaddr(addr)
|
||||
cmtlev++;
|
||||
|
||||
/* allow space for closing paren */
|
||||
if (!skipping)
|
||||
if (SM_HAVE_ROOM)
|
||||
{
|
||||
buflim--;
|
||||
realcmtlev++;
|
||||
if (copylev++ <= 0)
|
||||
{
|
||||
if (bp != bufhead)
|
||||
*bp++ = ' ';
|
||||
*bp++ = c;
|
||||
SM_APPEND_CHAR(' ');
|
||||
SM_APPEND_CHAR(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1130,7 +1160,7 @@ crackaddr(addr)
|
||||
{
|
||||
cmtlev--;
|
||||
copylev--;
|
||||
if (!skipping)
|
||||
if (SM_HAVE_ROOM)
|
||||
{
|
||||
realcmtlev--;
|
||||
buflim++;
|
||||
@@ -1141,7 +1171,7 @@ crackaddr(addr)
|
||||
else if (c == ')')
|
||||
{
|
||||
/* syntax error: unmatched ) */
|
||||
if (copylev > 0 && !skipping)
|
||||
if (copylev > 0 && SM_HAVE_ROOM)
|
||||
bp--;
|
||||
}
|
||||
|
||||
@@ -1159,7 +1189,7 @@ crackaddr(addr)
|
||||
|
||||
/*
|
||||
** Check for DECnet phase IV ``::'' (host::user)
|
||||
** or ** DECnet phase V ``:.'' syntaxes. The latter
|
||||
** or DECnet phase V ``:.'' syntaxes. The latter
|
||||
** covers ``user@DEC:.tay.myhost'' and
|
||||
** ``DEC:.tay.myhost::user'' syntaxes (bletch).
|
||||
*/
|
||||
@@ -1168,10 +1198,10 @@ crackaddr(addr)
|
||||
{
|
||||
if (cmtlev <= 0 && !qmode)
|
||||
quoteit = true;
|
||||
if (copylev > 0 && !skipping)
|
||||
if (copylev > 0)
|
||||
{
|
||||
*bp++ = c;
|
||||
*bp++ = *p;
|
||||
SM_APPEND_CHAR(c);
|
||||
SM_APPEND_CHAR(*p);
|
||||
}
|
||||
p++;
|
||||
goto putg;
|
||||
@@ -1182,41 +1212,43 @@ crackaddr(addr)
|
||||
bp = bufhead;
|
||||
if (quoteit)
|
||||
{
|
||||
*bp++ = '"';
|
||||
SM_APPEND_CHAR('"');
|
||||
|
||||
/* back up over the ':' and any spaces */
|
||||
--p;
|
||||
while (isascii(*--p) && isspace(*p))
|
||||
while (p > addr &&
|
||||
isascii(*--p) && isspace(*p))
|
||||
continue;
|
||||
p++;
|
||||
}
|
||||
for (q = addrhead; q < p; )
|
||||
{
|
||||
c = *q++;
|
||||
if (bp < buflim)
|
||||
if (quoteit && c == '"')
|
||||
{
|
||||
if (quoteit && c == '"')
|
||||
*bp++ = '\\';
|
||||
*bp++ = c;
|
||||
SM_APPEND_CHAR('\\');
|
||||
SM_APPEND_CHAR(c);
|
||||
}
|
||||
else
|
||||
SM_APPEND_CHAR(c);
|
||||
}
|
||||
if (quoteit)
|
||||
{
|
||||
if (bp == &bufhead[1])
|
||||
bp--;
|
||||
else
|
||||
*bp++ = '"';
|
||||
SM_APPEND_CHAR('"');
|
||||
while ((c = *p++) != ':')
|
||||
{
|
||||
if (bp < buflim)
|
||||
*bp++ = c;
|
||||
}
|
||||
*bp++ = c;
|
||||
SM_APPEND_CHAR(c);
|
||||
SM_APPEND_CHAR(c);
|
||||
}
|
||||
|
||||
/* any trailing white space is part of group: */
|
||||
while (isascii(*p) && isspace(*p) && bp < buflim)
|
||||
*bp++ = *p++;
|
||||
while (isascii(*p) && isspace(*p))
|
||||
{
|
||||
SM_APPEND_CHAR(*p);
|
||||
p++;
|
||||
}
|
||||
copylev = 0;
|
||||
putgmac = quoteit = false;
|
||||
bufhead = bp;
|
||||
@@ -1225,10 +1257,7 @@ crackaddr(addr)
|
||||
}
|
||||
|
||||
if (c == ';' && copylev <= 0 && !ColonOkInAddr)
|
||||
{
|
||||
if (bp < buflim)
|
||||
*bp++ = c;
|
||||
}
|
||||
SM_APPEND_CHAR(c);
|
||||
|
||||
/* check for characters that may have to be quoted */
|
||||
if (strchr(MustQuoteChars, c) != NULL)
|
||||
@@ -1256,42 +1285,45 @@ crackaddr(addr)
|
||||
|
||||
/* oops -- have to change our mind */
|
||||
anglelev = 1;
|
||||
if (!skipping)
|
||||
realanglelev = 1;
|
||||
if (SM_HAVE_ROOM)
|
||||
{
|
||||
if (!addangle)
|
||||
buflim--;
|
||||
addangle = true;
|
||||
}
|
||||
|
||||
bp = bufhead;
|
||||
if (quoteit)
|
||||
{
|
||||
*bp++ = '"';
|
||||
SM_APPEND_CHAR('"');
|
||||
|
||||
/* back up over the '<' and any spaces */
|
||||
--p;
|
||||
while (isascii(*--p) && isspace(*p))
|
||||
while (p > addr &&
|
||||
isascii(*--p) && isspace(*p))
|
||||
continue;
|
||||
p++;
|
||||
}
|
||||
for (q = addrhead; q < p; )
|
||||
{
|
||||
c = *q++;
|
||||
if (bp < buflim)
|
||||
if (quoteit && c == '"')
|
||||
{
|
||||
if (quoteit && c == '"')
|
||||
*bp++ = '\\';
|
||||
*bp++ = c;
|
||||
SM_APPEND_CHAR('\\');
|
||||
SM_APPEND_CHAR(c);
|
||||
}
|
||||
else
|
||||
SM_APPEND_CHAR(c);
|
||||
}
|
||||
if (quoteit)
|
||||
{
|
||||
if (bp == &buf[1])
|
||||
bp--;
|
||||
else
|
||||
*bp++ = '"';
|
||||
SM_APPEND_CHAR('"');
|
||||
while ((c = *p++) != '<')
|
||||
{
|
||||
if (bp < buflim)
|
||||
*bp++ = c;
|
||||
}
|
||||
*bp++ = c;
|
||||
SM_APPEND_CHAR(c);
|
||||
SM_APPEND_CHAR(c);
|
||||
}
|
||||
copylev = 0;
|
||||
putgmac = quoteit = false;
|
||||
@@ -1303,13 +1335,14 @@ crackaddr(addr)
|
||||
if (anglelev > 0)
|
||||
{
|
||||
anglelev--;
|
||||
if (!skipping)
|
||||
if (SM_HAVE_ROOM)
|
||||
{
|
||||
realanglelev--;
|
||||
buflim++;
|
||||
if (addangle)
|
||||
buflim++;
|
||||
addangle = false;
|
||||
}
|
||||
}
|
||||
else if (!skipping)
|
||||
else if (SM_HAVE_ROOM)
|
||||
{
|
||||
/* syntax error: unmatched > */
|
||||
if (copylev > 0)
|
||||
@@ -1318,7 +1351,7 @@ crackaddr(addr)
|
||||
continue;
|
||||
}
|
||||
if (copylev++ <= 0)
|
||||
*bp++ = c;
|
||||
SM_APPEND_CHAR(c);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1326,30 +1359,42 @@ crackaddr(addr)
|
||||
putg:
|
||||
if (copylev <= 0 && !putgmac)
|
||||
{
|
||||
if (bp > bufhead && bp[-1] == ')')
|
||||
*bp++ = ' ';
|
||||
*bp++ = MACROEXPAND;
|
||||
*bp++ = 'g';
|
||||
if (bp > buf && bp[-1] == ')')
|
||||
SM_APPEND_CHAR(' ');
|
||||
SM_APPEND_CHAR(MACROEXPAND);
|
||||
SM_APPEND_CHAR('g');
|
||||
putgmac = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* repair any syntactic damage */
|
||||
if (realqmode)
|
||||
if (realqmode && bp < bufend)
|
||||
*bp++ = '"';
|
||||
while (realcmtlev-- > 0)
|
||||
while (realcmtlev-- > 0 && bp < bufend)
|
||||
*bp++ = ')';
|
||||
while (realanglelev-- > 0)
|
||||
if (addangle && bp < bufend)
|
||||
*bp++ = '>';
|
||||
*bp++ = '\0';
|
||||
*bp = '\0';
|
||||
if (bp < bufend)
|
||||
goto success;
|
||||
|
||||
returng:
|
||||
/* String too long, punt */
|
||||
buf[0] = '<';
|
||||
buf[1] = MACROEXPAND;
|
||||
buf[2]= 'g';
|
||||
buf[3] = '>';
|
||||
buf[4]= '\0';
|
||||
sm_syslog(LOG_ALERT, e->e_id,
|
||||
"Dropped invalid comments from header address");
|
||||
|
||||
success:
|
||||
if (tTd(33, 1))
|
||||
{
|
||||
sm_dprintf("crackaddr=>`");
|
||||
xputs(buf);
|
||||
sm_dprintf("'\n");
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -4227,7 +4227,7 @@ testmodeline(line, e)
|
||||
"Usage: /parse address\n");
|
||||
return;
|
||||
}
|
||||
q = crackaddr(p);
|
||||
q = crackaddr(p, e);
|
||||
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
|
||||
"Cracked address = ");
|
||||
xputs(q);
|
||||
|
||||
@@ -608,7 +608,7 @@ unsigned char TokTypeNoC[256] =
|
||||
};
|
||||
|
||||
|
||||
#define NOCHAR -1 /* signal nothing in lookahead token */
|
||||
#define NOCHAR (-1) /* signal nothing in lookahead token */
|
||||
|
||||
char **
|
||||
prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
|
||||
@@ -694,22 +694,31 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
|
||||
/* see if there is room */
|
||||
if (q >= &pvpbuf[pvpbsize - 5])
|
||||
{
|
||||
addrtoolong:
|
||||
usrerr("553 5.1.1 Address too long");
|
||||
if (strlen(addr) > MAXNAME)
|
||||
addr[MAXNAME] = '\0';
|
||||
returnnull:
|
||||
if (delimptr != NULL)
|
||||
{
|
||||
if (p > addr)
|
||||
p--;
|
||||
*delimptr = p;
|
||||
}
|
||||
CurEnv->e_to = saveto;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* squirrel it away */
|
||||
#if !ALLOW_255
|
||||
if ((char) c == (char) -1 && !tTd(82, 101))
|
||||
c &= 0x7f;
|
||||
#endif /* !ALLOW_255 */
|
||||
*q++ = c;
|
||||
}
|
||||
|
||||
/* read a new input character */
|
||||
c = *p++;
|
||||
c = (*p++) & 0x00ff;
|
||||
if (c == '\0')
|
||||
{
|
||||
/* diagnose and patch up bad syntax */
|
||||
@@ -764,6 +773,9 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
|
||||
}
|
||||
else if (c != '!' || state == QST)
|
||||
{
|
||||
/* see if there is room */
|
||||
if (q >= &pvpbuf[pvpbsize - 5])
|
||||
goto addrtoolong;
|
||||
*q++ = '\\';
|
||||
continue;
|
||||
}
|
||||
@@ -849,6 +861,9 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
|
||||
/* new token */
|
||||
if (tok != q)
|
||||
{
|
||||
/* see if there is room */
|
||||
if (q >= &pvpbuf[pvpbsize - 5])
|
||||
goto addrtoolong;
|
||||
*q++ = '\0';
|
||||
if (tTd(22, 36))
|
||||
{
|
||||
@@ -2508,7 +2523,7 @@ remotename(name, m, flags, pstat, e)
|
||||
if (bitset(RF_CANONICAL, flags) || bitnset(M_NOCOMMENT, m->m_flags))
|
||||
fancy = "\201g";
|
||||
else
|
||||
fancy = crackaddr(name);
|
||||
fancy = crackaddr(name, e);
|
||||
|
||||
/*
|
||||
** Turn the name into canonical form.
|
||||
|
||||
@@ -325,7 +325,7 @@ extern ADDRESS NullAddress; /* a null (template) address [main.c] */
|
||||
|
||||
/* functions */
|
||||
extern void cataddr __P((char **, char **, char *, int, int));
|
||||
extern char *crackaddr __P((char *));
|
||||
extern char *crackaddr __P((char *, ENVELOPE *));
|
||||
extern bool emptyaddr __P((ADDRESS *));
|
||||
extern ADDRESS *getctladdr __P((ADDRESS *));
|
||||
extern int include __P((char *, bool, ADDRESS *, ADDRESS **, int, ENVELOPE *));
|
||||
|
||||
@@ -233,6 +233,7 @@ parse_dns_reply(data, len)
|
||||
dns_free_data(r);
|
||||
return NULL;
|
||||
}
|
||||
memset(*rr, 0, sizeof(**rr));
|
||||
(*rr)->rr_domain = sm_strdup(host);
|
||||
if ((*rr)->rr_domain == NULL)
|
||||
{
|
||||
|
||||
@@ -15,4 +15,4 @@
|
||||
|
||||
SM_RCSID("@(#)$Id: version.c,v 8.104.2.5 2002/08/24 16:27:21 ca Exp $")
|
||||
|
||||
char Version[] = "8.12.6";
|
||||
char Version[] = "8.12.6p3";
|
||||
@@ -1,342 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)telnet.h 8.2 (Berkeley) 12/15/93
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_TELNET_H_
|
||||
#define _ARPA_TELNET_H_
|
||||
|
||||
/*
|
||||
* Definitions for the TELNET protocol.
|
||||
*/
|
||||
#define IAC 255 /* interpret as command: */
|
||||
#define DONT 254 /* you are not to use option */
|
||||
#define DO 253 /* please, you use option */
|
||||
#define WONT 252 /* I won't use option */
|
||||
#define WILL 251 /* I will use option */
|
||||
#define SB 250 /* interpret as subnegotiation */
|
||||
#define GA 249 /* you may reverse the line */
|
||||
#define EL 248 /* erase the current line */
|
||||
#define EC 247 /* erase the current character */
|
||||
#define AYT 246 /* are you there */
|
||||
#define AO 245 /* abort output--but let prog finish */
|
||||
#define IP 244 /* interrupt process--permanently */
|
||||
#define BREAK 243 /* break */
|
||||
#define DM 242 /* data mark--for connect. cleaning */
|
||||
#define NOP 241 /* nop */
|
||||
#define SE 240 /* end sub negotiation */
|
||||
#define EOR 239 /* end of record (transparent mode) */
|
||||
#define ABORT 238 /* Abort process */
|
||||
#define SUSP 237 /* Suspend process */
|
||||
#define xEOF 236 /* End of file: EOF is already used... */
|
||||
|
||||
#define SYNCH 242 /* for telfunc calls */
|
||||
|
||||
#ifdef TELCMDS
|
||||
const char *telcmds[] = {
|
||||
"EOF", "SUSP", "ABORT", "EOR",
|
||||
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
|
||||
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
|
||||
0
|
||||
};
|
||||
#else
|
||||
extern char *telcmds[];
|
||||
#endif
|
||||
|
||||
#define TELCMD_FIRST xEOF
|
||||
#define TELCMD_LAST IAC
|
||||
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
|
||||
(unsigned int)(x) >= TELCMD_FIRST)
|
||||
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
|
||||
|
||||
/* telnet options */
|
||||
#define TELOPT_BINARY 0 /* 8-bit data path */
|
||||
#define TELOPT_ECHO 1 /* echo */
|
||||
#define TELOPT_RCP 2 /* prepare to reconnect */
|
||||
#define TELOPT_SGA 3 /* suppress go ahead */
|
||||
#define TELOPT_NAMS 4 /* approximate message size */
|
||||
#define TELOPT_STATUS 5 /* give status */
|
||||
#define TELOPT_TM 6 /* timing mark */
|
||||
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
|
||||
#define TELOPT_NAOL 8 /* negotiate about output line width */
|
||||
#define TELOPT_NAOP 9 /* negotiate about output page size */
|
||||
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
|
||||
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
|
||||
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
|
||||
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
|
||||
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
|
||||
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
|
||||
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
|
||||
#define TELOPT_XASCII 17 /* extended ascic character set */
|
||||
#define TELOPT_LOGOUT 18 /* force logout */
|
||||
#define TELOPT_BM 19 /* byte macro */
|
||||
#define TELOPT_DET 20 /* data entry terminal */
|
||||
#define TELOPT_SUPDUP 21 /* supdup protocol */
|
||||
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
|
||||
#define TELOPT_SNDLOC 23 /* send location */
|
||||
#define TELOPT_TTYPE 24 /* terminal type */
|
||||
#define TELOPT_EOR 25 /* end or record */
|
||||
#define TELOPT_TUID 26 /* TACACS user identification */
|
||||
#define TELOPT_OUTMRK 27 /* output marking */
|
||||
#define TELOPT_TTYLOC 28 /* terminal location number */
|
||||
#define TELOPT_3270REGIME 29 /* 3270 regime */
|
||||
#define TELOPT_X3PAD 30 /* X.3 PAD */
|
||||
#define TELOPT_NAWS 31 /* window size */
|
||||
#define TELOPT_TSPEED 32 /* terminal speed */
|
||||
#define TELOPT_LFLOW 33 /* remote flow control */
|
||||
#define TELOPT_LINEMODE 34 /* Linemode option */
|
||||
#define TELOPT_XDISPLOC 35 /* X Display Location */
|
||||
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
|
||||
#define TELOPT_AUTHENTICATION 37/* Authenticate */
|
||||
#define TELOPT_ENCRYPT 38 /* Encryption option */
|
||||
#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
|
||||
#define TELOPT_EXOPL 255 /* extended-options-list */
|
||||
|
||||
|
||||
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
|
||||
#ifdef TELOPTS
|
||||
const char *telopts[NTELOPTS+1] = {
|
||||
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
|
||||
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
|
||||
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
|
||||
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
|
||||
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
|
||||
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
|
||||
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
|
||||
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
|
||||
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
|
||||
"ENCRYPT", "NEW-ENVIRON",
|
||||
0
|
||||
};
|
||||
#define TELOPT_FIRST TELOPT_BINARY
|
||||
#define TELOPT_LAST TELOPT_NEW_ENVIRON
|
||||
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
|
||||
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
|
||||
#endif
|
||||
|
||||
/* sub-option qualifiers */
|
||||
#define TELQUAL_IS 0 /* option is... */
|
||||
#define TELQUAL_SEND 1 /* send option */
|
||||
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
|
||||
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
|
||||
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
|
||||
|
||||
#define LFLOW_OFF 0 /* Disable remote flow control */
|
||||
#define LFLOW_ON 1 /* Enable remote flow control */
|
||||
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
|
||||
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
|
||||
|
||||
/*
|
||||
* LINEMODE suboptions
|
||||
*/
|
||||
|
||||
#define LM_MODE 1
|
||||
#define LM_FORWARDMASK 2
|
||||
#define LM_SLC 3
|
||||
|
||||
#define MODE_EDIT 0x01
|
||||
#define MODE_TRAPSIG 0x02
|
||||
#define MODE_ACK 0x04
|
||||
#define MODE_SOFT_TAB 0x08
|
||||
#define MODE_LIT_ECHO 0x10
|
||||
|
||||
#define MODE_MASK 0x1f
|
||||
|
||||
/* Not part of protocol, but needed to simplify things... */
|
||||
#define MODE_FLOW 0x0100
|
||||
#define MODE_ECHO 0x0200
|
||||
#define MODE_INBIN 0x0400
|
||||
#define MODE_OUTBIN 0x0800
|
||||
#define MODE_FORCE 0x1000
|
||||
|
||||
#define SLC_SYNCH 1
|
||||
#define SLC_BRK 2
|
||||
#define SLC_IP 3
|
||||
#define SLC_AO 4
|
||||
#define SLC_AYT 5
|
||||
#define SLC_EOR 6
|
||||
#define SLC_ABORT 7
|
||||
#define SLC_EOF 8
|
||||
#define SLC_SUSP 9
|
||||
#define SLC_EC 10
|
||||
#define SLC_EL 11
|
||||
#define SLC_EW 12
|
||||
#define SLC_RP 13
|
||||
#define SLC_LNEXT 14
|
||||
#define SLC_XON 15
|
||||
#define SLC_XOFF 16
|
||||
#define SLC_FORW1 17
|
||||
#define SLC_FORW2 18
|
||||
#define SLC_MCL 19
|
||||
#define SLC_MCR 20
|
||||
#define SLC_MCWL 21
|
||||
#define SLC_MCWR 22
|
||||
#define SLC_MCBOL 23
|
||||
#define SLC_MCEOL 24
|
||||
#define SLC_INSRT 25
|
||||
#define SLC_OVER 26
|
||||
#define SLC_ECR 27
|
||||
#define SLC_EWR 28
|
||||
#define SLC_EBOL 29
|
||||
#define SLC_EEOL 30
|
||||
|
||||
#define NSLC 30
|
||||
|
||||
/*
|
||||
* For backwards compatibility, we define SLC_NAMES to be the
|
||||
* list of names if SLC_NAMES is not defined.
|
||||
*/
|
||||
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
|
||||
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
|
||||
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
|
||||
"MCL", "MCR", "MCWL", "MCWR", "MCBOL", \
|
||||
"MCEOL", "INSRT", "OVER", "ECR", "EWR", \
|
||||
"EBOL", "EEOL", \
|
||||
0
|
||||
|
||||
#ifdef SLC_NAMES
|
||||
const char *slc_names[] = {
|
||||
SLC_NAMELIST
|
||||
};
|
||||
#else
|
||||
extern char *slc_names[];
|
||||
#define SLC_NAMES SLC_NAMELIST
|
||||
#endif
|
||||
|
||||
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
|
||||
#define SLC_NAME(x) slc_names[x]
|
||||
|
||||
#define SLC_NOSUPPORT 0
|
||||
#define SLC_CANTCHANGE 1
|
||||
#define SLC_VARIABLE 2
|
||||
#define SLC_DEFAULT 3
|
||||
#define SLC_LEVELBITS 0x03
|
||||
|
||||
#define SLC_FUNC 0
|
||||
#define SLC_FLAGS 1
|
||||
#define SLC_VALUE 2
|
||||
|
||||
#define SLC_ACK 0x80
|
||||
#define SLC_FLUSHIN 0x40
|
||||
#define SLC_FLUSHOUT 0x20
|
||||
|
||||
#define OLD_ENV_VAR 1
|
||||
#define OLD_ENV_VALUE 0
|
||||
#define NEW_ENV_VAR 0
|
||||
#define NEW_ENV_VALUE 1
|
||||
#define ENV_ESC 2
|
||||
#define ENV_USERVAR 3
|
||||
|
||||
/*
|
||||
* AUTHENTICATION suboptions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Who is authenticating who ...
|
||||
*/
|
||||
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
|
||||
#define AUTH_WHO_SERVER 1 /* Server authenticating client */
|
||||
#define AUTH_WHO_MASK 1
|
||||
|
||||
/*
|
||||
* amount of authentication done
|
||||
*/
|
||||
#define AUTH_HOW_ONE_WAY 0
|
||||
#define AUTH_HOW_MUTUAL 2
|
||||
#define AUTH_HOW_MASK 2
|
||||
|
||||
#define AUTHTYPE_NULL 0
|
||||
#define AUTHTYPE_KERBEROS_V4 1
|
||||
#define AUTHTYPE_KERBEROS_V5 2
|
||||
#define AUTHTYPE_SPX 3
|
||||
#define AUTHTYPE_MINK 4
|
||||
#define AUTHTYPE_SRA 6
|
||||
#define AUTHTYPE_CNT 7
|
||||
|
||||
#define AUTHTYPE_TEST 99
|
||||
|
||||
#ifdef AUTH_NAMES
|
||||
const char *authtype_names[] = {
|
||||
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", NULL, "SRA",
|
||||
0
|
||||
};
|
||||
#else
|
||||
extern char *authtype_names[];
|
||||
#endif
|
||||
|
||||
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
|
||||
#define AUTHTYPE_NAME(x) authtype_names[x]
|
||||
|
||||
/*
|
||||
* ENCRYPTion suboptions
|
||||
*/
|
||||
#define ENCRYPT_IS 0 /* I pick encryption type ... */
|
||||
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
|
||||
#define ENCRYPT_REPLY 2 /* Initial setup response */
|
||||
#define ENCRYPT_START 3 /* Am starting to send encrypted */
|
||||
#define ENCRYPT_END 4 /* Am ending encrypted */
|
||||
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
|
||||
#define ENCRYPT_REQEND 6 /* Request you end encrypting */
|
||||
#define ENCRYPT_ENC_KEYID 7
|
||||
#define ENCRYPT_DEC_KEYID 8
|
||||
#define ENCRYPT_CNT 9
|
||||
|
||||
#define ENCTYPE_ANY 0
|
||||
#define ENCTYPE_DES_CFB64 1
|
||||
#define ENCTYPE_DES_OFB64 2
|
||||
#define ENCTYPE_CNT 3
|
||||
|
||||
#ifdef ENCRYPT_NAMES
|
||||
const char *encrypt_names[] = {
|
||||
"IS", "SUPPORT", "REPLY", "START", "END",
|
||||
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
|
||||
0
|
||||
};
|
||||
const char *enctype_names[] = {
|
||||
"ANY", "DES_CFB64", "DES_OFB64",
|
||||
0
|
||||
};
|
||||
#else
|
||||
extern char *encrypt_names[];
|
||||
extern char *enctype_names[];
|
||||
#endif
|
||||
|
||||
|
||||
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
|
||||
#define ENCRYPT_NAME(x) encrypt_names[x]
|
||||
|
||||
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
|
||||
#define ENCTYPE_NAME(x) enctype_names[x]
|
||||
|
||||
#endif /* !_TELNET_H_ */
|
||||
@@ -1,111 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)auth-proto.h 8.1 (Berkeley) 6/4/93
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1990 by the Massachusetts Institute of Technology
|
||||
*
|
||||
* Export of this software from the United States of America is assumed
|
||||
* to require a specific license from the United States Government.
|
||||
* It is the responsibility of any person or organization contemplating
|
||||
* export to obtain such a license before exporting.
|
||||
*
|
||||
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
||||
* distribute this software and its documentation for any purpose and
|
||||
* without fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright notice and
|
||||
* this permission notice appear in supporting documentation, and that
|
||||
* the name of M.I.T. not be used in advertising or publicity pertaining
|
||||
* to distribution of the software without specific, written prior
|
||||
* permission. M.I.T. makes no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is" without express
|
||||
* or implied warranty.
|
||||
*/
|
||||
|
||||
#ifdef AUTHENTICATION
|
||||
|
||||
Authenticator *findauthenticator(int, int);
|
||||
|
||||
void auth_init(const char *, int);
|
||||
int auth_cmd(int, char **);
|
||||
void auth_request(void);
|
||||
void auth_send(unsigned char *, int);
|
||||
void auth_send_retry(void);
|
||||
void auth_is(unsigned char *, int);
|
||||
void auth_reply(unsigned char *, int);
|
||||
void auth_finished(Authenticator *, int);
|
||||
int auth_wait(char *);
|
||||
void auth_disable_name(char *);
|
||||
void auth_gen_printsub(unsigned char *, int, unsigned char *, int);
|
||||
void auth_name(unsigned char *, int);
|
||||
void auth_printsub(unsigned char *, int, unsigned char *, int);
|
||||
int auth_sendname(unsigned char *, int);
|
||||
void auth_encrypt_user(char *);
|
||||
int auth_disable(char *);
|
||||
int auth_enable(char *);
|
||||
int auth_togdebug(int);
|
||||
int auth_status(void);
|
||||
|
||||
int getauthmask(char *, int *);
|
||||
|
||||
#ifdef KRB4
|
||||
int kerberos4_init(Authenticator *, int);
|
||||
int kerberos4_send(Authenticator *);
|
||||
void kerberos4_is(Authenticator *, unsigned char *, int);
|
||||
void kerberos4_reply(Authenticator *, unsigned char *, int);
|
||||
int kerberos4_status(Authenticator *, char *, int);
|
||||
void kerberos4_printsub(unsigned char *, int, unsigned char *, int);
|
||||
#endif
|
||||
|
||||
#ifdef KRB5
|
||||
int kerberos5_init(Authenticator *, int);
|
||||
int kerberos5_send_mutual(Authenticator *);
|
||||
int kerberos5_send_oneway(Authenticator *);
|
||||
void kerberos5_is(Authenticator *, unsigned char *, int);
|
||||
void kerberos5_reply(Authenticator *, unsigned char *, int);
|
||||
int kerberos5_status(Authenticator *, char *, int level);
|
||||
void kerberos5_printsub(unsigned char *, int, unsigned char *, int);
|
||||
#endif
|
||||
|
||||
#ifdef SRA
|
||||
int sra_init(Authenticator *, int);
|
||||
int sra_send(Authenticator *);
|
||||
void sra_is(Authenticator *, unsigned char *, int);
|
||||
void sra_reply(Authenticator *, unsigned char *, int);
|
||||
int sra_status(Authenticator *, char *, int);
|
||||
void sra_printsub(unsigned char *, int, unsigned char *, int);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,623 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)auth.c 8.3 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1990 by the Massachusetts Institute of Technology
|
||||
*
|
||||
* Export of this software from the United States of America is assumed
|
||||
* to require a specific license from the United States Government.
|
||||
* It is the responsibility of any person or organization contemplating
|
||||
* export to obtain such a license before exporting.
|
||||
*
|
||||
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
||||
* distribute this software and its documentation for any purpose and
|
||||
* without fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright notice and
|
||||
* this permission notice appear in supporting documentation, and that
|
||||
* the name of M.I.T. not be used in advertising or publicity pertaining
|
||||
* to distribution of the software without specific, written prior
|
||||
* permission. M.I.T. makes no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is" without express
|
||||
* or implied warranty.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef AUTHENTICATION
|
||||
#define AUTH_NAMES
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/telnet.h>
|
||||
|
||||
#include "encrypt.h"
|
||||
#include "auth.h"
|
||||
#include "misc-proto.h"
|
||||
#include "auth-proto.h"
|
||||
|
||||
#define typemask(x) ((x) > 0 ? 1 << ((x)-1) : 0)
|
||||
|
||||
#ifdef KRB4_ENCPWD
|
||||
extern krb4encpwd_init();
|
||||
extern krb4encpwd_send();
|
||||
extern krb4encpwd_is();
|
||||
extern krb4encpwd_reply();
|
||||
extern krb4encpwd_status();
|
||||
extern krb4encpwd_printsub();
|
||||
#endif
|
||||
|
||||
#ifdef RSA_ENCPWD
|
||||
extern rsaencpwd_init();
|
||||
extern rsaencpwd_send();
|
||||
extern rsaencpwd_is();
|
||||
extern rsaencpwd_reply();
|
||||
extern rsaencpwd_status();
|
||||
extern rsaencpwd_printsub();
|
||||
#endif
|
||||
|
||||
int auth_debug_mode = 0;
|
||||
static const char *Name = "Noname";
|
||||
static int Server = 0;
|
||||
static Authenticator *authenticated = 0;
|
||||
static int authenticating = 0;
|
||||
static int validuser = 0;
|
||||
static unsigned char _auth_send_data[256];
|
||||
static unsigned char *auth_send_data;
|
||||
static int auth_send_cnt = 0;
|
||||
|
||||
int auth_onoff(char *type, int on);
|
||||
void auth_encrypt_user(char *name);
|
||||
|
||||
/*
|
||||
* Authentication types supported. Plese note that these are stored
|
||||
* in priority order, i.e. try the first one first.
|
||||
*/
|
||||
Authenticator authenticators[] = {
|
||||
#ifdef KRB5
|
||||
# ifdef ENCRYPTION
|
||||
{ AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
|
||||
kerberos5_init,
|
||||
kerberos5_send_mutual,
|
||||
kerberos5_is,
|
||||
kerberos5_reply,
|
||||
kerberos5_status,
|
||||
kerberos5_printsub },
|
||||
# endif /* ENCRYPTION */
|
||||
{ AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
|
||||
kerberos5_init,
|
||||
kerberos5_send_oneway,
|
||||
kerberos5_is,
|
||||
kerberos5_reply,
|
||||
kerberos5_status,
|
||||
kerberos5_printsub },
|
||||
#endif
|
||||
#ifdef KRB4
|
||||
# ifdef ENCRYPTION
|
||||
{ AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
|
||||
kerberos4_init,
|
||||
kerberos4_send,
|
||||
kerberos4_is,
|
||||
kerberos4_reply,
|
||||
kerberos4_status,
|
||||
kerberos4_printsub },
|
||||
# endif /* ENCRYPTION */
|
||||
{ AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
|
||||
kerberos4_init,
|
||||
kerberos4_send,
|
||||
kerberos4_is,
|
||||
kerberos4_reply,
|
||||
kerberos4_status,
|
||||
kerberos4_printsub },
|
||||
#endif
|
||||
#ifdef KRB4_ENCPWD
|
||||
{ AUTHTYPE_KRB4_ENCPWD, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
|
||||
krb4encpwd_init,
|
||||
krb4encpwd_send,
|
||||
krb4encpwd_is,
|
||||
krb4encpwd_reply,
|
||||
krb4encpwd_status,
|
||||
krb4encpwd_printsub },
|
||||
#endif
|
||||
#ifdef RSA_ENCPWD
|
||||
{ AUTHTYPE_RSA_ENCPWD, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
|
||||
rsaencpwd_init,
|
||||
rsaencpwd_send,
|
||||
rsaencpwd_is,
|
||||
rsaencpwd_reply,
|
||||
rsaencpwd_status,
|
||||
rsaencpwd_printsub },
|
||||
#endif
|
||||
#ifdef SRA
|
||||
{ AUTHTYPE_SRA, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
|
||||
sra_init,
|
||||
sra_send,
|
||||
sra_is,
|
||||
sra_reply,
|
||||
sra_status,
|
||||
sra_printsub },
|
||||
|
||||
#endif
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
static Authenticator NoAuth = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
static int i_support = 0;
|
||||
static int i_wont_support = 0;
|
||||
|
||||
Authenticator *
|
||||
findauthenticator(int type, int way)
|
||||
{
|
||||
Authenticator *ap = authenticators;
|
||||
|
||||
while (ap->type && (ap->type != type || ap->way != way))
|
||||
++ap;
|
||||
return(ap->type ? ap : 0);
|
||||
}
|
||||
|
||||
void
|
||||
auth_init(const char *name, int server)
|
||||
{
|
||||
Authenticator *ap = authenticators;
|
||||
|
||||
Server = server;
|
||||
Name = name;
|
||||
|
||||
i_support = 0;
|
||||
authenticated = 0;
|
||||
authenticating = 0;
|
||||
while (ap->type) {
|
||||
if (!ap->init || (*ap->init)(ap, server)) {
|
||||
i_support |= typemask(ap->type);
|
||||
if (auth_debug_mode)
|
||||
printf(">>>%s: I support auth type %d %d\r\n",
|
||||
Name,
|
||||
ap->type, ap->way);
|
||||
}
|
||||
else if (auth_debug_mode)
|
||||
printf(">>>%s: Init failed: auth type %d %d\r\n",
|
||||
Name, ap->type, ap->way);
|
||||
++ap;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
auth_disable_name(char *name)
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < AUTHTYPE_CNT; ++x) {
|
||||
if (AUTHTYPE_NAME(x) && !strcasecmp(name, AUTHTYPE_NAME(x))) {
|
||||
i_wont_support |= typemask(x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
getauthmask(char *type, int *maskp)
|
||||
{
|
||||
int x;
|
||||
|
||||
if (AUTHTYPE_NAME(0) && !strcasecmp(type, AUTHTYPE_NAME(0))) {
|
||||
*maskp = -1;
|
||||
return(1);
|
||||
}
|
||||
|
||||
for (x = 1; x < AUTHTYPE_CNT; ++x) {
|
||||
if (AUTHTYPE_NAME(x) && !strcasecmp(type, AUTHTYPE_NAME(x))) {
|
||||
*maskp = typemask(x);
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
auth_enable(char *type)
|
||||
{
|
||||
return(auth_onoff(type, 1));
|
||||
}
|
||||
|
||||
int
|
||||
auth_disable(char *type)
|
||||
{
|
||||
return(auth_onoff(type, 0));
|
||||
}
|
||||
|
||||
int
|
||||
auth_onoff(char *type, int on)
|
||||
{
|
||||
int i, mask = -1;
|
||||
Authenticator *ap;
|
||||
|
||||
if (!strcasecmp(type, "?") || !strcasecmp(type, "help")) {
|
||||
printf("auth %s 'type'\n", on ? "enable" : "disable");
|
||||
printf("Where 'type' is one of:\n");
|
||||
printf("\t%s\n", AUTHTYPE_NAME(0));
|
||||
mask = 0;
|
||||
for (ap = authenticators; ap->type; ap++) {
|
||||
if ((mask & (i = typemask(ap->type))) != 0)
|
||||
continue;
|
||||
mask |= i;
|
||||
printf("\t%s\n", AUTHTYPE_NAME(ap->type));
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (!getauthmask(type, &mask)) {
|
||||
printf("%s: invalid authentication type\n", type);
|
||||
return(0);
|
||||
}
|
||||
if (on)
|
||||
i_wont_support &= ~mask;
|
||||
else
|
||||
i_wont_support |= mask;
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
auth_togdebug(int on)
|
||||
{
|
||||
if (on < 0)
|
||||
auth_debug_mode ^= 1;
|
||||
else
|
||||
auth_debug_mode = on;
|
||||
printf("auth debugging %s\n", auth_debug_mode ? "enabled" : "disabled");
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
auth_status(void)
|
||||
{
|
||||
Authenticator *ap;
|
||||
int i, mask;
|
||||
|
||||
if (i_wont_support == -1)
|
||||
printf("Authentication disabled\n");
|
||||
else
|
||||
printf("Authentication enabled\n");
|
||||
|
||||
mask = 0;
|
||||
for (ap = authenticators; ap->type; ap++) {
|
||||
if ((mask & (i = typemask(ap->type))) != 0)
|
||||
continue;
|
||||
mask |= i;
|
||||
printf("%s: %s\n", AUTHTYPE_NAME(ap->type),
|
||||
(i_wont_support & typemask(ap->type)) ?
|
||||
"disabled" : "enabled");
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine is called by the server to start authentication
|
||||
* negotiation.
|
||||
*/
|
||||
void
|
||||
auth_request(void)
|
||||
{
|
||||
static unsigned char str_request[64] = { IAC, SB,
|
||||
TELOPT_AUTHENTICATION,
|
||||
TELQUAL_SEND, };
|
||||
Authenticator *ap = authenticators;
|
||||
unsigned char *e = str_request + 4;
|
||||
|
||||
if (!authenticating) {
|
||||
authenticating = 1;
|
||||
while (ap->type) {
|
||||
if (i_support & ~i_wont_support & typemask(ap->type)) {
|
||||
if (auth_debug_mode) {
|
||||
printf(">>>%s: Sending type %d %d\r\n",
|
||||
Name, ap->type, ap->way);
|
||||
}
|
||||
*e++ = ap->type;
|
||||
*e++ = ap->way;
|
||||
}
|
||||
++ap;
|
||||
}
|
||||
*e++ = IAC;
|
||||
*e++ = SE;
|
||||
net_write(str_request, e - str_request);
|
||||
printsub('>', &str_request[2], e - str_request - 2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is called when an AUTH SEND is received.
|
||||
* It should never arrive on the server side (as only the server can
|
||||
* send an AUTH SEND).
|
||||
* You should probably respond to it if you can...
|
||||
*
|
||||
* If you want to respond to the types out of order (i.e. even
|
||||
* if he sends LOGIN KERBEROS and you support both, you respond
|
||||
* with KERBEROS instead of LOGIN (which is against what the
|
||||
* protocol says)) you will have to hack this code...
|
||||
*/
|
||||
void
|
||||
auth_send(unsigned char *data, int cnt)
|
||||
{
|
||||
Authenticator *ap;
|
||||
static unsigned char str_none[] = { IAC, SB, TELOPT_AUTHENTICATION,
|
||||
TELQUAL_IS, AUTHTYPE_NULL, 0,
|
||||
IAC, SE };
|
||||
if (Server) {
|
||||
if (auth_debug_mode) {
|
||||
printf(">>>%s: auth_send called!\r\n", Name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (auth_debug_mode) {
|
||||
printf(">>>%s: auth_send got:", Name);
|
||||
printd(data, cnt); printf("\r\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the data, if it is new, so that we can continue looking
|
||||
* at it if the authorization we try doesn't work
|
||||
*/
|
||||
if (data < _auth_send_data ||
|
||||
data > _auth_send_data + sizeof(_auth_send_data)) {
|
||||
auth_send_cnt = (size_t)cnt > sizeof(_auth_send_data)
|
||||
? sizeof(_auth_send_data)
|
||||
: cnt;
|
||||
memmove((void *)_auth_send_data, (void *)data, auth_send_cnt);
|
||||
auth_send_data = _auth_send_data;
|
||||
} else {
|
||||
/*
|
||||
* This is probably a no-op, but we just make sure
|
||||
*/
|
||||
auth_send_data = data;
|
||||
auth_send_cnt = cnt;
|
||||
}
|
||||
while ((auth_send_cnt -= 2) >= 0) {
|
||||
if (auth_debug_mode)
|
||||
printf(">>>%s: He supports %d\r\n",
|
||||
Name, *auth_send_data);
|
||||
if ((i_support & ~i_wont_support) & typemask(*auth_send_data)) {
|
||||
ap = findauthenticator(auth_send_data[0],
|
||||
auth_send_data[1]);
|
||||
if (ap && ap->send) {
|
||||
if (auth_debug_mode)
|
||||
printf(">>>%s: Trying %d %d\r\n",
|
||||
Name, auth_send_data[0],
|
||||
auth_send_data[1]);
|
||||
if ((*ap->send)(ap)) {
|
||||
/*
|
||||
* Okay, we found one we like
|
||||
* and did it.
|
||||
* we can go home now.
|
||||
*/
|
||||
if (auth_debug_mode)
|
||||
printf(">>>%s: Using type %d\r\n",
|
||||
Name, *auth_send_data);
|
||||
auth_send_data += 2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* else
|
||||
* just continue on and look for the
|
||||
* next one if we didn't do anything.
|
||||
*/
|
||||
}
|
||||
auth_send_data += 2;
|
||||
}
|
||||
net_write(str_none, sizeof(str_none));
|
||||
printsub('>', &str_none[2], sizeof(str_none) - 2);
|
||||
if (auth_debug_mode)
|
||||
printf(">>>%s: Sent failure message\r\n", Name);
|
||||
auth_finished(0, AUTH_REJECT);
|
||||
}
|
||||
|
||||
void
|
||||
auth_send_retry(void)
|
||||
{
|
||||
/*
|
||||
* if auth_send_cnt <= 0 then auth_send will end up rejecting
|
||||
* the authentication and informing the other side of this.
|
||||
*/
|
||||
auth_send(auth_send_data, auth_send_cnt);
|
||||
}
|
||||
|
||||
void
|
||||
auth_is(unsigned char *data, int cnt)
|
||||
{
|
||||
Authenticator *ap;
|
||||
|
||||
if (cnt < 2)
|
||||
return;
|
||||
|
||||
if (data[0] == AUTHTYPE_NULL) {
|
||||
auth_finished(0, AUTH_REJECT);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ap = findauthenticator(data[0], data[1]))) {
|
||||
if (ap->is)
|
||||
(*ap->is)(ap, data+2, cnt-2);
|
||||
} else if (auth_debug_mode)
|
||||
printf(">>>%s: Invalid authentication in IS: %d\r\n",
|
||||
Name, *data);
|
||||
}
|
||||
|
||||
void
|
||||
auth_reply(unsigned char *data, int cnt)
|
||||
{
|
||||
Authenticator *ap;
|
||||
|
||||
if (cnt < 2)
|
||||
return;
|
||||
|
||||
if ((ap = findauthenticator(data[0], data[1]))) {
|
||||
if (ap->reply)
|
||||
(*ap->reply)(ap, data+2, cnt-2);
|
||||
} else if (auth_debug_mode)
|
||||
printf(">>>%s: Invalid authentication in SEND: %d\r\n",
|
||||
Name, *data);
|
||||
}
|
||||
|
||||
void
|
||||
auth_name(unsigned char *data, int cnt)
|
||||
{
|
||||
unsigned char savename[256];
|
||||
|
||||
if (cnt < 1) {
|
||||
if (auth_debug_mode)
|
||||
printf(">>>%s: Empty name in NAME\r\n", Name);
|
||||
return;
|
||||
}
|
||||
if ((size_t)cnt > sizeof(savename) - 1) {
|
||||
if (auth_debug_mode)
|
||||
printf(">>>%s: Name in NAME (%d) exceeds %d length\r\n",
|
||||
Name, cnt, (u_int)sizeof(savename)-1);
|
||||
return;
|
||||
}
|
||||
memmove((void *)savename, (void *)data, cnt);
|
||||
savename[cnt] = '\0'; /* Null terminate */
|
||||
if (auth_debug_mode)
|
||||
printf(">>>%s: Got NAME [%s]\r\n", Name, savename);
|
||||
auth_encrypt_user(savename);
|
||||
}
|
||||
|
||||
int
|
||||
auth_sendname(unsigned char *cp, int len)
|
||||
{
|
||||
static unsigned char str_request[256+6]
|
||||
= { IAC, SB, TELOPT_AUTHENTICATION, TELQUAL_NAME, };
|
||||
unsigned char *e = str_request + 4;
|
||||
unsigned char *ee = &str_request[sizeof(str_request)-2];
|
||||
|
||||
while (--len >= 0) {
|
||||
if ((*e++ = *cp++) == IAC)
|
||||
*e++ = IAC;
|
||||
if (e >= ee)
|
||||
return(0);
|
||||
}
|
||||
*e++ = IAC;
|
||||
*e++ = SE;
|
||||
net_write(str_request, e - str_request);
|
||||
printsub('>', &str_request[2], e - &str_request[2]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
void
|
||||
auth_finished(Authenticator *ap, int result)
|
||||
{
|
||||
if (!(authenticated = ap))
|
||||
authenticated = &NoAuth;
|
||||
validuser = result;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
auth_intr(int sig __unused)
|
||||
{
|
||||
auth_finished(0, AUTH_REJECT);
|
||||
}
|
||||
|
||||
int
|
||||
auth_wait(char *name)
|
||||
{
|
||||
if (auth_debug_mode)
|
||||
printf(">>>%s: in auth_wait.\r\n", Name);
|
||||
|
||||
if (Server && !authenticating)
|
||||
return(0);
|
||||
|
||||
(void) signal(SIGALRM, auth_intr);
|
||||
alarm(30);
|
||||
while (!authenticated)
|
||||
if (telnet_spin())
|
||||
break;
|
||||
alarm(0);
|
||||
(void) signal(SIGALRM, SIG_DFL);
|
||||
|
||||
/*
|
||||
* Now check to see if the user is valid or not
|
||||
*/
|
||||
if (!authenticated || authenticated == &NoAuth)
|
||||
return(AUTH_REJECT);
|
||||
|
||||
if (validuser == AUTH_VALID)
|
||||
validuser = AUTH_USER;
|
||||
|
||||
if (authenticated->status)
|
||||
validuser = (*authenticated->status)(authenticated,
|
||||
name, validuser);
|
||||
return(validuser);
|
||||
}
|
||||
|
||||
void
|
||||
auth_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
||||
{
|
||||
Authenticator *ap;
|
||||
|
||||
if ((ap = findauthenticator(data[1], data[2])) && ap->printsub)
|
||||
(*ap->printsub)(data, cnt, buf, buflen);
|
||||
else
|
||||
auth_gen_printsub(data, cnt, buf, buflen);
|
||||
}
|
||||
|
||||
void
|
||||
auth_gen_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
||||
{
|
||||
unsigned char *cp;
|
||||
unsigned char tbuf[16];
|
||||
|
||||
cnt -= 3;
|
||||
data += 3;
|
||||
buf[buflen-1] = '\0';
|
||||
buf[buflen-2] = '*';
|
||||
buflen -= 2;
|
||||
for (; cnt > 0; cnt--, data++) {
|
||||
sprintf((char *)tbuf, " %d", *data);
|
||||
for (cp = tbuf; *cp && buflen > 0; --buflen)
|
||||
*buf++ = *cp++;
|
||||
if (buflen <= 0)
|
||||
return;
|
||||
}
|
||||
*buf = '\0';
|
||||
}
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)auth.h 8.1 (Berkeley) 6/4/93
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1990 by the Massachusetts Institute of Technology
|
||||
*
|
||||
* Export of this software from the United States of America is assumed
|
||||
* to require a specific license from the United States Government.
|
||||
* It is the responsibility of any person or organization contemplating
|
||||
* export to obtain such a license before exporting.
|
||||
*
|
||||
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
||||
* distribute this software and its documentation for any purpose and
|
||||
* without fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright notice and
|
||||
* this permission notice appear in supporting documentation, and that
|
||||
* the name of M.I.T. not be used in advertising or publicity pertaining
|
||||
* to distribution of the software without specific, written prior
|
||||
* permission. M.I.T. makes no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is" without express
|
||||
* or implied warranty.
|
||||
*/
|
||||
|
||||
#ifndef __AUTH__
|
||||
#define __AUTH__
|
||||
|
||||
#define AUTH_REJECT 0 /* Rejected */
|
||||
#define AUTH_UNKNOWN 1 /* We don't know who he is, but he's okay */
|
||||
#define AUTH_OTHER 2 /* We know him, but not his name */
|
||||
#define AUTH_USER 3 /* We know he name */
|
||||
#define AUTH_VALID 4 /* We know him, and he needs no password */
|
||||
|
||||
typedef struct XauthP {
|
||||
int type;
|
||||
int way;
|
||||
int (*init)(struct XauthP *, int);
|
||||
int (*send)(struct XauthP *);
|
||||
void (*is)(struct XauthP *, unsigned char *, int);
|
||||
void (*reply)(struct XauthP *, unsigned char *, int);
|
||||
int (*status)(struct XauthP *, char *, int);
|
||||
void (*printsub)(unsigned char *, int, unsigned char *, int);
|
||||
} Authenticator;
|
||||
|
||||
#include "auth-proto.h"
|
||||
|
||||
extern int auth_debug_mode;
|
||||
#endif
|
||||
@@ -1,126 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)enc-proto.h 8.1 (Berkeley) 6/4/93
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1990 by the Massachusetts Institute of Technology
|
||||
*
|
||||
* Export of this software from the United States of America is assumed
|
||||
* to require a specific license from the United States Government.
|
||||
* It is the responsibility of any person or organization contemplating
|
||||
* export to obtain such a license before exporting.
|
||||
*
|
||||
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
||||
* distribute this software and its documentation for any purpose and
|
||||
* without fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright notice and
|
||||
* this permission notice appear in supporting documentation, and that
|
||||
* the name of M.I.T. not be used in advertising or publicity pertaining
|
||||
* to distribution of the software without specific, written prior
|
||||
* permission. M.I.T. makes no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is" without express
|
||||
* or implied warranty.
|
||||
*/
|
||||
|
||||
#ifdef ENCRYPTION
|
||||
void encrypt_init(const char *, int);
|
||||
Encryptions *findencryption(int);
|
||||
void encrypt_send_supprt(void);
|
||||
void encrypt_auto(int);
|
||||
void decrypt_auto(int);
|
||||
void encrypt_is(unsigned char *, int);
|
||||
void encrypt_reply(unsigned char *, int);
|
||||
void encrypt_start_input(int);
|
||||
void encrypt_session_key(Session_Key *, int);
|
||||
void encrypt_end_input(void);
|
||||
void encrypt_start_output(int);
|
||||
void encrypt_end_output(void);
|
||||
void encrypt_send_request_start(void);
|
||||
void encrypt_send_request_end(void);
|
||||
void encrypt_send_end(void);
|
||||
void encrypt_wait(void);
|
||||
void encrypt_send_support(void);
|
||||
void encrypt_send_keyid(int, const char *, int, int);
|
||||
void encrypt_start(unsigned char *, int);
|
||||
void encrypt_end(void);
|
||||
void encrypt_support(unsigned char *, int);
|
||||
void encrypt_request_start(unsigned char *, int);
|
||||
void encrypt_request_end(void);
|
||||
void encrypt_enc_keyid(unsigned char *, int);
|
||||
void encrypt_dec_keyid(unsigned char *, int);
|
||||
void encrypt_printsub(unsigned char *, int, unsigned char *, int);
|
||||
void encrypt_gen_printsub(unsigned char *, int, unsigned char *, int);
|
||||
void encrypt_display(void);
|
||||
|
||||
void fb64_printsub(unsigned char *, int, unsigned char *, int, const char *);
|
||||
|
||||
int EncryptEnable(char *, char *);
|
||||
int EncryptDisable(char *, char *);
|
||||
int EncryptStatus(void);
|
||||
int EncryptDebug(int);
|
||||
int EncryptVerbose(int);
|
||||
int EncryptAutoEnc(int);
|
||||
int EncryptAutoDec(int);
|
||||
|
||||
void krbdes_encrypt(unsigned char *, int);
|
||||
int krbdes_decrypt(int);
|
||||
int krbdes_is(unsigned char *, int);
|
||||
int krbdes_reply(unsigned char *, int);
|
||||
void krbdes_init(int);
|
||||
int krbdes_start(int, int);
|
||||
void krbdes_session(Session_Key *, int);
|
||||
void krbdes_printsub(unsigned char *, int, unsigned char *, int);
|
||||
|
||||
void cfb64_encrypt(unsigned char *, int);
|
||||
int cfb64_decrypt(int);
|
||||
void cfb64_init(int);
|
||||
int cfb64_start(int, int);
|
||||
int cfb64_is(unsigned char *, int);
|
||||
int cfb64_reply(unsigned char *, int);
|
||||
void cfb64_session(Session_Key *, int);
|
||||
int cfb64_keyid(int, unsigned char *, int *);
|
||||
void cfb64_printsub(unsigned char *, int, unsigned char *, int);
|
||||
|
||||
void ofb64_encrypt(unsigned char *, int);
|
||||
int ofb64_decrypt(int);
|
||||
void ofb64_init(int);
|
||||
int ofb64_start(int, int);
|
||||
int ofb64_is(unsigned char *, int);
|
||||
int ofb64_reply(unsigned char *, int);
|
||||
void ofb64_session(Session_Key *, int);
|
||||
int ofb64_keyid(int, unsigned char *, int *);
|
||||
void ofb64_printsub(unsigned char *, int, unsigned char *, int);
|
||||
|
||||
#endif /* ENCRYPTION */
|
||||
@@ -1,670 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)enc_des.c 8.3 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifdef ENCRYPTION
|
||||
# ifdef AUTHENTICATION
|
||||
#include <arpa/telnet.h>
|
||||
#include <openssl/des.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "encrypt.h"
|
||||
#include "key-proto.h"
|
||||
#include "misc-proto.h"
|
||||
|
||||
extern int encrypt_debug_mode;
|
||||
void des_set_random_generator_seed(des_cblock *); /* XXX */
|
||||
|
||||
#define CFB 0
|
||||
#define OFB 1
|
||||
|
||||
#define NO_SEND_IV 1
|
||||
#define NO_RECV_IV 2
|
||||
#define NO_KEYID 4
|
||||
#define IN_PROGRESS (NO_SEND_IV|NO_RECV_IV|NO_KEYID)
|
||||
#define SUCCESS 0
|
||||
#define FAILED -1
|
||||
|
||||
|
||||
struct fb {
|
||||
Block krbdes_key;
|
||||
Schedule krbdes_sched;
|
||||
Block temp_feed;
|
||||
unsigned char fb_feed[64];
|
||||
int need_start;
|
||||
int state[2];
|
||||
int keyid[2];
|
||||
int once;
|
||||
struct stinfo {
|
||||
Block str_output;
|
||||
Block str_feed;
|
||||
Block str_iv;
|
||||
Block str_ikey;
|
||||
Schedule str_sched;
|
||||
int str_index;
|
||||
int str_flagshift;
|
||||
} streams[2];
|
||||
};
|
||||
|
||||
static struct fb fb[2];
|
||||
|
||||
struct keyidlist {
|
||||
const char *keyid;
|
||||
int keyidlen;
|
||||
char *key;
|
||||
int keylen;
|
||||
int flags;
|
||||
} keyidlist [] = {
|
||||
{ "\0", 1, 0, 0, 0 }, /* default key of zero */
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
#define KEYFLAG_MASK 03
|
||||
|
||||
#define KEYFLAG_NOINIT 00
|
||||
#define KEYFLAG_INIT 01
|
||||
#define KEYFLAG_OK 02
|
||||
#define KEYFLAG_BAD 03
|
||||
|
||||
#define KEYFLAG_SHIFT 2
|
||||
|
||||
#define SHIFT_VAL(a,b) (KEYFLAG_SHIFT*((a)+((b)*2)))
|
||||
|
||||
#define FB64_IV 1
|
||||
#define FB64_IV_OK 2
|
||||
#define FB64_IV_BAD 3
|
||||
|
||||
|
||||
void fb64_stream_iv(Block, struct stinfo *);
|
||||
void fb64_init(struct fb *);
|
||||
static int fb64_start(struct fb *, int, int);
|
||||
int fb64_is(unsigned char *, int, struct fb *);
|
||||
int fb64_reply(unsigned char *, int, struct fb *);
|
||||
static void fb64_session(Session_Key *, int, struct fb *);
|
||||
void fb64_stream_key(Block, struct stinfo *);
|
||||
int fb64_keyid(int, unsigned char *, int *, struct fb *);
|
||||
|
||||
void
|
||||
cfb64_init(int server __unused)
|
||||
{
|
||||
fb64_init(&fb[CFB]);
|
||||
fb[CFB].fb_feed[4] = ENCTYPE_DES_CFB64;
|
||||
fb[CFB].streams[0].str_flagshift = SHIFT_VAL(0, CFB);
|
||||
fb[CFB].streams[1].str_flagshift = SHIFT_VAL(1, CFB);
|
||||
}
|
||||
|
||||
void
|
||||
ofb64_init(int server __unused)
|
||||
{
|
||||
fb64_init(&fb[OFB]);
|
||||
fb[OFB].fb_feed[4] = ENCTYPE_DES_OFB64;
|
||||
fb[CFB].streams[0].str_flagshift = SHIFT_VAL(0, OFB);
|
||||
fb[CFB].streams[1].str_flagshift = SHIFT_VAL(1, OFB);
|
||||
}
|
||||
|
||||
void
|
||||
fb64_init(struct fb *fbp)
|
||||
{
|
||||
memset((void *)fbp, 0, sizeof(*fbp));
|
||||
fbp->state[0] = fbp->state[1] = FAILED;
|
||||
fbp->fb_feed[0] = IAC;
|
||||
fbp->fb_feed[1] = SB;
|
||||
fbp->fb_feed[2] = TELOPT_ENCRYPT;
|
||||
fbp->fb_feed[3] = ENCRYPT_IS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns:
|
||||
* -1: some error. Negotiation is done, encryption not ready.
|
||||
* 0: Successful, initial negotiation all done.
|
||||
* 1: successful, negotiation not done yet.
|
||||
* 2: Not yet. Other things (like getting the key from
|
||||
* Kerberos) have to happen before we can continue.
|
||||
*/
|
||||
int
|
||||
cfb64_start(int dir, int server)
|
||||
{
|
||||
return(fb64_start(&fb[CFB], dir, server));
|
||||
}
|
||||
|
||||
int
|
||||
ofb64_start(int dir, int server)
|
||||
{
|
||||
return(fb64_start(&fb[OFB], dir, server));
|
||||
}
|
||||
|
||||
static int
|
||||
fb64_start(struct fb *fbp, int dir, int server __unused)
|
||||
{
|
||||
size_t x;
|
||||
unsigned char *p;
|
||||
int state;
|
||||
|
||||
switch (dir) {
|
||||
case DIR_DECRYPT:
|
||||
/*
|
||||
* This is simply a request to have the other side
|
||||
* start output (our input). He will negotiate an
|
||||
* IV so we need not look for it.
|
||||
*/
|
||||
state = fbp->state[dir-1];
|
||||
if (state == FAILED)
|
||||
state = IN_PROGRESS;
|
||||
break;
|
||||
|
||||
case DIR_ENCRYPT:
|
||||
state = fbp->state[dir-1];
|
||||
if (state == FAILED)
|
||||
state = IN_PROGRESS;
|
||||
else if ((state & NO_SEND_IV) == 0)
|
||||
break;
|
||||
|
||||
if (!VALIDKEY(fbp->krbdes_key)) {
|
||||
fbp->need_start = 1;
|
||||
break;
|
||||
}
|
||||
state &= ~NO_SEND_IV;
|
||||
state |= NO_RECV_IV;
|
||||
if (encrypt_debug_mode)
|
||||
printf("Creating new feed\r\n");
|
||||
/*
|
||||
* Create a random feed and send it over.
|
||||
*/
|
||||
des_new_random_key((Block *)fbp->temp_feed);
|
||||
des_ecb_encrypt((Block *)fbp->temp_feed, (Block *)fbp->temp_feed,
|
||||
fbp->krbdes_sched, 1);
|
||||
p = fbp->fb_feed + 3;
|
||||
*p++ = ENCRYPT_IS;
|
||||
p++;
|
||||
*p++ = FB64_IV;
|
||||
for (x = 0; x < sizeof(Block); ++x) {
|
||||
if ((*p++ = fbp->temp_feed[x]) == IAC)
|
||||
*p++ = IAC;
|
||||
}
|
||||
*p++ = IAC;
|
||||
*p++ = SE;
|
||||
printsub('>', &fbp->fb_feed[2], p - &fbp->fb_feed[2]);
|
||||
net_write(fbp->fb_feed, p - fbp->fb_feed);
|
||||
break;
|
||||
default:
|
||||
return(FAILED);
|
||||
}
|
||||
return(fbp->state[dir-1] = state);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns:
|
||||
* -1: some error. Negotiation is done, encryption not ready.
|
||||
* 0: Successful, initial negotiation all done.
|
||||
* 1: successful, negotiation not done yet.
|
||||
*/
|
||||
int
|
||||
cfb64_is(unsigned char *data, int cnt)
|
||||
{
|
||||
return(fb64_is(data, cnt, &fb[CFB]));
|
||||
}
|
||||
|
||||
int
|
||||
ofb64_is(unsigned char *data, int cnt)
|
||||
{
|
||||
return(fb64_is(data, cnt, &fb[OFB]));
|
||||
}
|
||||
|
||||
int
|
||||
fb64_is(unsigned char *data, int cnt, struct fb *fbp)
|
||||
{
|
||||
unsigned char *p;
|
||||
int state = fbp->state[DIR_DECRYPT-1];
|
||||
|
||||
if (cnt-- < 1)
|
||||
goto failure;
|
||||
|
||||
switch (*data++) {
|
||||
case FB64_IV:
|
||||
if (cnt != sizeof(Block)) {
|
||||
if (encrypt_debug_mode)
|
||||
printf("CFB64: initial vector failed on size\r\n");
|
||||
state = FAILED;
|
||||
goto failure;
|
||||
}
|
||||
|
||||
if (encrypt_debug_mode)
|
||||
printf("CFB64: initial vector received\r\n");
|
||||
|
||||
if (encrypt_debug_mode)
|
||||
printf("Initializing Decrypt stream\r\n");
|
||||
|
||||
fb64_stream_iv((void *)data, &fbp->streams[DIR_DECRYPT-1]);
|
||||
|
||||
p = fbp->fb_feed + 3;
|
||||
*p++ = ENCRYPT_REPLY;
|
||||
p++;
|
||||
*p++ = FB64_IV_OK;
|
||||
*p++ = IAC;
|
||||
*p++ = SE;
|
||||
printsub('>', &fbp->fb_feed[2], p - &fbp->fb_feed[2]);
|
||||
net_write(fbp->fb_feed, p - fbp->fb_feed);
|
||||
|
||||
state = fbp->state[DIR_DECRYPT-1] = IN_PROGRESS;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (encrypt_debug_mode) {
|
||||
printf("Unknown option type: %d\r\n", *(data-1));
|
||||
printd(data, cnt);
|
||||
printf("\r\n");
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
failure:
|
||||
/*
|
||||
* We failed. Send an FB64_IV_BAD option
|
||||
* to the other side so it will know that
|
||||
* things failed.
|
||||
*/
|
||||
p = fbp->fb_feed + 3;
|
||||
*p++ = ENCRYPT_REPLY;
|
||||
p++;
|
||||
*p++ = FB64_IV_BAD;
|
||||
*p++ = IAC;
|
||||
*p++ = SE;
|
||||
printsub('>', &fbp->fb_feed[2], p - &fbp->fb_feed[2]);
|
||||
net_write(fbp->fb_feed, p - fbp->fb_feed);
|
||||
|
||||
break;
|
||||
}
|
||||
return(fbp->state[DIR_DECRYPT-1] = state);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns:
|
||||
* -1: some error. Negotiation is done, encryption not ready.
|
||||
* 0: Successful, initial negotiation all done.
|
||||
* 1: successful, negotiation not done yet.
|
||||
*/
|
||||
int
|
||||
cfb64_reply(unsigned char *data, int cnt)
|
||||
{
|
||||
return(fb64_reply(data, cnt, &fb[CFB]));
|
||||
}
|
||||
|
||||
int
|
||||
ofb64_reply(unsigned char *data, int cnt)
|
||||
{
|
||||
return(fb64_reply(data, cnt, &fb[OFB]));
|
||||
}
|
||||
|
||||
int
|
||||
fb64_reply(unsigned char *data, int cnt, struct fb *fbp)
|
||||
{
|
||||
int state = fbp->state[DIR_ENCRYPT-1];
|
||||
|
||||
if (cnt-- < 1)
|
||||
goto failure;
|
||||
|
||||
switch (*data++) {
|
||||
case FB64_IV_OK:
|
||||
fb64_stream_iv(fbp->temp_feed, &fbp->streams[DIR_ENCRYPT-1]);
|
||||
if (state == FAILED)
|
||||
state = IN_PROGRESS;
|
||||
state &= ~NO_RECV_IV;
|
||||
encrypt_send_keyid(DIR_ENCRYPT, "\0", 1, 1);
|
||||
break;
|
||||
|
||||
case FB64_IV_BAD:
|
||||
memset(fbp->temp_feed, 0, sizeof(Block));
|
||||
fb64_stream_iv(fbp->temp_feed, &fbp->streams[DIR_ENCRYPT-1]);
|
||||
state = FAILED;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (encrypt_debug_mode) {
|
||||
printf("Unknown option type: %d\r\n", data[-1]);
|
||||
printd(data, cnt);
|
||||
printf("\r\n");
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
failure:
|
||||
state = FAILED;
|
||||
break;
|
||||
}
|
||||
return(fbp->state[DIR_ENCRYPT-1] = state);
|
||||
}
|
||||
|
||||
void
|
||||
cfb64_session(Session_Key *key, int server)
|
||||
{
|
||||
fb64_session(key, server, &fb[CFB]);
|
||||
}
|
||||
|
||||
void
|
||||
ofb64_session(Session_Key *key, int server)
|
||||
{
|
||||
fb64_session(key, server, &fb[OFB]);
|
||||
}
|
||||
|
||||
static void
|
||||
fb64_session(Session_Key *key, int server, struct fb *fbp)
|
||||
{
|
||||
if (!key || key->type != SK_DES) {
|
||||
if (encrypt_debug_mode)
|
||||
printf("Can't set krbdes's session key (%d != %d)\r\n",
|
||||
key ? key->type : -1, SK_DES);
|
||||
return;
|
||||
}
|
||||
memmove((void *)fbp->krbdes_key, (void *)key->data, sizeof(Block));
|
||||
|
||||
fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_ENCRYPT-1]);
|
||||
fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_DECRYPT-1]);
|
||||
|
||||
if (fbp->once == 0) {
|
||||
des_set_random_generator_seed((Block *)fbp->krbdes_key);
|
||||
fbp->once = 1;
|
||||
}
|
||||
des_key_sched((Block *)fbp->krbdes_key, fbp->krbdes_sched);
|
||||
/*
|
||||
* Now look to see if krbdes_start() was was waiting for
|
||||
* the key to show up. If so, go ahead an call it now
|
||||
* that we have the key.
|
||||
*/
|
||||
if (fbp->need_start) {
|
||||
fbp->need_start = 0;
|
||||
fb64_start(fbp, DIR_ENCRYPT, server);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We only accept a keyid of 0. If we get a keyid of
|
||||
* 0, then mark the state as SUCCESS.
|
||||
*/
|
||||
int
|
||||
cfb64_keyid(int dir, unsigned char *kp, int *lenp)
|
||||
{
|
||||
return(fb64_keyid(dir, kp, lenp, &fb[CFB]));
|
||||
}
|
||||
|
||||
int
|
||||
ofb64_keyid(int dir, unsigned char *kp, int *lenp)
|
||||
{
|
||||
return(fb64_keyid(dir, kp, lenp, &fb[OFB]));
|
||||
}
|
||||
|
||||
int
|
||||
fb64_keyid(int dir, unsigned char *kp, int *lenp, struct fb *fbp)
|
||||
{
|
||||
int state = fbp->state[dir-1];
|
||||
|
||||
if (*lenp != 1 || (*kp != '\0')) {
|
||||
*lenp = 0;
|
||||
return(state);
|
||||
}
|
||||
|
||||
if (state == FAILED)
|
||||
state = IN_PROGRESS;
|
||||
|
||||
state &= ~NO_KEYID;
|
||||
|
||||
return(fbp->state[dir-1] = state);
|
||||
}
|
||||
|
||||
void
|
||||
fb64_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen, const char *type)
|
||||
{
|
||||
char lbuf[32];
|
||||
int i;
|
||||
char *cp;
|
||||
|
||||
buf[buflen-1] = '\0'; /* make sure it's NULL terminated */
|
||||
buflen -= 1;
|
||||
|
||||
switch(data[2]) {
|
||||
case FB64_IV:
|
||||
sprintf(lbuf, "%s_IV", type);
|
||||
cp = lbuf;
|
||||
goto common;
|
||||
|
||||
case FB64_IV_OK:
|
||||
sprintf(lbuf, "%s_IV_OK", type);
|
||||
cp = lbuf;
|
||||
goto common;
|
||||
|
||||
case FB64_IV_BAD:
|
||||
sprintf(lbuf, "%s_IV_BAD", type);
|
||||
cp = lbuf;
|
||||
goto common;
|
||||
|
||||
default:
|
||||
sprintf(lbuf, " %d (unknown)", data[2]);
|
||||
cp = lbuf;
|
||||
common:
|
||||
for (; (buflen > 0) && (*buf = *cp++); buf++)
|
||||
buflen--;
|
||||
for (i = 3; i < cnt; i++) {
|
||||
sprintf(lbuf, " %d", data[i]);
|
||||
for (cp = lbuf; (buflen > 0) && (*buf = *cp++); buf++)
|
||||
buflen--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cfb64_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
||||
{
|
||||
fb64_printsub(data, cnt, buf, buflen, "CFB64");
|
||||
}
|
||||
|
||||
void
|
||||
ofb64_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
||||
{
|
||||
fb64_printsub(data, cnt, buf, buflen, "OFB64");
|
||||
}
|
||||
|
||||
void
|
||||
fb64_stream_iv(Block seed, struct stinfo *stp)
|
||||
{
|
||||
|
||||
memmove((void *)stp->str_iv, (void *)seed, sizeof(Block));
|
||||
memmove((void *)stp->str_output, (void *)seed, sizeof(Block));
|
||||
|
||||
des_key_sched((Block *)stp->str_ikey, stp->str_sched);
|
||||
|
||||
stp->str_index = sizeof(Block);
|
||||
}
|
||||
|
||||
void
|
||||
fb64_stream_key(Block key, struct stinfo *stp)
|
||||
{
|
||||
memmove((void *)stp->str_ikey, (void *)key, sizeof(Block));
|
||||
des_key_sched((Block *)key, stp->str_sched);
|
||||
|
||||
memmove((void *)stp->str_output, (void *)stp->str_iv, sizeof(Block));
|
||||
|
||||
stp->str_index = sizeof(Block);
|
||||
}
|
||||
|
||||
/*
|
||||
* DES 64 bit Cipher Feedback
|
||||
*
|
||||
* key --->+-----+
|
||||
* +->| DES |--+
|
||||
* | +-----+ |
|
||||
* | v
|
||||
* INPUT --(--------->(+)+---> DATA
|
||||
* | |
|
||||
* +-------------+
|
||||
*
|
||||
*
|
||||
* Given:
|
||||
* iV: Initial vector, 64 bits (8 bytes) long.
|
||||
* Dn: the nth chunk of 64 bits (8 bytes) of data to encrypt (decrypt).
|
||||
* On: the nth chunk of 64 bits (8 bytes) of encrypted (decrypted) output.
|
||||
*
|
||||
* V0 = DES(iV, key)
|
||||
* On = Dn ^ Vn
|
||||
* V(n+1) = DES(On, key)
|
||||
*/
|
||||
|
||||
void
|
||||
cfb64_encrypt(unsigned char *s, int c)
|
||||
{
|
||||
struct stinfo *stp = &fb[CFB].streams[DIR_ENCRYPT-1];
|
||||
int idx;
|
||||
|
||||
idx = stp->str_index;
|
||||
while (c-- > 0) {
|
||||
if (idx == sizeof(Block)) {
|
||||
Block b;
|
||||
des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
|
||||
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
/* On encryption, we store (feed ^ data) which is cypher */
|
||||
*s = stp->str_output[idx] = (stp->str_feed[idx] ^ *s);
|
||||
s++;
|
||||
idx++;
|
||||
}
|
||||
stp->str_index = idx;
|
||||
}
|
||||
|
||||
int
|
||||
cfb64_decrypt(int data)
|
||||
{
|
||||
struct stinfo *stp = &fb[CFB].streams[DIR_DECRYPT-1];
|
||||
int idx;
|
||||
|
||||
if (data == -1) {
|
||||
/*
|
||||
* Back up one byte. It is assumed that we will
|
||||
* never back up more than one byte. If we do, this
|
||||
* may or may not work.
|
||||
*/
|
||||
if (stp->str_index)
|
||||
--stp->str_index;
|
||||
return(0);
|
||||
}
|
||||
|
||||
idx = stp->str_index++;
|
||||
if (idx == sizeof(Block)) {
|
||||
Block b;
|
||||
des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
|
||||
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
|
||||
stp->str_index = 1; /* Next time will be 1 */
|
||||
idx = 0; /* But now use 0 */
|
||||
}
|
||||
|
||||
/* On decryption we store (data) which is cypher. */
|
||||
stp->str_output[idx] = data;
|
||||
return(data ^ stp->str_feed[idx]);
|
||||
}
|
||||
|
||||
/*
|
||||
* DES 64 bit Output Feedback
|
||||
*
|
||||
* key --->+-----+
|
||||
* +->| DES |--+
|
||||
* | +-----+ |
|
||||
* +-----------+
|
||||
* v
|
||||
* INPUT -------->(+) ----> DATA
|
||||
*
|
||||
* Given:
|
||||
* iV: Initial vector, 64 bits (8 bytes) long.
|
||||
* Dn: the nth chunk of 64 bits (8 bytes) of data to encrypt (decrypt).
|
||||
* On: the nth chunk of 64 bits (8 bytes) of encrypted (decrypted) output.
|
||||
*
|
||||
* V0 = DES(iV, key)
|
||||
* V(n+1) = DES(Vn, key)
|
||||
* On = Dn ^ Vn
|
||||
*/
|
||||
void
|
||||
ofb64_encrypt(unsigned char *s, int c)
|
||||
{
|
||||
struct stinfo *stp = &fb[OFB].streams[DIR_ENCRYPT-1];
|
||||
int idx;
|
||||
|
||||
idx = stp->str_index;
|
||||
while (c-- > 0) {
|
||||
if (idx == sizeof(Block)) {
|
||||
Block b;
|
||||
des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
|
||||
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
|
||||
idx = 0;
|
||||
}
|
||||
*s++ ^= stp->str_feed[idx];
|
||||
idx++;
|
||||
}
|
||||
stp->str_index = idx;
|
||||
}
|
||||
|
||||
int
|
||||
ofb64_decrypt(int data)
|
||||
{
|
||||
struct stinfo *stp = &fb[OFB].streams[DIR_DECRYPT-1];
|
||||
int idx;
|
||||
|
||||
if (data == -1) {
|
||||
/*
|
||||
* Back up one byte. It is assumed that we will
|
||||
* never back up more than one byte. If we do, this
|
||||
* may or may not work.
|
||||
*/
|
||||
if (stp->str_index)
|
||||
--stp->str_index;
|
||||
return(0);
|
||||
}
|
||||
|
||||
idx = stp->str_index++;
|
||||
if (idx == sizeof(Block)) {
|
||||
Block b;
|
||||
des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
|
||||
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
|
||||
stp->str_index = 1; /* Next time will be 1 */
|
||||
idx = 0; /* But now use 0 */
|
||||
}
|
||||
|
||||
return(data ^ stp->str_feed[idx]);
|
||||
}
|
||||
# endif /* AUTHENTICATION */
|
||||
#endif /* ENCRYPTION */
|
||||
@@ -1,953 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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$");
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char sccsid[] = "@(#)encrypt.c 8.2 (Berkeley) 5/30/95";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1990 by the Massachusetts Institute of Technology
|
||||
*
|
||||
* Export of this software from the United States of America is assumed
|
||||
* to require a specific license from the United States Government.
|
||||
* It is the responsibility of any person or organization contemplating
|
||||
* export to obtain such a license before exporting.
|
||||
*
|
||||
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
||||
* distribute this software and its documentation for any purpose and
|
||||
* without fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright notice and
|
||||
* this permission notice appear in supporting documentation, and that
|
||||
* the name of M.I.T. not be used in advertising or publicity pertaining
|
||||
* to distribution of the software without specific, written prior
|
||||
* permission. M.I.T. makes no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is" without express
|
||||
* or implied warranty.
|
||||
*/
|
||||
|
||||
#ifdef ENCRYPTION
|
||||
|
||||
#include <sys/types.h>
|
||||
#define ENCRYPT_NAMES
|
||||
#include <arpa/telnet.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "encrypt.h"
|
||||
#include "misc.h"
|
||||
|
||||
/*
|
||||
* These functions pointers point to the current routines
|
||||
* for encrypting and decrypting data.
|
||||
*/
|
||||
void (*encrypt_output)(unsigned char *, int);
|
||||
int (*decrypt_input)(int);
|
||||
|
||||
int EncryptType(char *type, char *mode);
|
||||
int EncryptStart(char *mode);
|
||||
int EncryptStop(char *mode);
|
||||
int EncryptStartInput(void);
|
||||
int EncryptStartOutput(void);
|
||||
int EncryptStopInput(void);
|
||||
int EncryptStopOutput(void);
|
||||
|
||||
int encrypt_debug_mode = 0;
|
||||
static int decrypt_mode = 0;
|
||||
static int encrypt_mode = 0;
|
||||
static int encrypt_verbose = 0;
|
||||
static int autoencrypt = 0;
|
||||
static int autodecrypt = 0;
|
||||
static int havesessionkey = 0;
|
||||
static int Server = 0;
|
||||
static const char *Name = "Noname";
|
||||
|
||||
#define typemask(x) ((x) > 0 ? 1 << ((x)-1) : 0)
|
||||
|
||||
static u_long i_support_encrypt = 0
|
||||
| typemask(ENCTYPE_DES_CFB64) | typemask(ENCTYPE_DES_OFB64)
|
||||
|0;
|
||||
static u_long i_support_decrypt = 0
|
||||
| typemask(ENCTYPE_DES_CFB64) | typemask(ENCTYPE_DES_OFB64)
|
||||
|0;
|
||||
|
||||
static u_long i_wont_support_encrypt = 0;
|
||||
static u_long i_wont_support_decrypt = 0;
|
||||
#define I_SUPPORT_ENCRYPT (i_support_encrypt & ~i_wont_support_encrypt)
|
||||
#define I_SUPPORT_DECRYPT (i_support_decrypt & ~i_wont_support_decrypt)
|
||||
|
||||
static u_long remote_supports_encrypt = 0;
|
||||
static u_long remote_supports_decrypt = 0;
|
||||
|
||||
static Encryptions encryptions[] = {
|
||||
{ "DES_CFB64", ENCTYPE_DES_CFB64,
|
||||
cfb64_encrypt,
|
||||
cfb64_decrypt,
|
||||
cfb64_init,
|
||||
cfb64_start,
|
||||
cfb64_is,
|
||||
cfb64_reply,
|
||||
cfb64_session,
|
||||
cfb64_keyid,
|
||||
cfb64_printsub },
|
||||
{ "DES_OFB64", ENCTYPE_DES_OFB64,
|
||||
ofb64_encrypt,
|
||||
ofb64_decrypt,
|
||||
ofb64_init,
|
||||
ofb64_start,
|
||||
ofb64_is,
|
||||
ofb64_reply,
|
||||
ofb64_session,
|
||||
ofb64_keyid,
|
||||
ofb64_printsub },
|
||||
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
static unsigned char str_send[64] = { IAC, SB, TELOPT_ENCRYPT,
|
||||
ENCRYPT_SUPPORT };
|
||||
static unsigned char str_suplen = 0;
|
||||
static unsigned char str_start[72] = { IAC, SB, TELOPT_ENCRYPT };
|
||||
static unsigned char str_end[] = { IAC, SB, TELOPT_ENCRYPT, 0, IAC, SE };
|
||||
|
||||
Encryptions *
|
||||
findencryption(int type)
|
||||
{
|
||||
Encryptions *ep = encryptions;
|
||||
|
||||
if (!(I_SUPPORT_ENCRYPT & remote_supports_decrypt & (unsigned)typemask(type)))
|
||||
return(0);
|
||||
while (ep->type && ep->type != type)
|
||||
++ep;
|
||||
return(ep->type ? ep : 0);
|
||||
}
|
||||
|
||||
static Encryptions *
|
||||
finddecryption(int type)
|
||||
{
|
||||
Encryptions *ep = encryptions;
|
||||
|
||||
if (!(I_SUPPORT_DECRYPT & remote_supports_encrypt & (unsigned)typemask(type)))
|
||||
return(0);
|
||||
while (ep->type && ep->type != type)
|
||||
++ep;
|
||||
return(ep->type ? ep : 0);
|
||||
}
|
||||
|
||||
#define MAXKEYLEN 64
|
||||
|
||||
static struct key_info {
|
||||
unsigned char keyid[MAXKEYLEN];
|
||||
int keylen;
|
||||
int dir;
|
||||
int *modep;
|
||||
Encryptions *(*getcrypt)(int);
|
||||
} ki[2] = {
|
||||
{ { 0 }, 0, DIR_ENCRYPT, &encrypt_mode, findencryption },
|
||||
{ { 0 }, 0, DIR_DECRYPT, &decrypt_mode, finddecryption },
|
||||
};
|
||||
|
||||
static void encrypt_keyid(struct key_info *kp, unsigned char *keyid, int len);
|
||||
|
||||
void
|
||||
encrypt_init(const char *name, int server)
|
||||
{
|
||||
Encryptions *ep = encryptions;
|
||||
|
||||
Name = name;
|
||||
Server = server;
|
||||
i_support_encrypt = i_support_decrypt = 0;
|
||||
remote_supports_encrypt = remote_supports_decrypt = 0;
|
||||
encrypt_mode = 0;
|
||||
decrypt_mode = 0;
|
||||
encrypt_output = 0;
|
||||
decrypt_input = 0;
|
||||
|
||||
str_suplen = 4;
|
||||
|
||||
while (ep->type) {
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: I will support %s\r\n",
|
||||
Name, ENCTYPE_NAME(ep->type));
|
||||
i_support_encrypt |= typemask(ep->type);
|
||||
i_support_decrypt |= typemask(ep->type);
|
||||
if ((i_wont_support_decrypt & typemask(ep->type)) == 0)
|
||||
if ((str_send[str_suplen++] = ep->type) == IAC)
|
||||
str_send[str_suplen++] = IAC;
|
||||
if (ep->init)
|
||||
(*ep->init)(Server);
|
||||
++ep;
|
||||
}
|
||||
str_send[str_suplen++] = IAC;
|
||||
str_send[str_suplen++] = SE;
|
||||
}
|
||||
|
||||
static void
|
||||
encrypt_list_types(void)
|
||||
{
|
||||
Encryptions *ep = encryptions;
|
||||
|
||||
printf("Valid encryption types:\n");
|
||||
while (ep->type) {
|
||||
printf("\t%s (%d)\r\n", ENCTYPE_NAME(ep->type), ep->type);
|
||||
++ep;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
EncryptEnable(char *type, char *mode)
|
||||
{
|
||||
if (isprefix(type, "help") || isprefix(type, "?")) {
|
||||
printf("Usage: encrypt enable <type> [input|output]\n");
|
||||
encrypt_list_types();
|
||||
return(0);
|
||||
}
|
||||
if (EncryptType(type, mode))
|
||||
return(EncryptStart(mode));
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptDisable(char *type, char *mode)
|
||||
{
|
||||
Encryptions *ep;
|
||||
int ret = 0;
|
||||
|
||||
if (isprefix(type, "help") || isprefix(type, "?")) {
|
||||
printf("Usage: encrypt disable <type> [input|output]\n");
|
||||
encrypt_list_types();
|
||||
} else if ((ep = (Encryptions *)genget(type, (char **)encryptions,
|
||||
sizeof(Encryptions))) == 0) {
|
||||
printf("%s: invalid encryption type\n", type);
|
||||
} else if (Ambiguous((char **)ep)) {
|
||||
printf("Ambiguous type '%s'\n", type);
|
||||
} else {
|
||||
if ((mode == 0) || (isprefix(mode, "input") ? 1 : 0)) {
|
||||
if (decrypt_mode == ep->type)
|
||||
EncryptStopInput();
|
||||
i_wont_support_decrypt |= typemask(ep->type);
|
||||
ret = 1;
|
||||
}
|
||||
if ((mode == 0) || (isprefix(mode, "output"))) {
|
||||
if (encrypt_mode == ep->type)
|
||||
EncryptStopOutput();
|
||||
i_wont_support_encrypt |= typemask(ep->type);
|
||||
ret = 1;
|
||||
}
|
||||
if (ret == 0)
|
||||
printf("%s: invalid encryption mode\n", mode);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptType(char *type, char *mode)
|
||||
{
|
||||
Encryptions *ep;
|
||||
int ret = 0;
|
||||
|
||||
if (isprefix(type, "help") || isprefix(type, "?")) {
|
||||
printf("Usage: encrypt type <type> [input|output]\n");
|
||||
encrypt_list_types();
|
||||
} else if ((ep = (Encryptions *)genget(type, (char **)encryptions,
|
||||
sizeof(Encryptions))) == 0) {
|
||||
printf("%s: invalid encryption type\n", type);
|
||||
} else if (Ambiguous((char **)ep)) {
|
||||
printf("Ambiguous type '%s'\n", type);
|
||||
} else {
|
||||
if ((mode == 0) || isprefix(mode, "input")) {
|
||||
decrypt_mode = ep->type;
|
||||
i_wont_support_decrypt &= ~typemask(ep->type);
|
||||
ret = 1;
|
||||
}
|
||||
if ((mode == 0) || isprefix(mode, "output")) {
|
||||
encrypt_mode = ep->type;
|
||||
i_wont_support_encrypt &= ~typemask(ep->type);
|
||||
ret = 1;
|
||||
}
|
||||
if (ret == 0)
|
||||
printf("%s: invalid encryption mode\n", mode);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptStart(char *mode)
|
||||
{
|
||||
int ret = 0;
|
||||
if (mode) {
|
||||
if (isprefix(mode, "input"))
|
||||
return(EncryptStartInput());
|
||||
if (isprefix(mode, "output"))
|
||||
return(EncryptStartOutput());
|
||||
if (isprefix(mode, "help") || isprefix(mode, "?")) {
|
||||
printf("Usage: encrypt start [input|output]\n");
|
||||
return(0);
|
||||
}
|
||||
printf("%s: invalid encryption mode 'encrypt start ?' for help\n", mode);
|
||||
return(0);
|
||||
}
|
||||
ret += EncryptStartInput();
|
||||
ret += EncryptStartOutput();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptStartInput(void)
|
||||
{
|
||||
if (decrypt_mode) {
|
||||
encrypt_send_request_start();
|
||||
return(1);
|
||||
}
|
||||
printf("No previous decryption mode, decryption not enabled\r\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptStartOutput(void)
|
||||
{
|
||||
if (encrypt_mode) {
|
||||
encrypt_start_output(encrypt_mode);
|
||||
return(1);
|
||||
}
|
||||
printf("No previous encryption mode, encryption not enabled\r\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptStop(char *mode)
|
||||
{
|
||||
int ret = 0;
|
||||
if (mode) {
|
||||
if (isprefix(mode, "input"))
|
||||
return(EncryptStopInput());
|
||||
if (isprefix(mode, "output"))
|
||||
return(EncryptStopOutput());
|
||||
if (isprefix(mode, "help") || isprefix(mode, "?")) {
|
||||
printf("Usage: encrypt stop [input|output]\n");
|
||||
return(0);
|
||||
}
|
||||
printf("%s: invalid encryption mode 'encrypt stop ?' for help\n", mode);
|
||||
return(0);
|
||||
}
|
||||
ret += EncryptStopInput();
|
||||
ret += EncryptStopOutput();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptStopInput(void)
|
||||
{
|
||||
encrypt_send_request_end();
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptStopOutput(void)
|
||||
{
|
||||
encrypt_send_end();
|
||||
return(1);
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_display(void)
|
||||
{
|
||||
if (encrypt_output)
|
||||
printf("Currently encrypting output with %s\r\n",
|
||||
ENCTYPE_NAME(encrypt_mode));
|
||||
if (decrypt_input)
|
||||
printf("Currently decrypting input with %s\r\n",
|
||||
ENCTYPE_NAME(decrypt_mode));
|
||||
}
|
||||
|
||||
int
|
||||
EncryptStatus(void)
|
||||
{
|
||||
if (encrypt_output)
|
||||
printf("Currently encrypting output with %s\r\n",
|
||||
ENCTYPE_NAME(encrypt_mode));
|
||||
else if (encrypt_mode) {
|
||||
printf("Currently output is clear text.\r\n");
|
||||
printf("Last encryption mode was %s\r\n",
|
||||
ENCTYPE_NAME(encrypt_mode));
|
||||
}
|
||||
if (decrypt_input) {
|
||||
printf("Currently decrypting input with %s\r\n",
|
||||
ENCTYPE_NAME(decrypt_mode));
|
||||
} else if (decrypt_mode) {
|
||||
printf("Currently input is clear text.\r\n");
|
||||
printf("Last decryption mode was %s\r\n",
|
||||
ENCTYPE_NAME(decrypt_mode));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_send_support(void)
|
||||
{
|
||||
if (str_suplen) {
|
||||
/*
|
||||
* If the user has requested that decryption start
|
||||
* immediatly, then send a "REQUEST START" before
|
||||
* we negotiate the type.
|
||||
*/
|
||||
if (!Server && autodecrypt)
|
||||
encrypt_send_request_start();
|
||||
net_write(str_send, str_suplen);
|
||||
printsub('>', &str_send[2], str_suplen - 2);
|
||||
str_suplen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
EncryptDebug(int on)
|
||||
{
|
||||
if (on < 0)
|
||||
encrypt_debug_mode ^= 1;
|
||||
else
|
||||
encrypt_debug_mode = on;
|
||||
printf("Encryption debugging %s\r\n",
|
||||
encrypt_debug_mode ? "enabled" : "disabled");
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptVerbose(int on)
|
||||
{
|
||||
if (on < 0)
|
||||
encrypt_verbose ^= 1;
|
||||
else
|
||||
encrypt_verbose = on;
|
||||
printf("Encryption %s verbose\r\n",
|
||||
encrypt_verbose ? "is" : "is not");
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptAutoEnc(int on)
|
||||
{
|
||||
encrypt_auto(on);
|
||||
printf("Automatic encryption of output is %s\r\n",
|
||||
autoencrypt ? "enabled" : "disabled");
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
EncryptAutoDec(int on)
|
||||
{
|
||||
decrypt_auto(on);
|
||||
printf("Automatic decryption of input is %s\r\n",
|
||||
autodecrypt ? "enabled" : "disabled");
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when ENCRYPT SUPPORT is received.
|
||||
*/
|
||||
void
|
||||
encrypt_support(unsigned char *typelist, int cnt)
|
||||
{
|
||||
int type, use_type = 0;
|
||||
Encryptions *ep;
|
||||
|
||||
/*
|
||||
* Forget anything the other side has previously told us.
|
||||
*/
|
||||
remote_supports_decrypt = 0;
|
||||
|
||||
while (cnt-- > 0) {
|
||||
type = *typelist++;
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: He is supporting %s (%d)\r\n",
|
||||
Name,
|
||||
ENCTYPE_NAME(type), type);
|
||||
if ((type < ENCTYPE_CNT) &&
|
||||
(I_SUPPORT_ENCRYPT & typemask(type))) {
|
||||
remote_supports_decrypt |= typemask(type);
|
||||
if (use_type == 0)
|
||||
use_type = type;
|
||||
}
|
||||
}
|
||||
if (use_type) {
|
||||
ep = findencryption(use_type);
|
||||
if (!ep)
|
||||
return;
|
||||
type = ep->start ? (*ep->start)(DIR_ENCRYPT, Server) : 0;
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: (*ep->start)() returned %d\r\n",
|
||||
Name, type);
|
||||
if (type < 0)
|
||||
return;
|
||||
encrypt_mode = use_type;
|
||||
if (type == 0)
|
||||
encrypt_start_output(use_type);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_is(unsigned char *data, int cnt)
|
||||
{
|
||||
Encryptions *ep;
|
||||
int type, ret;
|
||||
|
||||
if (--cnt < 0)
|
||||
return;
|
||||
type = *data++;
|
||||
if (type < ENCTYPE_CNT)
|
||||
remote_supports_encrypt |= typemask(type);
|
||||
if (!(ep = finddecryption(type))) {
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: Can't find type %s (%d) for initial negotiation\r\n",
|
||||
Name,
|
||||
ENCTYPE_NAME_OK(type)
|
||||
? ENCTYPE_NAME(type) : "(unknown)",
|
||||
type);
|
||||
return;
|
||||
}
|
||||
if (!ep->is) {
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: No initial negotiation needed for type %s (%d)\r\n",
|
||||
Name,
|
||||
ENCTYPE_NAME_OK(type)
|
||||
? ENCTYPE_NAME(type) : "(unknown)",
|
||||
type);
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = (*ep->is)(data, cnt);
|
||||
if (encrypt_debug_mode)
|
||||
printf("(*ep->is)(%p, %d) returned %s(%d)\n", data, cnt,
|
||||
(ret < 0) ? "FAIL " :
|
||||
(ret == 0) ? "SUCCESS " : "MORE_TO_DO ", ret);
|
||||
}
|
||||
if (ret < 0) {
|
||||
autodecrypt = 0;
|
||||
} else {
|
||||
decrypt_mode = type;
|
||||
if (ret == 0 && autodecrypt)
|
||||
encrypt_send_request_start();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_reply(unsigned char *data, int cnt)
|
||||
{
|
||||
Encryptions *ep;
|
||||
int ret, type;
|
||||
|
||||
if (--cnt < 0)
|
||||
return;
|
||||
type = *data++;
|
||||
if (!(ep = findencryption(type))) {
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: Can't find type %s (%d) for initial negotiation\r\n",
|
||||
Name,
|
||||
ENCTYPE_NAME_OK(type)
|
||||
? ENCTYPE_NAME(type) : "(unknown)",
|
||||
type);
|
||||
return;
|
||||
}
|
||||
if (!ep->reply) {
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: No initial negotiation needed for type %s (%d)\r\n",
|
||||
Name,
|
||||
ENCTYPE_NAME_OK(type)
|
||||
? ENCTYPE_NAME(type) : "(unknown)",
|
||||
type);
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = (*ep->reply)(data, cnt);
|
||||
if (encrypt_debug_mode)
|
||||
printf("(*ep->reply)(%p, %d) returned %s(%d)\n",
|
||||
data, cnt,
|
||||
(ret < 0) ? "FAIL " :
|
||||
(ret == 0) ? "SUCCESS " : "MORE_TO_DO ", ret);
|
||||
}
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: encrypt_reply returned %d\n", Name, ret);
|
||||
if (ret < 0) {
|
||||
autoencrypt = 0;
|
||||
} else {
|
||||
encrypt_mode = type;
|
||||
if (ret == 0 && autoencrypt)
|
||||
encrypt_start_output(type);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when a ENCRYPT START command is received.
|
||||
*/
|
||||
void
|
||||
encrypt_start(unsigned char *data __unused, int cnt __unused)
|
||||
{
|
||||
Encryptions *ep;
|
||||
|
||||
if (!decrypt_mode) {
|
||||
/*
|
||||
* Something is wrong. We should not get a START
|
||||
* command without having already picked our
|
||||
* decryption scheme. Send a REQUEST-END to
|
||||
* attempt to clear the channel...
|
||||
*/
|
||||
printf("%s: Warning, Cannot decrypt input stream!!!\r\n", Name);
|
||||
encrypt_send_request_end();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ep = finddecryption(decrypt_mode))) {
|
||||
decrypt_input = ep->input;
|
||||
if (encrypt_verbose)
|
||||
printf("[ Input is now decrypted with type %s ]\r\n",
|
||||
ENCTYPE_NAME(decrypt_mode));
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: Start to decrypt input with type %s\r\n",
|
||||
Name, ENCTYPE_NAME(decrypt_mode));
|
||||
} else {
|
||||
printf("%s: Warning, Cannot decrypt type %s (%d)!!!\r\n",
|
||||
Name,
|
||||
ENCTYPE_NAME_OK(decrypt_mode)
|
||||
? ENCTYPE_NAME(decrypt_mode)
|
||||
: "(unknown)",
|
||||
decrypt_mode);
|
||||
encrypt_send_request_end();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_session_key( Session_Key *key, int server)
|
||||
{
|
||||
Encryptions *ep = encryptions;
|
||||
|
||||
havesessionkey = 1;
|
||||
|
||||
while (ep->type) {
|
||||
if (ep->session)
|
||||
(*ep->session)(key, server);
|
||||
++ep;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when ENCRYPT END is received.
|
||||
*/
|
||||
void
|
||||
encrypt_end(void)
|
||||
{
|
||||
decrypt_input = 0;
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: Input is back to clear text\r\n", Name);
|
||||
if (encrypt_verbose)
|
||||
printf("[ Input is now clear text ]\r\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when ENCRYPT REQUEST-END is received.
|
||||
*/
|
||||
void
|
||||
encrypt_request_end(void)
|
||||
{
|
||||
encrypt_send_end();
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when ENCRYPT REQUEST-START is received. If we receive
|
||||
* this before a type is picked, then that indicates that the
|
||||
* other side wants us to start encrypting data as soon as we
|
||||
* can.
|
||||
*/
|
||||
void
|
||||
encrypt_request_start(unsigned char *data __unused, int cnt __unused)
|
||||
{
|
||||
if (encrypt_mode == 0) {
|
||||
if (Server)
|
||||
autoencrypt = 1;
|
||||
return;
|
||||
}
|
||||
encrypt_start_output(encrypt_mode);
|
||||
}
|
||||
|
||||
static unsigned char str_keyid[(MAXKEYLEN*2)+5] = { IAC, SB, TELOPT_ENCRYPT };
|
||||
|
||||
void
|
||||
encrypt_enc_keyid(unsigned char *keyid, int len)
|
||||
{
|
||||
encrypt_keyid(&ki[1], keyid, len);
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_dec_keyid(unsigned char *keyid, int len)
|
||||
{
|
||||
encrypt_keyid(&ki[0], keyid, len);
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_keyid(struct key_info *kp, unsigned char *keyid, int len)
|
||||
{
|
||||
Encryptions *ep;
|
||||
int dir = kp->dir;
|
||||
int ret = 0;
|
||||
|
||||
if (!(ep = (*kp->getcrypt)(*kp->modep))) {
|
||||
if (len == 0)
|
||||
return;
|
||||
kp->keylen = 0;
|
||||
} else if (len == 0) {
|
||||
/*
|
||||
* Empty option, indicates a failure.
|
||||
*/
|
||||
if (kp->keylen == 0)
|
||||
return;
|
||||
kp->keylen = 0;
|
||||
if (ep->keyid)
|
||||
(void)(*ep->keyid)(dir, kp->keyid, &kp->keylen);
|
||||
|
||||
} else if ((len != kp->keylen) ||
|
||||
(memcmp(keyid, kp->keyid, len) != 0)) {
|
||||
/*
|
||||
* Length or contents are different
|
||||
*/
|
||||
kp->keylen = len;
|
||||
memmove(kp->keyid, keyid, len);
|
||||
if (ep->keyid)
|
||||
(void)(*ep->keyid)(dir, kp->keyid, &kp->keylen);
|
||||
} else {
|
||||
if (ep->keyid)
|
||||
ret = (*ep->keyid)(dir, kp->keyid, &kp->keylen);
|
||||
if ((ret == 0) && (dir == DIR_ENCRYPT) && autoencrypt)
|
||||
encrypt_start_output(*kp->modep);
|
||||
return;
|
||||
}
|
||||
|
||||
encrypt_send_keyid(dir, kp->keyid, kp->keylen, 0);
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_send_keyid(int dir, const char *keyid, int keylen, int saveit)
|
||||
{
|
||||
unsigned char *strp;
|
||||
|
||||
str_keyid[3] = (dir == DIR_ENCRYPT)
|
||||
? ENCRYPT_ENC_KEYID : ENCRYPT_DEC_KEYID;
|
||||
if (saveit) {
|
||||
struct key_info *kp = &ki[(dir == DIR_ENCRYPT) ? 0 : 1];
|
||||
memmove(kp->keyid, keyid, keylen);
|
||||
kp->keylen = keylen;
|
||||
}
|
||||
|
||||
for (strp = &str_keyid[4]; keylen > 0; --keylen) {
|
||||
if ((*strp++ = *keyid++) == IAC)
|
||||
*strp++ = IAC;
|
||||
}
|
||||
*strp++ = IAC;
|
||||
*strp++ = SE;
|
||||
net_write(str_keyid, strp - str_keyid);
|
||||
printsub('>', &str_keyid[2], strp - str_keyid - 2);
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_auto(int on)
|
||||
{
|
||||
if (on < 0)
|
||||
autoencrypt ^= 1;
|
||||
else
|
||||
autoencrypt = on ? 1 : 0;
|
||||
}
|
||||
|
||||
void
|
||||
decrypt_auto(int on)
|
||||
{
|
||||
if (on < 0)
|
||||
autodecrypt ^= 1;
|
||||
else
|
||||
autodecrypt = on ? 1 : 0;
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_start_output(int type)
|
||||
{
|
||||
Encryptions *ep;
|
||||
unsigned char *p;
|
||||
int i;
|
||||
|
||||
if (!(ep = findencryption(type))) {
|
||||
if (encrypt_debug_mode) {
|
||||
printf(">>>%s: Can't encrypt with type %s (%d)\r\n",
|
||||
Name,
|
||||
ENCTYPE_NAME_OK(type)
|
||||
? ENCTYPE_NAME(type) : "(unknown)",
|
||||
type);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (ep->start) {
|
||||
i = (*ep->start)(DIR_ENCRYPT, Server);
|
||||
if (encrypt_debug_mode) {
|
||||
printf(">>>%s: Encrypt start: %s (%d) %s\r\n",
|
||||
Name,
|
||||
(i < 0) ? "failed" :
|
||||
"initial negotiation in progress",
|
||||
i, ENCTYPE_NAME(type));
|
||||
}
|
||||
if (i)
|
||||
return;
|
||||
}
|
||||
p = str_start + 3;
|
||||
*p++ = ENCRYPT_START;
|
||||
for (i = 0; i < ki[0].keylen; ++i) {
|
||||
if ((*p++ = ki[0].keyid[i]) == IAC)
|
||||
*p++ = IAC;
|
||||
}
|
||||
*p++ = IAC;
|
||||
*p++ = SE;
|
||||
net_write(str_start, p - str_start);
|
||||
net_encrypt();
|
||||
printsub('>', &str_start[2], p - &str_start[2]);
|
||||
/*
|
||||
* If we are already encrypting in some mode, then
|
||||
* encrypt the ring (which includes our request) in
|
||||
* the old mode, mark it all as "clear text" and then
|
||||
* switch to the new mode.
|
||||
*/
|
||||
encrypt_output = ep->output;
|
||||
encrypt_mode = type;
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: Started to encrypt output with type %s\r\n",
|
||||
Name, ENCTYPE_NAME(type));
|
||||
if (encrypt_verbose)
|
||||
printf("[ Output is now encrypted with type %s ]\r\n",
|
||||
ENCTYPE_NAME(type));
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_send_end(void)
|
||||
{
|
||||
if (!encrypt_output)
|
||||
return;
|
||||
|
||||
str_end[3] = ENCRYPT_END;
|
||||
net_write(str_end, sizeof(str_end));
|
||||
net_encrypt();
|
||||
printsub('>', &str_end[2], sizeof(str_end) - 2);
|
||||
/*
|
||||
* Encrypt the output buffer now because it will not be done by
|
||||
* netflush...
|
||||
*/
|
||||
encrypt_output = 0;
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: Output is back to clear text\r\n", Name);
|
||||
if (encrypt_verbose)
|
||||
printf("[ Output is now clear text ]\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_send_request_start(void)
|
||||
{
|
||||
unsigned char *p;
|
||||
int i;
|
||||
|
||||
p = &str_start[3];
|
||||
*p++ = ENCRYPT_REQSTART;
|
||||
for (i = 0; i < ki[1].keylen; ++i) {
|
||||
if ((*p++ = ki[1].keyid[i]) == IAC)
|
||||
*p++ = IAC;
|
||||
}
|
||||
*p++ = IAC;
|
||||
*p++ = SE;
|
||||
net_write(str_start, p - str_start);
|
||||
printsub('>', &str_start[2], p - &str_start[2]);
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: Request input to be encrypted\r\n", Name);
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_send_request_end(void)
|
||||
{
|
||||
str_end[3] = ENCRYPT_REQEND;
|
||||
net_write(str_end, sizeof(str_end));
|
||||
printsub('>', &str_end[2], sizeof(str_end) - 2);
|
||||
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: Request input to be clear text\r\n", Name);
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_wait(void)
|
||||
{
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: in encrypt_wait\r\n", Name);
|
||||
if (!havesessionkey || !(I_SUPPORT_ENCRYPT & remote_supports_decrypt))
|
||||
return;
|
||||
while (autoencrypt && !encrypt_output)
|
||||
if (telnet_spin())
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_gen_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
||||
{
|
||||
char tbuf[16], *cp;
|
||||
|
||||
cnt -= 2;
|
||||
data += 2;
|
||||
buf[buflen-1] = '\0';
|
||||
buf[buflen-2] = '*';
|
||||
buflen -= 2;;
|
||||
for (; cnt > 0; cnt--, data++) {
|
||||
sprintf(tbuf, " %d", *data);
|
||||
for (cp = tbuf; *cp && buflen > 0; --buflen)
|
||||
*buf++ = *cp++;
|
||||
if (buflen <= 0)
|
||||
return;
|
||||
}
|
||||
*buf = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
||||
{
|
||||
Encryptions *ep;
|
||||
int type = data[1];
|
||||
|
||||
for (ep = encryptions; ep->type && ep->type != type; ep++)
|
||||
;
|
||||
|
||||
if (ep->printsub)
|
||||
(*ep->printsub)(data, cnt, buf, buflen);
|
||||
else
|
||||
encrypt_gen_printsub(data, cnt, buf, buflen);
|
||||
}
|
||||
#endif /* ENCRYPTION */
|
||||
@@ -1,106 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)encrypt.h 8.1 (Berkeley) 6/4/93
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1990 by the Massachusetts Institute of Technology
|
||||
*
|
||||
* Export of this software from the United States of America is assumed
|
||||
* to require a specific license from the United States Government.
|
||||
* It is the responsibility of any person or organization contemplating
|
||||
* export to obtain such a license before exporting.
|
||||
*
|
||||
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
||||
* distribute this software and its documentation for any purpose and
|
||||
* without fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright notice and
|
||||
* this permission notice appear in supporting documentation, and that
|
||||
* the name of M.I.T. not be used in advertising or publicity pertaining
|
||||
* to distribution of the software without specific, written prior
|
||||
* permission. M.I.T. makes no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is" without express
|
||||
* or implied warranty.
|
||||
*/
|
||||
|
||||
#ifdef ENCRYPTION
|
||||
# ifndef __ENCRYPTION__
|
||||
# define __ENCRYPTION__
|
||||
|
||||
#define DIR_DECRYPT 1
|
||||
#define DIR_ENCRYPT 2
|
||||
|
||||
#include <openssl/des.h>
|
||||
typedef unsigned char Block[8];
|
||||
typedef unsigned char *BlockT;
|
||||
#if 0
|
||||
typedef struct { Block __; } Schedule[16];
|
||||
#else
|
||||
#define Schedule des_key_schedule
|
||||
#endif
|
||||
|
||||
#define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \
|
||||
key[4] | key[5] | key[6] | key[7])
|
||||
|
||||
#define SAMEKEY(k1, k2) (!bcmp((void *)k1, (void *)k2, sizeof(Block)))
|
||||
|
||||
typedef struct {
|
||||
short type;
|
||||
int length;
|
||||
unsigned char *data;
|
||||
} Session_Key;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int type;
|
||||
void (*output)(unsigned char *, int);
|
||||
int (*input)(int);
|
||||
void (*init)(int);
|
||||
int (*start)(int, int);
|
||||
int (*is)(unsigned char *, int);
|
||||
int (*reply)(unsigned char *, int);
|
||||
void (*session)(Session_Key *, int);
|
||||
int (*keyid)(int, unsigned char *, int *);
|
||||
void (*printsub)(unsigned char *, int, unsigned char *, int);
|
||||
} Encryptions;
|
||||
|
||||
#define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */
|
||||
|
||||
#include "enc-proto.h"
|
||||
|
||||
extern int encrypt_debug_mode;
|
||||
extern int (*decrypt_input)(int);
|
||||
extern void (*encrypt_output)(unsigned char *, int);
|
||||
# endif /* __ENCRYPTION__ */
|
||||
#endif /* ENCRYPTION */
|
||||
@@ -1,107 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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$");
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char sccsid[] = "@(#)genget.c 8.2 (Berkeley) 5/30/95";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "misc-proto.h"
|
||||
|
||||
#define LOWER(x) (isupper(x) ? tolower(x) : (x))
|
||||
/*
|
||||
* The prefix function returns 0 if *s1 is not a prefix
|
||||
* of *s2. If *s1 exactly matches *s2, the negative of
|
||||
* the length is returned. If *s1 is a prefix of *s2,
|
||||
* the length of *s1 is returned.
|
||||
*/
|
||||
int
|
||||
isprefix(char *s1, const char *s2)
|
||||
{
|
||||
char *os1;
|
||||
char c1, c2;
|
||||
|
||||
if (*s1 == '\0')
|
||||
return(-1);
|
||||
os1 = s1;
|
||||
c1 = *s1;
|
||||
c2 = *s2;
|
||||
while (LOWER(c1) == LOWER(c2)) {
|
||||
if (c1 == '\0')
|
||||
break;
|
||||
c1 = *++s1;
|
||||
c2 = *++s2;
|
||||
}
|
||||
return(*s1 ? 0 : (*s2 ? (s1 - os1) : (os1 - s1)));
|
||||
}
|
||||
|
||||
static char *ambiguous; /* special return value for command routines */
|
||||
|
||||
char **
|
||||
genget(char *name, char **table, int stlen)
|
||||
{
|
||||
char **c, **found;
|
||||
int n;
|
||||
|
||||
if (name == 0)
|
||||
return 0;
|
||||
|
||||
found = 0;
|
||||
for (c = table; *c != 0; c = (char **)((char *)c + stlen)) {
|
||||
if ((n = isprefix(name, *c)) == 0)
|
||||
continue;
|
||||
if (n < 0) /* exact match */
|
||||
return(c);
|
||||
if (found)
|
||||
return(&ambiguous);
|
||||
found = c;
|
||||
}
|
||||
return(found);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function call version of Ambiguous()
|
||||
*/
|
||||
int
|
||||
Ambiguous(char **s)
|
||||
{
|
||||
return(s == &ambiguous);
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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$");
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)getent.c 8.2 (Berkeley) 12/15/93";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "misc-proto.h"
|
||||
|
||||
static char *area;
|
||||
static char gettytab[] = "/etc/gettytab";
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
getent(char *cp __unused, const char *name)
|
||||
{
|
||||
int retval;
|
||||
char *tempnam, *dba[2] = { gettytab, NULL };
|
||||
|
||||
tempnam = strdup(name);
|
||||
retval = cgetent(&area, dba, tempnam) == 0 ? 1 : 0;
|
||||
free(tempnam);
|
||||
return(retval);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
char *
|
||||
Getstr(const char *id, char **cpp __unused)
|
||||
{
|
||||
int retval;
|
||||
char *answer, *tempid;
|
||||
|
||||
tempid = strdup(id);
|
||||
retval = cgetstr(area, tempid, &answer);
|
||||
free(tempid);
|
||||
return((retval > 0) ? answer : NULL);
|
||||
}
|
||||
Loaded 100 of 1856 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user