mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-31 21:06:18 +01:00
Compare commits
70
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
606cad63e0 | ||
|
|
da00f4efc2 | ||
|
|
32521d32d0 | ||
|
|
1df7c9c31d | ||
|
|
f241006773 | ||
|
|
43afd0bf1c | ||
|
|
74435f8eb3 | ||
|
|
6b73bc0356 | ||
|
|
7cf9efac69 | ||
|
|
970d5bae18 | ||
|
|
1e6d5626c8 | ||
|
|
bcce53dd34 | ||
|
|
a26e715d37 | ||
|
|
4fcbd8c517 | ||
|
|
882db38555 | ||
|
|
9d9668a3f2 | ||
|
|
8d8602badd | ||
|
|
1def6ae0d1 | ||
|
|
896ecc9a30 | ||
|
|
52d36a71f1 | ||
|
|
58a89d2d23 | ||
|
|
dbab9c6029 | ||
|
|
c99fcd78ed | ||
|
|
1e8b639eba | ||
|
|
8510587725 | ||
|
|
7d08752b0e | ||
|
|
18731eb4b9 | ||
|
|
1279beffe8 | ||
|
|
32e9c3c95d | ||
|
|
0925ddc26f | ||
|
|
bb581dec3c | ||
|
|
915446aa4a | ||
|
|
9c65783076 | ||
|
|
49c68b4b0d | ||
|
|
a0bccd8472 | ||
|
|
e6d6e4a290 | ||
|
|
814e9babff | ||
|
|
42884803ec | ||
|
|
d4f3f321a2 | ||
|
|
9b754369c0 | ||
|
|
ed2ab96198 | ||
|
|
49e842606b | ||
|
|
ee1754104e | ||
|
|
9d15ac2014 | ||
|
|
c867c8b833 | ||
|
|
4287d70395 | ||
|
|
1259db48a3 | ||
|
|
26687284d9 | ||
|
|
3dcc89db84 | ||
|
|
94a5228bc6 | ||
|
|
831b94a0a8 | ||
|
|
94aabdf0f0 | ||
|
|
5df5dfdee1 | ||
|
|
1122e55277 | ||
|
|
a303f06e5b | ||
|
|
104628a2ae | ||
|
|
9e2f957e5a | ||
|
|
b9214dfb5f | ||
|
|
958d51720e | ||
|
|
3fb61e5330 | ||
|
|
ef218d763b | ||
|
|
f586cc6b49 | ||
|
|
706d15887a | ||
|
|
4f97efb6bf | ||
|
|
48a5b0fd6f | ||
|
|
181e50d2d2 | ||
|
|
a0e41bfba0 | ||
|
|
5ee43a7150 | ||
|
|
527d1e545b | ||
|
|
d3272a1036 |
No files matched your search
+9
-5
@@ -514,7 +514,7 @@ update:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR}; cvs -q update -rRELENG_4 -P -d
|
||||
cd ${.CURDIR}; cvs -q update -rRELENG_4_6 -P -d
|
||||
.endif
|
||||
|
||||
#
|
||||
@@ -744,6 +744,7 @@ includes:
|
||||
# libradius: libmd
|
||||
# libreadline: libncurses
|
||||
# libskey: libcrypt libmd
|
||||
# libssh: libcrypto libz
|
||||
# libstc++: msun
|
||||
# libtacplus: libmd
|
||||
#
|
||||
@@ -753,7 +754,7 @@ includes:
|
||||
# kerberosIV/lib kerberos5/lib: lib/libcrypt
|
||||
# lib/libpam: secure/lib/libcrypto kerberosIV/lib/libkrb \
|
||||
# secure/lib/libssh lib/libz
|
||||
# secure/lib: lib/libmd
|
||||
# secure/lib: secure/lib/libcrypto lib/libmd lib/libz
|
||||
#
|
||||
.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
|
||||
_csu= lib/csu/${MACHINE_ARCH}.pcc
|
||||
@@ -763,8 +764,11 @@ _csu= lib/csu/i386-elf
|
||||
_csu= lib/csu/${MACHINE_ARCH}
|
||||
.endif
|
||||
|
||||
.if !defined(NOSECURE) && !defined(NOCRYPT)
|
||||
.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
|
||||
_secure_lib= secure/lib
|
||||
.if exists(${.CURDIR}/secure/lib/libcrypto)
|
||||
_libcrypto= secure/lib/libcrypto
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
|
||||
@@ -785,10 +789,10 @@ _libkeycap= usr.sbin/pcvt/keycap
|
||||
|
||||
libraries:
|
||||
.for _lib in ${_csu} gnu/lib/csu gnu/lib/libgcc lib/libmd lib/libcrypt \
|
||||
${_secure_lib} ${_kerberosIV_lib} \
|
||||
lib/libz ${_libcrypto} ${_secure_lib} ${_kerberosIV_lib} \
|
||||
${_kerberos5_lib} lib/libcom_err lib/msun lib/libncurses \
|
||||
lib/libopie lib/libradius lib/libskey lib/libtacplus lib/libutil \
|
||||
lib/libz lib gnu/lib ${_libperl} usr.bin/lex/lib ${_libkeycap}
|
||||
lib gnu/lib ${_libperl} usr.bin/lex/lib ${_libkeycap}
|
||||
.if exists(${.CURDIR}/${_lib})
|
||||
cd ${.CURDIR}/${_lib}; \
|
||||
${MAKE} depend; \
|
||||
|
||||
@@ -8,7 +8,75 @@ A reverse chronology since 4.0 was released is included, followed by
|
||||
the common items quick how-tos, followed by entries for versions of
|
||||
-current prior to 4.0 Release.
|
||||
|
||||
20020626: -p1
|
||||
This is for the 4.6 release branch. All entries since 4.6 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.
|
||||
|
||||
20020813: p11
|
||||
Bounds checking errors in accept(), getsockname(),
|
||||
getpeername(), and a VESA ioctl() command were corrected.
|
||||
|
||||
20020805: p10 FreeBSD-SA-02:33.openssl
|
||||
Correct a bug in the ASN.1 decoder which was introduced with
|
||||
the recent OpenSSL update.
|
||||
|
||||
20020805: p9 FreeBSD-SA-02:37.kqueue
|
||||
Registering an EVFILT_WRITE event on a pipe whose far end had
|
||||
already been closed would cause a kernel panic.
|
||||
|
||||
20020804: p8
|
||||
Bugfix for READ_BIG errors with ATAPI devices.
|
||||
|
||||
20020801: p7 FreeBSD-SA-02:36.nfs
|
||||
RPCs with zero-length payload would cause an infinite loop.
|
||||
|
||||
20020801: p6 FreeBSD-SA-02:34.rpc
|
||||
The original fix applied to the XDR decoder was in error.
|
||||
|
||||
20020731: p5 FreeBSD-SA-02:35.ffs
|
||||
A bounds checking error in FFS filesize limits was corrected.
|
||||
|
||||
20020731: p4 FreeBSD-SA-02:34.rpc
|
||||
A bounds checking error in the XDR decoder was corrected.
|
||||
|
||||
20020730: p3 FreeBSD-SA-02:33.openssl
|
||||
Upgrade to OpenSSL 0.9.6e.
|
||||
|
||||
20020730: p2 FreeBSD-SA-02:32.pppd
|
||||
A race condition in pppd(8) was corrected.
|
||||
|
||||
20020730: p1 FreeBSD-SA-02:23.stdio.v1.2
|
||||
A bug in the previous patch for the vulnerability described
|
||||
in FreeBSD-SA-02:23.stdio was found and corrected.
|
||||
|
||||
20020718:
|
||||
"Hang in atprq" bugfix for ATAPI CDROMs.
|
||||
|
||||
20020716:
|
||||
OpenSSH 3.4p1 update.
|
||||
|
||||
20020715: p3
|
||||
Upgrade to BIND 8.3.3.
|
||||
|
||||
20020714:
|
||||
pcic power bugfix.
|
||||
sendmail DNS map bugfix.
|
||||
|
||||
20020712: p2 FreeBSD-SA-02:29.tcpdump
|
||||
A buffer overflow in tcpdump has been corrected.
|
||||
|
||||
20020711: FreeBSD-SA-02:30.ktrace
|
||||
Prevent users from tracing previously privileged processes.
|
||||
|
||||
20020708:
|
||||
A tags bug in the ata(4) subsystem has been corrected.
|
||||
|
||||
20020626: p1 FreeBSD-SA-02:28.resolv
|
||||
A fix for a buffer overflow in libc has been corrected.
|
||||
|
||||
20020615:
|
||||
|
||||
@@ -1,4 +1,116 @@
|
||||
|
||||
--- 8.3.3-REL released --- (Wed Jun 26 21:15:43 PDT 2002)
|
||||
|
||||
1301. [func] log attempts to exploit #1300.
|
||||
|
||||
1300. [bug] Remote buffer overrun.
|
||||
|
||||
1299. [func] Log to xfer-in when a named-xfer fails and one of
|
||||
the masters returned REFUSED.
|
||||
|
||||
1298. [bug] named could leak a OPT record when returning a
|
||||
negative response.
|
||||
|
||||
1297. [func] 'ndc restart' will now attempt to preserve the
|
||||
arguments named was started with.
|
||||
Use 'ndc restart --' to clear the arguements.
|
||||
Use 'ndc restart <new arguements>' to restart named
|
||||
with a alternate set of arguements.
|
||||
|
||||
1296. [bug] delay setting need_restart until the response to
|
||||
ndc exec has been sent.
|
||||
|
||||
1295. [func] new ndc command 'args'. returns the arguements that
|
||||
named was started with %xx escaped.
|
||||
|
||||
1294. [bug] #1272 broke linkage for those OS's using -lfl (flex).
|
||||
Move -ll/-lfl to LIBL for all platforms.
|
||||
|
||||
--- 8.3.2-REL released --- (Mon Jun 17 20:24:32 PDT 2002)
|
||||
|
||||
1293. [doc] update man pages for 'dig', 'dnsquery' and 'host'
|
||||
to reflect IPv6 capabilities (nslookup and nsupdate
|
||||
were already IPv4/IPv6 agnostic).
|
||||
|
||||
1292. [func] host: the default lookups now also include AAAA
|
||||
records.
|
||||
|
||||
1291. [func] 'dig -x <ip6>' now works.
|
||||
|
||||
1290. [bug] 'dig @server' fail to report the IPv6 address of the
|
||||
server in error messages.
|
||||
|
||||
1289. [contrib] normalize_zone now handles $TTL.
|
||||
|
||||
1288. [bug] named: -t and -w could not be used together.
|
||||
|
||||
1287. [func] report serial(s) in out going transfer operation.
|
||||
|
||||
--- 8.3.2-RC1 released --- (Thu May 30 23:06:11 PDT 2002)
|
||||
|
||||
1286. [func] libbind: no longer attempts bit string labels for
|
||||
IPv6 reverse resolution. Try IP6.ARPA then IP6.INT
|
||||
for nibble style resolution.
|
||||
|
||||
1285. [port] linux: ss_family vs __ss_family in sockaddr_storage.
|
||||
|
||||
1284. [port] freebsd: 5.0 uses gid_t rather that int for
|
||||
GETGROUPLIST_ARGS
|
||||
|
||||
1283. [port] bsdi: 4.2 also has struct sockaddr_storage.
|
||||
|
||||
1282. [bug] nslookup was using inet_ntoa() to print out a IPv6
|
||||
address.
|
||||
|
||||
1281. [bug] escape '(' and ')' when coverting to presentation
|
||||
form.
|
||||
|
||||
1280. [func] server { edns yes_or_no; } is now supported.
|
||||
|
||||
1279. [bug] nslookup: partial coversion to similar style outputs
|
||||
for both -type=aaaa and -type=a.
|
||||
|
||||
1278. [bug] free() of non-malloced memory in nslookup.
|
||||
|
||||
1277. [port] cast all instances of yytext in commands.l to (char*)
|
||||
to silence compilers on OS's where lex declares it
|
||||
as (unsigned char *).
|
||||
|
||||
1276. [port] hpux 11.22: ansify GetAnswer in getinfo.c to
|
||||
silence compiler.
|
||||
|
||||
1275. [bug] bad declaration of si in tsig_key_from_addr().
|
||||
|
||||
1274. [port] hpux 11.22: ansify hexstring() and display() in
|
||||
addr.c to silence compiler.
|
||||
|
||||
1273. [bug] const pointer conficts in res_debug.c.
|
||||
|
||||
1272. [port] hpux 11.22: don't link against -ll unless required.
|
||||
|
||||
1272. [bug] main_need_num was not last entry in enum.
|
||||
main_need_tick nolonger required.
|
||||
|
||||
1271. [port] hpux: treat all hpux systems as BIG_ENDIAN, don't
|
||||
include <sys/mbuf.h>.
|
||||
|
||||
1270. [port] hpux 11.22 namespace clash DATASIZE -> BIND_DATASIZE.
|
||||
|
||||
1269. [port] hpux 11.11 interface scaning.
|
||||
|
||||
1268. [port] solaris: 64 bit binary compatability.
|
||||
|
||||
1267. [bug] aix4: missing IN6_IS_ADDR_V4COMPAT macro.
|
||||
|
||||
1266. [bug] If you are using TSIG #1261 introduced the potential
|
||||
of a infinite loop.
|
||||
|
||||
1265. [bug] nslookup failed on platforms that don't have BSD 43
|
||||
style sockets.
|
||||
|
||||
1264. [bug] LINK_INIT and UNLINK were not compatible with
|
||||
C++, use LINK_INIT_TYPE and UNLINK_TYPE instead.
|
||||
|
||||
--- 8.3.2-T1B released --- (Tue May 7 18:49:58 PDT 2002)
|
||||
|
||||
1263. [bug] gethostans() could get out of sync parsing the
|
||||
|
||||
@@ -10,6 +10,11 @@ artifacts including BIND, INN, and DHCP.
|
||||
Note that BIND 8 is in "end-of-life", having been replaced by BIND 9. See
|
||||
http://www.isc.org/ for more details.
|
||||
|
||||
BIND 8.3.3 Highlights
|
||||
Security Fix libbind. All applications linked against libbind
|
||||
need to relinked.
|
||||
'rndc restart' now preserves named's arguements
|
||||
|
||||
BIND 8.3.2 Highlights
|
||||
dig, nslookup, host and nsupdate have improved IPv6 support.
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.3.2-T1B
|
||||
8.3.3-REL
|
||||
@@ -1,5 +1,5 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: addr.c,v 8.8 1999/10/13 16:38:55 vixie Exp $";
|
||||
static const char rcsid[] = "$Id: addr.c,v 8.9 2002/05/21 02:26:21 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -47,11 +47,7 @@ usage() {
|
||||
|
||||
/* Warning: this scribbles on `dst' even if it's going to return `0'. */
|
||||
static int
|
||||
hexstring(src, dst, len)
|
||||
const char *src;
|
||||
u_char *dst;
|
||||
int len;
|
||||
{
|
||||
hexstring(const char *src, u_char *dst, int len) {
|
||||
static const char xdigits[] = "0123456789abcdef";
|
||||
u_char *ptr = dst, *end = dst + len;
|
||||
u_int val;
|
||||
@@ -100,12 +96,7 @@ hexstring(src, dst, len)
|
||||
}
|
||||
|
||||
static void
|
||||
display(input, af, addr, len)
|
||||
const char *input;
|
||||
int af;
|
||||
const u_char *addr;
|
||||
int len;
|
||||
{
|
||||
display(const char *input, int af, const u_char *addr, int len) {
|
||||
static int before = 0;
|
||||
char p[sizeof "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255"];
|
||||
int i;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static const char rcsid[] = "$Id: dig.c,v 8.54 2002/04/24 00:38:08 marka Exp $";
|
||||
static const char rcsid[] = "$Id: dig.c,v 8.57 2002/06/18 02:26:49 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -245,6 +245,7 @@ static int print_axfr(FILE *output, const u_char *msg,
|
||||
static struct timeval difftv(struct timeval, struct timeval);
|
||||
static void prnttime(struct timeval);
|
||||
static void stackarg(char *, char **);
|
||||
static void reverse6(char *, struct in6_addr *);
|
||||
|
||||
/* Public. */
|
||||
|
||||
@@ -289,6 +290,8 @@ main(int argc, char **argv) {
|
||||
int wait=0, delay;
|
||||
int envset=0, envsave=0;
|
||||
struct __res_state res_x, res_t;
|
||||
int r;
|
||||
struct in6_addr in6;
|
||||
|
||||
ns_tsig_key key;
|
||||
char *keyfile = NULL, *keyname = NULL;
|
||||
@@ -494,6 +497,11 @@ main(int argc, char **argv) {
|
||||
printf("; no arg for -x?\n");
|
||||
break;
|
||||
}
|
||||
r = inet_pton(AF_INET6, addrc, &in6);
|
||||
if (r > 0) {
|
||||
reverse6(domain, &in6);
|
||||
break;
|
||||
}
|
||||
addrend = addrc + strlen(addrc);
|
||||
if (*addrend == '.')
|
||||
*addrend = '\0';
|
||||
@@ -813,7 +821,7 @@ main(int argc, char **argv) {
|
||||
buf, sizeof(buf));
|
||||
break;
|
||||
case AF_INET6:
|
||||
inet_ntop(AF_INET,
|
||||
inet_ntop(AF_INET6,
|
||||
&u[0].sin6.sin6_addr,
|
||||
buf, sizeof(buf));
|
||||
break;
|
||||
@@ -1030,7 +1038,7 @@ where: server,\n\
|
||||
fputs("\
|
||||
notes: defname and search don't work; use fully-qualified names.\n\
|
||||
this is DiG version " VSTRING "\n\
|
||||
$Id: dig.c,v 8.54 2002/04/24 00:38:08 marka Exp $\n\
|
||||
$Id: dig.c,v 8.57 2002/06/18 02:26:49 marka Exp $\n\
|
||||
", stderr);
|
||||
}
|
||||
|
||||
@@ -1775,3 +1783,24 @@ stackarg(char *l, char **y) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reverse6(char *domain, struct in6_addr *in6) {
|
||||
sprintf(domain, "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
|
||||
in6->s6_addr[15] & 0x0f, (in6->s6_addr[15] >> 4) & 0x0f,
|
||||
in6->s6_addr[14] & 0x0f, (in6->s6_addr[14] >> 4) & 0x0f,
|
||||
in6->s6_addr[13] & 0x0f, (in6->s6_addr[13] >> 4) & 0x0f,
|
||||
in6->s6_addr[12] & 0x0f, (in6->s6_addr[12] >> 4) & 0x0f,
|
||||
in6->s6_addr[11] & 0x0f, (in6->s6_addr[11] >> 4) & 0x0f,
|
||||
in6->s6_addr[10] & 0x0f, (in6->s6_addr[10] >> 4) & 0x0f,
|
||||
in6->s6_addr[9] & 0x0f, (in6->s6_addr[9] >> 4) & 0x0f,
|
||||
in6->s6_addr[8] & 0x0f, (in6->s6_addr[8] >> 4) & 0x0f,
|
||||
in6->s6_addr[7] & 0x0f, (in6->s6_addr[7] >> 4) & 0x0f,
|
||||
in6->s6_addr[6] & 0x0f, (in6->s6_addr[6] >> 4) & 0x0f,
|
||||
in6->s6_addr[5] & 0x0f, (in6->s6_addr[5] >> 4) & 0x0f,
|
||||
in6->s6_addr[4] & 0x0f, (in6->s6_addr[4] >> 4) & 0x0f,
|
||||
in6->s6_addr[6] & 0x0f, (in6->s6_addr[3] >> 4) & 0x0f,
|
||||
in6->s6_addr[2] & 0x0f, (in6->s6_addr[2] >> 4) & 0x0f,
|
||||
in6->s6_addr[1] & 0x0f, (in6->s6_addr[1] >> 4) & 0x0f,
|
||||
in6->s6_addr[0] & 0x0f, (in6->s6_addr[0] >> 4) & 0x0f);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static const char rcsid[] = "$Id: host.c,v 8.52 2002/04/28 01:34:52 marka Exp $";
|
||||
static const char rcsid[] = "$Id: host.c,v 8.53 2002/06/18 02:34:02 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -675,7 +675,7 @@ gethostinfo(char *name) {
|
||||
|
||||
static int
|
||||
getdomaininfo(const char *name, const char *domain) {
|
||||
int val1, val2;
|
||||
int val1, val2, val3;
|
||||
|
||||
if (querytype)
|
||||
return (getinfo(name, domain, gettype=querytype));
|
||||
@@ -683,8 +683,9 @@ getdomaininfo(const char *name, const char *domain) {
|
||||
val1 = getinfo(name, domain, gettype=ns_t_a);
|
||||
if (cname || verbose)
|
||||
return (val1);
|
||||
val2 = getinfo(name, domain, gettype=ns_t_mx);
|
||||
return (val1 || val2);
|
||||
val2 = getinfo(name, domain, gettype=ns_t_aaaa);
|
||||
val3 = getinfo(name, domain, gettype=ns_t_mx);
|
||||
return (val1 || val2 || val3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1582,6 +1583,7 @@ static const char *
|
||||
pr_type(int type) {
|
||||
if (!verbose) switch (type) {
|
||||
case ns_t_a:
|
||||
case ns_t_aaaa:
|
||||
return ("has address");
|
||||
case ns_t_cname:
|
||||
return ("is a nickname for");
|
||||
|
||||
@@ -131,7 +131,7 @@ char copyright[] =
|
||||
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char sccsid[] = "@(#)named-xfer.c 4.18 (Berkeley) 3/7/91";
|
||||
static const char rcsid[] = "$Id: named-xfer.c,v 8.120 2002/01/29 06:54:52 marka Exp $";
|
||||
static const char rcsid[] = "$Id: named-xfer.c,v 8.121 2002/06/26 03:27:22 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "port_before.h"
|
||||
@@ -751,6 +751,7 @@ main(int argc, char *argv[]) {
|
||||
default:
|
||||
result = XFER_FAIL;
|
||||
/* fall through */
|
||||
case XFER_REFUSED:
|
||||
case XFER_TIMEOUT:
|
||||
case XFER_FAIL:
|
||||
(void) unlink(tmpname);
|
||||
@@ -1068,6 +1069,7 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) {
|
||||
u_int32_t query_serial = serial_no;
|
||||
int first_soa_printed;
|
||||
struct in_addr z_axfr_src;
|
||||
int refused = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug) {
|
||||
@@ -1631,6 +1633,7 @@ receive:
|
||||
my_addr_text,
|
||||
inet_ntoa(sin.sin_addr),
|
||||
zp->z_origin);
|
||||
refused = 1;
|
||||
} else {
|
||||
syslog(LOG_INFO,
|
||||
"[%s] record too short from [%s], zone %s\n",
|
||||
@@ -1913,6 +1916,7 @@ axfr_response:
|
||||
my_addr_text,
|
||||
inet_ntoa(sin.sin_addr),
|
||||
zp->z_origin);
|
||||
refused = 1;
|
||||
} else {
|
||||
syslog(LOG_INFO,
|
||||
"[%s] record too short from [%s], zone %s\n",
|
||||
@@ -1952,6 +1956,8 @@ axfr_response:
|
||||
}
|
||||
if (!error)
|
||||
return (XFER_TIMEOUT);
|
||||
if (refused)
|
||||
return (XFER_REFUSED);
|
||||
return (XFER_FAIL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* from db.h 4.16 (Berkeley) 6/1/90
|
||||
* $Id: db_defs.h,v 8.46 2001/11/17 15:16:46 marka Exp $
|
||||
* $Id: db_defs.h,v 8.47 2002/05/18 01:02:53 marka Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -147,7 +147,7 @@ struct databuf {
|
||||
u_int16_t d_nstime; /* NS response time, milliseconds */
|
||||
u_char d_data[sizeof(void*)]; /* dynamic (padded) */
|
||||
};
|
||||
#define DATASIZE(n) (sizeof(struct databuf) - sizeof(void*) + n)
|
||||
#define BIND_DATASIZE(n) (sizeof(struct databuf) - sizeof(void*) + n)
|
||||
|
||||
#ifdef HITCOUNTS
|
||||
extern u_int32_t db_total_hits;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char sccsid[] = "@(#)db_glue.c 4.4 (Berkeley) 6/1/90";
|
||||
static const char rcsid[] = "$Id: db_glue.c,v 8.46 2001/11/25 23:52:19 marka Exp $";
|
||||
static const char rcsid[] = "$Id: db_glue.c,v 8.47 2002/05/18 01:02:54 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -441,7 +441,7 @@ nhash(const char *name) {
|
||||
|
||||
static void
|
||||
db_freedata(struct databuf *dp) {
|
||||
int bytes = DATASIZE(dp->d_size);
|
||||
int bytes = BIND_DATASIZE(dp->d_size);
|
||||
|
||||
if (dp->d_rcnt != 0)
|
||||
panic("db_freedata: d_rcnt != 0", NULL);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char sccsid[] = "@(#)db_save.c 4.16 (Berkeley) 3/21/91";
|
||||
static const char rcsid[] = "$Id: db_save.c,v 8.29 2001/04/25 13:53:09 marka Exp $";
|
||||
static const char rcsid[] = "$Id: db_save.c,v 8.30 2002/05/18 01:02:56 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -137,7 +137,7 @@ savedata(class, type, ttl, data, size)
|
||||
int size;
|
||||
{
|
||||
struct databuf *dp;
|
||||
int bytes = DATASIZE(size);
|
||||
int bytes = BIND_DATASIZE(size);
|
||||
|
||||
dp = (struct databuf *)memget(bytes);
|
||||
if (dp == NULL)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: db_tsig.c,v 8.7 2001/06/18 14:42:59 marka Exp $";
|
||||
static const char rcsid[] = "$Id: db_tsig.c,v 8.8 2002/05/21 02:34:32 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -129,7 +129,7 @@ tsig_alg_value(char *name) {
|
||||
|
||||
DST_KEY *
|
||||
tsig_key_from_addr(struct in_addr addr) {
|
||||
server_info si = si = find_server(addr);
|
||||
server_info si = find_server(addr);
|
||||
if (si == NULL || si->key_list == NULL || si->key_list->first == NULL)
|
||||
return(NULL);
|
||||
return(si->key_list->first->key);
|
||||
|
||||
@@ -267,6 +267,8 @@ zone "non-default-acl.demo.zone" {
|
||||
acl key_acl { key sample_key; }; // a request signed with sample_key
|
||||
|
||||
server 1.2.3.4 {
|
||||
edns no; // if no, we won't send ends queries
|
||||
// to this server
|
||||
bogus no; // if yes, we won't query or listen
|
||||
// to this server
|
||||
transfer-format one-answer; // set transfer format for this
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: ns_config.c,v 8.134 2002/04/25 05:27:04 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_config.c,v 8.135 2002/05/24 03:04:59 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -2549,6 +2549,7 @@ new_server(struct in_addr address) {
|
||||
si->flags |= SERVER_INFO_SUPPORT_IXFR;
|
||||
else
|
||||
si->flags &= ~SERVER_INFO_SUPPORT_IXFR;
|
||||
si->flags |= SERVER_INFO_EDNS;
|
||||
return (si);
|
||||
}
|
||||
|
||||
@@ -2649,6 +2650,7 @@ set_server_option(server_config sc, int bool_opt, int value) {
|
||||
switch (bool_opt) {
|
||||
case SERVER_INFO_BOGUS:
|
||||
case SERVER_INFO_SUPPORT_IXFR:
|
||||
case SERVER_INFO_EDNS:
|
||||
if (value)
|
||||
si->flags |= bool_opt;
|
||||
else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: ns_ctl.c,v 8.46 2001/12/19 11:53:48 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_ctl.c,v 8.47 2002/06/24 07:11:07 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -112,6 +112,8 @@ static void verb_stop(struct ctl_sctx *, struct ctl_sess *,
|
||||
static void verb_exec(struct ctl_sctx *, struct ctl_sess *,
|
||||
const struct ctl_verb *,
|
||||
const char *, u_int, const void *, void *);
|
||||
static void exec_closure(struct ctl_sctx *, struct ctl_sess *,
|
||||
void *);
|
||||
static void verb_reload(struct ctl_sctx *, struct ctl_sess *,
|
||||
const struct ctl_verb *,
|
||||
const char *, u_int, const void *, void *);
|
||||
@@ -141,6 +143,9 @@ static void verb_help(struct ctl_sctx *, struct ctl_sess *,
|
||||
static void verb_quit(struct ctl_sctx *, struct ctl_sess *,
|
||||
const struct ctl_verb *,
|
||||
const char *, u_int, const void *, void *);
|
||||
static void verb_args(struct ctl_sctx *, struct ctl_sess *,
|
||||
const struct ctl_verb *,
|
||||
const char *, u_int, const void *, void *);
|
||||
|
||||
/* Private data. */
|
||||
|
||||
@@ -162,6 +167,7 @@ static struct ctl_verb verbs[] = {
|
||||
{ "qrylog", verb_querylog, "qrylog"},
|
||||
{ "help", verb_help, "help"},
|
||||
{ "quit", verb_quit, "quit"},
|
||||
{ "args", verb_args, "args"},
|
||||
{ NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -794,13 +800,25 @@ verb_exec(struct ctl_sctx *ctl, struct ctl_sess *sess,
|
||||
saved_argv[0], save);
|
||||
ctl_response(sess, 502, save, 0, NULL, NULL, NULL,
|
||||
NULL, 0);
|
||||
} else if (user_name != NULL || group_name != NULL) {
|
||||
ctl_response(sess, 502,
|
||||
"can't exec as user or group was specified",
|
||||
0, NULL, NULL, NULL, NULL, 0);
|
||||
} else {
|
||||
ns_need(main_need_restart);
|
||||
ctl_response(sess, 250, "Restart initiated.", 0, NULL,
|
||||
NULL, NULL, NULL, 0);
|
||||
exec_closure, NULL, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exec_closure(struct ctl_sctx *sctx, struct ctl_sess *sess, void *uap) {
|
||||
|
||||
UNUSED(sctx);
|
||||
UNUSED(sess);
|
||||
UNUSED(uap);
|
||||
ns_need(main_need_restart);
|
||||
}
|
||||
|
||||
static void
|
||||
verb_reload(struct ctl_sctx *ctl, struct ctl_sess *sess,
|
||||
const struct ctl_verb *verb, const char *rest,
|
||||
@@ -1049,3 +1067,81 @@ verb_quit(struct ctl_sctx *ctl, struct ctl_sess *sess,
|
||||
ctl_response(sess, 221, "End of control session.", CTL_EXIT, NULL,
|
||||
NULL, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
static char hex[] = "0123456789abcdef";
|
||||
|
||||
struct pvt_args {
|
||||
int argc;
|
||||
char text[MAX_STR_LEN];
|
||||
};
|
||||
|
||||
static void
|
||||
args_closure(struct ctl_sctx *sctx, struct ctl_sess *sess, void *uap) {
|
||||
struct pvt_args *pvt = ctl_getcsctx(sess);
|
||||
|
||||
UNUSED(sctx);
|
||||
UNUSED(uap);
|
||||
|
||||
memput(pvt, sizeof *pvt);
|
||||
ctl_setcsctx(sess, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
verb_args(struct ctl_sctx *ctl, struct ctl_sess *sess,
|
||||
const struct ctl_verb *verb, const char *rest,
|
||||
u_int respflags, const void *respctx, void *uctx)
|
||||
{
|
||||
struct pvt_args *pvt = ctl_getcsctx(sess);
|
||||
char *cp, *tp;
|
||||
|
||||
UNUSED(ctl);
|
||||
UNUSED(verb);
|
||||
UNUSED(rest);
|
||||
UNUSED(respflags);
|
||||
UNUSED(respctx);
|
||||
UNUSED(uctx);
|
||||
|
||||
if (pvt == NULL) {
|
||||
unsigned int i = 0;
|
||||
pvt = memget(sizeof *pvt);
|
||||
if (pvt == NULL) {
|
||||
ctl_response(sess, 505, "(out of memory)",
|
||||
0, NULL, NULL, NULL, NULL, 0);
|
||||
return;
|
||||
}
|
||||
pvt->argc = 0;
|
||||
ctl_setcsctx(sess, pvt);
|
||||
|
||||
/* Send the arguement count. */
|
||||
while (saved_argv[i] != NULL)
|
||||
i++;
|
||||
sprintf(pvt->text, "%u", i);
|
||||
ctl_response(sess, 250, pvt->text, CTL_MORE,
|
||||
NULL, args_closure, NULL, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Percent escape arguement.
|
||||
*/
|
||||
cp = saved_argv[pvt->argc++];
|
||||
tp = pvt->text;
|
||||
while (cp && *cp != NULL)
|
||||
if (*cp == '%' || *cp == ' ' ||
|
||||
!isprint((unsigned char)*cp)) {
|
||||
if (tp >= pvt->text + sizeof(pvt->text) - 4)
|
||||
break;
|
||||
*tp++ = '%';
|
||||
*tp++ = hex[(*cp>>4)&0xf];
|
||||
*tp++ = hex[(*cp++)&0xf];
|
||||
} else {
|
||||
if (tp >= pvt->text + sizeof(pvt->text) - 2)
|
||||
break;
|
||||
*tp++ = *cp++;
|
||||
}
|
||||
*tp = '\0';
|
||||
|
||||
ctl_response(sess, 250, pvt->text,
|
||||
saved_argv[pvt->argc] == NULL ? 0 : CTL_MORE,
|
||||
NULL, args_closure, NULL, NULL, 0);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* from ns.h 4.33 (Berkeley) 8/23/90
|
||||
* $Id: ns_defs.h,v 8.118 2002/04/25 05:27:06 marka Exp $
|
||||
* $Id: ns_defs.h,v 8.121 2002/06/26 03:27:19 marka Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -172,9 +172,8 @@ typedef enum need {
|
||||
main_need_restart, /* exec() needed. */
|
||||
main_need_reap, /* need to reap dead children. */
|
||||
main_need_noexpired, /* ns_reconfig() needed w/ noexpired set. */
|
||||
main_need_num, /* number of needs, used for array bound. */
|
||||
main_need_tick, /* tick every second to poll for cleanup (NT) */
|
||||
main_need_tryxfer /* attemt to start a zone transfer. */
|
||||
main_need_tryxfer, /* attemt to start a zone transfer. */
|
||||
main_need_num /* MUST BE LAST. */
|
||||
} main_need;
|
||||
|
||||
/* What global options are set? */
|
||||
@@ -438,6 +437,7 @@ enum zonetype { z_nil, z_master, z_slave, z_hint, z_stub, z_forward,
|
||||
#define XFER_SUCCESSAXFR 4 /* named-xfr recived a xfr */
|
||||
#define XFER_SUCCESSIXFR 5 /* named-xfr recived a ixfr */
|
||||
#define XFER_SUCCESSAXFRIXFRFILE 6 /* named-xfr received AXFR for IXFR */
|
||||
#define XFER_REFUSED 7 /* one master returned REFUSED */
|
||||
#define XFER_ISAXFR -1 /* the last XFR is AXFR */
|
||||
#define XFER_ISIXFR -2 /* the last XFR is IXFR */
|
||||
#define XFER_ISAXFRIXFR -3 /* the last XFR is AXFR but we must create IXFR base */
|
||||
@@ -835,6 +835,7 @@ typedef struct server_config {
|
||||
|
||||
#define SERVER_INFO_BOGUS 0x01
|
||||
#define SERVER_INFO_SUPPORT_IXFR 0x02
|
||||
#define SERVER_INFO_EDNS 0x04
|
||||
|
||||
typedef struct server_info {
|
||||
struct in_addr address;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char sccsid[] = "@(#)ns_forw.c 4.32 (Berkeley) 3/3/91";
|
||||
static const char rcsid[] = "$Id: ns_forw.c,v 8.90 2002/02/22 05:12:35 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_forw.c,v 8.91 2002/05/24 03:04:57 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -612,6 +612,11 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
|
||||
qs->nsdata = dp;
|
||||
qs->forwarder = 0;
|
||||
qs->noedns = dp->d_noedns;
|
||||
if (!qs->noedns) {
|
||||
server_info si = find_server(nsa);
|
||||
if (si && (si->flags & SERVER_INFO_EDNS) == 0)
|
||||
qs->noedns = 1;
|
||||
}
|
||||
qs->nretry = 0;
|
||||
/*
|
||||
* If this A RR has no RTT, initialize its RTT to a
|
||||
@@ -1285,6 +1290,11 @@ nsfwdadd(struct qinfo *qp, struct fwdinfo *fwd) {
|
||||
qs->nsdata = fwd->fwddata->nsdata;
|
||||
qs->forwarder = 1;
|
||||
qs->noedns = fwd->fwddata->nsdata->d_noedns;
|
||||
if (!qs->noedns) {
|
||||
server_info si = find_server(qs->ns_addr.sin_addr);
|
||||
if (si && (si->flags & SERVER_INFO_EDNS) == 0)
|
||||
qs->noedns = 1;
|
||||
}
|
||||
qs->nretry = 0;
|
||||
n++;
|
||||
nextfwd:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* from ns.h 4.33 (Berkeley) 8/23/90
|
||||
* $Id: ns_glob.h,v 8.57 2001/11/12 21:22:26 marka Exp $
|
||||
* $Id: ns_glob.h,v 8.58 2002/06/05 04:53:50 marka Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -336,6 +336,7 @@ DECL char * user_name INIT(NULL);
|
||||
DECL gid_t group_id;
|
||||
DECL char * group_name INIT(NULL);
|
||||
DECL char * chroot_dir INIT(NULL);
|
||||
DECL char * working_dir INIT(NULL);
|
||||
|
||||
DECL int loading INIT(0);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: ns_ixfr.c,v 8.31 2002/01/02 05:15:20 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_ixfr.c,v 8.32 2002/05/18 01:02:57 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -201,10 +201,10 @@ sx_send_ixfr(struct qstream *qsp) {
|
||||
ns_panic(ns_log_update, 1,
|
||||
"sx_send_ixfr: unable to locate soa");
|
||||
}
|
||||
old_soadp = memget(DATASIZE(soa_dp->d_size));
|
||||
old_soadp = memget(BIND_DATASIZE(soa_dp->d_size));
|
||||
if (old_soadp == NULL)
|
||||
ns_panic(ns_log_update, 1, "sx_send_ixfr: out of memory");
|
||||
memcpy(old_soadp, soa_dp, DATASIZE(soa_dp->d_size));
|
||||
memcpy(old_soadp, soa_dp, BIND_DATASIZE(soa_dp->d_size));
|
||||
|
||||
again:
|
||||
switch (qsp->xfr.state) {
|
||||
@@ -383,7 +383,7 @@ sx_send_ixfr(struct qstream *qsp) {
|
||||
qsp->xfr.top.ixfr = NULL;
|
||||
}
|
||||
cleanup:
|
||||
memput(old_soadp, DATASIZE(old_soadp->d_size));
|
||||
memput(old_soadp, BIND_DATASIZE(old_soadp->d_size));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: ns_lexer.c,v 8.30 2002/04/25 05:27:08 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_lexer.c,v 8.31 2002/05/24 03:05:03 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -251,6 +251,7 @@ static struct keyword keywords[] = {
|
||||
{"directory", T_DIRECTORY},
|
||||
{"dump-file", T_DUMP_FILE},
|
||||
{"dynamic", T_DYNAMIC},
|
||||
{"edns", T_EDNS},
|
||||
{"explicit", T_EXPLICIT},
|
||||
{"fail", T_FAIL},
|
||||
{"fake-iquery", T_FAKE_IQUERY},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char sccsid[] = "@(#)ns_main.c 4.55 (Berkeley) 7/1/91";
|
||||
static const char rcsid[] = "$Id: ns_main.c,v 8.157 2002/04/13 23:26:16 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_main.c,v 8.160 2002/06/24 07:06:55 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -99,8 +99,10 @@ char copyright[] =
|
||||
#ifdef SVR4 /* XXX */
|
||||
# include <sys/sockio.h>
|
||||
#else
|
||||
#ifndef __hpux
|
||||
# include <sys/mbuf.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <net/route.h>
|
||||
@@ -174,7 +176,7 @@ static u_int16_t nsid_c1, nsid_c2, nsid_c3;
|
||||
static u_int16_t nsid_state2;
|
||||
static int nsid_algorithm;
|
||||
|
||||
static int needs = 0, needs_exit = 0;
|
||||
static int needs = 0, needs_exit = 0, needs_restart = 0;
|
||||
static handler handlers[main_need_num];
|
||||
static void savedg_waitfunc(evContext, void*, const void*);
|
||||
static void need_waitfunc(evContext, void *, const void *);
|
||||
@@ -309,14 +311,7 @@ main(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
if (chdir(optarg) < 0) {
|
||||
syslog(LOG_CRIT, bad_directory, optarg,
|
||||
strerror(errno));
|
||||
fprintf(stderr, bad_directory, optarg,
|
||||
strerror(errno));
|
||||
fputc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
working_dir = savestr(optarg, 1);
|
||||
break;
|
||||
#ifdef QRYLOG
|
||||
case 'q':
|
||||
@@ -434,6 +429,19 @@ main(int argc, char *argv[]) {
|
||||
chroot_dir = freestr(chroot_dir);
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Set working directory.
|
||||
*/
|
||||
if (working_dir != NULL) {
|
||||
if (chdir(working_dir) < 0) {
|
||||
syslog(LOG_CRIT, bad_directory, working_dir,
|
||||
strerror(errno));
|
||||
fprintf(stderr, bad_directory, working_dir,
|
||||
strerror(errno));
|
||||
fputc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Establish global event context. */
|
||||
evCreate(&ev);
|
||||
@@ -550,7 +558,10 @@ main(int argc, char *argv[]) {
|
||||
else
|
||||
INSIST_ERR(errno == EINTR);
|
||||
}
|
||||
ns_info(ns_log_default, "named shutting down");
|
||||
if (needs_restart)
|
||||
ns_info(ns_log_default, "named restarting");
|
||||
else
|
||||
ns_info(ns_log_default, "named shutting down");
|
||||
#ifdef BIND_UPDATE
|
||||
dynamic_about_to_exit();
|
||||
#endif
|
||||
@@ -563,8 +574,11 @@ main(int argc, char *argv[]) {
|
||||
else
|
||||
shutdown_configuration();
|
||||
|
||||
/* Cleanup for system-dependent stuff */
|
||||
custom_shutdown();
|
||||
if (needs_restart)
|
||||
execvp(saved_argv[0], saved_argv);
|
||||
else
|
||||
/* Cleanup for system-dependent stuff */
|
||||
custom_shutdown();
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -2746,6 +2760,9 @@ deallocate_everything(void) {
|
||||
if (chroot_dir != NULL)
|
||||
freestr(chroot_dir);
|
||||
chroot_dir = NULL;
|
||||
if (working_dir != NULL)
|
||||
freestr(working_dir);
|
||||
working_dir = NULL;
|
||||
if (nsid_pool != NULL)
|
||||
memput(nsid_pool, 0x10000 * (sizeof(u_int16_t)));
|
||||
nsid_pool = NULL;
|
||||
@@ -2764,19 +2781,8 @@ deallocate_everything(void) {
|
||||
|
||||
static void
|
||||
ns_restart(void) {
|
||||
ns_info(ns_log_default, "named restarting");
|
||||
#ifdef BIND_UPDATE
|
||||
dynamic_about_to_exit();
|
||||
#endif
|
||||
if (server_options && server_options->pid_filename)
|
||||
(void)unlink(server_options->pid_filename);
|
||||
ns_logstats(ev, NULL, evNowTime(), evConsTime(0, 0));
|
||||
if (NS_OPTION_P(OPTION_DEALLOC_ON_EXIT))
|
||||
deallocate_everything();
|
||||
else
|
||||
shutdown_configuration();
|
||||
execvp(saved_argv[0], saved_argv);
|
||||
abort();
|
||||
needs_restart = 1;
|
||||
needs_exit = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char sccsid[] = "@(#)ns_maint.c 4.39 (Berkeley) 3/2/91";
|
||||
static const char rcsid[] = "$Id: ns_maint.c,v 8.135 2002/04/25 05:27:10 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_maint.c,v 8.136 2002/06/26 03:27:20 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -1681,6 +1681,17 @@ endxfer() {
|
||||
sched_zone_maint(zp);
|
||||
break;
|
||||
|
||||
case XFER_REFUSED:
|
||||
if (!(zp->z_flags & Z_SYSLOGGED)) {
|
||||
zp->z_flags |= Z_SYSLOGGED;
|
||||
ns_error(ns_log_xfer_in,
|
||||
"zoneref: Masters for slave zone \"%s\" REFUSED transfer",
|
||||
zp->z_origin);
|
||||
}
|
||||
ns_retrytime(zp, tt.tv_sec);
|
||||
sched_zone_maint(zp);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!(zp->z_flags & Z_SYSLOGGED)) {
|
||||
zp->z_flags |= Z_SYSLOGGED;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%{
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char rcsid[] = "$Id: ns_parser.y,v 8.79 2002/04/25 05:27:13 marka Exp $";
|
||||
static char rcsid[] = "$Id: ns_parser.y,v 8.80 2002/05/24 03:05:01 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -191,6 +191,7 @@ int yyparse();
|
||||
%token T_TRANSFERS
|
||||
%token T_KEYS
|
||||
%token T_SUPPORT_IXFR
|
||||
%token T_EDNS
|
||||
|
||||
/* Items used for "zone" statements: */
|
||||
%token T_ZONE
|
||||
@@ -1268,6 +1269,10 @@ server_info: T_BOGUS yea_or_nay
|
||||
set_server_transfer_format(current_server, $2);
|
||||
}
|
||||
| T_KEYS '{' key_list '}'
|
||||
| T_EDNS yea_or_nay
|
||||
{
|
||||
set_server_option(current_server, SERVER_INFO_EDNS, $2);
|
||||
}
|
||||
| error
|
||||
;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char sccsid[] = "@(#)ns_req.c 4.47 (Berkeley) 7/1/91";
|
||||
static const char rcsid[] = "$Id: ns_req.c,v 8.168 2002/04/30 03:43:52 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_req.c,v 8.169 2002/05/12 23:41:52 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -560,6 +560,8 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
|
||||
hp->arcount = htons(0);
|
||||
cp = msg + HFIXEDSZ;
|
||||
cp += ns_skiprr(cp, msg + msglen, ns_s_qd, ntohs(hp->qdcount));
|
||||
ns_name_rollback(cp, (const u_char **)dnptrs,
|
||||
(const u_char **)dnptrs_end);
|
||||
if (opt > 0) {
|
||||
n = ns_add_opt(msg, cp, buflen_orig, 0,
|
||||
rcode, EDNS_MESSAGE_SZ, 0, NULL, 0);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char sccsid[] = "@(#)ns_resp.c 4.65 (Berkeley) 3/3/91";
|
||||
static const char rcsid[] = "$Id: ns_resp.c,v 8.176 2002/04/17 07:10:10 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_resp.c,v 8.178 2002/06/27 03:09:19 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -288,7 +288,6 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
|
||||
struct namebuf *np;
|
||||
struct fwdinfo *fwd;
|
||||
struct databuf *dp;
|
||||
int forcecmsg = 0;
|
||||
char *tname = NULL;
|
||||
int sendto_errno = 0;
|
||||
int has_tsig, oldqlen = 0;
|
||||
@@ -298,6 +297,7 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
|
||||
u_char sig[TSIG_SIG_SIZE];
|
||||
time_t tsig_time;
|
||||
DST_KEY *key;
|
||||
int expect_cname;
|
||||
|
||||
nameserIncr(from.sin_addr, nssRcvdR);
|
||||
nsp[0] = NULL;
|
||||
@@ -924,6 +924,7 @@ tcp_retry:
|
||||
} else
|
||||
flushset = NULL;
|
||||
|
||||
expect_cname = 1;
|
||||
for (i = 0; i < count; i++) {
|
||||
struct databuf *dp;
|
||||
int type;
|
||||
@@ -955,6 +956,19 @@ tcp_retry:
|
||||
type = dp->d_type;
|
||||
if (i < ancount) {
|
||||
/* Answer section. */
|
||||
/*
|
||||
* Check for attempts to overflow the buffer in
|
||||
* getnameanswer.
|
||||
*/
|
||||
if (type == ns_t_cname && !expect_cname) {
|
||||
ns_warning(ns_log_security,
|
||||
"late CNAME in answer section for %s %s from %s",
|
||||
*qname ? qname : ".", p_type(qtype),
|
||||
sin_ntoa(from));
|
||||
|
||||
} else if (type != ns_t_cname && type != ns_t_dname &&
|
||||
type != ns_t_sig)
|
||||
expect_cname = 0;
|
||||
if (externalcname || ns_samename(name, aname) != 1) {
|
||||
if (!externalcname)
|
||||
ns_info(ns_log_resp_checks,
|
||||
@@ -1220,12 +1234,11 @@ tcp_retry:
|
||||
cache_n_resp(msg, msglen, from, qp->q_name,
|
||||
qp->q_class, qp->q_type);
|
||||
|
||||
if (!qp->q_cmsglen) {
|
||||
if (!qp->q_cmsglen && validanswer) {
|
||||
ns_debug(ns_log_default, 3,
|
||||
"resp: leaving NO: auth = %d", hp->aa);
|
||||
goto return_msg;
|
||||
}
|
||||
forcecmsg = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char sccsid[] = "@(#)ns_main.c 4.55 (Berkeley) 7/1/91";
|
||||
static const char rcsid[] = "$Id: ns_signal.c,v 8.14 2001/06/18 14:43:25 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_signal.c,v 8.15 2002/05/18 01:39:15 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -87,8 +87,10 @@ static const char rcsid[] = "$Id: ns_signal.c,v 8.14 2001/06/18 14:43:25 marka E
|
||||
#ifdef SVR4 /* XXX */
|
||||
# include <sys/sockio.h>
|
||||
#else
|
||||
#ifndef __hpux
|
||||
# include <sys/mbuf.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <net/route.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: ns_update.c,v 8.103 2002/01/03 00:25:02 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_update.c,v 8.104 2002/05/18 01:02:59 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -3010,9 +3010,9 @@ incr_serial(struct zoneinfo *zp) {
|
||||
return (-1);
|
||||
dp = findzonesoa(zp);
|
||||
if (dp) {
|
||||
olddp = memget(DATASIZE(dp->d_size));
|
||||
olddp = memget(BIND_DATASIZE(dp->d_size));
|
||||
if (olddp != NULL) {
|
||||
memcpy(olddp, dp, DATASIZE(dp->d_size));
|
||||
memcpy(olddp, dp, BIND_DATASIZE(dp->d_size));
|
||||
cp = findsoaserial(olddp->d_data);
|
||||
PUTLONG(old_serial, cp);
|
||||
fprintf(ifp, "update: {delete} %s. %u %s %s ",
|
||||
@@ -3021,7 +3021,7 @@ incr_serial(struct zoneinfo *zp) {
|
||||
p_type(dp->d_type));
|
||||
(void) rdata_dump(olddp, ifp);
|
||||
fprintf(ifp, "\n");
|
||||
memput(olddp, DATASIZE(dp->d_size));
|
||||
memput(olddp, BIND_DATASIZE(dp->d_size));
|
||||
}
|
||||
fprintf(ifp, "update: {add} %s. %u %s %s ",
|
||||
zp->z_origin, dp->d_ttl,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: ns_xfr.c,v 8.68 2002/04/11 05:19:06 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_xfr.c,v 8.69 2002/06/05 03:53:49 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -82,15 +82,21 @@ ns_xfr(struct qstream *qsp, struct namebuf *znp,
|
||||
ns_deltalist *changes;
|
||||
|
||||
switch (type) {
|
||||
case ns_t_axfr: /*FALLTHROUGH*/
|
||||
case ns_t_ixfr:
|
||||
ns_info(ns_log_xfer_out,
|
||||
"zone transfer (%s) of \"%s\" (%s) to %s serial %u -> %u",
|
||||
p_type(type), zones[zone].z_origin, p_class(class),
|
||||
sin_ntoa(qsp->s_from), serial_ixfr,
|
||||
zones[zone].z_serial);
|
||||
break;
|
||||
case ns_t_axfr: /*FALLTHROUGH*/
|
||||
#ifdef BIND_ZXFR
|
||||
case ns_t_zxfr:
|
||||
#endif
|
||||
ns_info(ns_log_xfer_out,
|
||||
"zone transfer (%s) of \"%s\" (%s) to %s",
|
||||
"zone transfer (%s) of \"%s\" (%s) to %s serial %u",
|
||||
p_type(type), zones[zone].z_origin, p_class(class),
|
||||
sin_ntoa(qsp->s_from));
|
||||
sin_ntoa(qsp->s_from), zones[zone].z_serial);
|
||||
break;
|
||||
default:
|
||||
ns_warning(ns_log_xfer_out,
|
||||
|
||||
+183
-3
@@ -1,5 +1,5 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static const char rcsid[] = "$Id: ndc.c,v 1.21 2001/12/19 23:16:23 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ndc.c,v 1.22 2002/06/24 07:28:55 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -250,6 +250,179 @@ slashhelp(void) {
|
||||
"toggle silence (suppresses nonfatal errors)");
|
||||
}
|
||||
|
||||
struct argv {
|
||||
int argc;
|
||||
char **argv;
|
||||
int error;
|
||||
};
|
||||
|
||||
static char hexdigits[] = "0123456789abcdef";
|
||||
|
||||
static void
|
||||
getargs_closure(void *arg, const char *msg, int flags) {
|
||||
struct argv *argv = arg;
|
||||
int len;
|
||||
int i;
|
||||
const char *cp, *cp2;
|
||||
char *tp, c;
|
||||
|
||||
UNUSED(flags);
|
||||
|
||||
if (argv->error)
|
||||
return;
|
||||
|
||||
if (argv->argc == -1) {
|
||||
i = atoi(msg + 4);
|
||||
if (i < 1) {
|
||||
argv->error = 1;
|
||||
return;
|
||||
}
|
||||
argv->argc = i;
|
||||
argv->argv = calloc((i+1), sizeof(char*));
|
||||
return;
|
||||
}
|
||||
len = 0;
|
||||
cp = msg + 4;
|
||||
while (*cp != NULL) {
|
||||
c = *cp;
|
||||
if (c == '%') {
|
||||
cp2 = strchr(hexdigits, cp[1]);
|
||||
if (cp2 == NULL) {
|
||||
argv->error = 1;
|
||||
return;
|
||||
}
|
||||
c = (cp2-hexdigits) << 4;
|
||||
cp2 = strchr(hexdigits, cp[2]);
|
||||
if (cp2 == NULL) {
|
||||
argv->error = 1;
|
||||
return;
|
||||
}
|
||||
c += (cp2-hexdigits);
|
||||
cp += 2;
|
||||
}
|
||||
if (!isalnum((unsigned)c)) {
|
||||
switch (c) {
|
||||
case '+': case '-': case '=': case '/': case '.':
|
||||
break;
|
||||
default:
|
||||
len++;
|
||||
}
|
||||
}
|
||||
len++;
|
||||
cp++;
|
||||
}
|
||||
i = 0;
|
||||
while (argv->argv[i] != NULL)
|
||||
i++;
|
||||
if (i >= argv->argc) {
|
||||
argv->error = 1;
|
||||
return;
|
||||
}
|
||||
argv->argv[i] = malloc(len + 1);
|
||||
if (argv->argv[i] == NULL) {
|
||||
argv->error = 1;
|
||||
return;
|
||||
}
|
||||
cp = msg + 4;
|
||||
tp = argv->argv[i];
|
||||
while (*cp != NULL) {
|
||||
c = *cp;
|
||||
if (c == '%') {
|
||||
cp2 = strchr(hexdigits, cp[1]);
|
||||
if (cp2 == NULL) {
|
||||
argv->error = 1;
|
||||
return;
|
||||
}
|
||||
c = (cp2-hexdigits) << 4;
|
||||
cp2 = strchr(hexdigits, cp[2]);
|
||||
if (cp2 == NULL) {
|
||||
argv->error = 1;
|
||||
return;
|
||||
}
|
||||
c += (cp2-hexdigits);
|
||||
cp += 2;
|
||||
}
|
||||
if (!isalnum((unsigned)c)) {
|
||||
switch (c) {
|
||||
case '+': case '-': case '=': case '/': case '.':
|
||||
break;
|
||||
default:
|
||||
*tp = '\\';
|
||||
}
|
||||
}
|
||||
*tp++ = c;
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
get_args(char **restp) {
|
||||
struct argv argv;
|
||||
int len, i;
|
||||
char *rest, *p;
|
||||
int result = 1;
|
||||
|
||||
argv.argc = -1;
|
||||
argv.argv = NULL;
|
||||
argv.error = 0;
|
||||
|
||||
channel_loop("args", 1, getargs_closure, &argv);
|
||||
if (argv.error) {
|
||||
result = 0;
|
||||
goto err;
|
||||
}
|
||||
len = 0;
|
||||
for (i = 1 ; i < argv.argc && argv.argv[i] != NULL; i++)
|
||||
len += strlen(argv.argv[i]) + 1;
|
||||
rest = malloc(len);
|
||||
if (rest == NULL) {
|
||||
result = 0;
|
||||
goto err;
|
||||
}
|
||||
p = rest;
|
||||
for (i = 1 ; i < argv.argc && argv.argv[i] != NULL; i++) {
|
||||
strcpy(p, argv.argv[i]);
|
||||
p += strlen(argv.argv[i]);
|
||||
*p++ = ' ';
|
||||
}
|
||||
if (p != rest)
|
||||
p[-1] = '\0';
|
||||
*restp = rest;
|
||||
|
||||
err:
|
||||
if (argv.argv) {
|
||||
for (i = 0 ; i < argv.argc && argv.argv[i] != NULL; i++)
|
||||
free(argv.argv[i]);
|
||||
free(argv.argv);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
exec_closure(void *arg, const char *msg, int flags) {
|
||||
int *result = arg;
|
||||
UNUSED(flags);
|
||||
if (atoi(msg) == 250)
|
||||
*result = 1;
|
||||
}
|
||||
|
||||
static int
|
||||
try_exec(int local_quiet) {
|
||||
int good = 0;
|
||||
pid_t pid;
|
||||
|
||||
channel_loop("exec", 1, exec_closure, &good);
|
||||
|
||||
if (good) {
|
||||
sleep(3);
|
||||
if (!running(0, &pid))
|
||||
error("name server has not restarted (yet?)");
|
||||
else if (!local_quiet)
|
||||
result("new pid is %ld", (long)pid);
|
||||
}
|
||||
return (good);
|
||||
}
|
||||
|
||||
static int
|
||||
builtincmd(void) {
|
||||
static const char spaces[] = " \t";
|
||||
@@ -257,14 +430,18 @@ builtincmd(void) {
|
||||
pid_t pid;
|
||||
int save_quiet = quiet;
|
||||
int len;
|
||||
int freerest = 0;
|
||||
|
||||
quiet = 1;
|
||||
|
||||
len = strcspn(cmd, spaces);
|
||||
rest = cmd + len;
|
||||
if (*rest != '\0') {
|
||||
rest++;
|
||||
if (*rest != '\0')
|
||||
rest += strspn(rest, spaces);
|
||||
if (*rest == '\0' && !strncasecmp(cmd, "restart", len)) {
|
||||
if (try_exec(save_quiet))
|
||||
return (1);
|
||||
freerest = get_args(&rest);
|
||||
}
|
||||
syscmd = malloc(strlen(named_path) + sizeof " " + strlen(rest));
|
||||
if (syscmd == NULL)
|
||||
@@ -274,6 +451,8 @@ builtincmd(void) {
|
||||
strcat(syscmd, " ");
|
||||
strcat(syscmd, rest);
|
||||
}
|
||||
if (freerest)
|
||||
free(rest);
|
||||
if (strncasecmp(cmd, "start", len) == 0) {
|
||||
if (running(debug, &pid))
|
||||
error("name server already running? (pid %ld)",
|
||||
@@ -417,6 +596,7 @@ channel_loop(const char *cmdtext, int show, closure cl, void *ua) {
|
||||
a.cl = cl;
|
||||
a.ua = ua;
|
||||
logger_show = show;
|
||||
trace("command '%s'", cmdtext);
|
||||
ctl = ctl_client(ev, client_addr, impute_addrlen(client_addr),
|
||||
(struct sockaddr *)&server,
|
||||
impute_addrlen((struct sockaddr *)&server),
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
## SOFTWARE.
|
||||
|
||||
# $Id: Makefile,v 8.27 2001/01/31 08:44:43 marka Exp $
|
||||
# $Id: Makefile,v 8.28 2002/05/21 00:44:59 marka Exp $
|
||||
|
||||
DESTDIR=
|
||||
CC= cc
|
||||
@@ -31,7 +31,8 @@ A=a
|
||||
O=o
|
||||
EXE=
|
||||
LEX = lex -I
|
||||
SYSLIBS = -ll -lutil
|
||||
SYSLIBS =-lutil
|
||||
LIBL=-ll
|
||||
DESTBIN = /usr/local/bin
|
||||
DESTSBIN = /usr/local/sbin
|
||||
DESTEXEC = /usr/local/libexec
|
||||
@@ -56,7 +57,7 @@ all: ${PROG}${EXE}
|
||||
|
||||
${PROG}${EXE}: ${OBJS} ${LIBBIND} Makefile
|
||||
${CC} ${CDEBUG} ${LDFLAGS} ${BOUNDS} -o ${PROG}${EXE} ${OBJS} \
|
||||
${LIBBIND} ${SYSLIBS}
|
||||
${LIBBIND} ${LIBL} ${SYSLIBS}
|
||||
|
||||
.c.${O}:
|
||||
${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} -c $*.c
|
||||
|
||||
@@ -171,11 +171,11 @@ NAME [:A-Za-z0-9.*=_/-]
|
||||
* 1 == use original server to find
|
||||
* the new one.
|
||||
*/
|
||||
SetDefaultServer(yytext, 0);
|
||||
SetDefaultServer((char*)yytext, 0);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*lserver{WS}+{LET}{NAME}*{WS}*$ {
|
||||
SetDefaultServer(yytext, 1);
|
||||
SetDefaultServer((char*)yytext, 1);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*exit{WS}*$ {
|
||||
@@ -191,11 +191,11 @@ NAME [:A-Za-z0-9.*=_/-]
|
||||
* 0 == output to stdout
|
||||
* 1 == output to file
|
||||
*/
|
||||
Finger(yytext, 1);
|
||||
Finger((char*)yytext, 1);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*finger({WS}+{LET}{NAME}*)?{WS}*$ {
|
||||
Finger(yytext, 0);
|
||||
Finger((char*)yytext, 0);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*ls{WS}+(("-a"|"-d"|"-h"|"-m"|"-s"){WS}+)?{LET}{NAME}*{WS}+>>?{WS}+{NAME}+{WS}*$ {
|
||||
@@ -204,11 +204,11 @@ NAME [:A-Za-z0-9.*=_/-]
|
||||
* 0 == output to stdout
|
||||
* 1 == output to file
|
||||
*/
|
||||
ListHosts(yytext, 1);
|
||||
ListHosts((char*)yytext, 1);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*ls{WS}+(("-a"|"-d"|"-h"|"-m"|"-s"){WS}+)?{LET}{NAME}*{WS}*$ {
|
||||
ListHosts(yytext, 0);
|
||||
ListHosts((char*)yytext, 0);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*ls{WS}+-t{WS}+({LET}{NAME}*{WS}+)?{LET}{NAME}*{WS}+>>?{WS}+{NAME}+{WS}*$ {
|
||||
@@ -217,15 +217,15 @@ NAME [:A-Za-z0-9.*=_/-]
|
||||
* 0 == output to stdout
|
||||
* 1 == output to file
|
||||
*/
|
||||
ListHostsByType(yytext, 1);
|
||||
ListHostsByType((char*)yytext, 1);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*ls{WS}+-t{WS}+({LET}{NAME}*{WS}+)?{LET}{NAME}*{WS}*$ {
|
||||
ListHostsByType(yytext, 0);
|
||||
ListHostsByType((char*)yytext, 0);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*set{WS}+{NAME}+{WS}*$ {
|
||||
SetOption(yytext);
|
||||
SetOption((char*)yytext);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*help{WS}*$ {
|
||||
@@ -243,11 +243,11 @@ NAME [:A-Za-z0-9.*=_/-]
|
||||
* 0 == output to stdout
|
||||
* 1 == output to file
|
||||
*/
|
||||
LookupHost(yytext, 1);
|
||||
LookupHost((char*)yytext, 1);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*{FLET}{NAME}*{WS}*$ {
|
||||
LookupHost(yytext, 0);
|
||||
LookupHost((char*)yytext, 0);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*{FLET}{NAME}*{WS}+{LET}{NAME}*{WS}+>>?{WS}*{NAME}+{WS}*$ {
|
||||
@@ -255,11 +255,11 @@ NAME [:A-Za-z0-9.*=_/-]
|
||||
* 0 == output to stdout
|
||||
* 1 == output to file
|
||||
*/
|
||||
LookupHostWithServer(yytext, 1);
|
||||
LookupHostWithServer((char*)yytext, 1);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*{FLET}{NAME}*{WS}+{LET}{NAME}*{WS}*$ {
|
||||
LookupHostWithServer(yytext, 0);
|
||||
LookupHostWithServer((char*)yytext, 0);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*\n {
|
||||
@@ -267,7 +267,7 @@ NAME [:A-Za-z0-9.*=_/-]
|
||||
}
|
||||
^.*\n {
|
||||
printf("Unrecognized command: %s",
|
||||
yytext);
|
||||
(char*)yytext);
|
||||
return(1);
|
||||
}
|
||||
\n { ; }
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91";
|
||||
static const char rcsid[] = "$Id: getinfo.c,v 8.23 2002/04/29 01:11:52 marka Exp $";
|
||||
static const char rcsid[] = "$Id: getinfo.c,v 8.27 2002/05/22 04:06:57 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -142,16 +142,9 @@ typedef union {
|
||||
*/
|
||||
|
||||
static int
|
||||
GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer,
|
||||
merge)
|
||||
union res_sockaddr_union *nsAddrPtr;
|
||||
char *msg;
|
||||
int queryType;
|
||||
int msglen;
|
||||
Boolean iquery;
|
||||
register HostInfo *hostPtr;
|
||||
Boolean isServer;
|
||||
Boolean merge;
|
||||
GetAnswer(union res_sockaddr_union *nsAddrPtr, int queryType,
|
||||
char *msg, int msglen, Boolean iquery, HostInfo *hostPtr,
|
||||
Boolean isServer, Boolean merge)
|
||||
{
|
||||
register HEADER *headerPtr;
|
||||
register const u_char *cp;
|
||||
@@ -253,7 +246,8 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer,
|
||||
printf("Non-authoritative answer:\n");
|
||||
}
|
||||
|
||||
if (queryType != T_A && !(iquery && queryType == T_PTR)) {
|
||||
if (queryType != T_A && queryType != T_AAAA && /* A6? */
|
||||
!(iquery && queryType == T_PTR)) {
|
||||
while (--ancount >= 0 && cp < eom) {
|
||||
if ((cp = Print_rr(cp, (u_char *)&answer,
|
||||
eom, stdout)) == NULL) {
|
||||
@@ -334,7 +328,7 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer,
|
||||
memcpy(hostPtr->name, bp, s);
|
||||
}
|
||||
}
|
||||
bp += (((u_int32_t)bp) % sizeof(align));
|
||||
bp += (((u_long)bp) % sizeof(align));
|
||||
|
||||
if (bp + dlen >= &hostbuf[sizeof(hostbuf)]) {
|
||||
if (res.options & RES_DEBUG) {
|
||||
@@ -360,7 +354,8 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer,
|
||||
}
|
||||
}
|
||||
|
||||
if ((queryType == T_A || queryType == T_PTR) && haveAnswer) {
|
||||
if ((queryType == T_A || queryType == T_AAAA || queryType == T_PTR) &&
|
||||
haveAnswer) {
|
||||
|
||||
/*
|
||||
* Go through the alias and address lists and return them
|
||||
@@ -540,7 +535,7 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer,
|
||||
*/
|
||||
cp = res_skip((u_char*)&answer, 3, eom);
|
||||
|
||||
if (queryType != T_A) {
|
||||
if (queryType != T_A && queryType != T_AAAA) {
|
||||
/*
|
||||
* If we don't need to save the record, just print it.
|
||||
*/
|
||||
|
||||
@@ -78,7 +78,7 @@ char copyright[] =
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91";
|
||||
static const char rcsid[] = "$Id: main.c,v 8.22 2002/04/12 03:03:49 marka Exp $";
|
||||
static const char rcsid[] = "$Id: main.c,v 8.24 2002/05/26 03:12:20 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -341,10 +341,21 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
result = GetHostInfoByAddr(&u[i], &u[i], defaultPtr);
|
||||
if (result != SUCCESS) {
|
||||
char t[80];
|
||||
switch (u[i].sin.sin_family) {
|
||||
case AF_INET:
|
||||
inet_ntop(AF_INET, &u[i].sin.sin_addr, t, sizeof(t));
|
||||
break;
|
||||
case AF_INET6:
|
||||
inet_ntop(AF_INET6, &u[i].sin6.sin6_addr, t, sizeof(t));
|
||||
break;
|
||||
default:
|
||||
strcpy(t, "<UNKNOWN>");
|
||||
break;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"*** Can't find server name for address %s: %s\n",
|
||||
inet_ntoa(res.nsaddr_list[i].sin_addr),
|
||||
DecodeError(result));
|
||||
"*** Can't find server name for address %s: %s\n",
|
||||
t, DecodeError(result));
|
||||
} else {
|
||||
defaultAddr = u[i];
|
||||
break;
|
||||
@@ -693,7 +704,7 @@ DoLookup(host, servPtr, serverName)
|
||||
* RFC1123 says we "SHOULD check the string syntactically for a
|
||||
* dotted-decimal number before looking it up [...]" (p. 13).
|
||||
*/
|
||||
if (queryType == T_A && IsAddr(host, &addr)) {
|
||||
if ((queryType == T_A || queryType == T_AAAA) && IsAddr(host, &addr)) {
|
||||
result = GetHostInfoByAddr(&servAddr, &addr, &curHostInfo);
|
||||
} else {
|
||||
if (queryType == T_PTR) {
|
||||
@@ -711,7 +722,7 @@ DoLookup(host, servPtr, serverName)
|
||||
* There's no need to print anything for other query types
|
||||
* because the info has already been printed.
|
||||
*/
|
||||
if (queryType == T_A) {
|
||||
if (queryType == T_A || queryType == T_AAAA) {
|
||||
curHostValid = TRUE;
|
||||
PrintHostInfo(filePtr, "Name:", &curHostInfo);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)send.c 5.18 (Berkeley) 3/2/91";
|
||||
static const char rcsid[] = "$Id: send.c,v 8.13 2002/04/09 05:55:23 marka Exp $";
|
||||
static const char rcsid[] = "$Id: send.c,v 8.14 2002/05/10 04:35:09 marka Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -291,7 +291,7 @@ SendRequest(union res_sockaddr_union *nsAddrPtr, const u_char *buf,
|
||||
}
|
||||
#else /* BSD */
|
||||
if (sendto(s, (const char *)buf, buflen, 0,
|
||||
(struct sockaddr *) &nsAddrPtr,
|
||||
(struct sockaddr *) nsAddrPtr,
|
||||
clen) != buflen) {
|
||||
if (res.options & RES_DEBUG)
|
||||
perror("sendto");
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
<PRE>
|
||||
server <VAR><A HREF="docdef.html">ip_addr</A></VAR> {
|
||||
[ edns <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
|
||||
[ bogus <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
|
||||
[ support-ixfr <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
|
||||
[ transfers <VAR><A HREF="docdef.html">number</A></VAR>; ]
|
||||
@@ -28,6 +29,10 @@ server <VAR><A HREF="docdef.html">ip_addr</A></VAR> {
|
||||
<P>The server statement defines the characteristics to be
|
||||
associated with a remote name server.</P>
|
||||
|
||||
<P>If you discover that a server does not support EDNS you can prevent
|
||||
named making EDNS queries to it by specifying <CODE>edns no;</CODE>.
|
||||
The default value of <CODE>edns</CODE> is <CODE>yes</CODE>.
|
||||
|
||||
<P>If you discover that a server is giving out bad data, marking it as
|
||||
<CODE>bogus</CODE> will prevent further queries to it. The default value of
|
||||
<CODE>bogus</CODE> is <CODE>no</CODE>. Marking a server as <CODE>bogus</CODE>
|
||||
@@ -69,7 +74,7 @@ required to be signed by this key.
|
||||
|
||||
<HR>
|
||||
<ADDRESS>
|
||||
Last Updated: $Id: server.html,v 1.12 2001/08/10 05:12:29 marka Exp $
|
||||
Last Updated: $Id: server.html,v 1.13 2002/05/24 03:04:51 marka Exp $
|
||||
</ADDRESS>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,5 +1,5 @@
|
||||
.\" $FreeBSD$
|
||||
.\" $Id: dig.1,v 8.8 2001/09/24 15:21:29 marka Exp $
|
||||
.\" $Id: dig.1,v 8.9 2002/06/18 01:53:43 marka Exp $
|
||||
.\"
|
||||
.\" ++Copyright++ 1993
|
||||
.\" -
|
||||
@@ -96,7 +96,7 @@ will take the form:
|
||||
where:
|
||||
.Bl -tag -width Fl
|
||||
.It Ar server
|
||||
may be either a domain name or a dot-notation
|
||||
may be either a domain name or a raw (IPv4 / IPv6)
|
||||
Internet address. If this optional field is omitted,
|
||||
.Ic dig
|
||||
will attempt to use the default name server for your machine.
|
||||
@@ -145,7 +145,7 @@ See the
|
||||
.Fl x
|
||||
option (documented in the
|
||||
.Sx OTHER OPTIONS
|
||||
subsection of this section) for convenient way to specify inverse address
|
||||
subsection of this section) for convenient way to specify reverse address
|
||||
query.
|
||||
.It Ar query-type
|
||||
is the type of information (DNS query type) that
|
||||
@@ -240,9 +240,15 @@ available (although not guaranteed to be useful):
|
||||
.It Fl x Ar dot-notation-address
|
||||
Convenient form to specify inverse address mapping.
|
||||
Instead of
|
||||
.Dq Ic dig 32.0.9.128.in-addr.arpa ,
|
||||
.Dq Ic dig 32.0.9.28.in-addr.arpa ,
|
||||
one can simply
|
||||
.Dq Ic dig -x 128.9.0.32 .
|
||||
.Dq Ic dig -x 28.9.0.32 .
|
||||
.It Fl x Ar IPv6-address
|
||||
Convenient form to specify inverse address mapping.
|
||||
Instead of
|
||||
.Dq Ic dig 1.0.0.0.0.0.0.0.0.0.0.0. 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa ,
|
||||
one can simply
|
||||
.Dq Ic dig -x ::1 .
|
||||
.It Fl f Ar file
|
||||
File for
|
||||
.Ic dig
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $Id: dnsquery.1,v 8.4 2001/08/08 07:49:58 marka Exp $
|
||||
.\" $Id: dnsquery.1,v 8.5 2002/06/18 02:04:54 marka Exp $
|
||||
.\"
|
||||
.\"Copyright (c) 1995,1996,1999 by Internet Software Consortium
|
||||
.\"
|
||||
@@ -49,8 +49,10 @@ are treated without case-sensitivity.
|
||||
.Bl -tag -width Fl
|
||||
.It Fl n Ar nameserver
|
||||
The nameserver to be used in the query. Nameservers can appear as either
|
||||
Internet addresses of the form
|
||||
.Ar w.x.y.z
|
||||
Internet addresses of the form
|
||||
.Ar ( w.x.y.z
|
||||
or
|
||||
.Ar xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx )
|
||||
or can appear as domain names.
|
||||
(Default: as specified in
|
||||
.Pa /etc/resolv.conf . )
|
||||
|
||||
+27
-39
@@ -1,3 +1,4 @@
|
||||
.\" $FreeBSD$
|
||||
.\" ++Copyright++ 1993
|
||||
.\" -
|
||||
.\" Copyright (c) 1993
|
||||
@@ -50,9 +51,7 @@
|
||||
.\" SOFTWARE.
|
||||
.\" -
|
||||
.\" --Copyright--
|
||||
.\" $Id: host.1,v 8.6 2001/08/10 00:14:47 cyarnell Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.\" $Id: host.1,v 8.7 2002/06/18 02:39:26 marka Exp $
|
||||
.Dd December 15, 1994
|
||||
.Dt HOST @CMD_EXT_U@
|
||||
.Os BSD 4
|
||||
@@ -61,9 +60,13 @@
|
||||
.Nd look up host names using domain server
|
||||
.Sh SYNOPSIS
|
||||
.Nm host
|
||||
.Op Fl adlrwv
|
||||
.Op Fl c Ar class
|
||||
.Op Fl l
|
||||
.Op Fl v
|
||||
.Op Fl w
|
||||
.Op Fl r
|
||||
.Op Fl d
|
||||
.Op Fl t Ar querytype
|
||||
.Op Fl a
|
||||
.Ar host
|
||||
.Op Ar server
|
||||
.Sh DESCRIPTION
|
||||
@@ -82,7 +85,7 @@ by the domain server.
|
||||
The arguments can be either host names or host numbers. The program
|
||||
first attempts to interpret them as host numbers. If this fails,
|
||||
it will treat them as host names. A host number consists of
|
||||
four decimal numbers separated by dots, e.g. 128.6.4.194
|
||||
IPv4 dotted decimal quad (127.0.0.1) or IPv6 raw address (::1).
|
||||
A host name consists of names separated by dots, e.g. topaz.rutgers.edu.
|
||||
Unless the name ends in a dot, the local domain
|
||||
is automatically tacked on the end. Thus, a Rutgers user can say
|
||||
@@ -156,39 +159,23 @@ There are a number of options that can be used before the
|
||||
host name. Most of these options are meaningful only to the
|
||||
staff who have to maintain the domain database.
|
||||
.Bl -tag -width Fl
|
||||
.It Fl a
|
||||
.Dq all ;
|
||||
this is equivalent to
|
||||
.Dq Fl v Fl t Cm any .
|
||||
.It Fl c Ar class
|
||||
The
|
||||
.Ar class
|
||||
to look for non-Internet data.
|
||||
.It Fl d
|
||||
Turn on debugging. Network transactions are shown in detail.
|
||||
.It Fl l
|
||||
List a complete domain; e.g.:
|
||||
.Pp
|
||||
.D1 Ic host -l rutgers.edu
|
||||
.Pp
|
||||
will give a listing of all hosts in the rutgers.edu domain. The
|
||||
.Dq Fl t
|
||||
option is used to filter what information is presented, as you
|
||||
would expect. The default is address information, which also
|
||||
include PTR and NS records. The command
|
||||
.Pp
|
||||
.D1 Ic host -l -v -t any rutgers.edu
|
||||
.Pp
|
||||
will give a complete download of the zone data for rutgers.edu,
|
||||
in the official master file format. (However the SOA record is
|
||||
listed twice, for arcane reasons.)
|
||||
.Pp
|
||||
.Sy NOTE:
|
||||
.Dq Fl l
|
||||
is implemented by
|
||||
doing a complete zone transfer and then filtering out the information
|
||||
that you have asked for. This command should be used only if it
|
||||
is absolutely necessary.
|
||||
.It Fl w
|
||||
This causes
|
||||
.Ic host
|
||||
to wait forever for a response. Normally
|
||||
it will time out after approximate one minute.
|
||||
.It Fl v
|
||||
Use "verbose" format for printout. This
|
||||
is the official domain master file format, which is documented
|
||||
in the man page for
|
||||
.Xr @INDOT@named @SYS_OPS_EXT@ .
|
||||
Without this option, output still follows
|
||||
this format in general terms, but some attempt is made to make it
|
||||
more intelligible to normal users. Without
|
||||
.Dq Fl v ,
|
||||
any "a", "mx", and "cname" records
|
||||
are written out as "has address", "mail is handled by", and
|
||||
"is a nickname for" (respectively), and TTL and class fields are not shown.
|
||||
.It Fl r
|
||||
Turn off recursion in the request.
|
||||
This means that the name server will return only data it has in
|
||||
@@ -206,6 +193,7 @@ to be looked up. The arguments are defined in the man page for
|
||||
.Xr @INDOT@named @SYS_OPS_EXT@ .
|
||||
Currently-supported types include:
|
||||
.Dq Cm a ,
|
||||
.Dq Cm aaaa ,
|
||||
.Dq Cm ns ,
|
||||
.Dq Cm md ,
|
||||
.Dq Cm mf ,
|
||||
|
||||
@@ -1895,6 +1895,7 @@ Any number of trusted keys can be specified.
|
||||
.Ss Syntax
|
||||
.Bd -literal
|
||||
server \fIip_addr\fR {
|
||||
[ edns \fIyes_or_no\fR; ]
|
||||
[ bogus \fIyes_or_no\fR; ]
|
||||
[ support-ixfr \fIyes_or_no\fR; ]
|
||||
[ transfers \fInumber\fR; ]
|
||||
@@ -1906,6 +1907,15 @@ server \fIip_addr\fR {
|
||||
The server statement defines the characteristics to be
|
||||
associated with a remote name server.
|
||||
.Pp
|
||||
If you discover that a server does not support EDNS you can prevent
|
||||
named making EDNS queries to it by specifying
|
||||
.Ic edns
|
||||
.Ic no; .
|
||||
The default value of
|
||||
.Ic edns
|
||||
is
|
||||
.Ic yes .
|
||||
.Pp
|
||||
If you discover that a server is giving out bad data, marking it as
|
||||
.Ic bogus
|
||||
will prevent further queries to it. The default value of
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
.\" $FreeBSD$
|
||||
.\" $Id: nsupdate.8,v 8.8 2002/04/22 04:38:04 marka Exp $
|
||||
.\"
|
||||
.\"Copyright (c) 1999 by Internet Software Consortium
|
||||
@@ -188,7 +187,6 @@ and examine the status field in the nameserver's reply.
|
||||
.Sh FILES
|
||||
.Bl -hang
|
||||
.It Pa /etc/resolv.conf
|
||||
.El
|
||||
initial domain name and name server addresses
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
.\"
|
||||
.\" @(#)resolver.3 6.5 (Berkeley) 6/23/90
|
||||
.\" $Id: resolver.3,v 8.16 2001/12/28 04:24:20 marka Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 4, 2000
|
||||
.Dt RESOLVER @LIB_NETWORK_EXT_U@
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
/*
|
||||
* from nameser.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: nameser_compat.h,v 8.13 2001/09/24 02:20:25 marka Exp $
|
||||
* $Id: nameser_compat.h,v 8.14 2002/05/18 01:39:11 marka Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_NAMESER_COMPAT_
|
||||
@@ -64,7 +64,7 @@
|
||||
defined(apollo) || defined(__convex__) || defined(_CRAY) || \
|
||||
defined(__hppa) || defined(__hp9000) || \
|
||||
defined(__hp9000s300) || defined(__hp9000s700) || \
|
||||
defined(__hp3000s900) || defined(MPE) || \
|
||||
defined(__hp3000s900) || defined(__hpux) || defined(MPE) || \
|
||||
defined (BIT_ZERO_ON_LEFT) || defined(m68k) || \
|
||||
(defined(__Lynx__) && \
|
||||
(defined(__68k__) || defined(__sparc__) || defined(__powerpc__)))
|
||||
|
||||
@@ -24,11 +24,13 @@
|
||||
do { (list).head = NULL; (list).tail = NULL; } while (0)
|
||||
|
||||
#define LINK(type) struct { type *prev, *next; }
|
||||
#define INIT_LINK(elt, link) \
|
||||
#define INIT_LINK_TYPE(elt, link, type) \
|
||||
do { \
|
||||
(elt)->link.prev = (void *)(-1); \
|
||||
(elt)->link.next = (void *)(-1); \
|
||||
(elt)->link.prev = (type *)(-1); \
|
||||
(elt)->link.next = (type *)(-1); \
|
||||
} while (0)
|
||||
#define INIT_LINK(elt, link) \
|
||||
INIT_LINK_TYPE(elt, link, void)
|
||||
#define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1))
|
||||
|
||||
#define HEAD(list) ((list).head)
|
||||
@@ -59,7 +61,7 @@
|
||||
(list).tail = (elt); \
|
||||
} while (0)
|
||||
|
||||
#define UNLINK(list, elt, link) \
|
||||
#define UNLINK_TYPE(list, elt, link, type) \
|
||||
do { \
|
||||
INSIST(LINKED(elt, link));\
|
||||
if ((elt)->link.next != NULL) \
|
||||
@@ -70,8 +72,10 @@
|
||||
(elt)->link.prev->link.next = (elt)->link.next; \
|
||||
else \
|
||||
(list).head = (elt)->link.next; \
|
||||
INIT_LINK(elt, link); \
|
||||
INIT_LINK_TYPE(elt, link, type); \
|
||||
} while (0)
|
||||
#define UNLINK(list, elt, link) \
|
||||
UNLINK_TYPE(list, elt, link, void)
|
||||
|
||||
#define PREV(elt, link) ((elt)->link.prev)
|
||||
#define NEXT(elt, link) ((elt)->link.next)
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
/*
|
||||
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: resolv.h,v 8.45 2002/04/12 06:27:48 marka Exp $
|
||||
* $Id: resolv.h,v 8.48 2002/05/31 06:05:29 marka Exp $
|
||||
*/
|
||||
|
||||
#ifndef _RESOLV_H_
|
||||
@@ -156,7 +156,11 @@ struct __res_state_ext;
|
||||
struct __res_state {
|
||||
int retrans; /* retransmition time interval */
|
||||
int retry; /* number of times to retransmit */
|
||||
#ifdef sun
|
||||
u_int options; /* option flags - see below. */
|
||||
#else
|
||||
u_long options; /* option flags - see below. */
|
||||
#endif
|
||||
int nscount; /* number of name servers */
|
||||
struct sockaddr_in
|
||||
nsaddr_list[MAXNS]; /* address of name server */
|
||||
@@ -164,7 +168,11 @@ struct __res_state {
|
||||
u_short id; /* current message id */
|
||||
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
|
||||
char defdname[256]; /* default domain (deprecated) */
|
||||
#ifdef sun
|
||||
u_int pfcode; /* RES_PRF_ flags - see below. */
|
||||
#else
|
||||
u_long pfcode; /* RES_PRF_ flags - see below. */
|
||||
#endif
|
||||
unsigned ndots:4; /* threshold for initial abs. query */
|
||||
unsigned nsort:4; /* number of elements in sort_list[] */
|
||||
char unused[3];
|
||||
@@ -177,9 +185,10 @@ struct __res_state {
|
||||
int res_h_errno; /* last one set for this context */
|
||||
int _vcsock; /* PRIVATE: for res_send VC i/o */
|
||||
u_int _flags; /* PRIVATE: see below */
|
||||
u_int _pad; /* make _u 64 bit aligned */
|
||||
union {
|
||||
/* On an 32-bit arch this means 512b total. */
|
||||
char pad[72 - 3*sizeof (int) - 2*sizeof (void *)];
|
||||
char pad[72 - 4*sizeof (int) - 2*sizeof (void *)];
|
||||
struct {
|
||||
u_int16_t nscount;
|
||||
u_int16_t nstimes[MAXNS]; /* ms. */
|
||||
@@ -245,6 +254,7 @@ union res_sockaddr_union {
|
||||
#define RES_USE_DNAME 0x10000000 /* use DNAME */
|
||||
#define RES_USE_A6 0x20000000 /* use A6 */
|
||||
#define RES_USE_EDNS0 0x40000000 /* use EDNS0 if configured */
|
||||
#define RES_NO_NIBBLE2 0x80000000 /* disable alternate nibble lookup */
|
||||
|
||||
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
|
||||
|
||||
@@ -460,6 +470,7 @@ const char * res_protocolname __P((int num));
|
||||
void res_destroyprotolist __P((void));
|
||||
void res_buildprotolist __P((void));
|
||||
const char * res_get_nibblesuffix __P((res_state));
|
||||
const char * res_get_nibblesuffix2 __P((res_state));
|
||||
const char * res_get_bitstringsuffix __P((res_state));
|
||||
void res_ndestroy __P((res_state));
|
||||
u_int16_t res_nametoclass __P((const char *buf, int *success));
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
/* BIND Id: gethnamaddr.c,v 8.15 1996/05/22 04:56:30 vixie Exp $ */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: dns_ho.c,v 1.35 2002/05/08 01:49:27 marka Exp $";
|
||||
static const char rcsid[] = "$Id: dns_ho.c,v 1.39 2002/06/27 03:56:32 marka Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* Imports. */
|
||||
@@ -74,6 +74,7 @@ static const char rcsid[] = "$Id: dns_ho.c,v 1.35 2002/05/08 01:49:27 marka Exp
|
||||
#include <resolv.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <isc/memcluster.h>
|
||||
#include <irs.h>
|
||||
@@ -161,7 +162,7 @@ static struct addrinfo * ho_addrinfo(struct irs_ho *this, const char *name,
|
||||
const struct addrinfo *pai);
|
||||
|
||||
static void map_v4v6_hostent(struct hostent *hp, char **bp,
|
||||
int *len);
|
||||
char *ep);
|
||||
static void addrsort(res_state, char **, int);
|
||||
static struct hostent * gethostans(struct irs_ho *this,
|
||||
const u_char *ansbuf, int anslen,
|
||||
@@ -404,15 +405,12 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
|
||||
q->answer = q->qbuf.buf;
|
||||
q->anslen = sizeof(q->qbuf);
|
||||
q->next = q2;
|
||||
if ((pvt->res->options & RES_NO_BITSTRING) != 0)
|
||||
q->action = RESTGT_IGNORE;
|
||||
else
|
||||
q->action = RESTGT_DOALWAYS;
|
||||
q->action = RESTGT_DOALWAYS;
|
||||
q2->qclass = C_IN;
|
||||
q2->qtype = T_PTR;
|
||||
q2->answer = q2->qbuf.buf;
|
||||
q2->anslen = sizeof(q2->qbuf);
|
||||
if ((pvt->res->options & RES_NO_NIBBLE) != 0)
|
||||
if ((pvt->res->options & RES_NO_NIBBLE2) != 0)
|
||||
q2->action = RESTGT_IGNORE;
|
||||
else
|
||||
q2->action = RESTGT_AFTERFAILURE;
|
||||
@@ -441,11 +439,12 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
|
||||
case AF_INET6:
|
||||
if (q->action != RESTGT_IGNORE) {
|
||||
qp = q->qname;
|
||||
qp += SPRINTF((qp, "\\[x"));
|
||||
for (n = 0; n < IN6ADDRSZ; n++)
|
||||
qp += SPRINTF((qp, "%02x", uaddr[n]));
|
||||
SPRINTF((qp, "/128].%s",
|
||||
res_get_bitstringsuffix(pvt->res)));
|
||||
for (n = IN6ADDRSZ - 1; n >= 0; n--) {
|
||||
qp += SPRINTF((qp, "%x.%x.",
|
||||
uaddr[n] & 0xf,
|
||||
(uaddr[n] >> 4) & 0xf));
|
||||
}
|
||||
strcpy(qp, res_get_nibblesuffix(pvt->res));
|
||||
}
|
||||
if (q2->action != RESTGT_IGNORE) {
|
||||
qp = q2->qname;
|
||||
@@ -454,7 +453,7 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
|
||||
uaddr[n] & 0xf,
|
||||
(uaddr[n] >> 4) & 0xf));
|
||||
}
|
||||
strcpy(qp, res_get_nibblesuffix(pvt->res));
|
||||
strcpy(qp, res_get_nibblesuffix2(pvt->res));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1081,7 +1080,7 @@ gethostans(struct irs_ho *this,
|
||||
struct addrinfo **ret_aip, const struct addrinfo *pai)
|
||||
{
|
||||
struct pvt *pvt = (struct pvt *)this->private;
|
||||
int type, class, buflen, ancount, qdcount, n, haveanswer, had_error;
|
||||
int type, class, ancount, qdcount, n, haveanswer, had_error;
|
||||
int error = NETDB_SUCCESS, arcount;
|
||||
int (*name_ok)(const char *);
|
||||
const HEADER *hp;
|
||||
@@ -1090,7 +1089,7 @@ gethostans(struct irs_ho *this,
|
||||
const u_char *cp;
|
||||
const char *tname;
|
||||
const char *hname;
|
||||
char *bp, **ap, **hap;
|
||||
char *bp, *ep, **ap, **hap;
|
||||
char tbuf[MAXDNAME+1];
|
||||
struct addrinfo sentinel, *cur, ai;
|
||||
const u_char *arp = NULL;
|
||||
@@ -1133,13 +1132,13 @@ gethostans(struct irs_ho *this,
|
||||
qdcount = ntohs(hp->qdcount);
|
||||
arcount = ntohs(hp->arcount);
|
||||
bp = pvt->hostbuf;
|
||||
buflen = sizeof pvt->hostbuf;
|
||||
ep = pvt->hostbuf + sizeof(pvt->hostbuf);
|
||||
cp = ansbuf + HFIXEDSZ;
|
||||
if (qdcount != 1) {
|
||||
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
|
||||
return (NULL);
|
||||
}
|
||||
n = dn_expand(ansbuf, eom, cp, bp, buflen);
|
||||
n = dn_expand(ansbuf, eom, cp, bp, ep - bp);
|
||||
if (n < 0 || !maybe_ok(pvt->res, bp, name_ok)) {
|
||||
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
|
||||
return (NULL);
|
||||
@@ -1163,7 +1162,6 @@ gethostans(struct irs_ho *this,
|
||||
pvt->host.h_name = bp;
|
||||
hname = bp;
|
||||
bp += n;
|
||||
buflen -= n;
|
||||
/* The qname can be abbreviated, but hname is now absolute. */
|
||||
qname = pvt->host.h_name;
|
||||
}
|
||||
@@ -1176,7 +1174,7 @@ gethostans(struct irs_ho *this,
|
||||
haveanswer = 0;
|
||||
had_error = 0;
|
||||
while (ancount-- > 0 && cp < eom && !had_error) {
|
||||
n = dn_expand(ansbuf, eom, cp, bp, buflen);
|
||||
n = dn_expand(ansbuf, eom, cp, bp, ep - bp);
|
||||
if (n < 0 || !maybe_ok(pvt->res, bp, name_ok)) {
|
||||
had_error++;
|
||||
continue;
|
||||
@@ -1197,6 +1195,15 @@ gethostans(struct irs_ho *this,
|
||||
eor = cp + n;
|
||||
if ((qtype == T_A || qtype == T_AAAA || qtype == ns_t_a6 ||
|
||||
qtype == T_ANY) && type == T_CNAME) {
|
||||
if (haveanswer) {
|
||||
int level = LOG_CRIT;
|
||||
#ifdef LOG_SECURITY
|
||||
level |= LOG_SECURITY;
|
||||
#endif
|
||||
syslog(level,
|
||||
"gethostans: possible attempt to exploit buffer overflow while looking up %s",
|
||||
*qname ? qname : ".");
|
||||
}
|
||||
n = dn_expand(ansbuf, eor, cp, tbuf, sizeof tbuf);
|
||||
if (n < 0 || !maybe_ok(pvt->res, tbuf, name_ok)) {
|
||||
had_error++;
|
||||
@@ -1209,10 +1216,9 @@ gethostans(struct irs_ho *this,
|
||||
*ap++ = bp;
|
||||
n = strlen(bp) + 1; /* for the \0 */
|
||||
bp += n;
|
||||
buflen -= n;
|
||||
/* Get canonical name. */
|
||||
n = strlen(tbuf) + 1; /* for the \0 */
|
||||
if (n > buflen || n > MAXHOSTNAMELEN) {
|
||||
if (n > (ep - bp) || n > MAXHOSTNAMELEN) {
|
||||
had_error++;
|
||||
continue;
|
||||
}
|
||||
@@ -1220,7 +1226,6 @@ gethostans(struct irs_ho *this,
|
||||
pvt->host.h_name = bp;
|
||||
hname = bp;
|
||||
bp += n;
|
||||
buflen -= n;
|
||||
continue;
|
||||
}
|
||||
if (type == ns_t_dname) {
|
||||
@@ -1256,7 +1261,7 @@ gethostans(struct irs_ho *this,
|
||||
cp += n;
|
||||
|
||||
n = strlen(t) + 1; /* for the \0 */
|
||||
if (n > buflen) {
|
||||
if (n > (ep - bp)) {
|
||||
had_error++;
|
||||
continue;
|
||||
}
|
||||
@@ -1266,7 +1271,6 @@ gethostans(struct irs_ho *this,
|
||||
else
|
||||
hname = bp;
|
||||
bp += n;
|
||||
buflen -= n;
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -1292,14 +1296,13 @@ gethostans(struct irs_ho *this,
|
||||
}
|
||||
/* Get canonical name. */
|
||||
n = strlen(tbuf) + 1; /* for the \0 */
|
||||
if (n > buflen) {
|
||||
if (n > (ep - bp)) {
|
||||
had_error++;
|
||||
continue;
|
||||
}
|
||||
strcpy(bp, tbuf);
|
||||
tname = bp;
|
||||
bp += n;
|
||||
buflen -= n;
|
||||
continue;
|
||||
}
|
||||
if (qtype == T_ANY) {
|
||||
@@ -1323,7 +1326,7 @@ gethostans(struct irs_ho *this,
|
||||
cp += n;
|
||||
continue;
|
||||
}
|
||||
n = dn_expand(ansbuf, eor, cp, bp, buflen);
|
||||
n = dn_expand(ansbuf, eor, cp, bp, ep - bp);
|
||||
if (n < 0 || !maybe_hnok(pvt->res, bp) ||
|
||||
n >= MAXHOSTNAMELEN) {
|
||||
had_error++;
|
||||
@@ -1341,7 +1344,6 @@ gethostans(struct irs_ho *this,
|
||||
if (n != -1) {
|
||||
n = strlen(bp) + 1; /* for the \0 */
|
||||
bp += n;
|
||||
buflen -= n;
|
||||
}
|
||||
break;
|
||||
case ns_t_a6: {
|
||||
@@ -1441,7 +1443,6 @@ gethostans(struct irs_ho *this,
|
||||
pvt->host.h_name = bp;
|
||||
hname = bp;
|
||||
bp += nn;
|
||||
buflen -= nn;
|
||||
}
|
||||
/* Ensure alignment. */
|
||||
bp = (char *)(((u_long)bp + (sizeof(align) - 1)) &
|
||||
@@ -1495,15 +1496,14 @@ gethostans(struct irs_ho *this,
|
||||
haveanswer);
|
||||
if (pvt->host.h_name == NULL) {
|
||||
n = strlen(qname) + 1; /* for the \0 */
|
||||
if (n > buflen || n >= MAXHOSTNAMELEN)
|
||||
if (n > (ep - bp) || n >= MAXHOSTNAMELEN)
|
||||
goto no_recovery;
|
||||
strcpy(bp, qname);
|
||||
pvt->host.h_name = bp;
|
||||
bp += n;
|
||||
buflen -= n;
|
||||
}
|
||||
if (pvt->res->options & RES_USE_INET6)
|
||||
map_v4v6_hostent(&pvt->host, &bp, &buflen);
|
||||
map_v4v6_hostent(&pvt->host, &bp, ep);
|
||||
RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);
|
||||
return (&pvt->host);
|
||||
} else {
|
||||
@@ -1577,7 +1577,7 @@ add_hostent(struct pvt *pvt, char *bp, char **hap, struct addrinfo *ai)
|
||||
}
|
||||
|
||||
static void
|
||||
map_v4v6_hostent(struct hostent *hp, char **bpp, int *lenp) {
|
||||
map_v4v6_hostent(struct hostent *hp, char **bpp, char *ep) {
|
||||
char **ap;
|
||||
|
||||
if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ)
|
||||
@@ -1590,17 +1590,15 @@ map_v4v6_hostent(struct hostent *hp, char **bpp, int *lenp) {
|
||||
if (i != 0)
|
||||
i = sizeof(align) - i;
|
||||
|
||||
if (*lenp < (i + IN6ADDRSZ)) {
|
||||
if ((ep - *bpp) < (i + IN6ADDRSZ)) {
|
||||
/* Out of memory. Truncate address list here. */
|
||||
*ap = NULL;
|
||||
return;
|
||||
}
|
||||
*bpp += i;
|
||||
*lenp -= i;
|
||||
map_v4v6_address(*ap, *bpp);
|
||||
*ap = *bpp;
|
||||
*bpp += IN6ADDRSZ;
|
||||
*lenp -= IN6ADDRSZ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: dns_nw.c,v 1.22 2002/02/27 03:50:10 marka Exp $";
|
||||
static const char rcsid[] = "$Id: dns_nw.c,v 1.23 2002/06/26 07:42:06 marka Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* Imports. */
|
||||
@@ -299,8 +299,8 @@ get1101answer(struct irs_nw *this,
|
||||
int af, const char *name, const u_char *addr, int addrlen)
|
||||
{
|
||||
struct pvt *pvt = (struct pvt *)this->private;
|
||||
int type, class, buflen, ancount, qdcount, haveanswer;
|
||||
char *bp, **ap;
|
||||
int type, class, ancount, qdcount, haveanswer;
|
||||
char *bp, *ep, **ap;
|
||||
u_char *cp, *eom;
|
||||
HEADER *hp;
|
||||
|
||||
@@ -332,7 +332,7 @@ get1101answer(struct irs_nw *this,
|
||||
|
||||
/* Prepare a return structure. */
|
||||
bp = pvt->buf;
|
||||
buflen = sizeof pvt->buf;
|
||||
ep = pvt->buf + sizeof(pvt->buf);
|
||||
pvt->net.n_name = NULL;
|
||||
pvt->net.n_aliases = pvt->ali;
|
||||
pvt->net.n_addrtype = af;
|
||||
@@ -345,20 +345,19 @@ get1101answer(struct irs_nw *this,
|
||||
if (name != NULL) {
|
||||
int n = strlen(name) + 1;
|
||||
|
||||
if (n > buflen) {
|
||||
if (n > (ep - bp)) {
|
||||
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
|
||||
return (NULL);
|
||||
}
|
||||
pvt->net.n_name = strcpy(bp, name);
|
||||
bp += n;
|
||||
buflen -= n;
|
||||
}
|
||||
break;
|
||||
case by_addr:
|
||||
if (addr != NULL && addrlen != 0) {
|
||||
int n = addrlen / 8 + ((addrlen % 8) != 0);
|
||||
|
||||
if (INADDRSZ > buflen) {
|
||||
if (INADDRSZ > (ep - bp)) {
|
||||
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
|
||||
return (NULL);
|
||||
}
|
||||
@@ -366,7 +365,6 @@ get1101answer(struct irs_nw *this,
|
||||
memcpy(bp, addr, n);
|
||||
pvt->net.n_addr = bp;
|
||||
bp += INADDRSZ;
|
||||
buflen -= INADDRSZ;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -377,7 +375,7 @@ get1101answer(struct irs_nw *this,
|
||||
ap = pvt->ali;
|
||||
haveanswer = 0;
|
||||
while (--ancount >= 0 && cp < eom) {
|
||||
int n = dn_expand(ansbuf, eom, cp, bp, buflen);
|
||||
int n = dn_expand(ansbuf, eom, cp, bp, ep - bp);
|
||||
|
||||
cp += n; /* Owner */
|
||||
if (n < 0 || !maybe_dnok(pvt->res, bp) ||
|
||||
@@ -392,7 +390,7 @@ get1101answer(struct irs_nw *this,
|
||||
if (class == C_IN && type == T_PTR) {
|
||||
int nn;
|
||||
|
||||
nn = dn_expand(ansbuf, eom, cp, bp, buflen);
|
||||
nn = dn_expand(ansbuf, eom, cp, bp, ep - bp);
|
||||
if (nn < 0 || !maybe_hnok(pvt->res, bp) || nn != n) {
|
||||
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
|
||||
return (NULL);
|
||||
@@ -408,7 +406,6 @@ get1101answer(struct irs_nw *this,
|
||||
*ap++ = bp;
|
||||
nn = strlen(bp) + 1;
|
||||
bp += nn;
|
||||
buflen -= nn;
|
||||
haveanswer++;
|
||||
break;
|
||||
}
|
||||
@@ -419,7 +416,7 @@ get1101answer(struct irs_nw *this,
|
||||
sscanf(bp, "%u.%u.%u.%u.in-addr.arpa",
|
||||
&b1, &b2, &b3, &b4) != 4)
|
||||
break;
|
||||
if (buflen < INADDRSZ) {
|
||||
if ((ep - bp) < INADDRSZ) {
|
||||
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
|
||||
return (NULL);
|
||||
}
|
||||
@@ -428,7 +425,6 @@ get1101answer(struct irs_nw *this,
|
||||
*bp++ = b3;
|
||||
*bp++ = b2;
|
||||
*bp++ = b1;
|
||||
buflen -= INADDRSZ;
|
||||
pvt->net.n_length = INADDRSZ * 8;
|
||||
haveanswer++;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#if !defined(LINT) && !defined(CODECENTER)
|
||||
static const char rcsid[] = "$Id: gethostent.c,v 1.29 2001/05/29 05:48:44 marka Exp $";
|
||||
static const char rcsid[] = "$Id: gethostent.c,v 1.32 2002/05/27 06:50:55 marka Exp $";
|
||||
#endif
|
||||
|
||||
/* Imports */
|
||||
@@ -458,34 +458,34 @@ freehostent(struct hostent *he) {
|
||||
* -1 on failure.
|
||||
*/
|
||||
|
||||
static int
|
||||
scan_interfaces(int *have_v4, int *have_v6) {
|
||||
#ifndef SIOCGLIFCONF
|
||||
/* map new to old */
|
||||
#define SIOCGLIFCONF SIOCGIFCONF
|
||||
#define lifc_len ifc_len
|
||||
#define lifc_buf ifc_buf
|
||||
struct ifconf lifc;
|
||||
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
|
||||
!defined(IRIX_EMUL_IOCTL_SIOCGIFCONF)
|
||||
|
||||
#ifdef __hpux
|
||||
#define lifc_len iflc_len
|
||||
#define lifc_buf iflc_buf
|
||||
#define lifc_req iflc_req
|
||||
#define LIFCONF if_laddrconf
|
||||
#else
|
||||
#define SETFAMILYFLAGS
|
||||
struct lifconf lifc;
|
||||
#define LIFCONF lifconf
|
||||
#endif
|
||||
|
||||
#ifndef SIOCGLIFADDR
|
||||
/* map new to old */
|
||||
#define SIOCGLIFADDR SIOCGIFADDR
|
||||
#endif
|
||||
|
||||
#ifndef SIOCGLIFFLAGS
|
||||
#define SIOCGLIFFLAGS SIOCGIFFLAGS
|
||||
#define lifr_addr ifr_addr
|
||||
#define lifr_name ifr_name
|
||||
#define lifr_flags ifr_flags
|
||||
|
||||
#ifdef __hpux
|
||||
#define lifr_addr iflr_addr
|
||||
#define lifr_name iflr_name
|
||||
#define lifr_dstaddr iflr_dstaddr
|
||||
#define lifr_flags iflr_flags
|
||||
#define ss_family sa_family
|
||||
struct ifreq lifreq;
|
||||
#define LIFREQ if_laddrreq
|
||||
#else
|
||||
struct lifreq lifreq;
|
||||
#define LIFREQ lifreq
|
||||
#endif
|
||||
|
||||
static int
|
||||
scan_interfaces6(int *have_v4, int *have_v6) {
|
||||
struct LIFCONF lifc;
|
||||
struct LIFREQ lifreq;
|
||||
struct in_addr in4;
|
||||
struct in6_addr in6;
|
||||
char *buf = NULL, *cp, *cplim;
|
||||
@@ -496,7 +496,7 @@ scan_interfaces(int *have_v4, int *have_v6) {
|
||||
*have_v4 = *have_v6 = 0;
|
||||
|
||||
/* Get interface list from system. */
|
||||
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
|
||||
if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) == -1)
|
||||
goto err_ret;
|
||||
|
||||
/*
|
||||
@@ -508,20 +508,11 @@ scan_interfaces(int *have_v4, int *have_v6) {
|
||||
if (buf == NULL)
|
||||
goto err_ret;
|
||||
#ifdef SETFAMILYFLAGS
|
||||
lifc.lifc_family = AF_UNSPEC;
|
||||
lifc.lifc_family = AF_UNSPEC; /* request all families */
|
||||
lifc.lifc_flags = 0;
|
||||
#endif
|
||||
lifc.lifc_len = bufsiz;
|
||||
lifc.lifc_buf = buf;
|
||||
#ifdef IRIX_EMUL_IOCTL_SIOCGIFCONF
|
||||
/*
|
||||
* This is a fix for IRIX OS in which the call to ioctl with
|
||||
* the flag SIOCGIFCONF may not return an entry for all the
|
||||
* interfaces like most flavors of Unix.
|
||||
*/
|
||||
if (emul_ioctl(&lifc) >= 0)
|
||||
break;
|
||||
#else
|
||||
if ((n = ioctl(s, SIOCGLIFCONF, (char *)&lifc)) != -1) {
|
||||
/*
|
||||
* Some OS's just return what will fit rather
|
||||
@@ -534,7 +525,6 @@ scan_interfaces(int *have_v4, int *have_v6) {
|
||||
if (lifc.lifc_len + 2 * sizeof(lifreq) < bufsiz)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if ((n == -1) && errno != EINVAL)
|
||||
goto err_ret;
|
||||
|
||||
@@ -620,6 +610,158 @@ scan_interfaces(int *have_v4, int *have_v6) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int
|
||||
scan_interfaces(int *have_v4, int *have_v6) {
|
||||
struct ifconf ifc;
|
||||
union {
|
||||
char _pad[256]; /* leave space for IPv6 addresses */
|
||||
struct ifreq ifreq;
|
||||
} u;
|
||||
struct in_addr in4;
|
||||
struct in6_addr in6;
|
||||
char *buf = NULL, *cp, *cplim;
|
||||
static unsigned int bufsiz = 4095;
|
||||
int s, n;
|
||||
size_t cpsize;
|
||||
|
||||
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
|
||||
!defined(IRIX_EMUL_IOCTL_SIOCGIFCONF)
|
||||
/*
|
||||
* Try to scan the interfaces using IPv6 ioctls().
|
||||
*/
|
||||
if (!scan_interfaces6(have_v4, have_v6))
|
||||
return (0);
|
||||
#endif
|
||||
|
||||
/* Set to zero. Used as loop terminators below. */
|
||||
*have_v4 = *have_v6 = 0;
|
||||
|
||||
/* Get interface list from system. */
|
||||
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
|
||||
goto err_ret;
|
||||
|
||||
/*
|
||||
* Grow buffer until large enough to contain all interface
|
||||
* descriptions.
|
||||
*/
|
||||
for (;;) {
|
||||
buf = memget(bufsiz);
|
||||
if (buf == NULL)
|
||||
goto err_ret;
|
||||
ifc.ifc_len = bufsiz;
|
||||
ifc.ifc_buf = buf;
|
||||
#ifdef IRIX_EMUL_IOCTL_SIOCGIFCONF
|
||||
/*
|
||||
* This is a fix for IRIX OS in which the call to ioctl with
|
||||
* the flag SIOCGIFCONF may not return an entry for all the
|
||||
* interfaces like most flavors of Unix.
|
||||
*/
|
||||
if (emul_ioctl(&ifc) >= 0)
|
||||
break;
|
||||
#else
|
||||
if ((n = ioctl(s, SIOCGIFCONF, (char *)&ifc)) != -1) {
|
||||
/*
|
||||
* Some OS's just return what will fit rather
|
||||
* than set EINVAL if the buffer is too small
|
||||
* to fit all the interfaces in. If
|
||||
* ifc.ifc_len is too near to the end of the
|
||||
* buffer we will grow it just in case and
|
||||
* retry.
|
||||
*/
|
||||
if (ifc.ifc_len + 2 * sizeof(u.ifreq) < bufsiz)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if ((n == -1) && errno != EINVAL)
|
||||
goto err_ret;
|
||||
|
||||
if (bufsiz > 1000000)
|
||||
goto err_ret;
|
||||
|
||||
memput(buf, bufsiz);
|
||||
bufsiz += 4096;
|
||||
}
|
||||
|
||||
/* Parse system's interface list. */
|
||||
cplim = buf + ifc.ifc_len; /* skip over if's with big ifr_addr's */
|
||||
for (cp = buf;
|
||||
(*have_v4 == 0 || *have_v6 == 0) && cp < cplim;
|
||||
cp += cpsize) {
|
||||
memcpy(&u.ifreq, cp, sizeof u.ifreq);
|
||||
#ifdef HAVE_SA_LEN
|
||||
#ifdef FIX_ZERO_SA_LEN
|
||||
if (u.ifreq.ifr_addr.sa_len == 0)
|
||||
u.ifreq.ifr_addr.sa_len = 16;
|
||||
#endif
|
||||
#ifdef HAVE_MINIMUM_IFREQ
|
||||
cpsize = sizeof u.ifreq;
|
||||
if (u.ifreq.ifr_addr.sa_len > sizeof (struct sockaddr))
|
||||
cpsize += (int)u.ifreq.ifr_addr.sa_len -
|
||||
(int)(sizeof (struct sockaddr));
|
||||
#else
|
||||
cpsize = sizeof u.ifreq.ifr_name + u.ifreq.ifr_addr.sa_len;
|
||||
#endif /* HAVE_MINIMUM_IFREQ */
|
||||
if (cpsize > sizeof u.ifreq && cpsize <= sizeof u)
|
||||
memcpy(&u.ifreq, cp, cpsize);
|
||||
#elif defined SIOCGIFCONF_ADDR
|
||||
cpsize = sizeof u.ifreq;
|
||||
#else
|
||||
cpsize = sizeof u.ifreq.ifr_name;
|
||||
/* XXX maybe this should be a hard error? */
|
||||
if (ioctl(s, SIOCGIFADDR, (char *)&u.ifreq) < 0)
|
||||
continue;
|
||||
#endif
|
||||
switch (u.ifreq.ifr_addr.sa_family) {
|
||||
case AF_INET:
|
||||
if (*have_v4 == 0) {
|
||||
memcpy(&in4,
|
||||
&((struct sockaddr_in *)
|
||||
&u.ifreq.ifr_addr)->sin_addr,
|
||||
sizeof in4);
|
||||
if (in4.s_addr == INADDR_ANY)
|
||||
break;
|
||||
n = ioctl(s, SIOCGIFFLAGS, (char *)&u.ifreq);
|
||||
if (n < 0)
|
||||
break;
|
||||
if ((u.ifreq.ifr_flags & IFF_UP) == 0)
|
||||
break;
|
||||
*have_v4 = 1;
|
||||
}
|
||||
break;
|
||||
case AF_INET6:
|
||||
if (*have_v6 == 0) {
|
||||
memcpy(&in6,
|
||||
&((struct sockaddr_in6 *)
|
||||
&u.ifreq.ifr_addr)->sin6_addr,
|
||||
sizeof in6);
|
||||
if (memcmp(&in6, &in6addr_any, sizeof in6) == 0)
|
||||
break;
|
||||
n = ioctl(s, SIOCGIFFLAGS, (char *)&u.ifreq);
|
||||
if (n < 0)
|
||||
break;
|
||||
if ((u.ifreq.ifr_flags & IFF_UP) == 0)
|
||||
break;
|
||||
*have_v6 = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (buf != NULL)
|
||||
memput(buf, bufsiz);
|
||||
close(s);
|
||||
/* printf("scan interface -> 4=%d 6=%d\n", *have_v4, *have_v6); */
|
||||
return (0);
|
||||
err_ret:
|
||||
if (buf != NULL)
|
||||
memput(buf, bufsiz);
|
||||
if (s != -1)
|
||||
close(s);
|
||||
/* printf("scan interface -> 4=%d 6=%d\n", *have_v4, *have_v6); */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static struct hostent *
|
||||
copyandmerge(struct hostent *he1, struct hostent *he2, int af, int *error_num) {
|
||||
struct hostent *he = NULL;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] = "$Id: ns_name.c,v 8.17 2001/10/03 14:34:32 marka Exp $";
|
||||
static const char rcsid[] = "$Id: ns_name.c,v 8.18 2002/05/24 05:10:40 marka Exp $";
|
||||
#endif
|
||||
|
||||
#include "port_before.h"
|
||||
@@ -681,6 +681,8 @@ special(int ch) {
|
||||
case 0x2E: /* '.' */
|
||||
case 0x3B: /* ';' */
|
||||
case 0x5C: /* '\\' */
|
||||
case 0x28: /* '(' */
|
||||
case 0x29: /* ')' */
|
||||
/* Special modifiers in zone files. */
|
||||
case 0x40: /* '@' */
|
||||
case 0x24: /* '$' */
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
|
||||
static const char rcsid[] = "$Id: res_debug.c,v 8.45 2001/12/19 12:05:56 marka Exp $";
|
||||
static const char rcsid[] = "$Id: res_debug.c,v 8.46 2002/05/21 01:57:45 marka Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "port_before.h"
|
||||
@@ -683,12 +683,10 @@ precsize_ntoa(prec)
|
||||
|
||||
/* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */
|
||||
static u_int8_t
|
||||
precsize_aton(strptr)
|
||||
char **strptr;
|
||||
{
|
||||
precsize_aton(const char **strptr) {
|
||||
unsigned int mval = 0, cmval = 0;
|
||||
u_int8_t retval = 0;
|
||||
char *cp;
|
||||
const char *cp;
|
||||
int exponent;
|
||||
int mantissa;
|
||||
|
||||
@@ -725,11 +723,8 @@ precsize_aton(strptr)
|
||||
|
||||
/* converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */
|
||||
static u_int32_t
|
||||
latlon2ul(latlonstrptr,which)
|
||||
char **latlonstrptr;
|
||||
int *which;
|
||||
{
|
||||
char *cp;
|
||||
latlon2ul(const char **latlonstrptr, int *which) {
|
||||
const char *cp;
|
||||
u_int32_t retval;
|
||||
int deg = 0, min = 0, secs = 0, secsfrac = 0;
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
|
||||
static const char rcsid[] = "$Id: res_init.c,v 8.28 2002/01/30 01:07:35 marka Exp $";
|
||||
static const char rcsid[] = "$Id: res_init.c,v 8.29 2002/05/31 06:05:31 marka Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "port_before.h"
|
||||
@@ -194,7 +194,8 @@ __res_vinit(res_state statp, int preinit) {
|
||||
if (statp->_u._ext.ext != NULL) {
|
||||
memset(statp->_u._ext.ext, 0, sizeof(*statp->_u._ext.ext));
|
||||
statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
|
||||
strcpy(statp->_u._ext.ext->nsuffix, "ip6.int");
|
||||
strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa");
|
||||
strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int");
|
||||
strcpy(statp->_u._ext.ext->bsuffix, "ip6.arpa");
|
||||
}
|
||||
#ifdef RESOLVSORT
|
||||
@@ -520,6 +521,14 @@ res_setoptions(res_state statp, const char *options, const char *source)
|
||||
strncpy(ext->nsuffix, cp, i);
|
||||
ext->nsuffix[i] = '\0';
|
||||
}
|
||||
else if (!strncmp(cp, "nibble2:", sizeof("nibble2:") - 1)) {
|
||||
if (ext == NULL)
|
||||
goto skip;
|
||||
cp += sizeof("nibble2:") - 1;
|
||||
i = MIN(strcspn(cp, " \t"), sizeof(ext->nsuffix2) - 1);
|
||||
strncpy(ext->nsuffix2, cp, i);
|
||||
ext->nsuffix2[i] = '\0';
|
||||
}
|
||||
else if (!strncmp(cp, "bitstring:", sizeof("bitstring:") - 1)) {
|
||||
if (ext == NULL)
|
||||
goto skip;
|
||||
@@ -530,16 +539,12 @@ res_setoptions(res_state statp, const char *options, const char *source)
|
||||
}
|
||||
else if (!strncmp(cp, "v6revmode:", sizeof("v6revmode:") - 1)) {
|
||||
cp += sizeof("v6revmode:") - 1;
|
||||
if (!strncmp(cp, "nibble", sizeof("nibble") - 1)) {
|
||||
statp->options &= ~RES_NO_NIBBLE;
|
||||
statp->options |= RES_NO_BITSTRING;
|
||||
} else if (!strncmp(cp, "bitstring",
|
||||
sizeof("bitstring") - 1)) {
|
||||
statp->options |= RES_NO_NIBBLE;
|
||||
statp->options &= ~RES_NO_BITSTRING;
|
||||
/* "nibble" and "bitstring" used to be valid */
|
||||
if (!strncmp(cp, "single", sizeof("single") - 1)) {
|
||||
statp->options |= RES_NO_NIBBLE2;
|
||||
} else if (!strncmp(cp, "both", sizeof("both") - 1)) {
|
||||
statp->options &=
|
||||
~(RES_NO_NIBBLE|RES_NO_BITSTRING);
|
||||
~RES_NO_NIBBLE2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -613,6 +618,13 @@ const char *
|
||||
res_get_nibblesuffix(res_state statp) {
|
||||
if (statp->_u._ext.ext)
|
||||
return (statp->_u._ext.ext->nsuffix);
|
||||
return ("ip6.arpa");
|
||||
}
|
||||
|
||||
const char *
|
||||
res_get_nibblesuffix2(res_state statp) {
|
||||
if (statp->_u._ext.ext)
|
||||
return (statp->_u._ext.ext->nsuffix2);
|
||||
return ("ip6.int");
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ struct __res_state_ext {
|
||||
} sort_list[MAXRESOLVSORT];
|
||||
char nsuffix[64];
|
||||
char bsuffix[64];
|
||||
char nsuffix2[64];
|
||||
};
|
||||
|
||||
extern int
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'CC=cc'
|
||||
'CDEBUG=-O2 -g -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -DMEMCLUSTER_RECORD=1'
|
||||
'CDEBUG=-O2 -g -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat'
|
||||
'DESTBIN=/usr/bin'
|
||||
'DESTSBIN=/usr/sbin'
|
||||
'DESTEXEC=/usr/libexec'
|
||||
@@ -9,7 +9,8 @@
|
||||
'DESTRUN=/var/run'
|
||||
'LEX=lex -I'
|
||||
'YACC=yacc -d'
|
||||
'SYSLIBS=-ll -lutil'
|
||||
'SYSLIBS=-lutil'
|
||||
'LIBL=-ll'
|
||||
'INSTALL=install'
|
||||
'MANDIR=cat'
|
||||
'MANROFF=(tbl|nroff -man)'
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define SETPWENT_VOID
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define GROUP_R_RETURN struct group *
|
||||
@@ -27,8 +28,13 @@
|
||||
#define GROUP_R_ENT_ARGS void
|
||||
#define GROUP_R_OK gptr
|
||||
#define GROUP_R_BAD NULL
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 500030
|
||||
#define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, \
|
||||
int *ngroups
|
||||
#else
|
||||
#define GETGROUPLIST_ARGS const char *name, int basegid, int *groups, \
|
||||
int *ngroups
|
||||
#endif
|
||||
|
||||
#define HOST_R_RETURN struct hostent *
|
||||
#define HOST_R_SET_RETURN void
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
OPIE Software Distribution, Release 2.32 Bug Reporting Form
|
||||
======================================== ==================
|
||||
OPIE Software Distribution, Release 2.4 Bug Reporting Form
|
||||
======================================= ==================
|
||||
|
||||
Before submitting a bug report, please check the README file and make
|
||||
sure that your "bug" is not a known problem.
|
||||
|
||||
Please make a copy of this file and then edit it with your favorite
|
||||
text editor to include the answers to the following questions:
|
||||
text editor (NOT a word processor; the end result needs to be reasonable ASCII
|
||||
text) to include the answers to the following questions:
|
||||
|
||||
1. Your name and electronic mail address, in case we need more information.
|
||||
If you can provide multiple addresses, please do so in case we
|
||||
@@ -76,7 +77,7 @@ Copyright
|
||||
=========
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
|
||||
+96
-5
@@ -1,5 +1,5 @@
|
||||
OPIE Software Distribution, Release 2.31 Installation Instructions
|
||||
======================================== =========================
|
||||
OPIE Software Distribution, Release 2.4 Installation Instructions
|
||||
======================================= =========================
|
||||
|
||||
Did you read the README file?
|
||||
|
||||
@@ -26,11 +26,102 @@ hole, but a necessary evil for some sites), type:
|
||||
|
||||
If you'd like the file to go somewhere else, adjust this appropriately.
|
||||
|
||||
There are a number of configure-time options available for OPIE. To
|
||||
get a list, type:
|
||||
There are a number of configure-time options available for OPIE. You
|
||||
probably don't want to change the defaults. To get a complete listing of the
|
||||
currently available options, type:
|
||||
|
||||
sh configure --help
|
||||
|
||||
Some options that may be of interest are:
|
||||
|
||||
--enable-access-file=FILENAME: Enable the OPIE access file FILENAME
|
||||
The OPIE access file provides a system administrator with the ability
|
||||
to make the use of OTP optional for certain hosts. Note that individual
|
||||
users can create a file named ".opiealways" in their home directory to
|
||||
require that OTP be used to access to their account. Note also that the
|
||||
access file is based on addresses, but many of the clients that use it
|
||||
are only given hostnames. This opens this entire scheme up to DNS
|
||||
spoofing attacks, which is a major security problem. ALWAYS use a
|
||||
package such as tcp_wrappers configured to do paranoid checking on DNS
|
||||
information if you enable this option (it's good practice anyway).
|
||||
|
||||
--enable-server-md4: Use MD4 instead of MD5 for the server
|
||||
The old S/Key package used MD4 instead of MD5. MD4 is believed to be
|
||||
less secure than MD5. Use this option only for compatibility with old
|
||||
key files.
|
||||
|
||||
--disable-user-locking: Disable user locking
|
||||
OPIE only allows one session at a time to attempt to authenticate a
|
||||
principal; this prevents a possible race attack on OTP. This locking
|
||||
mechanism can cause problems in some applications, in which case you
|
||||
might want to disable the locking. This option also provides a work-
|
||||
around if the locking code doesn't work reliably on your system.
|
||||
|
||||
--enable-user-locking[=DIR]: Put user lock files in DIR [/etc/opielocks]
|
||||
The OPIE lock files need to be put in an isolated directory that is
|
||||
only accessable by the super-user and has a parent directory that is
|
||||
only writable by the super-user. If you are trying to use OPIE with
|
||||
the key file shared by NFS, you need to make the lock directory
|
||||
shared too. (But you read the README file, so you knew this)
|
||||
|
||||
--enable-retype: Ask users to re-type their secret pass phrases
|
||||
On the one hand, this helps prevent users from having to go generate
|
||||
an OTP, type it into a remote system, and then found out they
|
||||
mistyped. On the other hand, it's annoying. If this is enabled, users
|
||||
can simply hit return at the second prompt and the generator will skip
|
||||
the retype check, which allows users who don't like the retype check
|
||||
to mostly skip it.
|
||||
|
||||
--enable-su-star-check: Refuse to switch to disabled accounts
|
||||
On many systems, an asterisk means one thing and one thing only: this
|
||||
account is never meant for human users. Therefore, it doesn't make
|
||||
much sense for anyone other than an attacker to try to su to that
|
||||
account. Enabling this check causes su to refuse to switch to
|
||||
accounts with an asterisk in their password field. While probably
|
||||
better for security, this is not compatible with traditional *IX su
|
||||
behavior, so it is disabled by default
|
||||
|
||||
--disable-new-prompts: Use more compatible (but less informative) prompts
|
||||
OPIE uses login prompts that tell you exactly what kind of response
|
||||
(an OTP response and/or a cleartext password) it expects you to give.
|
||||
This can break automatic login scripts that look for 'Password:' as
|
||||
the prompt for the password. If you have users that use such scripts,
|
||||
you might want to disable the more informative responses so as not to
|
||||
break those scripts.
|
||||
|
||||
--enable-insecure-override: Allow users to override insecure checks
|
||||
While OPIE cannot determine whether or not a session is secure, it can
|
||||
check for fairly common signs that it isn't secure. If it believes the
|
||||
session is insecure, some programs like opiekey will refuse to run
|
||||
because they prompt the user to send a secret pass phrase. Sometimes
|
||||
these checks declare a session insecure when it is, and sometimes the
|
||||
user wants to continue anyway even if the session is insecure. If this
|
||||
option is enabled, many commands gain a '-f' option to force them to
|
||||
operate even if OPIE thinks the session is insecure.
|
||||
|
||||
--enable-anonymous-ftp Enable anonymous FTP support
|
||||
By default, the OPIE FTP daemon does not support anonymous FTP
|
||||
service. The FTP daemon contains many security related bug fixes
|
||||
relative to the original source, but bugs probably remain. It was not
|
||||
intended to be used for anonymous FTP, where it is more open to the
|
||||
commands of potentially hostile users. If you enable this option, it
|
||||
will once again support anonymous FTP, but it probably isn't secure
|
||||
when that way.
|
||||
|
||||
--disable-utmp Disable utmp logging
|
||||
--disable-wtmp Disable wtmp logging
|
||||
On some systems, logging to the utmp and/or wtmp files is just a lost
|
||||
cause. If this is the case on your system, you might be better off
|
||||
not having OPIE even try.
|
||||
|
||||
--enable-opieauto Enable support for opieauto
|
||||
opieauto is a facility that caches an intermediate result of the OTP
|
||||
generator so that a user-selected number of OTPs can be generated on
|
||||
demand for each time the user types in the secret pass phrase. This
|
||||
is great for user convenience, as typing a twenty or thirty character
|
||||
secret pass phrase can be annoying. It can also be a minor security
|
||||
hole (see the README for details).
|
||||
|
||||
2. Edit the Makefile
|
||||
|
||||
The Makefile contains some options that you may wish to modify. Also
|
||||
@@ -75,7 +166,7 @@ Copyright
|
||||
=========
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
|
||||
+91
-36
@@ -2,7 +2,7 @@
|
||||
# Makefile.source and Makefile: Directions for building and installing OPIE.
|
||||
#
|
||||
# %%% portions-copyright-cmetz-96
|
||||
# Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
# Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
# Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
# the software.
|
||||
# You should have received a copy of the license with this software. If
|
||||
@@ -15,6 +15,9 @@
|
||||
#
|
||||
# History:
|
||||
#
|
||||
# Modified by cmetz for OPIE 2.4. Add libmissing to include header path.
|
||||
# Renamed realclean to distclean. Added opieauto rules. Made
|
||||
# system program install more tolerant of non-existent files.
|
||||
# Modified by cmetz for OPIE 2.31. Moved logwtmp.o into libopie.
|
||||
# Modified by cmetz for OPIE 2.3. Removed manual config -- it's
|
||||
# Autoconf or bust. Replaced user configuration options
|
||||
@@ -80,9 +83,9 @@ SHELL=/bin/sh
|
||||
OWNER=0
|
||||
GROUP=bin
|
||||
|
||||
# Where should the OPIE standard and extended databases be stored?
|
||||
# Where should the OPIE standard and extended databases be stored?
|
||||
#
|
||||
# Some sites might want to put this elsewhere. If you want to use an old
|
||||
# Some sites might want to put this elsewhere. If you want to use an old
|
||||
# S/Key database, you should create a link from /etc/skeykeys to /etc/opiekeys.
|
||||
KEY_FILE=/etc/opiekeys
|
||||
|
||||
@@ -115,10 +118,11 @@ SU=@SU@
|
||||
ALT_SU=@ALT_SU@
|
||||
LOGIN=@LOGIN@
|
||||
LOCK_DIR=@LOCK_DIR@
|
||||
OPIEAUTO=@OPIEAUTO@
|
||||
|
||||
BACKUP=opie.old
|
||||
|
||||
CFLAGS=$(DEBUG)
|
||||
CFLAGS=$(DEBUG) -Ilibmissing
|
||||
|
||||
LFLAGS=-Llibopie -Llibmissing -lopie $(LIBS) -lmissing -lopie
|
||||
LDEPS=libmissing/libmissing.a libopie/libopie.a
|
||||
@@ -128,17 +132,19 @@ all: client server
|
||||
ifdefs:
|
||||
egrep '^#*if*def' *.c *.h | cut -f2 -d: | sort | uniq
|
||||
|
||||
client: libopie/libopie.a libmissing/libmissing.a opietest-passed opiekey opiegen
|
||||
client: libopie/libopie.a libmissing/libmissing.a opietest-passed opiekey opiegen $(OPIEAUTO)
|
||||
|
||||
client-install: client
|
||||
@echo "Installing OPIE client software..."
|
||||
@echo "Copying OPIE key-related files"
|
||||
@if test ! -d $(LOCALBIN); then $(MKDIR) $(LOCALBIN); chmod 755 $(LOCALBIN); fi
|
||||
@cp opiekey $(LOCALBIN)
|
||||
@cp opiekey $(OPIEAUTO) $(LOCALBIN)
|
||||
@$(CHOWN) $(OWNER) $(LOCALBIN)/opiekey
|
||||
@if test ! -z "$(OPIEAUTO)"; then $(CHOWN) $(OWNER) $(LOCALBIN)/opieauto; fi
|
||||
@chgrp $(GROUP) $(LOCALBIN)/opiekey
|
||||
@echo "Changing file permissions"
|
||||
@chmod 0511 $(LOCALBIN)/opiekey
|
||||
@if test ! -z "$(OPIEAUTO)"; then chmod 0511 $(LOCALBIN)/opieauto; fi
|
||||
@echo "Symlinking aliases to opiekey"
|
||||
@-ln -s $(LOCALBIN)/opiekey $(LOCALBIN)/otp-md4
|
||||
@-ln -s $(LOCALBIN)/opiekey $(LOCALBIN)/otp-md5
|
||||
@@ -160,32 +166,75 @@ server-install: server
|
||||
@chmod 0555 $(LOCALBIN)/opieinfo
|
||||
@chmod 4511 $(LOCALBIN)/opiepasswd
|
||||
@echo "Installing OPIE system programs..."
|
||||
@if test ! $(EXISTS) $(LOGIN).$(BACKUP); then echo "Renaming existing $(LOGIN) to $(LOGIN).$(BACKUP)"; mv $(LOGIN) $(LOGIN).$(BACKUP); echo "Clearing permissions on old $(LOGIN)"; chmod 0 $(LOGIN).$(BACKUP); fi
|
||||
@echo "Copying opielogin to $(LOGIN)"
|
||||
@cp opielogin $(LOGIN)
|
||||
@echo "Changing ownership of $(LOGIN)"
|
||||
@$(CHOWN) $(OWNER) $(LOGIN)
|
||||
@chgrp $(GROUP) $(LOGIN)
|
||||
@echo "Changing file permissions of $(LOGIN)"
|
||||
@chmod 4111 $(LOGIN)
|
||||
@if test ! $(EXISTS) $(SU).$(BACKUP); then echo "Renaming existing su to su.$(BACKUP)"; mv $(SU) $(SU).$(BACKUP); echo "Clearing permissions on old su"; chmod 0 $(SU).$(BACKUP); fi
|
||||
@-if test ! -z "$(ALT_SU)"; then if test ! $(EXISTS) $(ALT_SU).$(BACKUP); then echo "Renaming existing su to su.$(BACKUP)"; mv $(ALT_SU) $(ALT_SU).$(BACKUP); fi; echo "Copying opiesu to su"; cp opiesu $(ALT_SU); echo "Changing ownership"; $(CHOWN) $(OWNER) $(ALT_SU); chgrp $(GROUP) $(ALT_SU); echo "Changing file permissions"; chmod 4111 $(ALT_SU); echo "Clearning permissions on old su"; chmod 0 $(ALT_SU).$(BACKUP); fi
|
||||
@echo "Copying opiesu to su"
|
||||
@cp opiesu $(SU)
|
||||
@echo "Changing ownership of su"
|
||||
@$(CHOWN) $(OWNER) $(SU)
|
||||
@chgrp $(GROUP) $(SU)
|
||||
@echo "Changing file permissions of su"
|
||||
@chmod 4111 $(SU)
|
||||
@if test ! $(EXISTS) $(FTPD).$(BACKUP); then echo "Renaming existing ftp daemon to $(FTPD).$(BACKUP)"; mv $(FTPD) $(FTPD).$(BACKUP); echo "Clearing permissions on old ftp daemon"; chmod 0 $(FTPD).$(BACKUP); fi
|
||||
@echo "Copying OPIE ftp daemon"
|
||||
@cp opieftpd $(FTPD)
|
||||
@echo "Changing ownership of ftpd"
|
||||
@$(CHOWN) $(OWNER) $(FTPD)
|
||||
@chgrp $(GROUP) $(FTPD)
|
||||
@echo "Changing file permissions of ftpd"
|
||||
@chmod 0100 $(FTPD)
|
||||
@echo "Making sure OPIE database file exists"
|
||||
@if test ! -z $(LOGIN); \
|
||||
then \
|
||||
if test ! $(EXISTS) $(LOGIN).$(BACKUP); \
|
||||
then \
|
||||
echo "Renaming existing $(LOGIN) to $(LOGIN).$(BACKUP)"; \
|
||||
mv $(LOGIN) $(LOGIN).$(BACKUP); \
|
||||
echo "Clearing permissions on $(LOGIN)"; \
|
||||
chmod 0 $(LOGIN).$(BACKUP); \
|
||||
fi; \
|
||||
echo "Copying OPIE login to $(LOGIN)"; \
|
||||
cp opielogin $(LOGIN); \
|
||||
echo "Changing ownership of $(LOGIN)"; \
|
||||
$(CHOWN) $(OWNER) $(LOGIN); \
|
||||
chgrp $(GROUP) $(LOGIN); \
|
||||
echo "Changing file permissions of $(LOGIN)"; \
|
||||
chmod 4111 $(LOGIN); \
|
||||
fi
|
||||
@if test ! -z $(SU); \
|
||||
then \
|
||||
if test ! $(EXISTS) $(SU).$(BACKUP); \
|
||||
then \
|
||||
echo "Renaming existing $(SU) to $(SU).$(BACKUP)"; \
|
||||
mv $(SU) $(SU).$(BACKUP); \
|
||||
echo "Clearing permissions on $(SU)"; \
|
||||
chmod 0 $(SU).$(BACKUP); \
|
||||
fi; \
|
||||
echo "Copying OPIE su to $(SU)"; \
|
||||
cp opiesu $(SU); \
|
||||
echo "Changing ownership of $(SU)"; \
|
||||
$(CHOWN) $(OWNER) $(SU); \
|
||||
chgrp $(GROUP) $(SU); \
|
||||
echo "Changing file permissions of $(SU)"; \
|
||||
chmod 4111 $(SU); \
|
||||
fi
|
||||
@if test ! -z $(ALT_SU); \
|
||||
then \
|
||||
if test ! $(EXISTS) $(ALT_SU).$(BACKUP); \
|
||||
then \
|
||||
echo "Renaming existing $(ALT_SU) to $(ALT_SU).$(BACKUP)"; \
|
||||
mv $(ALT_SU) $(ALT_SU).$(BACKUP); \
|
||||
echo "Clearing permissions on $(ALT_SU)"; \
|
||||
chmod 0 $(ALT_SU).$(BACKUP); \
|
||||
fi; \
|
||||
echo "Copying OPIE su to $(ALT_SU)"; \
|
||||
cp opiesu $(ALT_SU); \
|
||||
echo "Changing ownership of $(ALT_SU)"; \
|
||||
$(CHOWN) $(OWNER) $(ALT_SU); \
|
||||
chgrp $(GROUP) $(ALT_SU); \
|
||||
echo "Changing file permissions of $(ALT_SU)"; \
|
||||
chmod 4111 $(ALT_SU); \
|
||||
fi
|
||||
@if test ! -z $(FTPD); \
|
||||
then \
|
||||
if test ! $(EXISTS) $(FTPD).$(BACKUP); \
|
||||
then \
|
||||
echo "Renaming existing $(FTPD) to $(FTPD).$(BACKUP)"; \
|
||||
mv $(FTPD) $(FTPD).$(BACKUP); \
|
||||
echo "Clearing permissions on $(FTPD).$(BACKUP)"; \
|
||||
chmod 0 $(FTPD).$(BACKUP); \
|
||||
fi; \
|
||||
echo "Copying OPIE ftp daemon to $(FTPD)"; \
|
||||
cp opieftpd $(FTPD); \
|
||||
echo "Changing ownership of $(FTPD)"; \
|
||||
$(CHOWN) $(OWNER) $(FTPD); \
|
||||
chgrp $(GROUP) $(FTPD); \
|
||||
echo "Changing file permissions of $(FTPD)"; \
|
||||
chmod 0100 $(FTPD); \
|
||||
fi
|
||||
@echo "Making sure OPIE database file exists";
|
||||
@touch $(KEY_FILE)
|
||||
@echo "Changing permissions of OPIE database file"
|
||||
@chmod 0644 $(KEY_FILE)
|
||||
@@ -230,16 +279,18 @@ libmissing/libmissing.a: libmissing/*.c
|
||||
|
||||
clean:
|
||||
-rm -f *.o opiekey opiegen opielogin opiepasswd opiesu opieftpd
|
||||
-rm -f opieserv opieinfo opietest *core* opietest-passed
|
||||
-rm -f opieserv opieinfo opietest opieauto *core* opietest-passed
|
||||
-rm -f Makefile.munge configure.munger y.tab.c .gdb*
|
||||
(cd libopie ; $(MAKE) clean)
|
||||
(cd libmissing ; $(MAKE) clean)
|
||||
|
||||
realclean: clean
|
||||
realclean: distclean
|
||||
|
||||
distclean: clean
|
||||
-rm -f *~ core* "\#*\#" Makefile make.log
|
||||
-rm -f config.log config.status config.cache config.h
|
||||
(cd libopie ; $(MAKE) realclean)
|
||||
(cd libmissing ; $(MAKE) realclean)
|
||||
(cd libopie ; $(MAKE) distclean)
|
||||
(cd libmissing ; $(MAKE) distclean)
|
||||
|
||||
opiekey: opiekey.o $(LDEPS)
|
||||
$(CC) $(CFLAGS) opiekey.o $(LFLAGS) -o opiekey
|
||||
@@ -270,3 +321,7 @@ opieinfo: opieinfo.o $(LDEPS)
|
||||
|
||||
opietest: opietest.o $(LDEPS)
|
||||
$(CC) $(CFLAGS) opietest.o $(LFLAGS) -o opietest
|
||||
|
||||
opieauto: opieauto.o $(LDEPS)
|
||||
$(CC) $(CFLAGS) opieauto.o $(LFLAGS) -o opieauto
|
||||
|
||||
+112
-68
@@ -1,5 +1,5 @@
|
||||
OPIE Software Distribution, Release 2.32 Important Information
|
||||
======================================== =====================
|
||||
OPIE Software Distribution, Release 2.4 Important Information
|
||||
======================================= =====================
|
||||
|
||||
Introduction
|
||||
============
|
||||
@@ -75,87 +75,104 @@ original Bellcore S/Key(tm) Version 1 software:
|
||||
A Glance at What's New
|
||||
======================
|
||||
|
||||
2.32 January 1, 1998.
|
||||
2.4 TEST VERSION -- NOT FOR REDISTRIBUTION
|
||||
|
||||
Indicate support for extended responses in challenges and check for
|
||||
such indication before generating any extended responses.
|
||||
Merged in opieauto, which is disabled by default.
|
||||
|
||||
Lots of portability and bug fixes.
|
||||
Lots of documentation updates.
|
||||
|
||||
2.31 March 20, 1997.
|
||||
Portability and bug fixes.
|
||||
|
||||
Removed active attack protection support due to patent problems.
|
||||
2.32 January 1, 1998.
|
||||
|
||||
Moved user locks to a separate directory.
|
||||
Indicate support for extended responses in challenges and check for such
|
||||
indication before generating any extended responses.
|
||||
|
||||
Moved user-serviceable configuration options to the configure script.
|
||||
Lots of portability and bug fixes.
|
||||
|
||||
Lots of portability and bug fixes.
|
||||
2.31 March 20, 1997.
|
||||
|
||||
2.3 September 22, 1996
|
||||
Removed active attack protection support due to patent problems.
|
||||
|
||||
Autoconf is now the only supported configuration method.
|
||||
Removed the supplemental key file; it did more harm than good.
|
||||
|
||||
Lots of internal functions got re-written in ways that will make some
|
||||
Moved user locks to a separate directory.
|
||||
|
||||
Moved user-serviceable configuration options to the configure script.
|
||||
|
||||
Lots of portability and bug fixes.
|
||||
|
||||
2.3 September 22, 1996
|
||||
|
||||
Autoconf is now the only supported configuration method.
|
||||
|
||||
Lots of internal functions got re-written in ways that will make some
|
||||
planned future changes easier.
|
||||
|
||||
OTP extended responses, such as automatic re-initialization.
|
||||
OTP extended responses, such as automatic re-initialization.
|
||||
|
||||
Support for a supplemental key file that stores information that was
|
||||
not in the original /etc/skeykeys file. This allows OPIE to store extra data
|
||||
needed for things like the OTP re-initialization extended response without
|
||||
breaking interoperability with other S/Key derived programs. This file is
|
||||
named "/etc/opiekeys.ext" by default. Unlike the standard key file, it MUST
|
||||
NOT be world readable.
|
||||
Support for a supplemental key file that stores information that was not
|
||||
in the original /etc/skeykeys file. This allows OPIE to store extra data needed
|
||||
for things like the OTP re-initialization extended response without breaking
|
||||
interoperability with other S/Key derived programs. This file is named
|
||||
"/etc/opiekeys.ext" by default. Unlike the standard key file, it MUST NOT be
|
||||
world readable.
|
||||
|
||||
OPIE should better support some of the native "features" of drain
|
||||
bamaged OSs such as AIX, HP-UX, and Solaris.
|
||||
OPIE should better support some of the native "features" of drain bamaged
|
||||
OSs such as AIX, HP-UX, and Solaris.
|
||||
|
||||
OPIE's utmp/wtmp handling has been completely re-written. This should
|
||||
solve many of the utmp/wtmp problems people have been having.
|
||||
OPIE's utmp/wtmp handling has been completely re-written. This should solve
|
||||
many of the utmp/wtmp problems people have been having.
|
||||
|
||||
Lots of cleanups.
|
||||
Lots of cleanups.
|
||||
|
||||
Bug fixes.
|
||||
Bug fixes.
|
||||
|
||||
2.22 May 3, 1996.
|
||||
2.22 May 3, 1996.
|
||||
|
||||
More minor bug fixes. OPIE once again works on Solaris 2.x.
|
||||
More minor bug fixes. OPIE once again works on Solaris 2.x.
|
||||
|
||||
2.21 April 27, 1996.
|
||||
2.21 April 27, 1996.
|
||||
|
||||
Minor bug fixes.
|
||||
Minor bug fixes.
|
||||
|
||||
2.2 April 11, 1996.
|
||||
2.2 April 11, 1996.
|
||||
|
||||
opiesubr.c, opiesubr2.c, and a few other functions moved into
|
||||
a subdirectory and split into files with fine granularity. Ditto with
|
||||
missing function replacements. This subdirectory structure changes a lot
|
||||
of things around and more splitting like this should be expected in the
|
||||
near future.
|
||||
opiesubr.c, opiesubr2.c, and a few other functions moved into a
|
||||
subdirectory and split into files with fine granularity. Ditto with missing
|
||||
function replacements. This subdirectory structure changes a lot of things
|
||||
around and more splitting like this should be expected in the near future.
|
||||
|
||||
Added opiegenerator() library function that should make it very easy
|
||||
to create OTP clients using the OPIE library (this function is subject to
|
||||
change: there are a few problems remaining to be solved). Just about re-write
|
||||
Added opiegenerator() library function that should make it very easy to
|
||||
create OTP clients using the OPIE library (this function is subject to change:
|
||||
there are a few problems remaining to be solved). Just about re-wrote
|
||||
opiegetpass() to use raw I/O and got most of the OPIE programs actually using
|
||||
that function. Autoconf build fixes. Lots of bug fixes. Lots of portability
|
||||
fixes. Function declarations should be ANSI style for ANSI compilers. Several
|
||||
fixes to bring OPIE in line with the latest OTP spec. MJR DES key crunch
|
||||
fixes to bring OPIE in line with the latest OTP spec. MJR DES key crunch
|
||||
de-implemented.
|
||||
|
||||
Added sample programs: opiegen (client) and opieserv (server).
|
||||
Added sample programs: opiegen (client) and opieserv (server).
|
||||
|
||||
Probably broke non-autoconf support along the way :(. I've tried to
|
||||
bring this back in sync, but it may still be broken.
|
||||
Probably broke non-autoconf support along the way :(. I've tried to bring
|
||||
this back in sync, but it may still be broken.
|
||||
|
||||
2.11 December 27, 1995.
|
||||
2.11 December 27, 1995.
|
||||
|
||||
Minor bug fixes.
|
||||
Minor bug fixes.
|
||||
|
||||
2.10 December 26, 1995.
|
||||
2.10 December 26, 1995.
|
||||
|
||||
Optional autoconf support. opieinfo is now a normal program.
|
||||
Bugs fixed -- should work much better on SunOS, HP-UX, and AIX.
|
||||
Optional autoconf support. opieinfo is now a normal program. Bugs fixed --
|
||||
should work much better on SunOS, HP-UX, and AIX.
|
||||
|
||||
2.01 -- 2.04
|
||||
|
||||
Bug fix releases.
|
||||
|
||||
2.00
|
||||
|
||||
Initial release of OPIE 2.0.
|
||||
|
||||
System Requirements
|
||||
===================
|
||||
@@ -177,12 +194,15 @@ OPIE code.
|
||||
If OPIE Doesn't Work
|
||||
====================
|
||||
|
||||
First and foremost, make sure you have the latest version of OPIE. The
|
||||
latest version is available by anonymous FTP at:
|
||||
Under NO circumstances should you send trouble reports directly to the
|
||||
authors or contributors. They WILL BE IGNORED.
|
||||
|
||||
ftp://ftp.nrl.navy.mil/pub/security/opie
|
||||
and
|
||||
ftp://ftp.inner.net/pub/opie
|
||||
Make sure you have the latest version of OPIE. The latest version is
|
||||
available by HTTP at:
|
||||
|
||||
http://www.inner.net/pub/opie
|
||||
|
||||
(sorry, but anonymous FTP is no longer available)
|
||||
|
||||
If you have installed the OPIE software (either through "make test"
|
||||
in (7) above or "make install" in (14)), you can run "make uninstall" from the
|
||||
@@ -194,7 +214,8 @@ installation procedure itself did not work properly.
|
||||
If you are running a release version, try installing the latest public
|
||||
test version (look around). These frequently have already fixed the problem
|
||||
you are seeing, but may have new problems of their own (that's why they're
|
||||
test versions!).
|
||||
test versions!). Similarly, if you are running a test version, try installing
|
||||
the latest released version.
|
||||
|
||||
OPIE is NOT supported software. We don't promise to support you or
|
||||
even to acknowledge your mail, but we are interested in bug reports and are
|
||||
@@ -233,7 +254,7 @@ Gotchas
|
||||
=======
|
||||
|
||||
Solaris 2.x is just a lose. It does a lot of nonstandard and downright
|
||||
broken things. If you want OPIE to be reliable on your box, upgrade to NetBSD
|
||||
broken things. If you want OPIE to be reliable on your box, upgrade to OpenBSD
|
||||
or Linux.
|
||||
|
||||
While an almost universal "feature", most people remain unaware that
|
||||
@@ -342,6 +363,25 @@ it puts them. The lock file directory must be a directory used only for OPIE
|
||||
lock files. It must be a directory, owned by the superuser, and must be mode
|
||||
0700.
|
||||
|
||||
opieauto is a potential security hole. It opens a limited window of
|
||||
exposure by transmitting and storing information that can be used to
|
||||
generate one or more OTPs earlier than the current sequence number. Every
|
||||
effort has been made to limit the potential for compromise to the user-
|
||||
specified window. However, an attacker with superuser priveleges or access to
|
||||
your account on the client system can still generate OTPs based on the
|
||||
information cached via opieauto. In practice, there are other ways for such an
|
||||
an attacker to get your entire secret pass phrase, so this is probably not
|
||||
creating a significant new security problem. However, because of this
|
||||
potential for problems and because opieauto uses system features that are not
|
||||
present on all systems, opieauto support is not compiled in by default and
|
||||
must be specifically enabled at compile time.
|
||||
|
||||
Many users are running OPIE with the key file on a shared NFS volume
|
||||
in order to use OTP as a single-login system for a cluster of machines. OPIE
|
||||
was NOT designed to be operated this way, though it does seem to work. If it
|
||||
fails or if this proves insecure, this is not OPIE's fault. Note that, if you
|
||||
do this, you probably want to share the OPIE lock files too.
|
||||
|
||||
Gripes
|
||||
======
|
||||
|
||||
@@ -355,14 +395,12 @@ are complying to some or other "standard." My (cmetz) conclusion is that the
|
||||
only thing that is standard about utmp and wtmp handling is that it will be
|
||||
nonstandard on any given system. I've tried a lot of things and I've wasted
|
||||
*a lot* of time on trying to make utmp and wtmp handling work for everybody;
|
||||
my conclusion is that it will never happen. I personally am willing to stand
|
||||
behind the code for utmp/wtmp handling on reasonable Linux and 4.4BSD-Lite
|
||||
systems. If it breaks, tell me and I will fix it. While I am still interested
|
||||
in hearing about fixes for other OSs, I'm not likely to go out of my way to fix
|
||||
utmp/wtmp handling on them. If you want it fixed, the best way to do it is to
|
||||
fix it yourself and give me a patch. As long as the patch is reasonable, I'll
|
||||
include it in the next release. If you can't wait, use the --disable-utmp
|
||||
option.
|
||||
my conclusion is that it will never happen. While I am still interested in
|
||||
hearing about fixes for utmp/wtmp on systems where they don't work, I'm not
|
||||
likely to go out of my way to fix utmp/wtmp handling. If you want it fixed,
|
||||
the best way to do it is to fix it yourself and contribute a patch. As long as
|
||||
the patch is reasonable, it will be included in the next release. If you can't
|
||||
wait, use the --disable-utmp option.
|
||||
|
||||
Credits
|
||||
=======
|
||||
@@ -396,23 +434,29 @@ community effort. These contributors include:
|
||||
Mowgli Assor
|
||||
Lawrie Brown
|
||||
Andrew Davis
|
||||
Taso N. Devetzis
|
||||
Carson Gaspar
|
||||
Dennis Glatting
|
||||
Ben Golding
|
||||
Axel Grewe
|
||||
"Hobbit"
|
||||
Kojima Hajime
|
||||
Darren Hosking
|
||||
Matt Hucke
|
||||
Matt Hucke
|
||||
Kenji Kamizono
|
||||
Charles Karney
|
||||
Jeff Kletsky
|
||||
Peter Koch
|
||||
Martijn Koster
|
||||
Osamu Kurati
|
||||
Ayamura Kikuchi
|
||||
Ronald van der Meer
|
||||
Bret Musser
|
||||
Hiroshi Nakano
|
||||
Ikuo Nakagawa
|
||||
Angelo Neri
|
||||
C. R. Oldham
|
||||
Ossama Othman
|
||||
D. Jason Penney
|
||||
John Perkins
|
||||
Steve Price
|
||||
@@ -429,7 +473,7 @@ City, Virginia.
|
||||
|
||||
If you have problems with OPIE, please follow the instructions under
|
||||
"If OPIE Doesn't Work." Under NO circumstances should you send trouble
|
||||
reports directly to the authors or contributors.
|
||||
reports directly to the authors or contributors. They WILL BE IGNORED.
|
||||
|
||||
Trademarks
|
||||
==========
|
||||
@@ -440,12 +484,12 @@ NRL is a trademark of the U. S. Naval Research Laboratory.
|
||||
All other trademarks are trademarks of their respective owners.
|
||||
|
||||
The term "OPIE" is in the public domain and hence cannot be legally
|
||||
trademarked by anyone.
|
||||
trademarked by anyone. Please do not abuse it.
|
||||
|
||||
Copyrights
|
||||
==========
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
|
||||
+76
-1
@@ -1,7 +1,7 @@
|
||||
/* acconfig.h: Extra commentary for Autoheader
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
@@ -117,6 +117,15 @@ you didn't get a copy, you may request one from <[email protected]>.
|
||||
/* Define if there is a ut_host field in struct utmp */
|
||||
#undef HAVE_UT_HOST
|
||||
|
||||
/* Define if there is a ut_id field in struct utmp */
|
||||
#undef HAVE_UT_ID
|
||||
|
||||
/* Define if there is a ut_syslen field in struct utmp */
|
||||
#undef HAVE_UT_SYSLEN
|
||||
|
||||
/* Define if there is a utx_syslen field in struct utmpx */
|
||||
#undef HAVE_UTX_SYSLEN
|
||||
|
||||
/* Define if the system has getutline() */
|
||||
#undef HAVE_GETUTLINE
|
||||
|
||||
@@ -149,3 +158,69 @@ you didn't get a copy, you may request one from <[email protected]>.
|
||||
|
||||
/* Defined if user locking is to be used */
|
||||
#undef USER_LOCKING
|
||||
|
||||
/* Defined if opieauto is to be used */
|
||||
#undef OPIEAUTO
|
||||
|
||||
/* Define if you have the atexit function. */
|
||||
#undef HAVE_ATEXIT
|
||||
|
||||
/* Define if you have the endutent function. */
|
||||
#undef HAVE_ENDUTENT
|
||||
|
||||
/* Define if you have the initgroups function. */
|
||||
#undef HAVE_INITGROUPS
|
||||
|
||||
/* Define if you have the memcmp function. */
|
||||
#undef HAVE_MEMCMP
|
||||
|
||||
/* Define if you have the memcpy function. */
|
||||
#undef HAVE_MEMCPY
|
||||
|
||||
/* Define if you have the memset function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define if you have the getenv function. */
|
||||
#undef HAVE_GETENV
|
||||
|
||||
/* Define if you have the getutline function. */
|
||||
#undef HAVE_GETUTLINE
|
||||
|
||||
/* Define if you have the pututline function. */
|
||||
#undef HAVE_PUTUTLINE
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define if you have the setegid function. */
|
||||
#undef HAVE_SETEGID
|
||||
|
||||
/* Define if you have the seteuid function. */
|
||||
#undef HAVE_SETEUID
|
||||
|
||||
/* Define if you have the setutent function. */
|
||||
#undef HAVE_SETUTENT
|
||||
|
||||
/* Define if you have the sigprocmask function. */
|
||||
#undef HAVE_SIGPROCMASK
|
||||
|
||||
/* Define if you have the strchr function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define if you have the strrchr function. */
|
||||
#undef HAVE_STRRCHR
|
||||
|
||||
/* Define if you have the strtoul function. */
|
||||
#undef HAVE_STRTOUL
|
||||
|
||||
/* Define if you have the sysconf function. */
|
||||
#undef HAVE_SYSCONF
|
||||
|
||||
/* Define if you have the uname function. */
|
||||
#undef HAVE_UNAME
|
||||
|
||||
/* Define if you have the unsetenv function. */
|
||||
#undef HAVE_UNSETENV
|
||||
@@ -1,379 +0,0 @@
|
||||
/* config.h. Generated automatically by configure. */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* #undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
/* #undef HAVE_ALLOCA_H */
|
||||
|
||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
||||
/* Define if the system does not provide POSIX.1 features except
|
||||
with this defined. */
|
||||
/* #undef _POSIX_1_SOURCE */
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define if you want the FTP daemon to support anonymous logins. */
|
||||
/* #undef DOANONYMOUS */
|
||||
|
||||
/* The default value of the PATH environment variable */
|
||||
#define DEFAULT_PATH "/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
|
||||
|
||||
/* Defined if the file /etc/default/login exists
|
||||
(and, presumably, should be looked at by login) */
|
||||
/* #undef HAVE_ETC_DEFAULT_LOGIN */
|
||||
|
||||
/* Defined to the name of a file that contains a list of files whose
|
||||
permissions and ownerships should be changed on login. */
|
||||
/* #undef HAVE_LOGIN_PERMFILE */
|
||||
|
||||
/* Defined to the name of a file that contains a list of environment
|
||||
values that should be set on login. */
|
||||
/* #undef HAVE_LOGIN_ENVFILE */
|
||||
|
||||
/* Defined if the file /etc/securetty exists
|
||||
(and, presumably, should be looked at by login) */
|
||||
/* #undef HAVE_SECURETTY */
|
||||
|
||||
/* Defined if the file /etc/shadow exists
|
||||
(and, presumably, should be looked at for shadow passwords) */
|
||||
/* #undef HAVE_ETC_SHADOW */
|
||||
|
||||
/* The path to the access file, if we're going to use it */
|
||||
/* #undef PATH_ACCESS_FILE */
|
||||
|
||||
/* The path to the mail spool, if we know it */
|
||||
#define PATH_MAIL "/var/mail"
|
||||
|
||||
/* The path to the utmp file, if we know it */
|
||||
#define PATH_UTMP_AC "/var/run/utmp"
|
||||
|
||||
/* The path to the wtmp file, if we know it */
|
||||
#define PATH_WTMP_AC "/var/log/wtmp"
|
||||
|
||||
/* The path to the wtmpx file, if we know it */
|
||||
/* #undef PATH_WTMPX_AC */
|
||||
|
||||
/* Defined if the system's profile (/etc/profile) displays
|
||||
the motd file */
|
||||
/* #undef HAVE_MOTD_IN_PROFILE */
|
||||
|
||||
/* Defined if the system's profile (/etc/profile) informs the
|
||||
user of new mail */
|
||||
/* #undef HAVE_MAILCHECK_IN_PROFILE */
|
||||
|
||||
/* Define if you have a nonstandard gettimeofday() that takes one argument
|
||||
instead of two. */
|
||||
/* #undef HAVE_ONE_ARG_GETTIMEOFDAY */
|
||||
|
||||
/* Define if the system has the getenv function */
|
||||
#define HAVE_GETENV 1
|
||||
|
||||
/* Define if the system has the setenv function */
|
||||
#define HAVE_SETENV 1
|
||||
|
||||
/* Define if the system has the /var/adm/sulog file */
|
||||
/* #undef HAVE_SULOG */
|
||||
|
||||
/* Define if the system has the unsetenv function */
|
||||
#define HAVE_UNSETENV 1
|
||||
|
||||
/* Define if the compiler can handle ANSI-style argument lists */
|
||||
#define HAVE_ANSIDECL 1
|
||||
|
||||
/* Define if the compiler can handle ANSI-style prototypes */
|
||||
#define HAVE_ANSIPROTO 1
|
||||
|
||||
/* Define if the system has an ANSI-style printf (returns int instead of char *) */
|
||||
#define HAVE_ANSISPRINTF 1
|
||||
|
||||
/* Define if the compiler can handle ANSI-style variable argument lists */
|
||||
#define HAVE_ANSISTDARG 1
|
||||
|
||||
/* Define if the compiler can handle void argument lists to functions */
|
||||
#define HAVE_VOIDARG 1
|
||||
|
||||
/* Define if the compiler can handle void return "values" from functions */
|
||||
#define HAVE_VOIDRET 1
|
||||
|
||||
/* Define if the compiler can handle void pointers to our liking */
|
||||
#define HAVE_VOIDPTR 1
|
||||
|
||||
/* Define if the /bin/ls command seems to support the -g flag */
|
||||
/* #undef HAVE_LS_G_FLAG */
|
||||
|
||||
/* Define if there is a ut_pid field in struct utmp */
|
||||
/* #undef HAVE_UT_PID */
|
||||
|
||||
/* Define if there is a ut_type field in struct utmp */
|
||||
/* #undef HAVE_UT_TYPE */
|
||||
|
||||
/* Define if there is a ut_name field in struct utmp */
|
||||
#define HAVE_UT_NAME 1
|
||||
|
||||
/* Define if there is a ut_host field in struct utmp */
|
||||
#define HAVE_UT_HOST 1
|
||||
|
||||
/* Define if the system has getutline() */
|
||||
/* #undef HAVE_GETUTLINE */
|
||||
|
||||
/* Defined if the system has SunOS C2 security shadow passwords */
|
||||
/* #undef HAVE_SUNOS_C2_SHADOW */
|
||||
|
||||
/* Defined if you want to disable utmp support */
|
||||
/* #undef DISABLE_UTMP */
|
||||
|
||||
/* Defined if you want to allow users to override the insecure checks */
|
||||
/* #undef INSECURE_OVERRIDE */
|
||||
|
||||
/* Defined to the default hash value, always defined */
|
||||
#define MDX 5
|
||||
|
||||
/* Defined if new-style prompts are to be used */
|
||||
#define NEW_PROMPTS 1
|
||||
|
||||
/* Defined to the path of the OPIE lock directory */
|
||||
#define OPIE_LOCK_DIR "/var/spool/opielocks"
|
||||
|
||||
/* Defined if users are to be asked to re-type secret pass phrases */
|
||||
/* #undef RETYPE */
|
||||
|
||||
/* Defined if su should not switch to disabled accounts */
|
||||
/* #undef SU_STAR_CHECK */
|
||||
|
||||
/* Defined if user locking is to be used */
|
||||
#define USER_LOCKING 1
|
||||
|
||||
/* Define if you have the bcopy function. */
|
||||
/* #undef HAVE_BCOPY */
|
||||
|
||||
/* Define if you have the bzero function. */
|
||||
/* #undef HAVE_BZERO */
|
||||
|
||||
/* Define if you have the endspent function. */
|
||||
/* #undef HAVE_ENDSPENT */
|
||||
|
||||
/* Define if you have the fpurge function. */
|
||||
#define HAVE_FPURGE 1
|
||||
|
||||
/* Define if you have the getdtablesize function. */
|
||||
/* #undef HAVE_GETDTABLESIZE */
|
||||
|
||||
/* Define if you have the getgroups function. */
|
||||
#define HAVE_GETGROUPS 1
|
||||
|
||||
/* Define if you have the gethostname function. */
|
||||
/* #undef HAVE_GETHOSTNAME */
|
||||
|
||||
/* Define if you have the getspnam function. */
|
||||
/* #undef HAVE_GETSPNAM */
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define if you have the getttynam function. */
|
||||
#define HAVE_GETTTYNAM 1
|
||||
|
||||
/* Define if you have the getusershell function. */
|
||||
#define HAVE_GETUSERSHELL 1
|
||||
|
||||
/* Define if you have the getutxline function. */
|
||||
/* #undef HAVE_GETUTXLINE */
|
||||
|
||||
/* Define if you have the getwd function. */
|
||||
/* #undef HAVE_GETWD */
|
||||
|
||||
/* Define if you have the index function. */
|
||||
/* #undef HAVE_INDEX */
|
||||
|
||||
/* Define if you have the lstat function. */
|
||||
#define HAVE_LSTAT 1
|
||||
|
||||
/* Define if you have the on_exit function. */
|
||||
/* #undef HAVE_ON_EXIT */
|
||||
|
||||
/* Define if you have the pututxline function. */
|
||||
/* #undef HAVE_PUTUTXLINE */
|
||||
|
||||
/* Define if you have the rindex function. */
|
||||
/* #undef HAVE_RINDEX */
|
||||
|
||||
/* Define if you have the setgroups function. */
|
||||
#define HAVE_SETGROUPS 1
|
||||
|
||||
/* Define if you have the setlogin function. */
|
||||
#define HAVE_SETLOGIN 1
|
||||
|
||||
/* Define if you have the setpriority function. */
|
||||
#define HAVE_SETPRIORITY 1
|
||||
|
||||
/* Define if you have the setregid function. */
|
||||
/* #undef HAVE_SETREGID */
|
||||
|
||||
/* Define if you have the setresgid function. */
|
||||
/* #undef HAVE_SETRESGID */
|
||||
|
||||
/* Define if you have the setresuid function. */
|
||||
/* #undef HAVE_SETRESUID */
|
||||
|
||||
/* Define if you have the setreuid function. */
|
||||
/* #undef HAVE_SETREUID */
|
||||
|
||||
/* Define if you have the setvbuf function. */
|
||||
#define HAVE_SETVBUF 1
|
||||
|
||||
/* Define if you have the sigaddset function. */
|
||||
#define HAVE_SIGADDSET 1
|
||||
|
||||
/* Define if you have the sigblock function. */
|
||||
/* #undef HAVE_SIGBLOCK */
|
||||
|
||||
/* Define if you have the sigemptyset function. */
|
||||
#define HAVE_SIGEMPTYSET 1
|
||||
|
||||
/* Define if you have the sigsetmask function. */
|
||||
/* #undef HAVE_SIGSETMASK */
|
||||
|
||||
/* Define if you have the socket function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the strftime function. */
|
||||
#define HAVE_STRFTIME 1
|
||||
|
||||
/* Define if you have the strncasecmp function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define if you have the ttyslot function. */
|
||||
#define HAVE_TTYSLOT 1
|
||||
|
||||
/* Define if you have the usleep function. */
|
||||
#define HAVE_USLEEP 1
|
||||
|
||||
/* Define if you have the <crypt.h> header file. */
|
||||
/* #undef HAVE_CRYPT_H */
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#define HAVE_DIRENT_H 1
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <lastlog.h> header file. */
|
||||
/* #undef HAVE_LASTLOG_H */
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
/* #undef HAVE_NDIR_H */
|
||||
|
||||
/* Define if you have the <paths.h> header file. */
|
||||
#define HAVE_PATHS_H 1
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
#define HAVE_PWD_H 1
|
||||
|
||||
/* Define if you have the <shadow.h> header file. */
|
||||
/* #undef HAVE_SHADOW_H */
|
||||
|
||||
/* Define if you have the <signal.h> header file. */
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
/* #undef HAVE_SYS_DIR_H */
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#define HAVE_SYS_FILE_H 1
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
/* #undef HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define if you have the <sys/signal.h> header file. */
|
||||
#define HAVE_SYS_SIGNAL_H 1
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define if you have the <sys/utsname.h> header file. */
|
||||
#define HAVE_SYS_UTSNAME_H 1
|
||||
|
||||
/* Define if you have the <syslog.h> header file. */
|
||||
#define HAVE_SYSLOG_H 1
|
||||
|
||||
/* Define if you have the <termios.h> header file. */
|
||||
#define HAVE_TERMIOS_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you have the <utmpx.h> header file. */
|
||||
/* #undef HAVE_UTMPX_H */
|
||||
|
||||
/* Define if you have the crypt library (-lcrypt). */
|
||||
#define HAVE_LIBCRYPT 1
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
/* #undef HAVE_LIBNSL */
|
||||
|
||||
/* Define if you have the posix library (-lposix). */
|
||||
/* #undef HAVE_LIBPOSIX */
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
/* #undef HAVE_LIBSOCKET */
|
||||
@@ -149,6 +149,12 @@
|
||||
/* Define if there is a ut_host field in struct utmp */
|
||||
#undef HAVE_UT_HOST
|
||||
|
||||
/* Define if there is a ut_id field in struct utmp */
|
||||
#undef HAVE_UT_ID
|
||||
|
||||
/* Define if there is a utx_syslen field in struct utmpx */
|
||||
#undef HAVE_UTX_SYSLEN
|
||||
|
||||
/* Define if the system has getutline() */
|
||||
#undef HAVE_GETUTLINE
|
||||
|
||||
@@ -158,6 +164,9 @@
|
||||
/* Defined if you want to disable utmp support */
|
||||
#undef DISABLE_UTMP
|
||||
|
||||
/* Defined if you want to disable wtmp support */
|
||||
#undef DISABLE_WTMP
|
||||
|
||||
/* Defined if you want to allow users to override the insecure checks */
|
||||
#undef INSECURE_OVERRIDE
|
||||
|
||||
@@ -176,6 +185,72 @@
|
||||
/* Defined if su should not switch to disabled accounts */
|
||||
#undef SU_STAR_CHECK
|
||||
|
||||
/* Defined if opieauto is to be used */
|
||||
#undef OPIEAUTO
|
||||
|
||||
/* Define if you have the atexit function. */
|
||||
#undef HAVE_ATEXIT
|
||||
|
||||
/* Define if you have the endutent function. */
|
||||
#undef HAVE_ENDUTENT
|
||||
|
||||
/* Define if you have the initgroups function. */
|
||||
#undef HAVE_INITGROUPS
|
||||
|
||||
/* Define if you have the memcmp function. */
|
||||
#undef HAVE_MEMCMP
|
||||
|
||||
/* Define if you have the memcpy function. */
|
||||
#undef HAVE_MEMCPY
|
||||
|
||||
/* Define if you have the memset function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define if you have the getenv function. */
|
||||
#undef HAVE_GETENV
|
||||
|
||||
/* Define if you have the getutline function. */
|
||||
#undef HAVE_GETUTLINE
|
||||
|
||||
/* Define if you have the pututline function. */
|
||||
#undef HAVE_PUTUTLINE
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define if you have the setegid function. */
|
||||
#undef HAVE_SETEGID
|
||||
|
||||
/* Define if you have the seteuid function. */
|
||||
#undef HAVE_SETEUID
|
||||
|
||||
/* Define if you have the setutent function. */
|
||||
#undef HAVE_SETUTENT
|
||||
|
||||
/* Define if you have the sigprocmask function. */
|
||||
#undef HAVE_SIGPROCMASK
|
||||
|
||||
/* Define if you have the strchr function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define if you have the strrchr function. */
|
||||
#undef HAVE_STRRCHR
|
||||
|
||||
/* Define if you have the strtoul function. */
|
||||
#undef HAVE_STRTOUL
|
||||
|
||||
/* Define if you have the sysconf function. */
|
||||
#undef HAVE_SYSCONF
|
||||
|
||||
/* Define if you have the uname function. */
|
||||
#undef HAVE_UNAME
|
||||
|
||||
/* Define if you have the unsetenv function. */
|
||||
#undef HAVE_UNSETENV
|
||||
|
||||
/* Define if you have the bcopy function. */
|
||||
#undef HAVE_BCOPY
|
||||
|
||||
|
||||
Vendored
+635
-310
File diff suppressed because it is too large.
Load diff
+43
-23
@@ -1,7 +1,7 @@
|
||||
dnl configure.in: Input for Autoconf
|
||||
dnl
|
||||
dnl %%% portions-copyright-cmetz-96
|
||||
dnl Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
dnl Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
dnl Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
dnl the software.
|
||||
dnl You should have received a copy of the license with this software. If
|
||||
@@ -14,6 +14,11 @@ dnl License Agreement applies to this software.
|
||||
dnl
|
||||
dnl History:
|
||||
dnl
|
||||
dnl Modified by cmetz for OPIE 2.4. Add --enable-opieauto option. Check
|
||||
dnl for ut_id and ut_syslen. Make disable-wtmp disable wtmp not utmp.
|
||||
dnl Define HAVE_foo if foo is found by the libmissing function check.
|
||||
dnl Added checks for libmissing functions that were there but never
|
||||
dnl actually checked for and therefore available.
|
||||
dnl Modified by cmetz for OPIE 2.32. Substitute default for LOCK_DIR.
|
||||
dnl Fix the --disable-user-locking bug. AC_DEFINE variables to 1.
|
||||
dnl Really check for ut_host.
|
||||
@@ -72,9 +77,11 @@ AC_ARG_ENABLE(su-star-check, [ --enable-su-star-check Refuse to switch to disa
|
||||
AC_ARG_ENABLE(new-prompts, [ --disable-new-prompts Use more compatible (but less informative) prompts],, AC_DEFINE(NEW_PROMPTS, 1))
|
||||
AC_ARG_ENABLE(insecure-override, [ --enable-insecure-override
|
||||
Allow users to override insecure checks], AC_DEFINE(INSECURE_OVERRIDE, 1))
|
||||
AC_ARG_ENABLE(anonymous-ftp, [ --enable-anonymous-ftp Enable anonymous FTP support], AC_DEFINE(DOANONYMOUS, 1) echo "Enabling anonymous FTP support in ftp -- don't say we didn't warn you!")
|
||||
AC_ARG_ENABLE(utmp, [ --disable-utmp Disable utmp logging], AC_DEFINE(DISABLE_UTMP, 1) echo "Disabling utmp logging")
|
||||
AC_ARG_ENABLE(wtmp, [ --disable-wtmp Disable wtmp logging], AC_DEFINE(DISABLE_UTMP, 1) echo "Disabling wtmp logging")
|
||||
AC_ARG_ENABLE(anonymous-ftp, [ --enable-anonymous-ftp Enable anonymous FTP support], AC_DEFINE(DOANONYMOUS, 1) echo "enabling anonymous FTP support in ftp -- don't say we didn't warn you!")
|
||||
AC_ARG_ENABLE(utmp, [ --disable-utmp Disable utmp logging], AC_DEFINE(DISABLE_UTMP, 1) echo "disabling utmp logging")
|
||||
AC_ARG_ENABLE(wtmp, [ --disable-wtmp Disable wtmp logging], AC_DEFINE(DISABLE_WTMP, 1) echo "disabling wtmp logging")
|
||||
AC_ARG_ENABLE(opieauto, [ --enable-opieauto Enable support for opieauto], AC_DEFINE(OPIEAUTO, 1) OPIEAUTO=opieauto; echo "enabling opieauto support")
|
||||
AC_SUBST(OPIEAUTO)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
@@ -484,6 +491,15 @@ dnl #include <utmp.h>], [struct utmp foo; return (int)foo.ut_user[0];], AC_DEFIN
|
||||
AC_MSG_CHECKING(for ut_host in struct utmp)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <utmp.h>], [struct utmp foo; return (int)foo.ut_host[0];], AC_DEFINE(HAVE_UT_HOST) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
|
||||
AC_MSG_CHECKING(for ut_id in struct utmp)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <utmp.h>], [struct utmp foo; return (int)foo.ut_id[0];], AC_DEFINE(HAVE_UT_ID) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
|
||||
#AC_MSG_CHECKING(for ut_syslen in struct utmp)
|
||||
#AC_TRY_COMPILE([#include <sys/types.h>
|
||||
##include <utmp.h>], [struct utmp foo; return (int)foo.ut_syslen;], AC_DEFINE(HAVE_UT_SYSLEN) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
|
||||
AC_MSG_CHECKING(for ut_syslen in struct utmpx)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <utmpx.h>], [struct utmpx foo; return (int)foo.ut_syslen;], AC_DEFINE(HAVE_UTX_SYSLEN) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
|
||||
|
||||
dnl Checks for library functions.
|
||||
dnl AC_PROG_GCC_TRADITIONAL
|
||||
@@ -495,25 +511,29 @@ AC_FUNC_MEMCMP
|
||||
AC_FUNC_ALLOCA
|
||||
AC_REPLACE_FUNCS(getusershell sigaddset sigemptyset strerror strncasecmp)
|
||||
MISSING="$LIBOBJS $ALLOCA " ;
|
||||
AC_CHECK_FUNC(atexit,, MISSING="${MISSING}atexit.o "; AC_CHECK_FUNCS(on_exit))
|
||||
AC_CHECK_FUNC(endutent,, MISSING="${MISSING}endutent.o ")
|
||||
AC_CHECK_FUNC(memcpy,, MISSING="${MISSING}memcpy.o "; AC_CHECK_FUNCS(bcopy))
|
||||
AC_CHECK_FUNC(memset,, MISSING="${MISSING}memset.o "; AC_CHECK_FUNCS(bzero))
|
||||
AC_CHECK_FUNC(getcwd,, MISSING="${MISSING}getcwd.o "; AC_CHECK_FUNCS(getwd))
|
||||
AC_CHECK_FUNC(getenv, AC_DEFINE(HAVE_GETENV), MISSING="${MISSING}env.o ")
|
||||
AC_CHECK_FUNC(getutline, AC_DEFINE(HAVE_GETUTLINE), MISSING="${MISSING}getutline.o "; AC_CHECK_FUNCS(ttyslot))
|
||||
AC_CHECK_FUNC(pututline,, MISSING="${MISSING}pututline.o "; AC_CHECK_FUNCS(ttyslot))
|
||||
AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV), MISSING="${MISSING}env.o ")
|
||||
AC_CHECK_FUNC(setegid,, MISSING="${MISSING}setegid.o "; AC_CHECK_FUNCS(setregid setresgid))
|
||||
AC_CHECK_FUNC(seteuid,, MISSING="${MISSING}seteuid.o "; AC_CHECK_FUNCS(setreuid setresuid))
|
||||
AC_CHECK_FUNC(setutent,, MISSING="${MISSING}setutent.o ")
|
||||
AC_CHECK_FUNC(sigprocmask,, MISSING="${MISSING}sigprocmask.o "; AC_CHECK_FUNCS(sigblock sigsetmask))
|
||||
AC_CHECK_FUNC(strchr,, MISSING="${MISSING}strchr.o "; AC_CHECK_FUNCS(index))
|
||||
AC_CHECK_FUNC(strrchr,, MISSING="${MISSING}strrchr.o "; AC_CHECK_FUNCS(rindex))
|
||||
AC_CHECK_FUNC(strtoul,, MISSING="${MISSING}strtoul.o ")
|
||||
AC_CHECK_FUNC(sysconf,, MISSING="${MISSING}sysconf.o "; AC_CHECK_FUNCS(getdtablesize))
|
||||
AC_CHECK_FUNC(uname,, MISSING="${MISSING}uname.o "; AC_CHECK_FUNCS(gethostname))
|
||||
AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV), MISSING="${MISSING}env.o ")
|
||||
|
||||
dnl These should be simplified by a macro
|
||||
AC_CHECK_FUNC(atexit, AC_DEFINE(HAVE_ATEXIT), MISSING="${MISSING}atexit.o "; AC_CHECK_FUNCS(on_exit))
|
||||
AC_CHECK_FUNC(endutent, AC_DEFINE(HAVE_ENDUTENT), MISSING="${MISSING}endutent.o ")
|
||||
AC_CHECK_FUNC(initgroups, AC_DEFINE(HAVE_INITGROUPS), MISSING="${MISSING}initgroups.o ")
|
||||
AC_CHECK_FUNC(memcmp, AC_DEFINE(HAVE_MEMCMP), MISSING="${MISSING}memcmp.o ")
|
||||
AC_CHECK_FUNC(memcpy, AC_DEFINE(HAVE_MEMCPY), MISSING="${MISSING}memcpy.o "; AC_CHECK_FUNCS(bcopy))
|
||||
AC_CHECK_FUNC(memset, AC_DEFINE(HAVE_MEMSET), MISSING="${MISSING}memset.o "; AC_CHECK_FUNCS(bzero))
|
||||
AC_CHECK_FUNC(getcwd, AC_DEFINE(HAVE_GETCWD), MISSING="${MISSING}getcwd.o "; AC_CHECK_FUNCS(getwd))
|
||||
AC_CHECK_FUNC(getenv, AC_DEFINE(HAVE_GETENV), MISSING="${MISSING}env.o ")
|
||||
AC_CHECK_FUNC(getutline, AC_DEFINE(HAVE_GETUTLINE), MISSING="${MISSING}getutline.o "; AC_CHECK_FUNCS(ttyslot))
|
||||
AC_CHECK_FUNC(pututline, AC_DEFINE(HAVE_PUTUTLINE), MISSING="${MISSING}pututline.o "; AC_CHECK_FUNCS(ttyslot))
|
||||
AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV), MISSING="${MISSING}env.o ")
|
||||
AC_CHECK_FUNC(setegid, AC_DEFINE(HAVE_SETEGID), MISSING="${MISSING}setegid.o "; AC_CHECK_FUNCS(setregid setresgid))
|
||||
AC_CHECK_FUNC(seteuid, AC_DEFINE(HAVE_SETEUID), MISSING="${MISSING}seteuid.o "; AC_CHECK_FUNCS(setreuid setresuid))
|
||||
AC_CHECK_FUNC(setutent, AC_DEFINE(HAVE_SETUTENT), MISSING="${MISSING}setutent.o ")
|
||||
AC_CHECK_FUNC(sigprocmask, AC_DEFINE(HAVE_SIGPROCMASK), MISSING="${MISSING}sigprocmask.o "; AC_CHECK_FUNCS(sigblock sigsetmask))
|
||||
AC_CHECK_FUNC(strchr, AC_DEFINE(HAVE_STRCHR), MISSING="${MISSING}strchr.o "; AC_CHECK_FUNCS(index))
|
||||
AC_CHECK_FUNC(strrchr, AC_DEFINE(HAVE_STRRCHR), MISSING="${MISSING}strrchr.o "; AC_CHECK_FUNCS(rindex))
|
||||
AC_CHECK_FUNC(strtoul, AC_DEFINE(HAVE_STRTOUL), MISSING="${MISSING}strtoul.o ")
|
||||
AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF), MISSING="${MISSING}sysconf.o "; AC_CHECK_FUNCS(getdtablesize))
|
||||
AC_CHECK_FUNC(uname, AC_DEFINE(HAVE_UNAME), MISSING="${MISSING}uname.o "; AC_CHECK_FUNCS(gethostname))
|
||||
AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV), MISSING="${MISSING}env.o ")
|
||||
AC_SUBST(MISSING)
|
||||
|
||||
AC_MSG_CHECKING(for nonstandard gettimeofday)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ftpcmd.y: yacc parser for the FTP daemon.
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
@@ -9,6 +9,7 @@ you didn't get a copy, you may request one from <[email protected]>.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.4. Use DOTITLE rather than SETPROCTITLE.
|
||||
Modified by cmetz for OPIE 2.3. Moved LS_COMMAND here.
|
||||
Modified by cmetz for OPIE 2.2. Fixed a *lot* of warnings.
|
||||
Use FUNCTION declaration et al. Removed useless strings.
|
||||
@@ -964,10 +965,10 @@ int yylex FUNCTION_NOARGS
|
||||
dologout(0);
|
||||
}
|
||||
(void) alarm(0);
|
||||
#ifdef SETPROCTITLE
|
||||
#if DOTITLE
|
||||
if (strncasecmp(cbuf, "PASS", 4) != NULL)
|
||||
setproctitle("%s: %s", proctitle, cbuf);
|
||||
#endif /* SETPROCTITLE */
|
||||
#endif /* DOTITLE */
|
||||
if ((cp = strchr(cbuf, '\r'))) {
|
||||
*cp++ = '\n';
|
||||
*cp = '\0';
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
/* glob.c: The csh et al glob pattern matching routines.
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
|
||||
@@ -2,29 +2,33 @@
|
||||
# Makefile.in/Makefile: Directions for building libmissing.
|
||||
#
|
||||
# %%% copyright-cmetz-96
|
||||
# This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
# The Inner Net License Version 2 applies to this software.
|
||||
# This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
# The Inner Net License Version 3 applies to this software.
|
||||
# You should have received a copy of the license with this software. If
|
||||
# you didn't get a copy, you may request one from <[email protected]>.
|
||||
#
|
||||
# History:
|
||||
#
|
||||
# Modified by cmetz for OPIE 2.4. Add current dir to include header path.
|
||||
# Use ar 'cr' instead of 'r'. Renamed realclean to distclean.
|
||||
# Created by cmetz for OPIE 2.3 using old Makefiles as a guide.
|
||||
|
||||
OBJS=bogus.o @MISSING@
|
||||
|
||||
CC=@CC@
|
||||
CFLAGS=$(CFL) -I..
|
||||
CFLAGS=$(CFL) -I.. -I.
|
||||
TARGET=libmissing.a
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
ar r $(TARGET) $(OBJS)
|
||||
ar cr $(TARGET) $(OBJS)
|
||||
@RANLIB@ $(TARGET)
|
||||
|
||||
clean:
|
||||
-rm -f $(OBJS) $(TARGET)
|
||||
|
||||
realclean: clean
|
||||
realclean: distclean
|
||||
|
||||
distclean: clean
|
||||
-rm -f *~ core* "\#*\#" *.o *.a Makefile
|
||||
@@ -0,0 +1,494 @@
|
||||
/* alloca.c -- allocate automatically reclaimed memory
|
||||
(Mostly) portable public-domain implementation -- D A Gwyn
|
||||
|
||||
This implementation of the PWB library alloca function,
|
||||
which is used to allocate space off the run-time stack so
|
||||
that it is automatically reclaimed upon procedure exit,
|
||||
was inspired by discussions with J. Q. Johnson of Cornell.
|
||||
J.Otto Tennant <jot@cray.com> contributed the Cray support.
|
||||
|
||||
There are some preprocessor constants that can
|
||||
be defined when compiling for your specific system, for
|
||||
improved efficiency; however, the defaults should be okay.
|
||||
|
||||
The general concept of this implementation is to keep
|
||||
track of all alloca-allocated blocks, and reclaim any
|
||||
that are found to be deeper in the stack than the current
|
||||
invocation. This heuristic does not reclaim storage as
|
||||
soon as it becomes invalid, but it will do so eventually.
|
||||
|
||||
As a special case, alloca(0) reclaims storage without
|
||||
allocating any. It is a good idea to use alloca(0) in
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef emacs
|
||||
#include "blockinput.h"
|
||||
#endif
|
||||
|
||||
/* If compiling with GCC 2, this file's not needed. */
|
||||
#if !defined (__GNUC__) || __GNUC__ < 2
|
||||
|
||||
/* If someone has defined alloca as a macro,
|
||||
there must be some other way alloca is supposed to work. */
|
||||
#ifndef alloca
|
||||
|
||||
#ifdef emacs
|
||||
#ifdef static
|
||||
/* actually, only want this if static is defined as ""
|
||||
-- this is for usg, in which emacs must undefine static
|
||||
in order to make unexec workable
|
||||
*/
|
||||
#ifndef STACK_DIRECTION
|
||||
you
|
||||
lose
|
||||
-- must know STACK_DIRECTION at compile-time
|
||||
#endif /* STACK_DIRECTION undefined */
|
||||
#endif /* static */
|
||||
#endif /* emacs */
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
#else
|
||||
#define ADDRESS_FUNCTION(arg) &(arg)
|
||||
#endif
|
||||
|
||||
#if __STDC__
|
||||
typedef void *pointer;
|
||||
#else
|
||||
typedef char *pointer;
|
||||
#endif
|
||||
|
||||
#define NULL 0
|
||||
|
||||
/* Different portions of Emacs need to call different versions of
|
||||
malloc. The Emacs executable needs alloca to call xmalloc, because
|
||||
ordinary malloc isn't protected from input signals. On the other
|
||||
hand, the utilities in lib-src need alloca to call malloc; some of
|
||||
them are very simple, and don't have an xmalloc routine.
|
||||
|
||||
Non-Emacs programs expect this to call use xmalloc.
|
||||
|
||||
Callers below should use malloc. */
|
||||
|
||||
#if 0
|
||||
#ifndef emacs
|
||||
#define malloc xmalloc
|
||||
#endif
|
||||
extern pointer malloc ();
|
||||
#endif /* 0 */
|
||||
|
||||
/* Define STACK_DIRECTION if you know the direction of stack
|
||||
growth for your system; otherwise it will be automatically
|
||||
deduced at run-time.
|
||||
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
|
||||
#ifndef STACK_DIRECTION
|
||||
#define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
#endif
|
||||
|
||||
#if STACK_DIRECTION != 0
|
||||
|
||||
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
#else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
#define STACK_DIR stack_dir
|
||||
|
||||
static void
|
||||
find_stack_direction ()
|
||||
{
|
||||
static char *addr = NULL; /* Address of first `dummy', once known. */
|
||||
auto char dummy; /* To get stack address. */
|
||||
|
||||
if (addr == NULL)
|
||||
{ /* Initial entry. */
|
||||
addr = ADDRESS_FUNCTION (dummy);
|
||||
|
||||
find_stack_direction (); /* Recurse once. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second entry. */
|
||||
if (ADDRESS_FUNCTION (dummy) > addr)
|
||||
stack_dir = 1; /* Stack grew upward. */
|
||||
else
|
||||
stack_dir = -1; /* Stack grew downward. */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/* An "alloca header" is used to:
|
||||
(a) chain together all alloca'ed blocks;
|
||||
(b) keep track of stack depth.
|
||||
|
||||
It is very important that sizeof(header) agree with malloc
|
||||
alignment chunk size. The following default should work okay. */
|
||||
|
||||
#ifndef ALIGN_SIZE
|
||||
#define ALIGN_SIZE sizeof(double)
|
||||
#endif
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
||||
struct
|
||||
{
|
||||
union hdr *next; /* For chaining headers. */
|
||||
char *deep; /* For stack depth measure. */
|
||||
} h;
|
||||
} header;
|
||||
|
||||
static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||
|
||||
/* Return a pointer to at least SIZE bytes of storage,
|
||||
which will be automatically reclaimed upon exit from
|
||||
the procedure that called alloca. Originally, this space
|
||||
was supposed to be taken from the current stack frame of the
|
||||
caller, but that method cannot be made to work for some
|
||||
implementations of C, for example under Gould's UTX/32. */
|
||||
|
||||
pointer
|
||||
alloca (size)
|
||||
unsigned size;
|
||||
{
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
#if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
find_stack_direction ();
|
||||
#endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
|
||||
{
|
||||
register header *hp; /* Traverses linked list. */
|
||||
|
||||
#ifdef emacs
|
||||
BLOCK_INPUT;
|
||||
#endif
|
||||
|
||||
for (hp = last_alloca_header; hp != NULL;)
|
||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
||||
{
|
||||
register header *np = hp->h.next;
|
||||
|
||||
free ((pointer) hp); /* Collect garbage. */
|
||||
|
||||
hp = np; /* -> next header. */
|
||||
}
|
||||
else
|
||||
break; /* Rest are not deeper. */
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
#ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return NULL; /* No allocation required. */
|
||||
|
||||
/* Allocate combined header + user data storage. */
|
||||
|
||||
{
|
||||
register pointer new = malloc (sizeof (header) + size);
|
||||
/* Address of header. */
|
||||
|
||||
((header *) new)->h.next = last_alloca_header;
|
||||
((header *) new)->h.deep = depth;
|
||||
|
||||
last_alloca_header = (header *) new;
|
||||
|
||||
/* User storage begins just after header. */
|
||||
|
||||
return (pointer) ((char *) new + sizeof (header));
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef CRAY_STACK
|
||||
#define CRAY_STACK
|
||||
#ifndef CRAY2
|
||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||
struct stack_control_header
|
||||
{
|
||||
long shgrow:32; /* Number of times stack has grown. */
|
||||
long shaseg:32; /* Size of increments to stack. */
|
||||
long shhwm:32; /* High water mark of stack. */
|
||||
long shsize:32; /* Current size of stack (all segments). */
|
||||
};
|
||||
|
||||
/* The stack segment linkage control information occurs at
|
||||
the high-address end of a stack segment. (The stack
|
||||
grows from low addresses to high addresses.) The initial
|
||||
part of the stack segment linkage control information is
|
||||
0200 (octal) words. This provides for register storage
|
||||
for the routine which overflows the stack. */
|
||||
|
||||
struct stack_segment_linkage
|
||||
{
|
||||
long ss[0200]; /* 0200 overflow words. */
|
||||
long sssize:32; /* Number of words in this segment. */
|
||||
long ssbase:32; /* Offset to stack base. */
|
||||
long:32;
|
||||
long sspseg:32; /* Offset to linkage control of previous
|
||||
segment of stack. */
|
||||
long:32;
|
||||
long sstcpt:32; /* Pointer to task common address block. */
|
||||
long sscsnm; /* Private control structure number for
|
||||
microtasking. */
|
||||
long ssusr1; /* Reserved for user. */
|
||||
long ssusr2; /* Reserved for user. */
|
||||
long sstpid; /* Process ID for pid based multi-tasking. */
|
||||
long ssgvup; /* Pointer to multitasking thread giveup. */
|
||||
long sscray[7]; /* Reserved for Cray Research. */
|
||||
long ssa0;
|
||||
long ssa1;
|
||||
long ssa2;
|
||||
long ssa3;
|
||||
long ssa4;
|
||||
long ssa5;
|
||||
long ssa6;
|
||||
long ssa7;
|
||||
long sss0;
|
||||
long sss1;
|
||||
long sss2;
|
||||
long sss3;
|
||||
long sss4;
|
||||
long sss5;
|
||||
long sss6;
|
||||
long sss7;
|
||||
};
|
||||
|
||||
#else /* CRAY2 */
|
||||
/* The following structure defines the vector of words
|
||||
returned by the STKSTAT library routine. */
|
||||
struct stk_stat
|
||||
{
|
||||
long now; /* Current total stack size. */
|
||||
long maxc; /* Amount of contiguous space which would
|
||||
be required to satisfy the maximum
|
||||
stack demand to date. */
|
||||
long high_water; /* Stack high-water mark. */
|
||||
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
|
||||
long hits; /* Number of internal buffer hits. */
|
||||
long extends; /* Number of block extensions. */
|
||||
long stko_mallocs; /* Block allocations by $STKOFEN. */
|
||||
long underflows; /* Number of stack underflow calls ($STKRETN). */
|
||||
long stko_free; /* Number of deallocations by $STKRETN. */
|
||||
long stkm_free; /* Number of deallocations by $STKMRET. */
|
||||
long segments; /* Current number of stack segments. */
|
||||
long maxs; /* Maximum number of stack segments so far. */
|
||||
long pad_size; /* Stack pad size. */
|
||||
long current_address; /* Current stack segment address. */
|
||||
long current_size; /* Current stack segment size. This
|
||||
number is actually corrupted by STKSTAT to
|
||||
include the fifteen word trailer area. */
|
||||
long initial_address; /* Address of initial segment. */
|
||||
long initial_size; /* Size of initial segment. */
|
||||
};
|
||||
|
||||
/* The following structure describes the data structure which trails
|
||||
any stack segment. I think that the description in 'asdef' is
|
||||
out of date. I only describe the parts that I am sure about. */
|
||||
|
||||
struct stk_trailer
|
||||
{
|
||||
long this_address; /* Address of this block. */
|
||||
long this_size; /* Size of this block (does not include
|
||||
this trailer). */
|
||||
long unknown2;
|
||||
long unknown3;
|
||||
long link; /* Address of trailer block of previous
|
||||
segment. */
|
||||
long unknown5;
|
||||
long unknown6;
|
||||
long unknown7;
|
||||
long unknown8;
|
||||
long unknown9;
|
||||
long unknown10;
|
||||
long unknown11;
|
||||
long unknown12;
|
||||
long unknown13;
|
||||
long unknown14;
|
||||
};
|
||||
|
||||
#endif /* CRAY2 */
|
||||
#endif /* not CRAY_STACK */
|
||||
|
||||
#ifdef CRAY2
|
||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||
I doubt that "lint" will like this much. */
|
||||
|
||||
static long
|
||||
i00afunc (long *address)
|
||||
{
|
||||
struct stk_stat status;
|
||||
struct stk_trailer *trailer;
|
||||
long *block, size;
|
||||
long result = 0;
|
||||
|
||||
/* We want to iterate through all of the segments. The first
|
||||
step is to get the stack status structure. We could do this
|
||||
more quickly and more directly, perhaps, by referencing the
|
||||
$LM00 common block, but I know that this works. */
|
||||
|
||||
STKSTAT (&status);
|
||||
|
||||
/* Set up the iteration. */
|
||||
|
||||
trailer = (struct stk_trailer *) (status.current_address
|
||||
+ status.current_size
|
||||
- 15);
|
||||
|
||||
/* There must be at least one stack segment. Therefore it is
|
||||
a fatal error if "trailer" is null. */
|
||||
|
||||
if (trailer == 0)
|
||||
abort ();
|
||||
|
||||
/* Discard segments that do not contain our argument address. */
|
||||
|
||||
while (trailer != 0)
|
||||
{
|
||||
block = (long *) trailer->this_address;
|
||||
size = trailer->this_size;
|
||||
if (block == 0 || size == 0)
|
||||
abort ();
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
if ((block <= address) && (address < (block + size)))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set the result to the offset in this segment and add the sizes
|
||||
of all predecessor segments. */
|
||||
|
||||
result = address - block;
|
||||
|
||||
if (trailer == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (trailer->this_size <= 0)
|
||||
abort ();
|
||||
result += trailer->this_size;
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
}
|
||||
while (trailer != 0);
|
||||
|
||||
/* We are done. Note that if you present a bogus address (one
|
||||
not in any segment), you will get a different number back, formed
|
||||
from subtracting the address of the first block. This is probably
|
||||
not what you want. */
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
#else /* not CRAY2 */
|
||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||
Determine the number of the cell within the stack,
|
||||
given the address of the cell. The purpose of this
|
||||
routine is to linearize, in some sense, stack addresses
|
||||
for alloca. */
|
||||
|
||||
static long
|
||||
i00afunc (long address)
|
||||
{
|
||||
long stkl = 0;
|
||||
|
||||
long size, pseg, this_segment, stack;
|
||||
long result = 0;
|
||||
|
||||
struct stack_segment_linkage *ssptr;
|
||||
|
||||
/* Register B67 contains the address of the end of the
|
||||
current stack segment. If you (as a subprogram) store
|
||||
your registers on the stack and find that you are past
|
||||
the contents of B67, you have overflowed the segment.
|
||||
|
||||
B67 also points to the stack segment linkage control
|
||||
area, which is what we are really interested in. */
|
||||
|
||||
stkl = CRAY_STACKSEG_END ();
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
|
||||
/* If one subtracts 'size' from the end of the segment,
|
||||
one has the address of the first word of the segment.
|
||||
|
||||
If this is not the first segment, 'pseg' will be
|
||||
nonzero. */
|
||||
|
||||
pseg = ssptr->sspseg;
|
||||
size = ssptr->sssize;
|
||||
|
||||
this_segment = stkl - size;
|
||||
|
||||
/* It is possible that calling this routine itself caused
|
||||
a stack overflow. Discard stack segments which do not
|
||||
contain the target address. */
|
||||
|
||||
while (!(this_segment <= address && address <= stkl))
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||
#endif
|
||||
if (pseg == 0)
|
||||
break;
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
this_segment = stkl - size;
|
||||
}
|
||||
|
||||
result = address - this_segment;
|
||||
|
||||
/* If you subtract pseg from the current end of the stack,
|
||||
you get the address of the previous stack segment's end.
|
||||
This seems a little convoluted to me, but I'll bet you save
|
||||
a cycle somewhere. */
|
||||
|
||||
while (pseg != 0)
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||
#endif
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
result += size;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
#endif /* not CRAY2 */
|
||||
#endif /* CRAY */
|
||||
|
||||
#endif /* no alloca */
|
||||
#endif /* not GCC version 2 */
|
||||
@@ -1,8 +1,8 @@
|
||||
/* endutent.c: A replacement for the endutent function
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
/* env.c: Replacement environment handling functions.
|
||||
|
||||
%%% portions-copyright-cmetz
|
||||
Portions of this software are Copyright 1996 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
Portions of this software are Copyright 1995 by Randall Atkinson and Dan
|
||||
McDonald, All Rights Reserved. All Rights under this copyright are assigned
|
||||
to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
|
||||
License Agreement applies to this software.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.2. Changed ifdefs for libmissing.
|
||||
Combined all env functions and made _findenv static.
|
||||
Including headers is a good idea, though. Add more headers.
|
||||
Modified at NRL for OPIE 2.0.
|
||||
Originally from BSD.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1987 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include "opie_cfg.h"
|
||||
#include <stdio.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
#if HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
#include "opie.h"
|
||||
|
||||
static char *_findenv FUNCTION((name, offset), register char *name AND int *offset)
|
||||
{
|
||||
extern char **environ;
|
||||
register int len;
|
||||
register char **P, *C;
|
||||
|
||||
for (C = name, len = 0; *C && *C != '='; ++C, ++len);
|
||||
for (P = environ; *P; ++P)
|
||||
if (!strncmp(*P, name, len))
|
||||
if (*(C = *P + len) == '=') {
|
||||
*offset = P - environ;
|
||||
return (++C);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#if !HAVE_GETENV
|
||||
char *getenv FUNCTION((name), char *name)
|
||||
{
|
||||
int offset;
|
||||
char *_findenv();
|
||||
|
||||
return (_findenv(name, &offset));
|
||||
}
|
||||
#endif /* !HAVE_GETENV */
|
||||
|
||||
#if !HAVE_SETENV
|
||||
int setenv FUNCTION((name, value, rewrite), char *name AND char *value AND int rewrite)
|
||||
{
|
||||
extern char **environ;
|
||||
static int alloced; /* if allocated space before */
|
||||
register char *C;
|
||||
int l_value, offset;
|
||||
|
||||
if (*value == '=') /* no `=' in value */
|
||||
++value;
|
||||
l_value = strlen(value);
|
||||
if ((C = _findenv(name, &offset))) { /* find if already exists */
|
||||
if (!rewrite)
|
||||
return (0);
|
||||
if (strlen(C) >= l_value) { /* old larger; copy over */
|
||||
while (*C++ = *value++);
|
||||
return (0);
|
||||
}
|
||||
} else { /* create new slot */
|
||||
register int cnt;
|
||||
register char **P;
|
||||
|
||||
for (P = environ, cnt = 0; *P; ++P, ++cnt);
|
||||
if (alloced) { /* just increase size */
|
||||
environ = (char **) realloc((char *) environ,
|
||||
(u_int) (sizeof(char *) * (cnt + 2)));
|
||||
|
||||
if (!environ)
|
||||
return (-1);
|
||||
} else { /* get new space */
|
||||
alloced = 1; /* copy old entries into it */
|
||||
P = (char **) malloc((u_int) (sizeof(char *) *
|
||||
(cnt + 2)));
|
||||
|
||||
if (!P)
|
||||
return (-1);
|
||||
strncpy(P, environ, cnt * sizeof(char *));
|
||||
|
||||
environ = P;
|
||||
}
|
||||
environ[cnt + 1] = NULL;
|
||||
offset = cnt;
|
||||
}
|
||||
for (C = name; *C && *C != '='; ++C); /* no `=' in name */
|
||||
if (!(environ[offset] = /* name + `=' + value */
|
||||
malloc((u_int) ((int) (C - name) + l_value + 2))))
|
||||
return (-1);
|
||||
for (C = environ[offset]; (*C = *name++) && *C != '='; ++C);
|
||||
for (*C++ = '='; *C++ = *value++;);
|
||||
return (0);
|
||||
}
|
||||
#endif /* !HAVE_SETENV */
|
||||
|
||||
#if !HAVE_UNSETENV
|
||||
VOIDRET unsetenv FUNCTION((name), char *name)
|
||||
{
|
||||
extern char **environ;
|
||||
register char **P;
|
||||
int offset;
|
||||
|
||||
while (_findenv(name, &offset)) /* if set multiple times */
|
||||
for (P = &environ[offset];; ++P)
|
||||
if (!(*P = *(P + 1)))
|
||||
break;
|
||||
}
|
||||
#endif /* !HAVE_UNSETENV */
|
||||
@@ -0,0 +1,23 @@
|
||||
/* getcwd.c: A replacement for the getcwd function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.3.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
char *getcwd FUNCTION((c, l), char *c AND int l)
|
||||
{
|
||||
#if HAVE_GETWD
|
||||
return getwd(c);
|
||||
#else /* HAVE_INDEX */
|
||||
#error Need getwd() to build a replacement getcwd()
|
||||
#endif /* HAVE_INDEX */
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/* getusershell.c: minimal implementation of the getusershell() and
|
||||
endusershell() library routines for systems that don't have them.
|
||||
|
||||
%%% portions-copyright-cmetz
|
||||
Portions of this software are Copyright 1996 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
Portions of this software are Copyright 1995 by Randall Atkinson and Dan
|
||||
McDonald, All Rights Reserved. All Rights under this copyright are assigned
|
||||
to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
|
||||
License Agreement applies to this software.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
|
||||
Modified at NRL for OPIE 2.1. Remove trailing newlines from
|
||||
/etc/shells entries. Fixed infinite loop. Fixed a bug
|
||||
where second invocation on would fail.
|
||||
Written at NRL for OPIE 2.0.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#include <stdio.h>
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif /* HAVE_STRING_H */
|
||||
#include "opie.h"
|
||||
|
||||
static FILE *fh = NULL;
|
||||
static char *internal[] = {"/bin/sh", "/bin/csh", NULL};
|
||||
static int i = 0;
|
||||
static char buffer[1024];
|
||||
|
||||
char *getusershell FUNCTION_NOARGS
|
||||
{
|
||||
char *c;
|
||||
|
||||
if (!fh)
|
||||
fh = fopen("/etc/shells", "r");
|
||||
|
||||
if (fh) {
|
||||
if (fgets(buffer, sizeof(buffer), fh)) {
|
||||
if (c = strchr(buffer, '\n'))
|
||||
*c = 0;
|
||||
return buffer;
|
||||
} else {
|
||||
fclose(fh);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
if (internal[i])
|
||||
return internal[i++];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
VOIDRET endusershell FUNCTION_NOARGS
|
||||
{
|
||||
if (fh) {
|
||||
fclose(fh);
|
||||
fh = NULL;
|
||||
}
|
||||
i = 0;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
/* getutline.c: A replacement for the getutline() function
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
/* initgroups.c: Replacement for the initgroups() function.
|
||||
|
||||
%%% portions-copyright-cmetz
|
||||
Portions of this software are Copyright 1996 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.2. Removed useless string.
|
||||
Ifdef around headers. Use FUNCTION declarations.
|
||||
Not everyone has multiple groups. Work around
|
||||
lack of NGROUPS.
|
||||
Originally from 4.3BSD Net/2.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1983 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* initgroups
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif /* HAVE_SYS_PARAM_H */
|
||||
#include <stdio.h>
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif /* HAVE_STRING */
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
#include <grp.h>
|
||||
|
||||
#include "opie.h"
|
||||
|
||||
struct group *getgrent();
|
||||
|
||||
int initgroups FUNCTION((uname, agroup), const char *uname AND int agroup)
|
||||
{
|
||||
#if HAVE_SETGROUPS && HAVE_GETGROUPS
|
||||
#if NGROUPS
|
||||
int groups[NGROUPS];
|
||||
#else /* NGROUPS */
|
||||
#define STARTING_NGROUPS 32
|
||||
int groups[STARTING_NGROUPS];
|
||||
#endif /* NGROUPS */
|
||||
int ngroups;
|
||||
register struct group *grp;
|
||||
register int i;
|
||||
|
||||
/*
|
||||
* If installing primary group, duplicate it;
|
||||
* the first element of groups is the effective gid
|
||||
* and will be overwritten when a setgid file is executed.
|
||||
*/
|
||||
if (agroup >= 0) {
|
||||
groups[ngroups++] = agroup;
|
||||
groups[ngroups++] = agroup;
|
||||
}
|
||||
setgrent();
|
||||
while (grp = getgrent()) {
|
||||
if (grp->gr_gid == agroup)
|
||||
continue;
|
||||
for (i = 0; grp->gr_mem[i]; i++)
|
||||
if (!strcmp(grp->gr_mem[i], uname)) {
|
||||
#if NGROUPS
|
||||
if (ngroups == NGROUPS) {
|
||||
#else /* NGROUPS */
|
||||
if (ngroups == STARTING_NGROUPS) {
|
||||
#endif /* NGROUPS */
|
||||
fprintf(stderr, "initgroups: %s is in too many groups\n", uname);
|
||||
goto toomany;
|
||||
}
|
||||
groups[ngroups++] = grp->gr_gid;
|
||||
}
|
||||
}
|
||||
toomany:
|
||||
endgrent();
|
||||
#if NGROUPS
|
||||
if (setgroups(ngroups, groups) < 0) {
|
||||
perror("setgroups");
|
||||
return (-1);
|
||||
}
|
||||
#else /* NGROUPS */
|
||||
ngroups++;
|
||||
do {
|
||||
if ((i = setgroups(--ngroups, groups) < 0) && (i != EINVAL)) {
|
||||
perror("setgroups");
|
||||
return (-1);
|
||||
}
|
||||
} while ((i < 0) && (ngroups > 0));
|
||||
#endif /* NGROUPS */
|
||||
#endif /* HAVE_SETGROUPS && HAVE_GETGROUPS */
|
||||
return (0);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* strncasecmp.c: A replacement for the strncasecmp function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.2.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
int memcmp FUNCTION((s1, s2, n), unsigned char *s1 AND unsigned char *s2 AND int n)
|
||||
{
|
||||
while(n--) {
|
||||
if (*s1 != *s2)
|
||||
return (*s1 > *s2) ? 1 : -1;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* memcpy.c: A replacement for the memcpy function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.2.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
VOIDPTR *memcpy FUNCTION((d, s, n), unsigned char *d AND unsigned char *s AND int n)
|
||||
{
|
||||
#if HAVE_BCOPY
|
||||
bcopy(s, d, n);
|
||||
#else /* HAVE_BCOPY */
|
||||
char *d2 = d;
|
||||
while(n--) (*d2++) = (*s++);
|
||||
#endif /* HAVE_BCOPY */
|
||||
return d;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/* memcpy.c: A replacement for the memcpy function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.2.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
VOIDPTR *memset FUNCTION((d, v, n), unsigned char *d AND int v AND int n)
|
||||
{
|
||||
unsigned char *d2 = d;
|
||||
while(n--) (*d2++) = (unsigned char)v;
|
||||
return d;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
/* pututline.c: A replacement for the pututline() function
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* setutent.c: A replacement for the setutent function
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/* sigaddset.c: A replacement for the sigaddset function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.2.
|
||||
*/
|
||||
|
||||
#include "opie_cfg.h"
|
||||
|
||||
#ifndef _NSIG
|
||||
#ifdef NSIG
|
||||
#define _NSIG NSIG
|
||||
#else /* NSIG */
|
||||
#define _NSIG 32
|
||||
#endif /* NSIG */
|
||||
#endif /* _NSIG */
|
||||
|
||||
#include "opie.h"
|
||||
|
||||
int sigaddset FUNCTION((set, signum), sigset_t *set AND int signum)
|
||||
{
|
||||
#if sizeof(sigset_t) != sizeof(int)
|
||||
Sorry, we don't currently support your system.
|
||||
#else /* sizeof(sigset_t) != sizeof(int) */
|
||||
if (set && (signum > 0) && (signum < _NSIG))
|
||||
*set |= 1 << (signum - 1);
|
||||
#endif /* sizeof(sigset_t) != sizeof(int) */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/* sigemptyset.c: A replacement for the sigemptyset function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.2.
|
||||
*/
|
||||
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
int sigemptyset FUNCTION((set), sigset_t *set)
|
||||
{
|
||||
if (set)
|
||||
memset(set, 0, sizeof(sigset_t))
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/* sigprocmask.c: A replacement for the sigprocmask() function
|
||||
|
||||
%%% portions-copyright-cmetz
|
||||
Portions of this software are Copyright 1996 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
Portions of this software are Copyright 1995 by Randall Atkinson and Dan
|
||||
McDonald, All Rights Reserved. All Rights under this copyright are assigned
|
||||
to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
|
||||
License Agreement applies to this software.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.2 from popen.c. Use FUNCTION
|
||||
declaration et al. Include opie.h.
|
||||
*/
|
||||
|
||||
#include "opie_cfg.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#if HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif /* HAVE_SIGNAL_H */
|
||||
#if HAVE_SYS_SIGNAL_H
|
||||
#include <sys/signal.h>
|
||||
#endif /* HAVE_SYS_SIGNAL_H */
|
||||
|
||||
#if !HAVE_SIGBLOCK || !HAVE_SIGSETMASK
|
||||
Without sigblock and sigsetmask, we can't build a replacement sigprocmask.
|
||||
#endif /* !HAVE_SIGBLOCK || !HAVE_SIGSETMASK */
|
||||
|
||||
#include "opie.h"
|
||||
|
||||
#ifndef sigset_t
|
||||
#define sigset_t int
|
||||
#endif /* sigset_t */
|
||||
|
||||
int sigprocmask FUNCTION((how, set, oset), int how AND sigset_t *set AND sigset_t *oset)
|
||||
{
|
||||
int old, new;
|
||||
|
||||
if (set && (set != (sigset_t *)SIG_IGN) && (set != (sigset_t *)SIG_ERR))
|
||||
new = *set;
|
||||
else
|
||||
new = 0;
|
||||
|
||||
switch(how) {
|
||||
case SIG_BLOCK:
|
||||
old = sigblock(new);
|
||||
if (oset && (oset != (sigset_t *)SIG_IGN) && (oset != (sigset_t *)SIG_ERR))
|
||||
*oset = old;
|
||||
return 0;
|
||||
|
||||
case SIG_SETMASK:
|
||||
old = sigsetmask(new);
|
||||
if (oset && (oset != (sigset_t *)SIG_IGN) && (oset != (sigset_t *)SIG_ERR))
|
||||
*oset = old;
|
||||
return 0;
|
||||
|
||||
case SIG_UNBLOCK:
|
||||
/* not implemented */
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* strchr.c: A replacement for the strchr function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.3.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
char *strchr FUNCTION((s, c), char *s AND int c)
|
||||
{
|
||||
#if HAVE_INDEX
|
||||
return index(s, c);
|
||||
#else /* HAVE_INDEX */
|
||||
while(*s && (*s != c)) s++;
|
||||
return *s ? s : (char *)0;
|
||||
#endif /* HAVE_INDEX */
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/* strerror.c: A replacement for the strerror function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.2.
|
||||
*/
|
||||
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
char *strerror FUNCTION((errnum), int errnum)
|
||||
{
|
||||
#if HAVE_SYS_ERRLIST
|
||||
extern char *sys_errlist[];
|
||||
return sys_errlist[errnum];
|
||||
#else /* NEED_STRERROR */
|
||||
#if HAVE__SYS_ERRLIST
|
||||
extern char *_sys_errlist[];
|
||||
return sys_errlist[errnum];
|
||||
#else /* HAVE__SYS_ERRLIST */
|
||||
static char hexdigits[] = "0123456789abcdef";
|
||||
static char buffer[] = "System error 0x42";
|
||||
buffer[15] = hexdigits[(errnum >> 4) & 0x0f];
|
||||
buffer[16] = hexdigits[errnum & 0x0f];
|
||||
return buffer;
|
||||
#endif /* HAVE__SYS_ERRLIST */
|
||||
#endif /* NEED_STRERROR */
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/* strncasecmp.c: A replacement for the strncasecmp function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.2.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
int strncasecmp FUNCTION((s1, s2, n), unsigned char *s1 AND unsigned char *s2 AND int n)
|
||||
{
|
||||
unsigned char c1, c2;
|
||||
while(*s1 && *s2 && n--) {
|
||||
c1 = ((*s1 >= 'A') && (*s1 <= 'Z')) ? (*s1++) + ('a' - 'A') : (*s1++);
|
||||
c2 = ((*s2 >= 'A') && (*s2 <= 'Z')) ? (*s2++) + ('a' - 'A') : (*s2++);
|
||||
if (c1 != c2)
|
||||
return (c1 > c2) ? 1 : -1;
|
||||
}
|
||||
if (*s1 && !*s2)
|
||||
return 1;
|
||||
if (!*s1 && *s2)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* strrchr.c: A replacement for the strrchr function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.3.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
char *strrchr FUNCTION((s, c), char *s AND int c)
|
||||
{
|
||||
#if HAVE_RINDEX
|
||||
return rindex(s, c);
|
||||
#else /* HAVE_RINDEX */
|
||||
char *s2 = (char *)0;
|
||||
while(*s) { if (*s == c) s2 = s; s++ };
|
||||
return s2;
|
||||
#endif /* HAVE_RINDEX */
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/* sysconf.c: A (partial) replacement for the sysconf function
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Created by cmetz for OPIE 2.3.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif /* HAVE_SYS_PARAM_H */
|
||||
#include "opie.h"
|
||||
|
||||
long sysconf(int name)
|
||||
{
|
||||
switch(name) {
|
||||
case _SC_OPEN_MAX:
|
||||
#if HAVE_GETDTABLESIZE
|
||||
return getdtablesize();
|
||||
#else /* HAVE_GETDTABLESIZE */
|
||||
#error Need getdtablesize() to build a replacement sysconf()
|
||||
#endif /* HAVE_GETDTABLESIZE */
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/* uname.c: A replacement for the uname function (sort of)
|
||||
|
||||
%%% copyright-cmetz
|
||||
This software is Copyright 1996 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.3. Ifdef around gethostname().
|
||||
Created by cmetz for OPIE 2.2.
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif /* HAVE_SYS_PARAM_H */
|
||||
#include "opie.h"
|
||||
|
||||
int uname FUNCTION(struct utsname *buf)
|
||||
{
|
||||
#if HAVE_GETHOSTNAME
|
||||
char hostname[MAXHOSTNAMELEN], *c;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)-1) < 0)
|
||||
return -1;
|
||||
|
||||
hostname[sizeof(hostname) - 1] = 0;
|
||||
|
||||
if (c = strchr(hostname, '.')) {
|
||||
*c = 0;
|
||||
}
|
||||
|
||||
strncpy(buf->nodename, hostname, sizeof(buf->nodename) - 1);
|
||||
return 0;
|
||||
#else /* HAVE_GETHOSTNAME */
|
||||
strncpy(buf->nodename, "unknown", sizeof(buf->nodename) - 1);
|
||||
return 0;
|
||||
#endif /* HAVE_GETHOSTNAME */
|
||||
}
|
||||
@@ -2,30 +2,34 @@
|
||||
# Makefile.in/Makefile: Directions for building libopie.
|
||||
#
|
||||
# %%% copyright-cmetz-96
|
||||
# This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
# The Inner Net License Version 2 applies to this software.
|
||||
# This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
# The Inner Net License Version 3 applies to this software.
|
||||
# You should have received a copy of the license with this software. If
|
||||
# you didn't get a copy, you may request one from <[email protected]>.
|
||||
#
|
||||
# History:
|
||||
#
|
||||
# Modified by cmetz for OPIE 2.4. Add libmissing to include header path.
|
||||
# Use ar 'cr' instead of 'r'. Renamed realclean to distclean.
|
||||
# Modified by cmetz for OPIE 2.31. Added logwtmp.o
|
||||
# Created by cmetz for OPIE 2.3 using old Makefiles as a guide.
|
||||
|
||||
OBJS=md4c.o md5c.o atob8.o btoa8.o btoh.o challenge.o getsequence.o hash.o hashlen.o keycrunch.o lock.o lookup.o newseed.o parsechallenge.o passcheck.o passwd.o randomchallenge.o readpass.o unlock.o verify.o version.o btoe.o accessfile.o generator.o insecure.o getutmpentry.o readrec.o writerec.o login.o open.o logwtmp.o # sha.o
|
||||
|
||||
CC=@CC@
|
||||
CFLAGS=$(CFL) -I..
|
||||
CFLAGS=$(CFL) -I.. -I../libmissing
|
||||
TARGET=libopie.a
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
ar r $(TARGET) $(OBJS)
|
||||
ar cr $(TARGET) $(OBJS)
|
||||
@RANLIB@ $(TARGET)
|
||||
|
||||
clean:
|
||||
-rm -f $(OBJS) $(TARGET)
|
||||
|
||||
realclean: clean
|
||||
realclean: distclean
|
||||
|
||||
distclean: clean
|
||||
-rm -f *~ core* "\#*\#" *.o *.a Makefile
|
||||
@@ -2,7 +2,7 @@
|
||||
overrides.
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* atob8.c: The opieatob8() library function.
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
@@ -14,6 +14,7 @@ License Agreement applies to this software.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.4. Use struct opie_otpkey for binary arg.
|
||||
Modified by cmetz for OPIE 2.3. Return the output variable.
|
||||
Don't check parameters.
|
||||
Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
|
||||
@@ -27,10 +28,11 @@ License Agreement applies to this software.
|
||||
|
||||
/* Convert 8-byte hex-ascii string to binary array
|
||||
*/
|
||||
char *opieatob8 FUNCTION((out, in), char *out AND char *in)
|
||||
char *opieatob8 FUNCTION((out, in), struct opie_otpkey *outkey AND char *in)
|
||||
{
|
||||
register int i;
|
||||
register int val;
|
||||
unsigned char *out = (unsigned char *)outkey;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
while (*in == ' ' || *in == '\t')
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/* btoa8.c: The opiebtoa8() library function.
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.4. Use struct opie_otpkey for binary arg.
|
||||
Created by cmetz for OPIE 2.3 (quick re-write).
|
||||
*/
|
||||
|
||||
@@ -17,9 +18,10 @@ you didn't get a copy, you may request one from <[email protected]>.
|
||||
static char hextochar[16] =
|
||||
{'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
||||
|
||||
char *opiebtoa8 FUNCTION((out, in), char *out AND char *in)
|
||||
char *opiebtoa8 FUNCTION((out, in), char *out AND struct opie_otpkey *inkey)
|
||||
{
|
||||
int i;
|
||||
unsigned char *in = (unsigned char *)inkey;
|
||||
char *c = out;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
64 bit OTP.
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
@@ -16,6 +16,7 @@ License Agreement applies to this software.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.4. Use struct opie_otpkey for binary arg.
|
||||
Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
|
||||
Remove unnecessary address futzing with Wp in opiebtoe.
|
||||
Changed unsigned long to UINT4 for Alpha.
|
||||
@@ -2088,13 +2089,13 @@ static char Wp[2048][4] =
|
||||
};
|
||||
|
||||
/* Encode 8 bytes in 'c' as a string of English words. */
|
||||
char *opiebtoe FUNCTION((engout, c), char *engout AND char *c)
|
||||
char *opiebtoe FUNCTION((engout, c), char *engout AND struct opie_otpkey *c)
|
||||
{
|
||||
char cp[9]; /* add in room for the parity 2 bits */
|
||||
char cp[sizeof(struct opie_otpkey) + 1]; /* add in room for the parity 2 bits */
|
||||
int p, i;
|
||||
|
||||
engout[0] = '\0';
|
||||
memcpy(cp, c, 8);
|
||||
memcpy(cp, c, sizeof(struct opie_otpkey));
|
||||
/* compute parity */
|
||||
for (p = 0, i = 0; i < 64; i += 2)
|
||||
p += extract(cp, i, 2);
|
||||
@@ -2120,7 +2121,7 @@ char *opiebtoe FUNCTION((engout, c), char *engout AND char *c)
|
||||
* -1 badly formed in put ie > 4 char word
|
||||
* -2 words OK but parity is wrong
|
||||
*/
|
||||
int opieetob FUNCTION((out, e), char *out AND char *e)
|
||||
int opieetob FUNCTION((out, e), struct opie_otpkey *out AND char *e)
|
||||
{
|
||||
char *word, *c, *input, b[9];
|
||||
int i, p, v, l, low, high, rval = -1;
|
||||
@@ -2137,7 +2138,7 @@ int opieetob FUNCTION((out, e), char *out AND char *e)
|
||||
strncpy(input, e, i);
|
||||
input[i] = 0;
|
||||
memset(b, 0, sizeof(b));
|
||||
memset(out, 0, 8);
|
||||
memset(out, 0, sizeof(struct opie_otpkey));
|
||||
|
||||
for (i = 0, p = 0, word = c = input; i < 6; i++, p += 11) {
|
||||
while (*c && !isalpha(*c)) c++;
|
||||
@@ -2187,7 +2188,7 @@ int opieetob FUNCTION((out, e), char *out AND char *e)
|
||||
goto opiebtoeret;
|
||||
}
|
||||
|
||||
memcpy(out, b, 8);
|
||||
memcpy(out, b, sizeof(struct opie_otpkey));
|
||||
|
||||
rval = 1;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* btoh.c: The opiebtoh() library function.
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
@@ -17,10 +17,11 @@ you didn't get a copy, you may request one from <[email protected]>.
|
||||
static char hextochar[16] =
|
||||
{'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
|
||||
|
||||
char *opiebtoh FUNCTION((out, in), char *out AND char *in)
|
||||
char *opiebtoh FUNCTION((out, in), char *out AND struct opie_otpkey *inkey)
|
||||
{
|
||||
int i;
|
||||
char *c = out;
|
||||
unsigned char *in = (unsigned char *)inkey;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
*(c++) = hextochar[((*in) >> 4) & 0x0f];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* challenge.c: The opiechallenge() library function.
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
@@ -20,6 +20,9 @@ License Agreement applies to this software.
|
||||
syslog. Add sha plumbing.
|
||||
Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
|
||||
Created at NRL for OPIE 2.2 from opiesubr2.c
|
||||
|
||||
$FreeBSD$
|
||||
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
#include <stdio.h>
|
||||
@@ -52,8 +55,6 @@ int opiechallenge FUNCTION((mp, name, ss), struct opie *mp AND char *name AND ch
|
||||
{
|
||||
int rval = -1;
|
||||
|
||||
memset(mp, 0, sizeof(*mp));
|
||||
|
||||
rval = opielookup(mp, name);
|
||||
#if DEBUG
|
||||
if (rval) syslog(LOG_DEBUG, "opiechallenge: opielookup(mp, name=%s) returned %d", name, rval);
|
||||
@@ -66,11 +67,11 @@ int opiechallenge FUNCTION((mp, name, ss), struct opie *mp AND char *name AND ch
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
if (rval) {
|
||||
if (rval ||
|
||||
(snprintf(ss, OPIE_CHALLENGE_MAX, "otp-%s %d %s ext", algids[MDX], mp->opie_n - 1, mp->opie_seed) >= OPIE_CHALLENGE_MAX)) {
|
||||
opierandomchallenge(ss);
|
||||
memset(mp, 0, sizeof(*mp));
|
||||
} else
|
||||
sprintf(ss, "otp-%s %d %s ext", algids[MDX], mp->opie_n - 1, mp->opie_seed);
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/* generator.c: The opiegenerator() library function.
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
@@ -9,6 +9,9 @@ you didn't get a copy, you may request one from <[email protected]>.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.4. Added opieauto code based on
|
||||
previously released test code. Renamed buffer to challenge.
|
||||
Use struct opie_otpkey for keys.
|
||||
Modified by cmetz for OPIE 2.32. If secret=NULL, always return
|
||||
as if opieauto returned "get the secret". Renamed
|
||||
_opieparsechallenge() to __opieparsechallenge(). Check
|
||||
@@ -33,73 +36,362 @@ $FreeBSD$
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif /* HAVE_STRING_H */
|
||||
#if OPIEAUTO
|
||||
#include <errno.h>
|
||||
#if HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#endif /* OPIEAUTO */
|
||||
#if DEBUG
|
||||
#include <syslog.h>
|
||||
#endif /* DEBUG */
|
||||
#include "opie.h"
|
||||
|
||||
static char *algids[] = { NULL, NULL, NULL, "sha1", "md4", "md5" };
|
||||
|
||||
int opiegenerator FUNCTION((buffer, secret, response), char *buffer AND char *secret AND char *response)
|
||||
#if OPIEAUTO
|
||||
#ifndef max
|
||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif /* max */
|
||||
|
||||
static int opieauto_connect FUNCTION_NOARGS
|
||||
{
|
||||
int s;
|
||||
struct sockaddr_un sun;
|
||||
char buffer[1024];
|
||||
char *c, *c2 ="/.opieauto";
|
||||
uid_t myuid = getuid(), myeuid = geteuid();
|
||||
|
||||
if (!myuid || !myeuid || (myuid != myeuid)) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opieauto_connect: superuser and/or setuid not allowed");
|
||||
#endif /* DEBUG */
|
||||
return -1;
|
||||
};
|
||||
|
||||
memset(&sun, 0, sizeof(struct sockaddr_un));
|
||||
sun.sun_family = AF_UNIX;
|
||||
|
||||
if (!(c = getenv("HOME"))) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opieauto_connect: no HOME variable?");
|
||||
#endif /* DEBUG */
|
||||
return -1;
|
||||
};
|
||||
|
||||
if (strlen(c) > (sizeof(sun.sun_path) - strlen(c2) - 1)) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opieauto_connect: HOME is too long: %s", c);
|
||||
#endif /* DEBUG */
|
||||
return -1;
|
||||
};
|
||||
|
||||
strcpy(sun.sun_path, c);
|
||||
strcat(sun.sun_path, c2);
|
||||
|
||||
if ((s = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opieauto_connect: socket: %s(%d)", strerror(errno), errno);
|
||||
#endif /* DEBUG */
|
||||
return -1;
|
||||
};
|
||||
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(sun.sun_path, &st) < 0) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opieauto_connect: stat: %s(%d)\n", strerror(errno), errno);
|
||||
#endif /* DEBUG */
|
||||
goto ret;
|
||||
};
|
||||
|
||||
if (connect(s, (struct sockaddr *)&sun, sizeof(struct sockaddr_un))) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opieauto_connect: connect: %s(%d)\n", strerror(errno), errno);
|
||||
#endif /* DEBUG */
|
||||
goto ret;
|
||||
};
|
||||
|
||||
if ((st.st_uid != myuid) || (!S_ISSOCK(st.st_mode)) || ((st.st_mode & 07777) != 0600)) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opieauto_connect: something's fishy about the socket\n");
|
||||
#endif /* DEBUG */
|
||||
goto ret;
|
||||
};
|
||||
};
|
||||
|
||||
return s;
|
||||
|
||||
ret:
|
||||
close(s);
|
||||
return -1;
|
||||
};
|
||||
#endif /* OPIEAUTO */
|
||||
|
||||
int opiegenerator FUNCTION((challenge, secret, response), char *challenge AND char *secret AND char *response)
|
||||
{
|
||||
int algorithm;
|
||||
int sequence;
|
||||
char *seed;
|
||||
char key[8];
|
||||
struct opie_otpkey key;
|
||||
int i;
|
||||
int exts;
|
||||
#if OPIEAUTO
|
||||
int s;
|
||||
int window;
|
||||
char cmd[1+1+1+1+4+1+OPIE_SEED_MAX+1+4+1+4+1+4+1+4+1];
|
||||
char *c;
|
||||
#endif /* OPIEAUTO */
|
||||
|
||||
if (!(buffer = strstr(buffer, "otp-")))
|
||||
if (!(challenge = strstr(challenge, "otp-")))
|
||||
return 1;
|
||||
|
||||
buffer += 4;
|
||||
challenge += 4;
|
||||
|
||||
if (__opieparsechallenge(buffer, &algorithm, &sequence, &seed, &exts))
|
||||
if (__opieparsechallenge(challenge, &algorithm, &sequence, &seed, &exts))
|
||||
return 1;
|
||||
|
||||
if ((sequence < 2) || (sequence > 9999))
|
||||
return 1;
|
||||
|
||||
if (!secret[0])
|
||||
return 2;
|
||||
if (*secret) {
|
||||
if (opiepasscheck(secret))
|
||||
return -2;
|
||||
|
||||
if (opiepasscheck(secret))
|
||||
return -2;
|
||||
if (i = opiekeycrunch(algorithm, &key, seed, secret))
|
||||
return i;
|
||||
|
||||
if (i = opiekeycrunch(algorithm, key, seed, secret))
|
||||
return i;
|
||||
if (sequence <= OPIE_SEQUENCE_RESTRICT) {
|
||||
if (!(exts & 1))
|
||||
return 1;
|
||||
|
||||
if (sequence < 10) {
|
||||
if (!(exts & 1))
|
||||
return 1;
|
||||
{
|
||||
char newseed[OPIE_SEED_MAX + 1];
|
||||
struct opie_otpkey newkey;
|
||||
char *c;
|
||||
char buf[OPIE_SEED_MAX + 48 + 1];
|
||||
|
||||
while (sequence-- != 0)
|
||||
opiehash(&key, algorithm);
|
||||
|
||||
if (opienewseed(strcpy(newseed, seed)) < 0)
|
||||
return -1;
|
||||
|
||||
if (opiekeycrunch(algorithm, &newkey, newseed, secret))
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < 499; i++)
|
||||
opiehash(&newkey, algorithm);
|
||||
|
||||
strcpy(response, "init-hex:");
|
||||
strcat(response, opiebtoh(buf, &key));
|
||||
if (snprintf(buf, sizeof(buf), ":%s 499 %s:", algids[algorithm],
|
||||
newseed) >= sizeof(buf)) {
|
||||
#ifdef DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: snprintf truncation at init-hex");
|
||||
#endif /* DEBUG */
|
||||
return -1;
|
||||
}
|
||||
strcat(response, buf);
|
||||
strcat(response, opiebtoh(buf, &newkey));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#if OPIEAUTO
|
||||
if ((s = opieauto_connect()) >= 0) {
|
||||
if ((i = read(s, cmd, sizeof(cmd)-1)) < 0) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: read: %s(%d)\n", strerror(errno), errno);
|
||||
#endif /* DEBUG */
|
||||
close(s);
|
||||
s = -1;
|
||||
goto l0;
|
||||
};
|
||||
cmd[i] = 0;
|
||||
if ((cmd[0] != 'C') || (cmd[1] != '+') || (cmd[2] != ' ')) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: got invalid/failing C+ response: %s\n", cmd);
|
||||
#endif /* DEBUG */
|
||||
close(s);
|
||||
s = -1;
|
||||
goto l0;
|
||||
};
|
||||
|
||||
window = strtoul(&cmd[3], &c, 10);
|
||||
if (!window || (window >= (OPIE_SEQUENCE_MAX - OPIE_SEQUENCE_RESTRICT)) || !isspace(*c)) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: got bogus option response: %s\n", cmd);
|
||||
#endif /* DEBUG */
|
||||
close(s);
|
||||
s = -1;
|
||||
goto l0;
|
||||
};
|
||||
};
|
||||
|
||||
l0:
|
||||
if (*secret) {
|
||||
int j;
|
||||
|
||||
if (s < 0) {
|
||||
j = 0;
|
||||
goto l1;
|
||||
};
|
||||
|
||||
j = max(sequence - window + 1, OPIE_SEQUENCE_RESTRICT);
|
||||
|
||||
for (i = j; i > 0; i--)
|
||||
opiehash(&key, algorithm);
|
||||
|
||||
{
|
||||
char newseed[OPIE_SEED_MAX + 1];
|
||||
char newkey[8];
|
||||
char *c;
|
||||
char buf[OPIE_SEED_MAX + 48 + 1];
|
||||
char buf[16+1];
|
||||
|
||||
while (sequence-- != 0)
|
||||
opiehash(key, algorithm);
|
||||
opiebtoa8(buf, &key);
|
||||
|
||||
if (opienewseed(strcpy(newseed, seed)) < 0)
|
||||
return -1;
|
||||
if (snprintf(cmd, sizeof(cmd), "S= %d %d %s %s\n", algorithm, sequence,
|
||||
seed, buf) >= sizeof(cmd)) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: snprintf truncation at S=\n");
|
||||
#endif /* DEBUG */
|
||||
goto l1;
|
||||
}
|
||||
}
|
||||
|
||||
if (opiekeycrunch(algorithm, newkey, newseed, secret))
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < 499; i++)
|
||||
opiehash(newkey, algorithm);
|
||||
|
||||
strcpy(response, "init-hex:");
|
||||
strcat(response, opiebtoh(buf, key));
|
||||
sprintf(buf, ":%s 499 %s:", algids[algorithm], newseed);
|
||||
strcat(response, buf);
|
||||
strcat(response, opiebtoh(buf, newkey));
|
||||
if (write(s, cmd, i = strlen(cmd)) != i) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: write: %s(%d)\n", strerror(errno), errno);
|
||||
#endif /* DEBUG */
|
||||
goto l1;
|
||||
};
|
||||
} else {
|
||||
while (sequence-- != 0)
|
||||
opiehash(key, algorithm);
|
||||
|
||||
opiebtoh(response, key);
|
||||
}
|
||||
if ((i = read(s, cmd, sizeof(cmd))) < 0) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: read: %s(%d)\n", strerror(errno), errno);
|
||||
#endif /* DEBUG */
|
||||
};
|
||||
close(s);
|
||||
|
||||
cmd[i] = 0;
|
||||
i = strlen(seed);
|
||||
if ((cmd[0] != 'S') || (cmd[1] != '+') || (cmd[2] != ' ') || (strtoul(&cmd[3], &c, 10) != algorithm) || (strtoul(c + 1, &c, 10) != sequence) || strncmp(++c, seed, i) || (*(c + i) != '\n')) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: got invalid/failing S+ response: %s\n", cmd);
|
||||
#endif /* DEBUG */
|
||||
};
|
||||
|
||||
l1:
|
||||
for (i = sequence - j; i > 0; i--)
|
||||
opiehash(&key, algorithm);
|
||||
|
||||
opiebtoh(response, &key);
|
||||
} else {
|
||||
if (s < 0)
|
||||
goto l2;
|
||||
|
||||
if ((snprintf(cmd, sizeof(cmd), "s= %d %d %s\n", algorithm, sequence,
|
||||
seed) >= sizeof(cmd))) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: snprintf truncation at s=\n");
|
||||
#endif /* DEBUG */
|
||||
goto l2;
|
||||
}
|
||||
|
||||
if (write(s, cmd, i = strlen(cmd)) != i) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: write: %s(%d)\n", strerror(errno), errno);
|
||||
#endif /* DEBUG */
|
||||
goto l2;
|
||||
};
|
||||
|
||||
if ((i = read(s, cmd, sizeof(cmd))) < 0) {
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: read: %s(%d)\n", strerror(errno), errno);
|
||||
#endif /* DEBUG */
|
||||
goto l2;
|
||||
};
|
||||
close(s);
|
||||
|
||||
i = strlen(seed);
|
||||
|
||||
if ((cmd[0] != 's') || (cmd[2] != ' ') || (strtoul(&cmd[3], &c, 10) != algorithm) || (strtoul(c + 1, &c, 10) != sequence) || strncmp(++c, seed, i)) {
|
||||
#if DEBUG
|
||||
if (c)
|
||||
*c = 0;
|
||||
else
|
||||
cmd[3] = 0;
|
||||
|
||||
syslog(LOG_DEBUG, "opiegenerator: got bogus/invalid s response: %s\n", cmd);
|
||||
#endif /* DEBUG */
|
||||
goto l2;
|
||||
};
|
||||
|
||||
c += i;
|
||||
|
||||
if (cmd[1] == '-') {
|
||||
#if DEBUG
|
||||
if (*c != '\n') {
|
||||
*c = 0;
|
||||
syslog(LOG_DEBUG, "opiegenerator: got invalid s- response: %s\n", cmd);
|
||||
};
|
||||
#endif /* DEBUG */
|
||||
goto l2;
|
||||
};
|
||||
|
||||
if (cmd[1] != '+') {
|
||||
#if DEBUG
|
||||
*c = 0;
|
||||
syslog(LOG_DEBUG, "opiegenerator: got invalid s response: %s\n", cmd);
|
||||
#endif /* DEBUG */
|
||||
goto l2;
|
||||
};
|
||||
|
||||
{
|
||||
char *c2;
|
||||
|
||||
if (!(c2 = strchr(++c, '\n'))) {
|
||||
#if DEBUG
|
||||
*c = 0;
|
||||
syslog(LOG_DEBUG, "opiegenerator: got invalid s+ response: %s\n", cmd);
|
||||
#endif /* DEBUG */
|
||||
goto l2;
|
||||
};
|
||||
|
||||
*c2++ = 0;
|
||||
};
|
||||
|
||||
if (!opieatob8(&key, c))
|
||||
goto l2;
|
||||
|
||||
opiebtoh(response, &key);
|
||||
};
|
||||
|
||||
if (s >= 0)
|
||||
close(s);
|
||||
#else /* OPIEAUTO */
|
||||
if (*secret) {
|
||||
while (sequence-- != 0)
|
||||
opiehash(&key, algorithm);
|
||||
|
||||
opiebtoh(response, &key);
|
||||
} else
|
||||
return -2;
|
||||
#endif /* OPIEAUTO */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if OPIEAUTO
|
||||
l2:
|
||||
#if DEBUG
|
||||
syslog(LOG_DEBUG, "opiegenerator: no opieauto response available.\n");
|
||||
#endif /* DEBUG */
|
||||
if (s >= 0)
|
||||
close(s);
|
||||
|
||||
return -2;
|
||||
#endif /* OPIEAUTO */
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
/* getsequence.c: The opiegetsequence() library function.
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* getutmpentry.c: The __opiegetutmpentry() library function.
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
|
||||
+13
-14
@@ -1,14 +1,15 @@
|
||||
/* hash.c: The opiehash() library function.
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Updated by cmetz for OPIE 2.31. Added SHA support (which may
|
||||
Modified by cmetz for OPIE 2.4. Use struct opie_otpkey for binary arg.
|
||||
Modified by cmetz for OPIE 2.31. Added SHA support (which may
|
||||
not be correct). Backed out previous optimizations as
|
||||
they killed thread-safety.
|
||||
Created by cmetz for OPIE 2.3 using the old hash.c as a guide.
|
||||
@@ -17,31 +18,29 @@ $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "opie_cfg.h"
|
||||
#if 0
|
||||
#include "sha.h"
|
||||
#endif /* 0 */
|
||||
#include "opie.h"
|
||||
|
||||
#include <sha.h>
|
||||
#include <md4.h>
|
||||
#include <md5.h>
|
||||
|
||||
VOIDRET opiehash FUNCTION((x, algorithm), VOIDPTR x AND unsigned algorithm)
|
||||
VOIDRET opiehash FUNCTION((x, algorithm), struct opie_otpkey *x AND
|
||||
unsigned algorithm)
|
||||
{
|
||||
UINT4 *results = (UINT4 *)x;
|
||||
|
||||
switch(algorithm) {
|
||||
#if 0
|
||||
case 3:
|
||||
{
|
||||
SHA_CTX sha;
|
||||
SHAInit(&sha);
|
||||
SHAUpdate(&sha, (unsigned char *)x, 8);
|
||||
SHAFinal(&sha);
|
||||
results[0] = sha.buffer[0] ^ sha.buffer[2] ^ sha.buffer[4];
|
||||
results[1] = sha.buffer[1] ^ sha.buffer[3];
|
||||
UINT4 digest[5];
|
||||
SHA1_Init(&sha);
|
||||
SHA1_Update(&sha, (unsigned char *)x, 8);
|
||||
SHA1_Final((unsigned char *)digest, &sha);
|
||||
results[0] = digest[0] ^ digest[2] ^ digest[4];
|
||||
results[1] = digest[1] ^ digest[3];
|
||||
};
|
||||
break;
|
||||
#endif /* 0 */
|
||||
case 4:
|
||||
{
|
||||
MD4_CTX mdx;
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/* hashlen.c: The opiehashlen() library function.
|
||||
|
||||
%%% copyright-cmetz-96
|
||||
This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 2 applies to this software.
|
||||
This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
|
||||
The Inner Net License Version 3 applies to this software.
|
||||
You should have received a copy of the license with this software. If
|
||||
you didn't get a copy, you may request one from <license@inner.net>.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.4. Use struct opie_otpkey, isolate variables.
|
||||
Created by cmetz for OPIE 2.3.
|
||||
|
||||
$FreeBSD$
|
||||
@@ -16,27 +17,27 @@ $FreeBSD$
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
#include <sha.h>
|
||||
#include <md4.h>
|
||||
#include <md5.h>
|
||||
|
||||
VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND VOIDPTR in AND VOIDPTR out AND int n)
|
||||
VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND
|
||||
VOIDPTR in AND struct opie_otpkey *out AND int n)
|
||||
{
|
||||
UINT4 *results = (UINT4 *)out;
|
||||
UINT4 mdx_tmp[4];
|
||||
#if 0
|
||||
SHA_INFO sha;
|
||||
#endif /* 0 */
|
||||
|
||||
switch(algorithm) {
|
||||
#if 0
|
||||
case 3:
|
||||
sha_init(&sha);
|
||||
sha_update(&sha, (BYTE *)in, n);
|
||||
sha_final(&sha);
|
||||
results[0] = sha.digest[0] ^ sha.digest[2] ^ sha.digest[4];
|
||||
results[1] = sha.digest[1] ^ sha.digest[3] ^ sha.digest[5];
|
||||
case 3: {
|
||||
SHA_CTX sha;
|
||||
UINT4 digest[5];
|
||||
SHA1_Init(&sha);
|
||||
SHA1_Update(&sha, (unsigned char *)in, n);
|
||||
SHA1_Final((unsigned char *)digest, &sha);
|
||||
results[0] = digest[0] ^ digest[2] ^ digest[4];
|
||||
results[1] = digest[1] ^ digest[3];
|
||||
break;
|
||||
#endif /* 0 */
|
||||
}
|
||||
case 4: {
|
||||
MD4_CTX mdx;
|
||||
MD4Init(&mdx);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* insecure.c: The opieinsecure() library function.
|
||||
|
||||
%%% portions-copyright-cmetz-96
|
||||
Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
|
||||
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
||||
Reserved. The Inner Net License Version 2 applies to these portions of
|
||||
the software.
|
||||
You should have received a copy of the license with this software. If
|
||||
@@ -14,6 +14,8 @@ License Agreement applies to this software.
|
||||
|
||||
History:
|
||||
|
||||
Modified by cmetz for OPIE 2.4. Do utmp checks on utmpx systems.
|
||||
Handle unterminated ut_host.
|
||||
Modified by cmetz for OPIE 2.31. Fixed a logic bug. Call endut[x]ent().
|
||||
Modified by cmetz for OPIE 2.3. Added result caching. Use
|
||||
__opiegetutmpentry(). Ifdef around ut_host check. Eliminate
|
||||
@@ -25,6 +27,9 @@ License Agreement applies to this software.
|
||||
found. Use uname().
|
||||
Created at NRL for OPIE 2.2 from opiesubr.c. Fixed pointer
|
||||
assignment that should have been a comparison.
|
||||
|
||||
$FreeBSD$
|
||||
|
||||
*/
|
||||
#include "opie_cfg.h"
|
||||
|
||||
@@ -56,14 +61,16 @@ int opieinsecure FUNCTION_NOARGS
|
||||
char *s;
|
||||
char *term_name;
|
||||
int insecure = 0;
|
||||
#if HAVE_UT_HOST
|
||||
#if HAVE_UT_HOST || DOUTMPX
|
||||
struct utmp utmp;
|
||||
#endif /* HAVE_UT_HOST */
|
||||
#endif /* HAVE_UT_HOST || DOUTMPX */
|
||||
static int result = -1;
|
||||
|
||||
if (result != -1)
|
||||
return result;
|
||||
|
||||
if (getenv("SSH_CLIENT") != NULL)
|
||||
return (result = 0);
|
||||
display_name = (char *) getenv("DISPLAY");
|
||||
term_name = (char *) getenv("TERM");
|
||||
|
||||
@@ -117,30 +124,34 @@ int opieinsecure FUNCTION_NOARGS
|
||||
return (result = 1);
|
||||
};
|
||||
|
||||
#if HAVE_UT_HOST
|
||||
#if HAVE_UT_HOST || DOUTMPX
|
||||
if (isatty(0)) {
|
||||
memset(&utmp, 0, sizeof(struct utmp));
|
||||
{
|
||||
int i = __opiegetutmpentry(ttyname(0), &utmp);
|
||||
endutent();
|
||||
if (!i && utmp.ut_host[0]) {
|
||||
char host[sizeof(utmp.ut_host) + 1];
|
||||
insecure = 1;
|
||||
|
||||
if (s = strchr(utmp.ut_host, ':')) {
|
||||
int n = s - utmp.ut_host;
|
||||
strncpy(host, utmp.ut_host, sizeof(utmp.ut_host));
|
||||
host[sizeof(utmp.ut_host)] = 0;
|
||||
|
||||
if (s = strchr(host, ':')) {
|
||||
int n = s - host;
|
||||
if (!n)
|
||||
insecure = 0;
|
||||
else
|
||||
if (display_name) {
|
||||
if (!strncmp(utmp.ut_host, display_name, n))
|
||||
if (!strncmp(host, display_name, n))
|
||||
insecure = 0;
|
||||
#ifdef SOLARIS
|
||||
#if 1 /* def SOLARIS */
|
||||
else
|
||||
if (s = strchr(utmp.ut_host, ' ')) {
|
||||
if (s = strchr(host, ' ')) {
|
||||
*s = ':';
|
||||
if (s = strchr(s + 1, ' '))
|
||||
*s = '.';
|
||||
if (!strncmp(utmp.ut_host, display_name, n))
|
||||
if (!strncmp(host, display_name, n))
|
||||
insecure = 0;
|
||||
}
|
||||
#endif /* SOLARIS */
|
||||
@@ -149,7 +160,7 @@ int opieinsecure FUNCTION_NOARGS
|
||||
}
|
||||
};
|
||||
};
|
||||
#endif /* HAVE_UT_HOST */
|
||||
#endif /* HAVE_UT_HOST || DOUTMPX */
|
||||
if (insecure)
|
||||
return (result = 1);
|
||||
|
||||
|
||||
Loaded 100 of 845 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user