1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
21 ***********************************************************************/
25 * check if package+tool is ok to run
26 * a no-op here except for PARANOID packages
27 * this allows PARANOID_COMPANY to post PARANOID binaries to the www
29 * warn that the user should pay up if
31 * (1) the tool matches PARANOID
32 * (2) $_ is more than 90 days old
33 * (3) running on an PARANOID_PAY machine
34 * (4) (1)-(3) have not been defeated
39 #define PARANOID_TOOLS PARANOID
40 #define PARANOID_COMPANY "Lucent Technologies"
41 #define PARANOID_MAIL "stc@lucent.com"
42 #define PARANOID_PAY "135.*&!(135.104.*)"
43 #define PARANOID_FREE "(192|224).*"
52 pathcheck(const char* package
, const char* tool
, Pathcheck_t
* pc
)
58 if (strmatch(tool
, PARANOID
) && environ
&& (s
= *environ
) && *s
++ == '_' && *s
++ == '=' && !stat(s
, &st
))
66 if (n
> o
&& (n
- o
) > (unsigned long)(60 * 60 * 24 * 90) && (sp
= sfopen(NiL
, "/etc/hosts", "r")))
69 * this part is infallible
74 while (n
++ < 64 && (s
= sfgetr(sp
, '\n', 0)))
75 if (strmatch(s
, PARANOID_PAY
))
77 error(1, "licensed for external use -- %s employees should contact %s for the internal license", PARANOID_COMPANY
, PARANOID_MAIL
);
80 else if (*s
!= '#' && !isspace(*s
) && !strneq(s
, "127.", 4) && !strmatch(s
, PARANOID_FREE
) && o
++ > 4)
89 if (pc
) memzero(pc
, sizeof(*pc
));