FOSSology  4.4.0
Open Source License Compliance by Open Source Software
parse.c
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: © 2006-2015 Hewlett-Packard Development Company, L.P.
3  SPDX-FileCopyrightText: © 2017-2019 Bittium Wireless Ltd.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 /* Equivalent to version 1.83 of Core Nomos code. */
8 #include <ctype.h>
9 
10 #include "nomos.h"
11 
12 #include "parse.h"
13 #include "list.h"
14 #include "util.h"
15 #include "nomos_regex.h"
16 #include "nomos_utils.h"
17 #include <_autodefs.h>
18 
19 /* DEBUG
20 #define DOCTOR_DEBUG 1
21 #define PROC_TRACE 1
22  DEBUG */
23 
40 #define _mGPL 0
41 #define _mLGPL 1
42 #define _mGFDL 2
43 #define _mQPL 3
44 #define _mPYTHON 4
45 #define _mPYTH_TEXT 5
46 #define _mAPACHE 6
47 #define _mHP 7
48 #define _mPHP 8
49 #define _mMIT 9
50 #define _mXOPEN 10
51 #define _mREDHAT 11
52 #define _mISC 12
53 #define _mCMU 13
54 #define _mOSF 14
55 #define _mSUN 15
56 #define _mALADDIN 16
57 #define _mCUPS 17
58 #define _fOPENLDAP 18
59 #define _fBSD 19
60 #define _fGPL 20
61 #define _mCDDL 21
62 #define _mLIBRE 22
63 #define _mGSOAP 23
64 #define _mMPL 24
65 #define _fATTRIB 25
66 #define _fREAL 26
67 #define _fIETF 27
68 #define _fDOC 28
69 #define _fMSCORP 29
70 #define _fW3C 30
71 #define _mAPTANA 31
72 #define _tOPENLDAP 32
73 #define _mNTP 33 // To avoid W3C-style detection
74 #define _fIP 34
75 #define _fANTLR 35
76 #define _fCCBY 36
77 #define _fZPL 37
78 #define _fCLA 38
79 #define _fODBL 39
80 #define _fPDDL 40
81 #define _fRUBY 41
82 #define _fSAX 42
83 #define _fAPL 43
84 #define _fARTISTIC 44
85 #define _fCITRIX 45
86 #define _fPURDUE 46
87 #define _fUNICODE 47
88 #define _fOFL 48
89 #define _mAPACHE10 49
90 #define _mAPACHE11 50
91 #define _mWORDNET 51
92 #define _fNCSA 52
93 #define _fTCL 53
94 #define _fIJG 54
95 #define _msize _fIJG+1
97 
101 static struct {
102  char *base;
103  int sso;
104  int seo;
105  int index;
107 
108 
109 #ifdef PRECHECK
110 extern void preloadResults(char *filetext, char *ltsr);
111 #endif /* PRECHECK */
112 
118 int findPhrase(int, char *,int, int, int, int);
119 int famOPENLDAP(char *, int ,int, int);
120 int checkUnclassified(char *, int, int, int, int, int);
121 int checkPublicDomain(char *, int, int, int, int, int);
122 static int dbgIdxGrep(int, char *, int);
123 #ifdef LTSR_DEBUG
124 void showLTCache(char *);
125 #endif /* LTSR_DEBUG */
126 void checkCornerCases(char *, int, int, int, int, int, int, int);
127 void checkFileReferences(char *, int, int, int, int, int);
128 void addRef(char *, int);
129 #ifdef DOCTOR_DEBUG
130 void dumpMatch(char *, char *);
131 #endif /* DOCTOR_DEBUG */
132 void locateRegex(char *, item_t *, int, int, int, int);
133 void saveRegexLocation(int, int, int, int);
134 void saveUnclBufLocation(int);
135 void saveLicenseParagraph(char *, int , int , int);
136 char *cplVersion(char *, int, int, int);
137 static char *gplVersion(char *, int, int, int);
138 char *lgplVersion(char *, int, int, int);
139 char *agplVersion(char *, int, int, int);
140 char *gfdlVersion(char *, int, int, int);
141 char *lpplVersion(char *, int, int, int);
142 char *mplNplVersion(char *, int, int, int);
143 char *pythonVersion(char *, int, int, int);
144 static char *realVersion(char *, int, int, int, int);
145 static char *sisslVersion(char *, int, int, int);
146 char *aslVersion(char *, int, int, int);
147 char *cddlVersion(char *, int, int, int);
148 char *ccVersion(char *, int, int, int);
149 char *oslVersion(char *, int, int, int);
150 char *aflVersion(char *, int, int, int);
151 static int match3(int, char *, int, int, int, int);
152 void spdxReference(char *, int, int, int);
153 void copyleftExceptions(char *, int, int, int);
155 
164 static char licStr[myBUFSIZ];
165 
166 static char ltsr[NFOOTPRINTS];
168 static char name[256];
169 static char lmem[_msize];
170 static list_t searchList;
171 static list_t whereList;
172 static list_t whCacheList;
173 static int refOffset;
174 static int maxInterest;
175 static int pd;
177 static int crCheck;
178 static int checknw;
179 static int lDebug = 0;
180 static int lDiags = 0;
182 
188 #define PARSE_ARGS filetext, size, isML, isPS
189 #define LVAL(x) (ltsr[x] & LTSR_RMASK)
190 #define SEEN(x) (ltsr[x] & LTSR_SMASK)
191 #define INFILE(x) fileHasPatt(x, PARSE_ARGS, 0)
192 #define NOT_INFILE(x) !( fileHasPatt(x, PARSE_ARGS, 0) && clearLastElementOfLicenceBuffer() )
193 #define RM_INFILE(x) fileHasPatt(x, PARSE_ARGS, 1)
194 #define GPL_INFILE(x) fileHasPatt(x, PARSE_ARGS, 2)
195 #define PERL_INFILE(x) fileHasPatt(x, PARSE_ARGS, 3)
196 #define NY_INFILE(x) fileHasPatt(x, PARSE_ARGS, 4)
197 #define X_INFILE(x, y) fileHasPatt(x, PARSE_ARGS, y)
198 #define DEBUG_INFILE(x) printf(" Regex[%d] = \"%s\"\nINFILE(%d) = %d\n", x, _REGEX(x), x, INFILE(x));
199 #define HASREGEX(x, cp) idxGrep(x, cp, REG_ICASE|REG_EXTENDED)
200 #define HASREGEX_RI(x, cp) idxGrep_recordIndex(x, cp, REG_ICASE|REG_EXTENDED)
201 #define HASTEXT(x, fl) idxGrep_recordIndex(x, filetext, REG_ICASE|fl)
202 #define URL_INFILE(x) (INFILE(x) || fileHasPatt(x, PARSE_ARGS, -1))
203 #define CANSKIP(i,x,y,z) ((i >= y) && (i <= z) && !(kwbm & (1 << (x - _KW_first))))
204 #define HASKW(x, y) (x & (1 << (y - _KW_first)))
205 #define TRYGROUP(x) x(PARSE_ARGS)
206 #define LOWINTEREST(x) addRef(x, IL_LOW)
207 #define MEDINTEREST(x) addRef(x, IL_MED)
208 //#define INTERESTING(x) printf("INTERESTING: %s, %d, %s\n", __FILE__, __LINE__, x);addRef(x, IL_HIGH)
209 #define INTERESTING(x) addRef(x, IL_HIGH)
210 #define ASLVERS() aslVersion(PARSE_ARGS)
211 #define CCVERS() ccVersion(PARSE_ARGS)
212 #define AFLVERS() aflVersion(PARSE_ARGS)
213 #define OSLVERS() oslVersion(PARSE_ARGS)
214 #define CPLVERS() cplVersion(PARSE_ARGS)
215 #define GPLVERS() gplVersion(PARSE_ARGS)
216 #define LGPLVERS() lgplVersion(PARSE_ARGS)
217 #define AGPLVERS() agplVersion(PARSE_ARGS)
218 #define GFDLVERS() gfdlVersion(PARSE_ARGS)
219 #define CDDLVERS() cddlVersion(PARSE_ARGS)
220 #define LPPLVERS() lpplVersion(PARSE_ARGS)
221 #define MPLVERS() mplNplVersion(PARSE_ARGS)
222 #define PYTHVERS() pythonVersion(PARSE_ARGS)
223 #define SISSLVERS() sisslVersion(PARSE_ARGS)
224 #define REALVERS(x) realVersion(PARSE_ARGS, x)
225 #define PR_REGEX(x) printf("check %d = %s\n", x, _REGEX(x));
226 #define mCR_CMU() (INFILE(_CR_CMU_1) || INFILE(_CR_CMU_2))
227 #define mCR_EDIN() (INFILE(_CR_EDINBURGH_1) || INFILE(_CR_EDINBURGH_2))
228 #define mCR_FSF() (INFILE(_CR_FSF1) || INFILE(_CR_FSF2))
229 #define mCR_HP() (INFILE(_CR_HP_1)|| INFILE(_CR_HP_2) || INFILE(_CR_DEC) || INFILE(_CR_EDS))
230 #define mCR_IETF() (INFILE(_CR_IETF_1) || INFILE(_CR_IETF_2))
231 #define mCR_MIT() (INFILE(_CR_MIT1) || INFILE(_CR_MIT2))
232 #define mCR_X11() (INFILE(_CR_X11) || INFILE(_CR_XFREE86))
233 #define mCR_IPTC() (INFILE(_CR_IPTC1) || INFILE(_CR_IPTC2))
234 #define SPDXREF() spdxReference(PARSE_ARGS)
235 #define EXCEPTIONS() copyleftExceptions(PARSE_ARGS)
237 
248 static int fileHasPatt(int licTextIdx, char *filetext, int size,
249  int isML, int isPS, int qType)
250 {
251  int ret = 0;
252  int show = 0;
253  item_t *ip;
254 
255 #ifdef PROC_TRACE
256  traceFunc("== fileHasPatt(size=%d, isML=%d, isPS=%d, qType=%d, idx=%d)\n",
257  size, isML, isPS, qType, licTextIdx);
258 
259 #endif /* PROC_TRACE */
260 
261  /*
262  * If qType is negative, then we should call idxGrep to look at the
263  * raw text of the file; non-negative value means look in the doctored
264  * text buffers...
265  */
266  if ((qType >= 0) && (qType & FL_SHOWMATCH)) {
267  qType &= ~FL_SHOWMATCH;
268  show = FL_SHOWMATCH;
269  }
270  if (qType < 0) {
271  ret = idxGrep_recordPosition(licTextIdx, filetext, REG_ICASE | REG_EXTENDED | show);
272  if (lDiags && ret) {
273 #ifdef DOCTOR_DEBUG
274  dumpMatch(filetext, "RAW-Text");
275 #endif /* DEBUG */
276  printRegexMatch(licTextIdx, NO);
277  saveRegexLocation(licTextIdx, cur.regm.rm_so,
278  cur.regm.rm_eo - cur.regm.rm_so, YES);
279 #ifdef DEBUG
280  printf("WINDOW-RAW: offset %d, length %d\n",
281  cur.regm.rm_so, cur.regm.rm_eo - cur.regm.rm_so);
282 #endif /* DEBUG */
283  }
284  return(ret);
285  }
286  if (SEEN(licTextIdx)) {
287 #ifdef LTSR_DEBUG
288  printf("Cache hit: ltsr[%d] = 0x%x\n", licTextIdx, ltsr[licTextIdx]);
289 #endif /* LTSR_DEBUG */
290  if (lDiags && (ltsr[licTextIdx] & LTSR_YES) == LTSR_YES) {
291  printRegexMatch(licTextIdx, YES);
292  (void) sprintf(name, "reg%04d", licTextIdx);
293  ip = listGetItem(&whCacheList, name);
294  if (ip->bIndex != licTextIdx) {
295  listDump(&whCacheList, NO);
296  LOG_FATAL("Offset-cache (\"%s\") == %d, not %d!", name, ip->bIndex, licTextIdx)
297  Bail(-__LINE__);
298  }
299  saveRegexLocation(licTextIdx, ip->bStart, ip->bLen, NO);
300  }
301  return(ltsr[licTextIdx] & LTSR_RMASK);
302  }
303  return(findPhrase(licTextIdx, PARSE_ARGS, qType));
304 }
305 
316 static int dbgIdxGrep(int licTextIdx, char *buf, int show)
317 {
318  int ret;
319  int flags = REG_ICASE|REG_EXTENDED;
320 
321  if (SEEN(licTextIdx)) {
322  return(ltsr[licTextIdx] & LTSR_RMASK);
323  }
324 
325  if (show) {
326  flags |= FL_SHOWMATCH;
327  }
328  ret = idxGrep(licTextIdx, buf, flags);
329  if (lDiags && ret) {
330  printRegexMatch(licTextIdx, NO);
331  saveRegexLocation(licTextIdx, cur.regm.rm_so,
332  cur.regm.rm_eo - cur.regm.rm_so, YES);
333  }
334  ltsr[licTextIdx] |= ret;
335  return ret;
336 }
337 
359 char *parseLicenses(char *filetext, int size, scanres_t *scp,
360  int isML, int isPS)
361 {
362  static int first = 1;
363  char *cp;
364  int i;
365  int j;
366  int nw = 0;
367  int score = scp->score;
368  int kwbm = scp->kwbm;
369 #ifdef PRECHECK
370  extern void preloadResults(char *, char *);
371 #endif /* PRECHECK */
372 
373 #if defined(PROC_TRACE) || defined(DOCTOR_DEBUG)
374  traceFunc("== parseLicenses(%p, %d, [%d, 0x%x], %d, %d)\n",
375  filetext, size, score, kwbm, isML, isPS );
376 #endif /* PROC_TRACE || DOCTOR_DEBUG */
377 
378  if (size == 0) {
379  LOWINTEREST("Empty-file-no-data!");
380  return(licStr+1);
381  }
382 
383  if (first) {
384  if (optionIsSet(OPTS_DEBUG)) {
385  lDebug = 1;
386  lDiags = 1;
387  }
388  listInit(&searchList, 0, "pattern-search list");
389  listInit(&whereList, 0, "regex-match locations list");
390  listInit(&whCacheList, 0, "regex-cache-match list");
391  first = 0;
392  }
393  crCheck = 0;
394  kludge.base = NULL_STR;
395  /*
396  * Interestingly enough, the headers for Nomos-generated file (e.g., the
397  * page containing the keywords found, file attributes and file text, etc.)
398  * contain enough data to confuse the parser in multiple ways... in the
399  * rare event we encounter a data file we generated, skip the header.
400  *****
401  * AND, not all nomos-created files have the same header(s).
402  */
403  pd = -1; /* unchecked */
404  cp = filetext;
405  maxInterest = IL_INIT;
406  cur.licPara = NULL_STR; /* unclassified license data */
407  gl.flags &= ~FL_FRAGMENT;
408 #ifdef FLAG_NO_COPYRIGHT
409  gl.flags &= ~FL_NOCOPYRIGHT;
410 #endif /* FLAG_NO_COPYRIGHT */
411  if (scp->dataOffset && lDiags) {
412  LOG_NOTICE("%s-generated link, ignore header (%d bytes)!",
413  gl.progName, scp->dataOffset);
414  }
415 
416  /*
417  * It's been observed over time that the file-magic() stuff doesn't always
418  * identify everything correctly. One case in particular is PostScript files
419  * when the "%%PS" directive isn't the first line in a file... but the rest
420  * of the data really IS PostScript
421  */
422  if (!isPS && (strncasecmp(filetext, "%%page:", 7) == 0 || strncasecmp(filetext, "{\\rtf", 5) == 0)) {
423 #if defined(DEBUG) || defined(DOCTOR_DEBUG)
424  printf("File is really postscript, %s filetext !\n", filetext);
425 #endif /* DEBUG || DOCTOR_DEBUG */
426  isPS = 1;
427  }
428 
429  *licStr = NULL_CHAR;
430  refOffset = 0;
431  (void) memset(ltsr, 0, sizeof(ltsr));
432  (void) memset(lmem, 0, sizeof(lmem));
433 #if defined(DEBUG) && defined(LTSR_DEBUG)
434  showLTCache("LTSR-results START:");
435 #endif /* DEBUG && LTSR_DEBUG */
436 #ifdef PRECHECK
437  preloadResults(/*PARSE_ARGS*/filetext, ltsr);
438 #endif /* PRECHECK */
439 #ifdef MEMSTATS
440  memStats("parseLicenses: BOP");
441 #endif /* MEMSTATS */
442  lmem[_mPYTH_TEXT] = HASTEXT(_TEXT_PYTHON, 0);
443  lmem[_tOPENLDAP] = HASTEXT(_TEXT_OPENLDAP, 0);
444  (void) INFILE(_TEXT_GNU_LIC_INFO);
445 #ifdef LTSR_DEBUG
446  showLTCache("LTSR-results INIT-SCAN:");
447 #endif /* LTSR_DEBUG */
448  /*
449  * MySQL.FLOSS exception
450  */
451  if (INFILE(_LT_MYSQL_EXCEPT) || INFILE(_PHR_FREE_LIBRE)) {
452  if (INFILE(_TITLE_ALFRESCO)) {
453  INTERESTING("Alfresco-FLOSS");
454  }
455  else if (HASTEXT(_TEXT_ALFRESCO, 0)) {
456  INTERESTING("Alfresco");
457  }
458  else if (INFILE(_CR_MYSQL) || INFILE(_TITLE_mysql_floss_exception)) {
459  if (INFILE(_TITLE_MYSQL_V03)) {
460  INTERESTING("MySQL-0.3");
461  }
462  else {
463  INTERESTING("mysql-floss-exception");
464  }
465  }
466  else {
467  INTERESTING("MySQL-style");
468  }
469  lmem[_mLIBRE] = 1;
470  }
471  /*
472  * Some RealNetworks licenses included a list of "compatible" licenses that
473  * can confuse the license-detection algorithms within. Look for these early
474  * in the process, and ignore the known (false) matches when we detect the
475  * RPSL/RCSL licenses.
476  */
477  if (HASTEXT(_TEXT_REALNET, REG_EXTENDED)) {
478  /*
479  * List of other licenses should be excluded only if full license text is found
480  */
481  if (INFILE(_LT_RPSL_COMPATIBLE)) {
482  lmem[_fREAL] = 1;
483  }
484  if (INFILE(_LT_REAL_RPSL)) {
485  cp = REALVERS(_TITLE_RPSL);
486  INTERESTING(lDebug ? "RPSL" : cp);
487  }
488  else if (INFILE(_LT_REAL_RPSLref)) {
489  cp = REALVERS(_TITLE_RPSL);
490  INTERESTING(lDebug ? "Real-RPSL(ref)" : cp);
491  }
492  if (INFILE(_LT_REAL_RCSL)) {
493  cp = REALVERS(_TITLE_RCSL);
494  INTERESTING(lDebug ? "RCSL" : cp);
495  }
496  else if (INFILE(_LT_REAL_RCSLref)) {
497  cp = REALVERS(_TITLE_RCSL);
498  INTERESTING(lDebug ? "Real-RCSL(ref)" : cp);
499  }
500  if (INFILE(_TITLE_REAL_EULA)) {
501  INTERESTING("RealNetworks-EULA");
502  }
503  else if (INFILE(_LT_HELIX_TITLE)) {
504  INTERESTING("Helix.RealNetworks-EULA");
505  }
506  }
508  /*
509  * Zope - this license is explicitly listed (by title) in several other
510  * licenses...
511  */
512  if (!lmem[_mLIBRE] && !lmem[_fREAL] && INFILE(_TITLE_ZOPE)) {
513  if (INFILE(_TITLE_ZOPE_V21)) {
514  INTERESTING("ZPL-2.1");
515  lmem[_fZPL] = 1;
516  }
517  else if (INFILE(_TITLE_ZOPE_V20)) {
518  INTERESTING("ZPL-2.0");
519  lmem[_fZPL] = 1;
520  }
521  else if (INFILE(_TITLE_ZOPE_V10)) {
522  INTERESTING("ZPL-1.0");
523  lmem[_fZPL] = 1;
524  }
525  else if (INFILE(_TITLE_ZOPE_V11)) {
526  INTERESTING("ZPL-1.1");
527  lmem[_fZPL] = 1;
528  }
529  else if (INFILE(_SPDX_ZPL_11)) {
530  INTERESTING("ZPL-1.1");
531  lmem[_fZPL] = 1;
532  }
533  else if (INFILE(_SPDX_ZPL_20)) {
534  INTERESTING("ZPL-2.0");
535  lmem[_fZPL] = 1;
536  }
537  else if (INFILE(_SPDX_ZPL_21)) {
538  INTERESTING("ZPL-2.1");
539  lmem[_fZPL] = 1;
540  }
541  else if (INFILE(_TITLE_ZIMBRA_13)) {
542  INTERESTING("Zimbra-1.3");
543  }
544  else if (INFILE(_TITLE_ZIMBRA_12)) {
545  INTERESTING("Zimbra-1.2");
546  }
547  else {
548  INTERESTING(lDebug ? "Zope(ref)" : "ZPL");
549  lmem[_fZPL] = 1;
550  }
551  }
553  /*
554  * Check Apache licenses before BSD
555  */
556  if (HASTEXT(_PHR_Apache_ref0, REG_EXTENDED) || INFILE(_PHR_Apache_ref7) || INFILE(_TITLE_Apache)) {
557  cp = ASLVERS();
558  INTERESTING(cp);
559  }
561  /*
562  * BSD and all the variant 'flavors'. BSD licenses are kind of like
563  * the cooking concept of 'the mother sauces' -- MANY things are derived
564  * from the wordings of these licenses. There are still many more, for
565  * certain, but LOTS of licenses are based on ~10 originally-BSD-phrases.
566  */
567  if (INFILE(_LT_BSD_1)) {
568  if (INFILE(_TITLE_PHP301)) {
569  INTERESTING(lDebug ? "PHP(v3.01#1)" : "PHP-3.01");
570  lmem[_mPHP] = 1;
571  }
572  else if (INFILE(_TITLE_PHP30)) {
573  INTERESTING(lDebug ? "PHP(v3.0#1)" : "PHP-3.0");
574  lmem[_mPHP] = 1;
575  }
576  else if (INFILE(_TITLE_PHP202)) {
577  INTERESTING(lDebug ? "PHP(v2.02#1)" : "PHP-2.02");
578  lmem[_mPHP] = 1;
579  }
580  else if (INFILE(_CR_VOVIDA) || INFILE(_TITLE_VOVIDA)) {
581  INTERESTING("VSL-1.0");
582  lmem[_fBSD] = 1;
583  }
584  else if (INFILE(_CR_NAUMEN) || INFILE(_TITLE_NAUMEN)) {
585  INTERESTING("Naumen");
586  }
587  else if (INFILE(_CR_ENTESSA) || INFILE(_TITLE_ENTESSA)) {
588  INTERESTING("Entessa");
589  }
590  else if (INFILE(_LT_ATTRIB) || INFILE(_TITLE_ATTRIBUTION)) {
591  INTERESTING("AAL");
592  lmem[_fATTRIB] = 1;
593  }
594  else if (INFILE(_CR_ZOPE)) {
595  INTERESTING(lDebug ? "Zope(bsd)" : "ZPL");
596  }
597  else if (INFILE(_LT_Oracle_Berkeley_DB)) {
598  INTERESTING("Oracle-Berkeley-DB");
599  }
600  else if (INFILE(_CR_SLEEPYCAT) || INFILE(_LT_SLEEPYCAT_1)) {
601  MEDINTEREST(lDebug ? "Sleepycat(1)" : "Sleepycat");
602  }
603  else if (INFILE(_TITLE_ZEND_V20)) {
604  INTERESTING("Zend-2.0");
605  }
606  else if (!lmem[_fOPENLDAP] && !TRYGROUP(famOPENLDAP)) {
607  if (HASTEXT(_LT_OPENSSLref5, REG_EXTENDED)) {
608  INTERESTING(lDebug ? "OpenSSL(ref)" : "OpenSSL");
609  }
610  else if (INFILE(_LT_BSD_CLAUSE_0) && INFILE(_LT_BSD_CLAUSE_1) && INFILE(_LT_BSD_CLAUSE_2)) {
611  if (INFILE(_LT_BSD_CLAUSE_3) && (INFILE(_LT_BSD_CLAUSE_4) || INFILE(_LT_BSD_CLAUSE_4_LONG)) && INFILE(_LT_UC)) {
612  INTERESTING("BSD-4-Clause-UC");
613  }
614  else if (INFILE(_LT_BSD_CLAUSE_3) && (INFILE(_LT_BSD_CLAUSE_4) || INFILE(_LT_BSD_CLAUSE_4_LONG))) {
615  INTERESTING("BSD-4-Clause");
616  }
617  else if (INFILE(_LT_BSD_CLAUSE_4) && INFILE(_LT_BSD_CLAUSE_CLEAR)) {
618  INTERESTING("BSD-3-Clause-Clear");
619  }
620  else if (INFILE(_LT_BSD_CLAUSE_4) && INFILE(_LT_BSD_CLAUSE_OPEN_MPI)) {
621  INTERESTING("BSD-3-Clause-Open-MPI");
622  }
623  else if (INFILE(_LT_BSD_CLAUSE_4) && HASTEXT(_KW_severability, REG_EXTENDED)) {
624  INTERESTING("BSD-3-Clause-Severability");
625  }
626  else if (INFILE(_LT_XML_DB_V10)) {
627  INTERESTING("XMLDB-1.0");
628  }
629  else if (INFILE(_LT_BSD_CLAUSE_4) && INFILE(_LT_ANT_BSD_RESTRICTION)) {
630  INTERESTING("ANT+SharedSource");
631  }
632  else if (!lmem[_mAPACHE11] && INFILE(_LT_Apache_11_CLAUSE_3) && INFILE(_LT_Apache_11_CLAUSE_4) && INFILE(_LT_Apache_11_CLAUSE_5)) {
633  INTERESTING(lDebug ? "BSD(Apache-1.1)" : "Apache-1.1-style");
634  }
635  else if(HASTEXT(_LT_Sendmail_823_title, 0)) {
636  INTERESTING("Sendmail-8.23");
637  }
638  else if (!lmem[_mAPACHE10] && !lmem[_mAPACHE11] && INFILE(_LT_BSD_CLAUSE_ATTRIBUTION)) {
639  INTERESTING("BSD-3-Clause-Attribution");
640  }
641  else if (!lmem[_mAPACHE10] && !lmem[_mAPACHE11] && INFILE(_LT_BSD_CLAUSE_4)) {
642  if (INFILE(_LT_DARPA_COUGAAR_2)) {
643  INTERESTING("DARPA-Cougaar");
644  }
645  else {
646  INTERESTING("BSD-3-Clause");
647  }
648  }
649  else if (INFILE(_LT_SSLEAY)) {
650  INTERESTING("SSLeay");
651  }
652  else if (INFILE(_LT_TMATE)) {
653  INTERESTING("TMate");
654  }
655  else if (INFILE(_LT_MUP)) {
656  INTERESTING("Mup");
657  }
658  else if (INFILE(_LT_FREE_BSD)) {
659  INTERESTING("BSD-2-Clause-FreeBSD");
660  }
661  else if (INFILE(_LT_BSD_CLAUSE_PATENT)) {
662  INTERESTING("BSD-2-Clause-Patent");
663  }
664  else if (INFILE(_CR_NETBSD)) {
665  INTERESTING("BSD-2-Clause-NetBSD");
666  }
667  else if (INFILE(_LT_MIT_0)) {
668  lmem[_mMIT] = 1;
669  INTERESTING("Linux-OpenIB");
670  }
671  else if (!lmem[_mAPACHE10] && !lmem[_mAPACHE11]) {
672  INTERESTING("BSD-2-Clause");
673  }
674  }
675  else if (INFILE(_CR_CRYPTOGAMS)) {
676  INTERESTING("Cryptogams");
677  }
678  else if (INFILE(_LT_BSD_SHORTENED_CLAUSE_0) && INFILE(_LT_BSD_SHORTENED_CLAUSE_1) && INFILE(_LT_BSD_SHORTENED_CLAUSE_2) && INFILE(_LT_BSD_CLAUSE_3)) {
679  INTERESTING("BSD-4-Clause-Shortened");
680  }
681  else if (INFILE(_CR_BSDCAL)) {
682  INTERESTING(lDebug ? "BSD(1)" : "BSD");
683  }
684  else if (HASTEXT(_TEXT_ALTERED_SOURCE, REG_EXTENDED) && HASTEXT(_TEXT_ORIGIN, 0)) {
685  if (INFILE(_PHR_BZIP2_3)) {
686  INTERESTING("bzip2-1.0.5");
687  }
688  else if (HASTEXT(_PHR_BZIP2_4, REG_EXTENDED)) {
689  INTERESTING("bzip2-1.0.6");
690  }
691  else {
692  INTERESTING("bzip2");
693  }
694  }
695  else if (mCR_CMU()) {
696  INTERESTING(lDebug ? "CMU(BSD-ish)" : "CMU");
697  }
698  else if (INFILE(_LT_MTLL)) {
699  INTERESTING("MTLL");
700  }
701  else if (INFILE(_LT_BSD_CLAUSE_1_DISCLAIMER)) {
702  INTERESTING("BSD-1-Clause");
703  }
704  else if (INFILE(_LT_Spencer_99) && INFILE(_CR_Spencer)) {
705  INTERESTING("Spencer-99");
706  }
707  else if (!lmem[_fZPL]) {
708  INTERESTING(lDebug ? "BSD-style(1)" : "BSD-style");
709  }
710  }
711  lmem[_fBSD] = 1;
712  }
713  else if (INFILE(_LT_BSD_CLEAR_CLAUSE_0) && INFILE(_LT_BSD_CLAUSE_1) && INFILE(_LT_BSD_CLAUSE_2)) {
714  INTERESTING("BSD-3-Clause-Clear");
715  }
716  else if (INFILE(_PHR_Linux_OpenIB)) {
717  INTERESTING("Linux-OpenIB");
718  }
719  else if (INFILE(_LT_BSD_2)) {
720  /*
721  * Python, OSF, SecretLabs, some universities, some vendors, etc., have
722  * variants here.
723  */
724  if (INFILE(_CR_PYTHON) || INFILE(_TITLE_PYTHON)) {
725  cp = PYTHVERS();
726  INTERESTING(lDebug ? "Python(3)" : cp);
727  lmem[_mPYTHON] = 1;
728  }
729  else if (INFILE(_CR_OSF)) {
730  INTERESTING(lDebug ? "OSF(1)" : "OSF");
731  lmem[_mOSF] = 1;
732  }
733  else if (INFILE(_CR_UI)) {
734  INTERESTING(lDebug ? "UI(1)" : "Unix-Intl");
735  }
736  else if (INFILE(_CR_XOPEN)) {
737  INTERESTING(lDebug ? "XOpen(1)" : "X/Open");
738  lmem[_mXOPEN] = 1;
739  }
740  else if (INFILE(_PHR_HISTORICAL)) {
741  INTERESTING("HPND");
742  }
743  else if (INFILE(_LT_CMU_7)) {
744  if (INFILE(_CR_CMU_1) || INFILE(_CR_CMU_2) || INFILE(_CR_BSDCAL)) {
745  INTERESTING("MIT-CMU");
746  }
747  else {
748  INTERESTING("MIT-CMU-style");
749  }
750  lmem[_mCMU] = 1;
751  }
752  else if (INFILE(_CR_BSDCAL)) {
753  INTERESTING(lDebug ? "BSD(2)" : "BSD");
754  }
755  else if (INFILE(_LT_NTP)) {
756  INTERESTING("NTP");
757  }
758  else if (INFILE(_LT_WORDNET))
759  {
760  INTERESTING("WordNet-3.0");
761  lmem[_mMIT] = 1;
762  }
763  else if (INFILE(_LT_HPND_1) && INFILE(_LT_HPND_2)) {
764  INTERESTING("HPND");
765  lmem[_mMIT] = 1;
766  }
767  else if (INFILE(_LT_NOT_ADVERTISING)) {
768  INTERESTING(lDebug ? "BSD-style(2)" : "BSD-style");
769  }
770  else if (INFILE(_PHR_NO_WARRANTY_12)) {
771  INTERESTING(lDebug ? "ISC(BSD-style)" : "ISC-style");
772  }
773  else {
774  INTERESTING(lDebug ? "BSD-style(2)-MIT" : "MIT-style");
775  }
776  lmem[_fBSD] = 1;
777  }
778  else if (INFILE(_LT_BSD_3) && NOT_INFILE(_TITLE_OPENLDAP)) {
779  if (INFILE(_LT_AMPAS)) {
780  INTERESTING("AMPAS");
781  }
782  else if (INFILE(_CR_BSDCAL)) {
783  INTERESTING(lDebug ? "BSD(3)" : "BSD");
784  }
785  else if (INFILE(_TITLE_OZPLB_10)) {
786  INTERESTING("OZPLB-1.0");
787  }
788  /*
789  * JPNIC
790  */
791  else if (HASTEXT(_TEXT_JPNIC, 0) && INFILE(_LT_JPNIC)) {
792  INTERESTING("JPNIC");
793  }
794  else if (NOT_INFILE(_CR_XFREE86) && NOT_INFILE(_TITLE_NCSA) && NOT_INFILE(_TITLE_INNERNET200)) {
795  INTERESTING(lDebug ? "BSD-style(3)" : "BSD-style");
796  }
797  lmem[_fBSD] = 1;
798  }
799  else if (INFILE(_LT_BSD_4)) {
800  if (INFILE(_CR_BSDCAL)) {
801  INTERESTING(lDebug ? "BSD(4)" : "BSD");
802  }
803  else {
804  INTERESTING(lDebug ? "BSD-style(4)" : "BSD-style");
805  }
806  lmem[_fBSD] = 1;
807  }
808  /*
809  * FIX-ME: this license text explicitly mentions "for no-profit", and as
810  * such it should list it in the license-summary, yes?
811  */
812  else if (INFILE(_LT_BSD_5)) {
813  if (!lmem[_mPYTHON] && INFILE(_CR_PYTHON)) {
814  INTERESTING(lDebug ? "Python(2)" : "Python");
815  lmem[_mPYTHON] = 1;
816  }
817  else if (INFILE(_CR_USL_EUR)) {
818  INTERESTING(lDebug ? "USLE(1)" : "USL-Europe");
819  }
820  else if (INFILE(_CR_BSDCAL)) {
821  INTERESTING(lDebug ? "BSD(5)" : "BSD");
822  }
823  else {
824  INTERESTING(lDebug ? "BSD-style(5)" : "BSD-style");
825  }
826  lmem[_fBSD] = 1;
827  }
828  else if (INFILE(_LT_BSD_6)) {
829  if (INFILE(_CR_BSDCAL)) {
830  INTERESTING(lDebug ? "BSD(6)" : "BSD");
831  }
832  else {
833  INTERESTING(lDebug ? "BSD-style(6)" : "BSD-style");
834  }
835  lmem[_fBSD] = 1;
836  }
837  else if (INFILE(_LT_BSD_7)) {
838  if (HASTEXT(_LT_MAKEINDEX_1, 0) && HASTEXT(_LT_MAKEINDEX_2, 0)) {
839  INTERESTING("MakeIndex");
840  }
841  else if (INFILE(_CR_BSDCAL)) {
842  INTERESTING(lDebug ? "BSD(7)" : "BSD");
843  }
844  else {
845  INTERESTING(lDebug ? "BSD-style(7)" : "BSD-style");
846  }
847  lmem[_fBSD] = 1;
848  }
849  else if (INFILE(_LT_BSD_8)) {
850  if (INFILE(_CR_BSDCAL)) {
851  INTERESTING(lDebug ? "BSD(8)" : "BSD");
852  }
853  else {
854  INTERESTING(lDebug ? "BSD-style(8)" : "BSD-style");
855  }
856  lmem[_fBSD] = 1;
857  }
858  else if (INFILE(_LT_BSD_9)) {
859  if (INFILE(_CR_BSDCAL)) {
860  INTERESTING(lDebug ? "BSD(9)" : "BSD");
861  }
862  else {
863  INTERESTING(lDebug ? "BSD-style(8)" : "BSD-style");
864  }
865  lmem[_fBSD] = 1;
866  }
867  else if (INFILE(_LT_BSD_10)) {
868  if (INFILE(_CR_BSDCAL)) {
869  INTERESTING(lDebug ? "BSD(10)" : "BSD");
870  }
871  else {
872  INTERESTING(lDebug ? "BSD-style(9)" : "BSD-style");
873  }
874  lmem[_fBSD] = 1;
875  }
876  else if (INFILE(_LT_BSD_11)) {
877  if (INFILE(_CR_BSDCAL)) {
878  INTERESTING(lDebug ? "BSD(11)" : "BSD");
879  }
880  else {
881  INTERESTING(lDebug ? "BSD-style(10)" : "BSD-style");
882  }
883  lmem[_fBSD] = 1;
884  }
885  else if (INFILE(_LT_BSD_12)) {
886  if (INFILE(_CR_BSDCAL)) {
887  INTERESTING(lDebug ? "BSD(12)" : "BSD");
888  }
889  else {
890  INTERESTING(lDebug ? "BSD-style(11)" : "BSD-style");
891  }
892  lmem[_fBSD] = 1;
893  }
894  else if (INFILE(_LT_BSD_13)) {
895  if (INFILE(_CR_BSDCAL)) {
896  INTERESTING(lDebug ? "BSD(13)" : "BSD");
897  }
898  else {
899  INTERESTING(lDebug ? "BSD-style(12)" : "BSD-style");
900  }
901  lmem[_fBSD] = 1;
902  }
903  else if (INFILE(_LT_BSD_NONC)) {
904  if (INFILE(_CR_BSDCAL)) {
905  INTERESTING(lDebug ? "BSD(NonC)" : "BSD.non-commercial");
906  }
907  else {
908  INTERESTING(lDebug ? "BSD-style(NonC)" : "Non-commercial");
909  }
910  lmem[_fBSD] = 1;
911  }
912  else if (INFILE(_SPDX_BSD_3_Clause_Clear)) {
913  INTERESTING("BSD-3-Clause-Clear");
914  }
915  else if (INFILE(_SPDX_BSD_3_Clause_No_Nuclear_License_2014)) {
916  INTERESTING("BSD-3-Clause-No-Nuclear-License-2014");
917  }
918  else if (INFILE(_SPDX_BSD_3_Clause_No_Nuclear_License)) {
919  INTERESTING("BSD-3-Clause-No-Nuclear-License");
920  }
921  else if (INFILE(_SPDX_BSD_3_Clause_No_Nuclear_Warranty)) {
922  INTERESTING("BSD-3-Clause-No-Nuclear-Warranty");
923  }
924  else if (INFILE(_SPDX_BSD_3_Clause_Attribution)) {
925  INTERESTING("BSD-3-Clause-Attribution");
926  }
927  else if (INFILE(_SPDX_BSD_3_Clause_LBNL)) {
928  INTERESTING("BSD-3-Clause-LBNL");
929  }
930  else if (INFILE(_SPDX_BSD_3_Clause_Open_MPI)) {
931  INTERESTING("BSD-3-Clause-Open-MPI");
932  }
933  else if (INFILE(_SPDX_BSD_3_Clause)) {
934  INTERESTING("BSD-3-Clause");
935  }
936  else if (INFILE(_PHR_BSD_3_CLAUSE_1) || INFILE(_PHR_BSD_3_CLAUSE_2) || INFILE(_PHR_BSD_3_CLAUSE_3) || INFILE(_PHR_BSD_3_CLAUSE_4)) {
937  INTERESTING(lDebug ? "BSD(phr1/2)" : "BSD-3-Clause");
938  }
939  else if (INFILE(_SPDX_BSD_2_Clause_FreeBSD)) {
940  INTERESTING("BSD-2-Clause-FreeBSD");
941  }
942  else if (INFILE(_SPDX_BSD_2_Clause_NetBSD)) {
943  INTERESTING("BSD-2-Clause-NetBSD");
944  }
945  else if (INFILE(_SPDX_BSD_2_Clause_Patent)) {
946  INTERESTING("BSD-2-Clause-Patent");
947  }
948  else if (INFILE(_SPDX_BSD_2_Clause_Views)) {
949  INTERESTING("BSD-2-Clause-Views");
950  }
951  else if (INFILE(_SPDX_BSD_2_Clause_1)) {
952  INTERESTING("BSD-2-Clause");
953  }
954  else if (INFILE(_SPDX_BSD_2_Clause_2)) {
955  INTERESTING("BSD-2-Clause");
956  }
957  else if (INFILE(_PHR_BSD_2_CLAUSE_1)
958  || INFILE(_PHR_BSD_2_CLAUSE_2)
959  || INFILE(_PHR_BSD_2_CLAUSE_3)
960  || INFILE(_PHR_BSD_2_CLAUSE_4)
961  || INFILE(_PHR_BSD_2_CLAUSE_5)
962  || INFILE(_PHR_BSD_2_CLAUSE_6)) {
963  INTERESTING(lDebug ? "BSD(phr1/2/3/4/5/6)" : "BSD-2-Clause");
964  }
965  else if (INFILE(_SPDX_BSD_4_Clause_UC)) {
966  INTERESTING("BSD-4-Clause-UC");
967  }
968  else if (INFILE(_SPDX_BSD_4_Clause)) {
969  INTERESTING("BSD-4-Clause");
970  }
971  else if (INFILE(_PHR_BSD_4_CLAUSE_1)) {
972  INTERESTING(lDebug ? "BSD-4-Clause(phr1)" : "BSD-4-Clause");
973  }
974  else if (INFILE(_PHR_BSD_CLEAR_1)) {
975  INTERESTING(lDebug ? "BSD-Clear(phr1)" : "BSD-3-Clause-Clear");
976  }
977  else if (INFILE(_PHR_BSD_3_CLAUSE_LBNL)) {
978  INTERESTING("BSD-3-Clause-LBNL");
979  }
980  else if (INFILE(_SPDX_BSD_Protection)) {
981  INTERESTING("BSD-Protection");
982  }
983  else if (INFILE(_SPDX_BSD_Source_Code)) {
984  INTERESTING("BSD-Source-Code");
985  }
986  else if (INFILE(_SPDX_BSD_1_Clause)) {
987  INTERESTING("BSD-1-Clause");
988  }
989  else if (INFILE(_PHR_0BSD)) {
990  INTERESTING("0BSD");
991  }
992  else if (INFILE(_LT_BSDref1)) {
993  INTERESTING(lDebug ? "BSD(ref1)" : "BSD");
994  }
995  else if (INFILE(_LT_BSDref2)) {
996  INTERESTING(lDebug ? "BSD(ref2)" : "BSD");
997  }
998  else if (INFILE(_LT_BSDref3)) {
999  INTERESTING(lDebug ? "BSD(ref3)" : "BSD");
1000  }
1001  else if (INFILE(_LT_BSDref4)) {
1002  INTERESTING(lDebug ? "BSD(ref4)" : "BSD");
1003  }
1004  else if (INFILE(_LT_BSDref5)) {
1005  INTERESTING(lDebug ? "BSD(ref5)" : "BSD");
1006  }
1007  else if (INFILE(_LT_BSDref6)) {
1008  INTERESTING(lDebug ? "BSD(ref6)" : "BSD");
1009  }
1010  else if (INFILE(_LT_BSDref7)) {
1011  INTERESTING(lDebug ? "BSD(ref7)" : "BSD");
1012  }
1013  else if (INFILE(_LT_BSDref8)) {
1014  INTERESTING(lDebug ? "BSD(ref8)" : "BSD");
1015  }
1016  else if (INFILE(_LT_BSDref9)) {
1017  INTERESTING(lDebug ? "BSD(ref9)" : "BSD");
1018  }
1019  else if (INFILE(_LT_BSDref10)) {
1020  INTERESTING(lDebug ? "BSD(ref10)" : "BSD");
1021  }
1022  else if (INFILE(_LT_BSDref11)) {
1023  INTERESTING(lDebug ? "BSD(ref11)" : "BSD");
1024  }
1025  else if (INFILE(_LT_BSDref12) || HASTEXT(_LT_BSDref13, REG_EXTENDED)) {
1026  INTERESTING(lDebug ? "BSD(ref12)" : "BSD-3-Clause");
1027  }
1028  else if (URL_INFILE(_URL_BSD_1) || URL_INFILE(_URL_BSD_2)) {
1029  INTERESTING(lDebug ? "BSD(url)" : "BSD");
1030  lmem[_fBSD] = 1;
1031  }
1032  else if (INFILE(_LT_BSDref14)) {
1033  INTERESTING(lDebug ? "BSD(ref14)" : "BSD");
1034  lmem[_fBSD] = 1;
1035  }
1036  else if (INFILE(_LT_BSDref15)) {
1037  INTERESTING(lDebug ? "BSD(ref15)" : "BSD");
1038  lmem[_fBSD] = 1;
1039  }
1040  else if (INFILE(_LT_BSDSTYLEref1)) {
1041  INTERESTING(lDebug ? "BSD-st(1)" : "BSD-style");
1042  lmem[_fBSD] = 1;
1043  }
1044  else if (INFILE(_LT_BSDSTYLEref2)) {
1045  INTERESTING(lDebug ? "BSD-st(2)" : "BSD-style");
1046  lmem[_fBSD] = 1;
1047  }
1048  else if (INFILE(_LT_BSDSTYLEref4)) {
1049  INTERESTING(lDebug ? "BSD-st(4)" : "BSD-style");
1050  lmem[_fBSD] = 1;
1051  }
1052  else if (INFILE(_LT_BSDSTYLEref3)) {
1053  INTERESTING(lDebug ? "BSD-st(3)" : "BSD-style");
1054  lmem[_fBSD] = 1;
1055  }
1056  else if (INFILE(_LT_BSD_HTMLAREA_1) || INFILE(_LT_BSD_HTMLAREA_2)) {
1057  INTERESTING(lDebug ? "BSD-htmlArea" : "BSD-3-Clause");
1058  lmem[_fBSD] = 1;
1059  }
1060  else if (INFILE(_FILE_BSD1) || INFILE(_FILE_BSD2)) {
1061  INTERESTING(lDebug ? "BSD(deb)" : "BSD");
1062  }
1064  /*
1065  * Aptana public license (based on MPL)
1066  */
1067  if (INFILE(_LT_APTANA)) {
1068  if (INFILE(_TITLE_APTANA_V10)) {
1069  INTERESTING("Aptana-1.0");
1070  }
1071  else {
1072  INTERESTING("Aptana");
1073  }
1074  lmem[_mMPL] = 1;
1075  lmem[_mAPTANA] = 1;
1076  }
1077  /*
1078  * PHP variants
1079  */
1080  if (!lmem[_mPHP] && INFILE(_LT_PHP)) {
1081  if (INFILE(_TITLE_PHP301)) {
1082  INTERESTING(lDebug ? "PHP(v3.01#2)" : "PHP-3.01");
1083  }
1084  else if (INFILE(_TITLE_PHP30)) {
1085  INTERESTING(lDebug ? "PHP(v3.0#2)" : "PHP-3.0");
1086  }
1087  else if (INFILE(_TITLE_PHP202)) {
1088  INTERESTING(lDebug ? "PHP(v2.02#3)" : "PHP-2.02");
1089  }
1090  else if (INFILE(_CR_PHP)) {
1091  INTERESTING(lDebug ? "PHP(1)" : "PHP");
1092  }
1093  else {
1094  INTERESTING("PHP-style");
1095  }
1096  lmem[_mPHP] = 1;
1097  }
1098  else if (!lmem[_mPHP] && INFILE(_LT_PHP_V30_1)) {
1099  INTERESTING("PHP-3.0");
1100  lmem[_mPHP] = 1;
1101  }
1102  else if (!lmem[_mPHP] && INFILE(_LT_PHP_V30_2)) {
1103  INTERESTING("PHP-3.0");
1104  lmem[_mPHP] = 1;
1105  }
1106  else if (!lmem[_mPHP] && INFILE(_LT_PHPref1)) {
1107  if (INFILE(_PHR_PHP_V301)) {
1108  INTERESTING(lDebug ? "PHP(ref-3.01)" : "PHP-3.01");
1109  }
1110  else if (INFILE(_PHR_PHP_V20)) {
1111  INTERESTING(lDebug ? "PHP(ref-2.0)" : "PHP-2.0");
1112  }
1113  else {
1114  INTERESTING(lDebug ? "PHP(ref)" : "PHP");
1115  }
1116  lmem[_mPHP] = 1;
1117  }
1118  else if (!lmem[_mPHP] && URL_INFILE(_URL_PHP)) {
1119  INTERESTING(lDebug ? "PHP(url)" : "PHP");
1120  lmem[_mPHP] = 1;
1121  }
1122  else if (INFILE(_LT_PHP_ref)) {
1123  INTERESTING(lDebug ? "PHP(2)" : "PHP");
1124  lmem[_mPHP] = 1;
1125  }
1127  /*
1128  * Licenses between here and all the GPL/LGPL/GFDL/FSF checks (below) MUST
1129  * be tested PRIOR to checking GPL/FSF and friends
1130  */
1131  if ((INFILE(_CR_EASYSW) || INFILE(_TITLE_CUPS)) && INFILE(_LT_CUPS)) {
1132  if (INFILE(_LT_CUPS_COMMERCIAL)) {
1133  INTERESTING("CUPS-EULA");
1134  }
1135  else {
1136  INTERESTING("CUPS");
1137  }
1138  lmem[_mCUPS] = 1;
1139  }
1141  if (INFILE(_LT_HACKTIVISMO)) {
1142  INTERESTING("Hacktivismo");
1143  lmem[_mGPL] = 1; /* don't look for GPL references */
1144  }
1146  if (INFILE(_LT_NESSUS) && INFILE(_TITLE_NESSUS)) {
1147  INTERESTING("NESSUS-EULA");
1148  lmem[_mLGPL] = 1; /* don't look for LGPL references */
1149  lmem[_mGPL] = 1;
1150  }
1152  /*
1153  * Oracle
1154  */
1155  if (INFILE(_LT_ORACLE_PROTO) && INFILE(_TITLE_ORACLE_PROTO)) {
1156  INTERESTING(lDebug ? "Oracle(proto)" : "Oracle-EULA");
1157  lmem[_mGPL] = 1;
1158  }
1159  else if (INFILE(_LT_ORACLE_DEVEL) && INFILE(_TITLE_ORACLE_DEVEL)) {
1160  INTERESTING(lDebug ? "Oracle(dev)" : "Oracle-Dev");
1161  }
1162  else if (URL_INFILE(_URL_ORACLE_BERKELEY_DB)) {
1163  INTERESTING(lDebug ? "URL_ORACLE_BERKELEY_DB" : "Oracle-Berkeley-DB");
1164  }
1166  /*
1167  * CeCILL
1168  * According to digikam-0.9.4/digikam/libs/greycstoration/CImg.h:
1169  * The CeCILL-C (C_V1) license is close to the GNU LGPL
1170  * The CeCILL (V2.0) license is compatible with the GNU GPL
1171  */
1172  if (INFILE(_TITLE_CECILL_V11_2) || INFILE(_SPDX_CECILL_11)) {
1173  INTERESTING(lDebug ? "CeCILL_v1.1(#2)" : "CECILL-1.1");
1174  lmem[_mGPL] = lmem[_mLGPL] = 1;
1175  }
1176  else if (INFILE(_TITLE_CECILL_B) || INFILE(_TITLE_CECILL_B1) || INFILE(_SPDX_CECILL_B)) {
1177  INTERESTING("CECILL-B");
1178  }
1179  else if (INFILE(_TITLE_CECILL_C) || INFILE(_TITLE_CECILL_C1) || INFILE(_SPDX_CECILL_C)) {
1180  INTERESTING("CECILL-C");
1181  }
1182  else if (INFILE(_LT_CECILL_DUALref)) {
1183  INTERESTING("CECILL(dual)");
1184  lmem[_mGPL] = lmem[_mLGPL] = 1;
1185  }
1186  else if (INFILE(_SPDX_CECILL_10)) {
1187  INTERESTING("CECILL-1.0");
1188  }
1189  else if (INFILE(_SPDX_CECILL_21)) {
1190  INTERESTING("CECILL-2.1");
1191  }
1192  else if (INFILE(_LT_CECILL_2_ref) || INFILE(_SPDX_CECILL_20)) {
1193  INTERESTING("CECILL-2.0");
1194  }
1195  else if (INFILE(_LT_CECILL_ref2)) {
1196  INTERESTING("CECILL");
1197  }
1198  else if (INFILE(_LT_CECILL_B_ref)) {
1199  INTERESTING("CECILL-B");
1200  }
1201  else if (INFILE(_LT_CECILL_ref) || INFILE(_LT_CECILL_ref1)) {
1202  if (URL_INFILE(_URL_CECILL_C_V11)) {
1203  INTERESTING(lDebug ? "CeCILL_v1.1(url)" : "CECILL-1.1");
1204  }
1205  else if (URL_INFILE(_URL_CECILL_C_V1)) {
1206  INTERESTING(lDebug ? "CeCILL_v1(url)" : "CECILL-1.0");
1207  }
1208  else if (URL_INFILE(_URL_CECILL_V2)) {
1209  INTERESTING(lDebug ? "CeCILL_v2(url)" : "CECILL-2.0");
1210  }
1211  else if (URL_INFILE(_URL_CECILL)) {
1212  INTERESTING(lDebug ? "CeCILL(url)" : "CECILL");
1213  }
1214  else {
1215  INTERESTING(lDebug ? "CeCILL(#3)" : "CECILL");
1216  }
1217  lmem[_mGPL] = 1;
1218  }
1219  else if (INFILE(_LT_CECILL_1)) {
1220  if (INFILE(_TITLE_CECILL_V10)) {
1221  INTERESTING(lDebug ? "CeCILL_v1.0(#1)" : "CECILL-1.0");
1222  }
1223  else if (INFILE(_TITLE_CECILL_V20)) {
1224  INTERESTING(lDebug ? "CeCILL_v2.0(#1)" : "CECILL-2.0");
1225  }
1226  lmem[_mGPL] = 1;
1227  }
1228  else if (INFILE(_LT_CECILL_2) || INFILE(_TITLE_CECILL1) || INFILE(_TITLE_CECILL2)) {
1229  if (INFILE(_TITLE_CECILL_V10)) {
1230  INTERESTING(lDebug ? "CeCILL_v1.0(#2)" : "CECILL-1.0");
1231  }
1232  else if (INFILE(_TITLE_CECILL_V11)) {
1233  INTERESTING(lDebug ? "CeCILL_v1.1(#1)" : "CECILL-1.1");
1234  }
1235  else if (INFILE(_TITLE_CECILL_V20)) {
1236  INTERESTING(lDebug ? "CeCILL_v2.0(#2)" : "CECILL-2.0");
1237  }
1238  else {
1239  INTERESTING(lDebug ? "CeCILL(#2)" : "CECILL");
1240  }
1241  lmem[_mGPL] = 1;
1242  }
1244  /*
1245  * Monash University
1246  */
1247  if (INFILE(_CR_UMONASH) && INFILE(_LT_UMONASH)) {
1248  INTERESTING("U-Monash");
1249  if (INFILE(_PHR_GPL_NO_MORE)) {
1250  lmem[_mGPL] = 1;
1251  }
1252  }
1254  /* Open Font License */
1255  if (INFILE(_LT_OPEN_FONT_V10) || INFILE(_LT_OPEN_FONT_V10_1))
1256  {
1257  INTERESTING("OFL-1.0");
1258  lmem[_fOFL] = 1;
1259  }
1260  else if (INFILE(_SPDX_OFL_10_no_RFN)) {
1261  INTERESTING("OFL-1.0-no-RFN");
1262  }
1263  else if (INFILE(_SPDX_OFL_10_RFN)) {
1264  INTERESTING("OFL-1.0-RFN");
1265  }
1266  else if (INFILE(_SPDX_OFL_10)) {
1267  INTERESTING("OFL-1.0");
1268  }
1269  else if (INFILE(_PHR_OPEN_FONT_V10_1) || INFILE(_PHR_OPEN_FONT_V10_2))
1270  {
1271  INTERESTING("OFL-1.0");
1272  lmem[_fOFL] = 1;
1273  }
1274  else if (INFILE(_LT_OPEN_FONT_V11) || INFILE(_LT_OPEN_FONT_V11_1))
1275  {
1276  INTERESTING("OFL-1.1");
1277  lmem[_fOFL] = 1;
1278  }
1279  else if (INFILE(_SPDX_OFL_11_no_RFN)) {
1280  INTERESTING("OFL-1.1-no-RFN");
1281  }
1282  else if (INFILE(_SPDX_OFL_11_RFN)) {
1283  INTERESTING("OFL-1.1-RFN");
1284  }
1285  else if (INFILE(_SPDX_OFL_11)) {
1286  INTERESTING("OFL-1.1");
1287  }
1288  else if (INFILE(_PHR_OPEN_FONT_V11_1) || INFILE(_PHR_OPEN_FONT_V11_2))
1289  {
1290  INTERESTING("OFL-1.1");
1291  lmem[_fOFL] = 1;
1292  }
1294  /* Simple Public License 2.0 */
1295  if (INFILE(_TITLE_SimPL_V2)) {
1296  INTERESTING("SimPL-2.0");
1297  lmem[_mGPL] = 1;
1298  }
1300  /* Leptonica license */
1301  if (INFILE(_TITLE_LEPTONICA) && INFILE(_LT_GNU_3)) {
1302  INTERESTING("Leptonica");
1303  }
1305  /* copyleft-next license
1306  * It has to be checked before GPL because the license has the reference
1307  * to GPL license which gives a false positive GPL finding.
1308  */
1309  if (INFILE(_TITLE_copyleft_next_030) && INFILE(_PHR_copyleft_next_PARA1) && INFILE(_PHR_copyleft_next_PARA3)) {
1310  INTERESTING("copyleft-next-0.3.0");
1311  lmem[_mGPL] = 1;
1312  }
1313  else if (INFILE(_TITLE_copyleft_next_031) && INFILE(_PHR_copyleft_next_PARA1) && INFILE(_PHR_copyleft_next_PARA3)) {
1314  INTERESTING("copyleft-next-0.3.1");
1315  lmem[_mGPL] = 1;
1316  }
1317  else if (INFILE(_PHR_copyleft_next_030) || INFILE(_SPDX_copyleft_next_030)) {
1318  INTERESTING("copyleft-next-0.3.0");
1319  }
1320  else if (INFILE(_PHR_copyleft_next_031) || INFILE(_SPDX_copyleft_next_031)) {
1321  INTERESTING("copyleft-next-0.3.1");
1322  }
1324  /*
1325  * GPL, LGPL, GFDL
1326  * QUESTION: do we need to check for the FSF copyright since we also
1327  * check for "GNU" or "free"?
1328  */
1329  if ((NOT_INFILE(_LT_FORMER_GNU) && (mCR_FSF() ||
1330  HASTEXT(_TEXT_GNUTERMS, REG_EXTENDED)))) {
1331  /*
1332  * Affero
1333  */
1334  if (INFILE(_PHR_AGPL) && NOT_INFILE(_LT_GPL3ref4)) {
1335  if (INFILE(_LT_AGPL1) || INFILE(_LT_AGPL2) ||
1336  INFILE(_LT_AGPL3)) {
1337  cp = AGPLVERS();
1338  INTERESTING(lDebug ? "Affero(#1)" : cp);
1339  lmem[_mGPL] = 1;
1340  }
1341  else if (INFILE(_LT_AGPLref1)) {
1342  cp = AGPLVERS();
1343  INTERESTING(lDebug ? "Affero(#2)" : cp);
1344  lmem[_mGPL] = 1;
1345  }
1346  else if (INFILE(_LT_AGPLref2) && NOT_INFILE(_LT_NOT_AGPLref1)) {
1347  cp = AGPLVERS();
1348  INTERESTING(lDebug ? "Affero(#3)" : cp);
1349  lmem[_mGPL] = 1;
1350  }
1351  else if (mCR_FSF() && NOT_INFILE(_LT_GPL3_NOT_AGPL)) {
1352  cp = AGPLVERS();
1353  INTERESTING(lDebug ? "Affero(CR)" : cp);
1354  lmem[_mGPL] = 1;
1355  }
1356  }
1357  else if (INFILE(_LT_AGPL_NAMED)) {
1358  cp = AGPLVERS();
1359  INTERESTING(lDebug ? "AGPL(named)" : cp);
1360  lmem[_mGPL] = 1;
1361  }
1362 
1363  /*
1364  * Some packages have a single file containing both a GPL and an LGPL
1365  * license. Therefore, these checks should NOT be exclusive.
1366  */
1367  /* * The Nethack General Public License (NGPL) */
1368  else if (INFILE(_TITLE_NGPL)) {
1369  INTERESTING("NGPL");
1370  lmem[_mGPL] = 1;
1371  }
1372  else if (INFILE(_LT_GPL_V1)) {
1373  INTERESTING("GPL-1.0-only");
1374  lmem[_mGPL] = 1;
1375  }
1376  else if (INFILE(_LT_GPL_1) && !HASTEXT(_LT_GPL_EXCEPT_0, REG_EXTENDED)) {
1377  if (INFILE(_PHR_GPL2_OR_LATER_1) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1378  {
1379  INTERESTING(lDebug ? "PHR(GPL2_OR_LATER#1)" : "GPL-2.0-or-later");
1380  lmem[_mGPL] = 1;
1381  }
1382  else if (INFILE(_TITLE_GPL2)) {
1383  INTERESTING(lDebug ? "Title(GPL-2.0-only)" : "GPL-2.0-only");
1384  lmem[_mGPL] = 1;
1385  }
1386  else if (INFILE(_PHR_GPL1_OR_LATER) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1387  {
1388  INTERESTING("GPL-1.0-or-later");
1389  lmem[_mGPL] = 1;
1390  }
1391  else if (INFILE(_TITLE_GPL1)) {
1392  INTERESTING("GPL-1.0-only");
1393  lmem[_mGPL] = 1;
1394  }
1395  else {
1396  INTERESTING("GPL");
1397  lmem[_mGPL] = 1;
1398  }
1399  }
1400  else if ((INFILE(_LT_GPL_V2) || INFILE(_LT_GPL_V2_ref) || INFILE(_LT_GPL_V2_ref1) || INFILE(_LT_GPL_V2_ref2)) && !HASTEXT(_LT_GPL_EXCEPT_0, REG_EXTENDED)) {
1401  if (INFILE(_PHR_GPL2_OR_LATER_1) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1402  {
1403  INTERESTING(lDebug ? "PHR(GPL2_OR_LATER#2)" : "GPL-2.0-or-later");
1404  lmem[_mGPL] = 1;
1405  }
1406  else {
1407  INTERESTING(lDebug ? "LT(GPL-V2)" : "GPL-2.0-only");
1408  lmem[_mGPL] = 1;
1409  }
1410  }
1411  else if (INFILE(_PHR_GPL2_OR_LATER_2))
1412  {
1413  INTERESTING(lDebug ? "PHR(GPL2_OR_LATER#2)" : "GPL-2.0-or-later");
1414  lmem[_mGPL] = 1;
1415  }
1416  else if (INFILE(_LT_GPL3_PATENTS)) {
1417  if (INFILE(_TITLE_GPL3)) {
1418  INTERESTING(lDebug ? "GPL_v3(#1)" : "GPL-3.0-only");
1419  lmem[_mGPL] = 1;
1420  }
1421  else {
1422  INTERESTING("GPL-3.0-only-possibility");
1423  lmem[_mGPL] = 1;
1424  }
1425  }
1426  else if (INFILE(_TITLE_GPL3_ref3_later)) {
1427  INTERESTING("GPL-3.0-or-later");
1428  lmem[_mGPL] = 1;
1429  }
1430  else if (INFILE(_TITLE_GPL3_ref4_later)) {
1431  INTERESTING("GPL-3.0-or-later");
1432  lmem[_mGPL] = 1;
1433  }
1434  else if (INFILE(_TITLE_GPL3_ref3)) {
1435  INTERESTING("GPL-3.0-only");
1436  lmem[_mGPL] = 1;
1437  }
1438  if (INFILE(_LT_LGPL_1) || INFILE(_LT_LGPL_2)) {
1439  if (INFILE(_PHR_LGPL21_OR_LATER_1) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1440  {
1441  INTERESTING("LGPL-2.1-or-later");
1442  lmem[_mLGPL] = 1;
1443  }
1444  else if (INFILE(_PHR_LGPL2_OR_LATER) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1445  {
1446  INTERESTING("LGPL-2.0-or-later");
1447  lmem[_mLGPL] = 1;
1448  }
1449  else if (INFILE(_TITLE_LGPLV21)) {
1450  INTERESTING("LGPL-2.1-only");
1451  lmem[_mLGPL] = 1;
1452  }
1453  else if (INFILE(_TITLE_LGPLV2)) {
1454  INTERESTING("LGPL-2.0-only");
1455  lmem[_mLGPL] = 1;
1456  }
1457  else {
1458  INTERESTING("LGPL");
1459  lmem[_mLGPL] = 1;
1460  }
1461  }
1462  else if (INFILE(_LT_LGPL_3)) {
1463  if ((INFILE(_PHR_LGPL3_OR_LATER)
1464  || INFILE(_PHR_LGPL3_OR_LATER_ref1)
1465  || INFILE(_PHR_LGPL3_OR_LATER_ref2))
1466  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1467  {
1468  INTERESTING("LGPL-3.0-or-later");
1469  lmem[_mLGPL] = 1;
1470  }
1471  else if (INFILE(_TITLE_LGPL3)) {
1472  INTERESTING("LGPL-3.0-only");
1473  lmem[_mLGPL] = 1;
1474  }
1475  else {
1476  INTERESTING("LGPL-3.0-only-possibility");
1477  lmem[_mLGPL] = 1;
1478  }
1479  }
1480  if (INFILE(_LT_GFDL)) {
1481  cp = GFDLVERS();
1482  INTERESTING(lDebug ? "GFDL(#1)" : cp);
1483  lmem[_mGFDL] = 1;
1484  }
1485  if (!lmem[_mLGPL] && NOT_INFILE(_LT_MPL_SECONDARY)) { /* no FSF/GPL-like match yet */
1486  /*
1487  NOTE: search for LGPL before GPL; the latter matches
1488  occurrences of former
1489  */
1490  if (INFILE(_LT_GPL_FONT1) && INFILE(_LT_GPL_FONT2)) {
1491  INTERESTING(lDebug ? "GPL(fonts)" : "GPL-exception");
1492  lmem[_mGPL] = 1;
1493  }
1494  else if (INFILE(_LT_LGPL_ALT)) {
1495  cp = LGPLVERS();
1496  INTERESTING(lDebug ? "LGPL(alternate)" : cp);
1497  lmem[_mLGPL] = 1;
1498  }
1499  else if (INFILE(_LT_LGPL3_ref_later)) {
1500  INTERESTING("LGPL-3.0-or-later");
1501  lmem[_mLGPL] = 1;
1502  }
1503  else if (INFILE(_LT_LGPLref1)) {
1504  cp = LGPLVERS();
1505  INTERESTING(lDebug ? "LGPL(ref1)" : cp);
1506  lmem[_mLGPL] = 1;
1507  }
1508  else if (INFILE(_LT_LGPLref2) &&
1509  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1510  cp = LGPLVERS();
1511  INTERESTING(lDebug ? "LGPL(ref2#1)" : cp);
1512  lmem[_mLGPL] = 1;
1513  }
1514  else if (INFILE(_LT_LGPLref3)) {
1515  cp = LGPLVERS();
1516  INTERESTING(lDebug ? "LGPL(ref3)" : cp);
1517  lmem[_mLGPL] = 1;
1518  }
1519  else if (INFILE(_LT_LGPLref4)) {
1520  cp = LGPLVERS();
1521  INTERESTING(lDebug ? "LGPL(ref4)" : cp);
1522  lmem[_mLGPL] = 1;
1523  }
1524  else if (INFILE(_LT_LGPLref5)) {
1525  cp = LGPLVERS();
1526  INTERESTING(lDebug ? "LGPL(ref5)" : cp);
1527  lmem[_mLGPL] = 1;
1528  }
1529  else if (INFILE(_LT_LGPLref6)) {
1530  cp = LGPLVERS();
1531  INTERESTING(lDebug ? "LGPL(ref6)" : cp);
1532  lmem[_mLGPL] = 1;
1533  }
1534  else if (!lmem[_mLIBRE] && !lmem[_fREAL] &&
1535  INFILE(_LT_LGPLref7) &&
1536  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1537  cp = LGPLVERS();
1538  INTERESTING(lDebug ? "LGPL(ref7)" : cp);
1539  lmem[_mLGPL] = 1;
1540  }
1541  else if (!lmem[_fREAL] && !lmem[_mAPTANA] &&
1542  !LVAL(_TEXT_GNU_LIC_INFO) && INFILE(_LT_LGPLref8) &&
1543  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1544  cp = LGPLVERS();
1545  INTERESTING(lDebug ? "LGPL(ref8)" : cp);
1546  lmem[_mLGPL] = 1;
1547  }
1548  else if (INFILE(_LT_LGPLref9) &&
1549  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1550  cp = LGPLVERS();
1551  INTERESTING(lDebug ? "LGPL(ref9)" : cp);
1552  lmem[_mLGPL] = 1;
1553  }
1554  else if (INFILE(_LT_LGPLref10) &&
1555  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1556  cp = LGPLVERS();
1557  INTERESTING(lDebug ? "LGPL(ref10)" : cp);
1558  lmem[_mLGPL] = 1;
1559  }
1560  else if (INFILE(_LT_LGPLref11)) {
1561  cp = LGPLVERS();
1562  INTERESTING(lDebug ? "LGPL(ref11)" : cp);
1563  lmem[_mLGPL] = 1;
1564  }
1565  else if (INFILE(_FILE_LGPL1) || INFILE(_FILE_LGPL2)) {
1566  cp = LGPLVERS();
1567  INTERESTING(lDebug ? "LGPL(deb)" : cp);
1568  lmem[_mLGPL] = 1;
1569  }
1570  else if (!LVAL(_TEXT_GNU_LIC_INFO) &&
1571  (URL_INFILE(_URL_LGPL_1) ||
1572  URL_INFILE(_URL_LGPL_2))) {
1573  cp = LGPLVERS();
1574  INTERESTING(lDebug ? "LGPL(url)" : cp);
1575  lmem[_mLGPL] = 1;
1576  }
1577  else if (lmem[_fREAL] && !LVAL(_TEXT_GNU_LIC_INFO) &&
1578  GPL_INFILE(_LT_LGPL_OR)) {
1579  cp = LGPLVERS();
1580  INTERESTING(lDebug ? "LGPL(or)" : cp);
1581  lmem[_mLGPL] = 1;
1582  }
1583  else if (INFILE(_PHR_LGPL21_OR_LATER_2)) {
1584  INTERESTING(lDebug ? "LGPL-2.1-or-later(_LATER_2)" : "LGPL-2.1-or-later");
1585  lmem[_mLGPL] = 1;
1586  }
1587  else if (INFILE(_PHR_LGPL21_ONLY_ref) || INFILE(_TITLE_LGPLV21_2)) {
1588  INTERESTING("LGPL-2.1-only");
1589  lmem[_mLGPL] = 1;
1590  }
1591  }
1592  if (!lmem[_mGPL] && !HASTEXT(_TEXT_GCC, REG_EXTENDED)) {
1593  if (GPL_INFILE(_LT_GPL_ALT) && !INFILE(_LT_LGPL_ALT)) {
1594  cp = GPLVERS();
1595  INTERESTING(lDebug ? "GPL(alternate)" : cp);
1596  lmem[_mGPL] = 1;
1597  }
1598  else if ((GPL_INFILE(_LT_GPL3ref2) || GPL_INFILE(_PHR_GPL3_OR_LATER)
1599  || GPL_INFILE(_PHR_GPL3_OR_LATER_ref1) || GPL_INFILE(_PHR_GPL3_OR_LATER_ref2))
1600  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1601  {
1602  INTERESTING("GPL-3.0-or-later");
1603  lmem[_mGPL] = 1;
1604  }
1605  else if (GPL_INFILE(_LT_GPL3ref)) {
1606  INTERESTING(lDebug ? "GPL_v3(#2)" : "GPL-3.0-only");
1607  lmem[_mGPL] = 1;
1608  }
1609  else if (GPL_INFILE(_LT_GPL3ref3) && NOT_INFILE(_TITLE_LGPL3)) {
1610  INTERESTING("GPL-3.0-only");
1611  lmem[_mGPL] = 1;
1612  }
1613  else if (!lmem[_mLIBRE] && GPL_INFILE(_LT_GPLref1)
1614  && NOT_INFILE(_PHR_NOT_UNDER_GPL)
1615  && NOT_INFILE(_LT_LGPLref2)
1616  && NOT_INFILE(_PHR_GPL_COMPAT_3)) {
1617  /*
1618  * Special exceptions:
1619  * (1) LaTeX uses the following phrase:
1620  * "... why distributing LaTeX under the GNU General Public License (GPL)
1621  * was considered inappropriate".
1622  * (2) Python uses the following phrases:
1623  * "GPL-compatible doesn't mean that we're distributing Python under the GPL"
1624  * AND, "GPL-compatible licenses make it possible to combine Python with
1625  * other software that is released under the GPL.
1626  *****
1627  * These MUST be filtered. Do so by marking the GPL flag but don't assign
1628  * a license component (e.g., ignore GPL for this file)
1629  */
1630  if (INFILE(_PHR_LATEX_GPL_INAPPROPRIATE) ||
1631  INFILE(_PHR_PYTHON_NOTGPL_1) ||
1632  INFILE(_PHR_PYTHON_NOTGPL_2)) {
1633  lmem[_mGPL] = 1;
1634  }
1635  else if (!HASTEXT(_TEXT_GCC, REG_EXTENDED)
1636  && NOT_INFILE(_TITLE_D_FSL_10)){
1637  cp = GPLVERS();
1638  INTERESTING(cp);
1639  lmem[_mGPL] = 1;
1640  }
1641  }
1642  else if (INFILE(_LT_GPL_FSF)) {
1643  cp = GPLVERS();
1644  INTERESTING(lDebug ? "GPL(FSF)" : cp);
1645  lmem[_mGPL] = 1;
1646  }
1647  else if (GPL_INFILE(_LT_GPLref2)) {
1648  cp = GPLVERS();
1649  INTERESTING(lDebug ? "GPL(ref2)" : cp);
1650  lmem[_mGPL] = 1;
1651  }
1652  else if (GPL_INFILE(_LT_GPLref3)) {
1653  cp = GPLVERS();
1654  INTERESTING(lDebug ? "GPL(ref3)" : cp);
1655  lmem[_mGPL] = 1;
1656  }
1657  else if (INFILE(_LT_GPLref4)) {
1658  cp = GPLVERS();
1659  INTERESTING(lDebug ? "GPL(ref4)" : cp);
1660  lmem[_mGPL] = 1;
1661  }
1662  else if (GPL_INFILE(_LT_GPLref5)) {
1663  cp = GPLVERS();
1664  INTERESTING(lDebug ? "GPL(ref5)" : cp);
1665  lmem[_mGPL] = 1;
1666  }
1667  else if (GPL_INFILE(_LT_GPLref6)) {
1668  cp = GPLVERS();
1669  INTERESTING(lDebug ? "GPL(ref6)" : cp);
1670  lmem[_mGPL] = 1;
1671  }
1672  else if (GPL_INFILE(_LT_GPLref7)) {
1673  cp = GPLVERS();
1674  INTERESTING(lDebug ? "GPL(ref7)" : cp);
1675  lmem[_mGPL] = 1;
1676  }
1677  else if (GPL_INFILE(_LT_GPLref8)) {
1678  cp = GPLVERS();
1679  INTERESTING(lDebug ? "GPL(ref8)" : cp);
1680  lmem[_mGPL] = 1;
1681  }
1682  else if (INFILE(_LT_GPLref9)) {
1683  cp = GPLVERS();
1684  INTERESTING(lDebug ? "GPL(ref9)" : cp);
1685  lmem[_mGPL] = 1;
1686  }
1687  else if (GPL_INFILE(_LT_GPLref10)) {
1688  cp = GPLVERS();
1689  INTERESTING(lDebug ? "GPL(ref10)" : cp);
1690  lmem[_mGPL] = 1;
1691  }
1692  else if (INFILE(_LT_GPLref11)) {
1693  cp = GPLVERS();
1694  INTERESTING(lDebug ? "GPL(ref11)" : cp);
1695  lmem[_mGPL] = 1;
1696  }
1697  else if (INFILE(_LT_GPLref12)) {
1698  cp = GPLVERS();
1699  INTERESTING(lDebug ? "GPL(ref12)" : cp);
1700  lmem[_mGPL] = 1;
1701  }
1702  else if (GPL_INFILE(_LT_GPLref13)) {
1703  cp = GPLVERS();
1704  INTERESTING(lDebug ? "GPL(ref13)" : cp);
1705  lmem[_mGPL] = 1;
1706  }
1707  else if (GPL_INFILE(_LT_GPLref14) &&
1708  NOT_INFILE(_LT_LGPLref2)) {
1709  cp = GPLVERS();
1710  INTERESTING(lDebug ? "GPL(ref14)" : cp);
1711  lmem[_mGPL] = 1;
1712  }
1713  else if (INFILE(_LT_GPLref16)) {
1714  cp = GPLVERS();
1715  INTERESTING(lDebug ? "GPL(ref16)" : cp);
1716  lmem[_mGPL] = 1;
1717  }
1718  else if (INFILE(_LT_GPLref18)) {
1719  cp = GPLVERS();
1720  INTERESTING(lDebug ? "GPL(ref18)" : cp);
1721  lmem[_mGPL] = 1;
1722  }
1723  else if (INFILE(_LT_GPLref19)) {
1724  cp = GPLVERS();
1725  INTERESTING(lDebug ? "GPL(ref19)" : cp);
1726  lmem[_mGPL] = 1;
1727  }
1728  else if (INFILE(_LT_GPLref20)) {
1729  cp = GPLVERS();
1730  INTERESTING(lDebug ? "GPL(ref20)" : cp);
1731  lmem[_mGPL] = 1;
1732  }
1733  else if (!LVAL(_TEXT_GNU_LIC_INFO) && NOT_INFILE(_LT_INTEL_7) &&
1734  (URL_INFILE(_URL_GPL_1) ||
1735  URL_INFILE(_URL_GPL_2) ||
1736  URL_INFILE(_URL_GPL_3))) {
1737  cp = GPLVERS();
1738  INTERESTING(lDebug ? "GPL(url)" : cp);
1739  lmem[_mGPL] = 1;
1740  }
1741  else if (URL_INFILE(_URL_AGPL)) {
1742  cp = AGPLVERS();
1743  INTERESTING(lDebug ? "Affero(url)" : cp);
1744  lmem[_mGPL] = 1;
1745  }
1746  else if (!ltsr[_LT_LGPL_3] && INFILE(_LT_GPL_OR)) {
1747  cp = GPLVERS();
1748  INTERESTING(lDebug ? "GPL(or)" : cp);
1749  lmem[_mGPL] = 1;
1750  }
1751  else if (!lmem[_mGPL] && !lmem[_mLGPL] &&
1752  (INFILE(_LT_GNU_1) + INFILE(_LT_GNU_2) +
1753  INFILE(_LT_GNU_3) + INFILE(_LT_GNU_4) > 2)) {
1754  cp = GPLVERS();
1755  INTERESTING(lDebug ? "GPL(GNU)" : cp);
1756  lmem[_mGPL] = 1;
1757  }
1758  else if (!lmem[_mGPL] && !lmem[_mLGPL] &&
1759  INFILE(_LT_SEE_GPL) && INFILE(_LT_RECV_GPL)) {
1760  cp = GPLVERS();
1761  INTERESTING(lDebug ? "GPL(see)" : cp);
1762  lmem[_mGPL] = 1;
1763  }
1764  else if (!lmem[_mGPL] && !lmem[_mLGPL] &&
1765  INFILE(_LT_SEE_LGPL) && INFILE(_LT_RECV_LGPL)) {
1766  cp = LGPLVERS();
1767  INTERESTING(lDebug ? "LGPL(see)" : cp);
1768  lmem[_mLGPL] = 1;
1769  }
1770  }
1771  if (!lmem[_mGFDL] && (INFILE(_LT_GFDLref1) ||
1772  INFILE(_TITLE_GFDL))) {
1773  cp = GFDLVERS();
1774  INTERESTING(lDebug ? "GFDL(#2)" : cp);
1775  lmem[_mGFDL] = 1;
1776  }
1777  /*
1778  * Listed _explictly_ as an exception to the GPL -- this is NOT an 'else'
1779  * clause!
1780  */
1781  if (!lmem[_mGPL] && INFILE(_PHR_GPL_DESCRIPTIONS)) {
1782  INTERESTING(lDebug ? "GPL-kinda" : "GPL");
1783  lmem[_mGPL] = 1;
1784  }
1785  /* checking for FSF */
1786  if (INFILE(_LT_FSF_1)) {
1787  INTERESTING(lDebug ? "FSF(1)" : "FSFULLR");
1788  lmem[_mLGPL] = 1;
1789  }
1790  else if (INFILE(_LT_FSF_2)) {
1791  INTERESTING(lDebug ? "FSF(2)" : "FSF");
1792  }
1793  else if (INFILE(_LT_FSF_3)) {
1794  INTERESTING(lDebug ? "FSF(3)" : "FSF");
1795  }
1796  else if (mCR_FSF() && INFILE(_LT_FSF_4)) {
1797  INTERESTING(lDebug ? "FSF(4)" : "FSF");
1798  }
1799  else if (!lmem[_mGPL] && mCR_FSF() && INFILE(_LT_FSF_5)) {
1800  INTERESTING(lDebug ? "FSF(5)" : "FSF");
1801  }
1802  else if (!lmem[_mGPL] && INFILE(_LT_FSFUL)) {
1803  INTERESTING("FSFUL");
1804  }
1805  else if (!lmem[_mGPL] && NOT_INFILE(_LT_Autoconf_exception_20) && INFILE(_LT_FSFref1)) {
1806  INTERESTING(lDebug ? "FSF(ref1)" : "FSF");
1807  }
1808  else if (INFILE(_LT_FSFref2)) {
1809  INTERESTING(lDebug ? "FSF(ref2)" : "FSF");
1810  }
1811  else if (INFILE(_LT_LGPLrefFSF) &&
1812  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1813  INTERESTING(lDebug ? "LGPL(FSF)" : "LGPL");
1814  lmem[_mLGPL] = 1;
1815  }
1816  if (!lmem[_mGPL] && !lmem[_mLGPL] && !lmem[_mGFDL]) {
1817  /*
1818  * Check these patterns AFTER checking for FSF and GFDL, and only if the
1819  * CUPS license isn't present.
1820  */
1821  if (!lmem[_mCUPS] ) {
1822  if (GPL_INFILE(_LT_GPLpatt1) &&
1823  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1824  cp = GPLVERS();
1825  INTERESTING(lDebug ? "GPL(patt1)" : cp);
1826  lmem[_mGPL] = 1;
1827  }
1828  else if (GPL_INFILE(_LT_GPLpatt2)) {
1829  cp = GPLVERS();
1830  INTERESTING(lDebug ? "GPL(patt2)" : cp);
1831  lmem[_mGPL] = 1;
1832  }
1833  else if (INFILE(_CR_rms) && INFILE(_LT_GPL_2)) {
1834  INTERESTING("GPL(rms)");
1835  lmem[_mGPL] = 1;
1836  }
1837  else if (INFILE(_PHR_GPLISH_SAMPLE)) {
1838  INTERESTING(lDebug ? "GPLISH" : "GPL-possibility");
1839  INTERESTING(lDebug ? "GPLISH" : "LGPL-possibility");
1840  lmem[_mLGPL] = lmem[_mGPL] = 1;
1841  }
1842  }
1843  }
1844  else if (INFILE(_LT_GNU_COPYLEFT)) {
1845  INTERESTING("GNU-copyleft");
1846  lmem[_fGPL] = 1;
1847  }
1848  lmem[_fGPL] = lmem[_mLGPL]+lmem[_mGPL]+lmem[_mGFDL];
1849  }
1851  if (!lmem[_mGPL] && INFILE(_LT_GNU_PROJECTS)) {
1852  cp = GPLVERS();
1853  INTERESTING(lDebug ? "GPL(proj)" : cp);
1854  lmem[_mGPL] = 1;
1855  }
1857  if (HASTEXT(_LT_GPL_V2_NAMED_later, REG_EXTENDED) || HASTEXT(_TITLE_GPL2_ref1_later, REG_EXTENDED))
1858  {
1859  INTERESTING(lDebug ? "GPLV2+(named)" : "GPL-2.0-or-later");
1860  lmem[_mGPL] = 1;
1861  }
1862  else if (INFILE(_LT_TAPJOY) || INFILE(_LT_TAPJOY_ref1)) {
1863  INTERESTING("Tapjoy");
1864  lmem[_fGPL] = 1;
1865  lmem[_mMIT] = 1;
1866  }
1867  else if (!lmem[_mGPL] && !lmem[_mGFDL] && !lmem[_mLGPL] && !lmem[_fZPL]
1868  && (INFILE(_LT_GPL_NAMED)
1869  || INFILE(_LT_GPL_NAMED2)
1870  || HASTEXT(_LT_GPL_NAMED3, REG_EXTENDED))
1871  && !HASTEXT(_PHR_GPL_GHOSTSCRIPT, REG_EXTENDED)
1872  && NOT_INFILE(_LT_MPL_SECONDARY)
1873  && NOT_INFILE(_TEXT_NOT_GPL)
1874  && NOT_INFILE(_TEXT_NOT_GPL2)
1875  && NOT_INFILE(_LT_CNRI_PYTHON_GPL)
1876  && NOT_INFILE(_LT_W3Cref4)
1877  && NOT_INFILE(_LT_GPL_NAMED3_EXHIBIT)
1878  && NOT_INFILE(_LT_GPL_NAMED_COMPATIBLE)
1879  && !HASTEXT(_LT_GPL_NAMED_COMPATIBLE_1, REG_EXTENDED)
1880  && NOT_INFILE(_LT_GPL_NAMED_EXHIBIT)
1881  && NOT_INFILE(_TITLE_D_FSL_10)
1882  && NOT_INFILE(_LT_INTEL_7)
1883  && NOT_INFILE(_PHR_GPL_COMPAT_3)) {
1884  cp = GPLVERS();
1885  INTERESTING(lDebug ? "GPL(named)" : cp);
1886  lmem[_mGPL] = 1;
1887  }
1888  else if ( !lmem[_mGPL] && !INFILE(_TITLE_MIROS) && (INFILE(_LT_GPL_V2_NAMED) || INFILE(_LT_GPL_V2_NAMED_ref1)))
1889  {
1890  INTERESTING(lDebug ? "GPLV2(named)" : "GPL-2.0-only");
1891  lmem[_mGPL] = 1;
1892  }
1893  else if (!lmem[_mGPL] && INFILE(_LT_GPL_V3_NAMED_later))
1894  {
1895  INTERESTING(lDebug ? "GPLV3(named_later)" : "GPL-3.0-or-later");
1896  }
1897  else if (!lmem[_mGPL] && INFILE(_LT_GPL_V3_NAMED))
1898  {
1899  INTERESTING(lDebug ? "GPLV3(named)" : "GPL-3.0-only");
1900  }
1902  if (!lmem[_mLGPL] && (INFILE(_LT_LGPL_NAMED)
1903  || INFILE(_LT_LGPL_NAMED2)) && NOT_INFILE(_LT_GPL_NAMED_EXHIBIT)
1904  && NOT_INFILE(_LT_PHP_V30_2)) {
1905  cp = LGPLVERS();
1906  INTERESTING(lDebug ? "LGPL(named)" : cp);
1907  }
1908 
1910  /*
1911  * MIT, X11, Open Group, NEC -- text is very long, search in 2 parts
1912  */
1913  if (INFILE(_LT_JSON) && INFILE(_LT_MIT_NO_EVIL)) { // JSON license
1914  INTERESTING("JSON");
1915  lmem[_mMIT] = 1;
1916  }
1918  if (!lmem[_mWORDNET] && INFILE(_TITLE_WORDNET))
1919  {
1920  INTERESTING("WordNet-3.0");
1921  }
1923  if (INFILE(_CR_XFREE86_V10) || INFILE(_LT_XFREE86_V10)) {
1924  INTERESTING("XFree86-1.0");
1925  lmem[_mMIT] = 1;
1926  }
1927  else if (INFILE(_CR_XFREE86_V11) || INFILE(_LT_XFREE86_V11)) {
1928  INTERESTING("XFree86-1.1");
1929  lmem[_mMIT] = 1;
1930  }
1931  else if (INFILE(_LT_XFREE86)) {
1932  INTERESTING(lDebug ? "XFree86(1)" : "XFree86");
1933  lmem[_mMIT] = 1;
1934  }
1935  else if (HASTEXT(_LT_BSD_OR_MIT, REG_EXTENDED)) {
1936  INTERESTING("MIT");
1937  INTERESTING("BSD");
1938  lmem[_mMIT] = 1;
1939  }
1940  else if (HASTEXT(_LT_BSD_AND_MIT, REG_EXTENDED)) {
1941  INTERESTING("BSD");
1942  INTERESTING("MIT");
1943  lmem[_mMIT] = 1;
1944  }
1945  /*
1946  * MIT search order changed. First MIT license explicit phrases and references are checked .
1947  */
1948  else if (!lmem[_mMIT] && NOT_INFILE(_TITLE_MIT_EXHIBIT) && NOT_INFILE(_TITLE_SGI) &&
1949  (INFILE(_LT_MIT_1) || INFILE(_TITLE_MIT))) {
1950  if(INFILE(_LT_MIT_NO_EVIL)) {
1951  INTERESTING(lDebug ? "MIT-style(no evil)" : "JSON");
1952  lmem[_mMIT] = 1;
1953  }
1954  else if (INFILE(_LT_MIT_2)) {
1955  if (mCR_MIT() || INFILE(_TITLE_MIT)) {
1956  INTERESTING(lDebug ? "MIT(1)" : "MIT");
1957  lmem[_mMIT] = 1;
1958  }
1959  else if (INFILE(_TITLE_XNET)) {
1960  INTERESTING("Xnet");
1961  lmem[_mMIT] = 1;
1962  }
1963  else if (INFILE(_CR_X11) || INFILE(_TITLE_X11)) {
1964  INTERESTING(lDebug ? "X11(1)" : "X11");
1965  lmem[_mMIT] = 1;
1966  }
1967  else if (INFILE(_CR_XFREE86)) {
1968  INTERESTING(lDebug ? "XFree86(2)" : "XFree86");
1969  lmem[_mMIT] = 1;
1970  }
1971  /* MIT-advertising License */
1972  else if (INFILE(_LT_MIT_ADVERTISING)) {
1973  INTERESTING("MIT-advertising");
1974  lmem[_mMIT] = 1;
1975  }
1976  /* MIT-enna License */
1977  else if (INFILE(_LT_MIT_ENNA)) {
1978  INTERESTING("MIT-enna");
1979  lmem[_mMIT] = 1;
1980  }
1981  /* MIT-feh License */
1982  else if (INFILE(_LT_MIT_FEH)) {
1983  INTERESTING("MIT-feh");
1984  lmem[_mMIT] = 1;
1985  }
1986  /* MITNFA License */
1987  else if (HASTEXT(_LT_MITNFA, 0)) {
1988  INTERESTING("MITNFA");
1989  lmem[_mMIT] = 1;
1990  }
1991  /* Imlib2 License */
1992  else if (INFILE(_LT_Imlib2)) {
1993  INTERESTING("Imlib2");
1994  lmem[_mMIT] = 1;
1995  }
1996  else if (INFILE(_LT_MIT_13)) {
1997  INTERESTING(lDebug ? "MIT(14)" : "MIT");
1998  lmem[_mMIT] = 1;
1999  }
2000  /* NCSA */
2001  else if (INFILE(_TITLE_NCSA) && NOT_INFILE(_TITLE_NCSA_EXHIBIT)) {
2002  INTERESTING(lDebug ? "NCSA(1)" : "NCSA");
2003  lmem[_mMIT] = 1;
2004  lmem[_fNCSA] = 1;
2005  }
2006  else if (INFILE(_LT_MIT_0)) {
2007  INTERESTING("MIT-0");
2008  lmem[_mMIT] = 1;
2009  }
2010  else if (NOT_INFILE(_LT_INTEL_7)) {
2011  INTERESTING(lDebug ? "MIT-style(1)" : "MIT-style");
2012  lmem[_mMIT] = 1;
2013  }
2014  }
2015  else if (INFILE(_LT_BITSTREAM_1)) {
2016  INTERESTING(lDebug ? "Bitstream(1)" : "Bitstream");
2017  lmem[_mMIT] = 1;
2018  }
2019  else if (mCR_X11()) {
2020  INTERESTING(lDebug ? "X11(2)" : "X11");
2021  }
2022  else if (!lmem[_mMPL] && INFILE(_LT_MPL_1)) {
2023  cp = MPLVERS(); /* NPL, too */
2024  INTERESTING(lDebug ? "MPL/NPL#5" : cp);
2025  lmem[_mMPL] = 1;
2026  }
2027  else if (!lmem[_mMIT] && (mCR_MIT() || INFILE(_TITLE_MIT)) && NOT_INFILE(_TITLE_MIT_EXHIBIT)) {
2028  INTERESTING(lDebug ? "MIT(2)" : "MIT");
2029  lmem[_mMIT] = 1;
2030  }
2031  /*
2032  * BOOST (relatively new, circa August 2003)
2033  * hmm, some references have a Copyright Notre Dame, some don't
2034  */
2035  else if (INFILE(_LT_BOOST_1)) {
2036  if (INFILE(_TITLE_BOOST10)) {
2037  INTERESTING("BSL-1.0");
2038  }
2039  else if (INFILE(_CR_NOTREDAME)) {
2040  INTERESTING(lDebug ? "Boost(ND)" : "BSL-1.0");
2041  }
2042  else if (INFILE(_TITLE_BOOST)) {
2043  INTERESTING("BSL-1.0");
2044  }
2045  else {
2046  INTERESTING("BSL-style");
2047  }
2048  }
2049  else if (mCR_MIT()) {
2050  INTERESTING(lDebug ? "MIT(3)" : "MIT");
2051  lmem[_mMIT] = 1;
2052  }
2053  else if (INFILE(_TITLE_ICU) || HASTEXT(_URL_ICU, REG_EXTENDED)) {
2054  INTERESTING(lDebug ? "MIT-style(ICU)" : "ICU");
2055  lmem[_mMIT] = 1;
2056  }
2057  else if (INFILE(_LT_ICU_2) && (INFILE(_CR_IBM_1) || INFILE(_CR_IBM_1))) {
2058  INTERESTING(lDebug ? "MIT-style(ICU)" : "ICU");
2059  lmem[_mMIT] = 1;
2060  }
2061  else if (INFILE(_TITLE_JasPer_20)) {
2062  INTERESTING(lDebug ? "JasPer(title)" : "JasPer-2.0");
2063  lmem[_mMIT] = 1;
2064  }
2065  else if (INFILE(_LT_UNICODE_4)) {
2066  INTERESTING(lDebug ? "MIT-style(Unicode)" : "Unicode");
2067  lmem[_fUNICODE] = 1;
2068  lmem[_mMIT] = 1;
2069  }
2070  /*
2071  * Adobe-Glyph
2072  */
2073  else if (HASTEXT(_LT_ADOBE_GLYPH_1, REG_EXTENDED) && INFILE(_LT_ADOBE_GLYPH_2)) {
2074  INTERESTING("Adobe-Glyph");
2075  }
2076  /*
2077  * Ubuntu Font
2078  */
2079  else if (INFILE(_LT_UBUNTU_FONT)) {
2080  INTERESTING("ubuntu-font-1.0");
2081  }
2082  /*
2083  * OFL license text has MIT license warranty claims which is identifed as MIT-style
2084  */
2085  else if (!lmem[_fOFL]) {
2086  INTERESTING(lDebug ? "MIT-style(2)" : "MIT-style");
2087  lmem[_mMIT] = 1;
2088  }
2089  }
2090  /*
2091  * Secondly X11 and MIT style phrases are checked.
2092  */
2093  else if (INFILE(_LT_MIT_0) && (INFILE(_LT_MIT_2) || INFILE(_LT_MIT_3) || INFILE(_LT_MIT_4) ||
2094  INFILE(_LT_MIT_5) || INFILE(_LT_MIT_6) || INFILE(_LT_MIT_7))) {
2095  if(INFILE(_LT_MIT_NO_EVIL)) {
2096  INTERESTING(lDebug ? "MIT-style(no evil)" : "JSON");
2097  lmem[_mMIT] = 1;
2098  }
2099  else if (INFILE(_LT_X11_5)) {
2100  if (INFILE(_CR_XFREE86)) {
2101  INTERESTING(lDebug ? "XFree86(3)" : "XFree86");
2102  }
2103  else {
2104  INTERESTING(lDebug ? "X11(3)" : "X11");
2105  }
2106  lmem[_mMIT] = 1;
2107  }
2108  else if (INFILE(_LT_Xnet_STYLE)) {
2109  INTERESTING("Xnet");
2110  lmem[_mMIT] = 1;
2111  }
2112  else if (INFILE(_LT_TAPJOY)) {
2113  INTERESTING("Tapjoy");
2114  lmem[_mMIT] = 1;
2115  }
2116  else {
2117  /*
2118  * SPDX defines curl license. It has very typical MIT-style text. The only way to
2119  * identify it is to use copyright or copyright reference.
2120  */
2121  if (INFILE(_CR_CURL)) {
2122  INTERESTING("curl");
2123  }
2124  else {
2125  INTERESTING(lDebug ? "MIT-style(7)" : "MIT-style");
2126  }
2127  lmem[_mMIT] = 1;
2128  }
2129  }
2130  else if (INFILE(_LT_MIT_5)) {
2131  if (mCR_MIT()) {
2132  INTERESTING(lDebug ? "MIT(4)" : "MIT");
2133  }
2134  else {
2135  INTERESTING(lDebug ? "MIT-style(3)" : "MIT-style");
2136  }
2137  lmem[_mMIT] = 1;
2138  }
2140  /*
2141  * Open Group, NEC, MIT use the same text in licenses
2142  */
2143  if (INFILE(_LT_MIT_6)) {
2144  if (!lmem[_mMIT] && INFILE(_CR_OpenGroup)) {
2145  INTERESTING(lDebug ? "OpenGroup(1)" : "OpenGroup");
2146  lmem[_mMIT] = 1;
2147  }
2148  else if (!lmem[_mCMU] && mCR_CMU()) {
2149  INTERESTING(lDebug ? "CMU(2)" : "CMU");
2150  lmem[_mCMU] = 1;
2151  }
2152  else if (!lmem[_mMIT] && mCR_MIT()) {
2153  INTERESTING(lDebug ? "MIT(6)" : "MIT");
2154  lmem[_mMIT] = 1;
2155  }
2156  else if (!lmem[_mMIT] && INFILE(_LT_HPND_1) && INFILE(_LT_HPND_2)) {
2157  INTERESTING("HPND-sell-variant");
2158  lmem[_mMIT] = 1;
2159  }
2160  /*
2161  * _LT_MIT_6 is very similar to _LT_BSD_2 where MIT-CMU licenses
2162  * are also detected. Following else if is the copy from there.
2163  */
2164  else if (!lmem[_mMIT] && INFILE(_LT_CMU_7)) {
2165  if (INFILE(_CR_CMU_1) || INFILE(_CR_CMU_2) || INFILE(_CR_BSDCAL)) {
2166  INTERESTING("MIT-CMU");
2167  }
2168  else {
2169  INTERESTING("MIT-CMU-style");
2170  }
2171  lmem[_mCMU] = 1;
2172  }
2173  else if (!lmem[_mMIT]) {
2174  INTERESTING(lDebug ? "MIT-style(4)" : "MIT-style");
2175  lmem[_mMIT] = 1;
2176  }
2177  }
2178  else if (INFILE(_SPDX_MIT_0)) {
2179  INTERESTING("MIT-0");
2180  }
2181  else if (INFILE(_SPDX_MIT_advertising)) {
2182  INTERESTING("MIT-advertising");
2183  }
2184  else if (INFILE(_SPDX_MIT_enna)) {
2185  INTERESTING("MIT-enna");
2186  }
2187  else if (INFILE(_SPDX_MIT_feh)) {
2188  INTERESTING("MIT-feh");
2189  }
2190  else if (!lmem[_mMIT] && INFILE(_LT_MIT_7)) {
2191  if (INFILE(_CR_OpenGroup)) {
2192  INTERESTING(lDebug ? "OpenGroup(2)" : "OpenGroup");
2193  }
2194  else if (!lmem[_mMIT] && mCR_MIT()) {
2195  INTERESTING(lDebug ? "MIT(7)" : "MIT");
2196  lmem[_mMIT] = 1;
2197  }
2198  else {
2199  INTERESTING(lDebug ? "MIT-style(5)" : "MIT-style");
2200  lmem[_mMIT] = 1;
2201  }
2202  }
2203  else if ((!lmem[_mMIT] || mCR_MIT()) && INFILE(_LT_MITref1)) {
2204  INTERESTING(lDebug ? "MIT(ref1)" : "MIT");
2205  lmem[_mMIT] = 1;
2206  }
2207  else if (!lmem[_mMIT] && INFILE(_LT_MITref2)) {
2208  INTERESTING(lDebug ? "MIT(ref2)" : "MIT");
2209  lmem[_mMIT] = 1;
2210  }
2211  else if (!lmem[_mMIT] && INFILE(_LT_MITref6)) {
2212  INTERESTING(lDebug ? "MIT(ref6)" : "MIT");
2213  lmem[_mMIT] = 1;
2214  }
2215  else if (!lmem[_mMIT] && INFILE(_LT_MITref3)) {
2216  INTERESTING(lDebug ? "MIT(ref3)" : "MIT-style");
2217  lmem[_mMIT] = 1;
2218  }
2219  else if (!lmem[_mMIT] && INFILE(_LT_MITref4)) {
2220  INTERESTING(lDebug ? "MIT(ref4)" : "MIT");
2221  lmem[_mMIT] = 1;
2222  }
2223  else if (!lmem[_mMIT] && (INFILE(_LT_MITref5) || INFILE(_LT_MITref9))) {
2224  INTERESTING(lDebug ? "MIT(ref5)" : "MIT");
2225  lmem[_mMIT] = 1;
2226  }
2227  else if (INFILE(_SPDX_MIT_CMU)) {
2228  INTERESTING("MIT-CMU");
2229  }
2230  else if (!lmem[_fREAL] && (INFILE(_SPDX_MIT))) {
2231  INTERESTING(lDebug ? "MIT(SPDX)" : "MIT");
2232  }
2233  else if (!lmem[_mMIT] && !lmem[_fREAL] && INFILE(_LT_MITref7)) {
2234  INTERESTING(lDebug ? "MIT(ref7)" : "MIT");
2235  lmem[_mMIT] = 1;
2236  }
2237  else if (!lmem[_mMIT] && INFILE(_LT_MITref8)) {
2238  INTERESTING(lDebug ? "MIT(ref8/9)" : "MIT");
2239  lmem[_mMIT] = 1;
2240  }
2241  else if (INFILE(_LT_OpenGroup_1)) {
2242  if (INFILE(_CR_OpenGroup)) {
2243  INTERESTING(lDebug ? "OpenGroup(3)" : "OpenGroup");
2244  }
2245  else {
2246  INTERESTING(lDebug ? "OG-style(3)" : "OpenGroup-style");
2247  }
2248  }
2249  else if (INFILE(_LT_OpenGroup_3)) {
2250  if (INFILE(_CR_OpenGroup)) {
2251  INTERESTING(lDebug ? "OpenGroup(5)" : "OpenGroup");
2252  }
2253  else {
2254  INTERESTING(lDebug ? "OG-style(5)" : "OpenGroup-style");
2255  }
2256  }
2257  else if (INFILE(_LT_OpenGroup_PROP)) {
2258  if (!lmem[_mXOPEN] && INFILE(_CR_XOPEN)) {
2259  INTERESTING("XOPEN-EULA");
2260  lmem[_mXOPEN] = 1;
2261  }
2262  else if (INFILE(_CR_OpenGroup)) {
2263  INTERESTING("OpenGroup-Proprietary");
2264  }
2265  else {
2266  INTERESTING("Proprietary");
2267  }
2268  }
2269  else if (INFILE(_LT_X11_1)) {
2270  if (mCR_X11()) {
2271  INTERESTING(lDebug ? "X11(4)" : "X11");
2272  }
2273  else {
2274  INTERESTING(lDebug ? "X11-style(2)" : "X11-style");
2275  }
2276  }
2277  else if (INFILE(_LT_X11_2)) {
2278  if (mCR_X11()) {
2279  INTERESTING(lDebug ? "X11(5)" : "X11");
2280  }
2281  else {
2282  INTERESTING(lDebug ? "X11-style(3)" : "X11-style");
2283  }
2284  }
2285  else if (INFILE(_LT_X11_3)) {
2286  if (mCR_X11()) {
2287  INTERESTING(lDebug ? "X11(6)" : "X11");
2288  }
2289  /*
2290  * Unix System Laboratories
2291  */
2292  else if (INFILE(_CR_USL_EUR)) {
2293  INTERESTING(lDebug ? "USLE(2)" : "USL-Europe");
2294  }
2295  else {
2296  INTERESTING(lDebug ? "X11-style(4)" : "X11-style");
2297  }
2298  }
2299  else if (INFILE(_LT_X11_4)) {
2300  if (mCR_X11()) {
2301  INTERESTING(lDebug ? "X11(7)" : "X11");
2302  }
2303  else {
2304  INTERESTING(lDebug ? "X11-style(5)" : "X11-style");
2305  }
2306  }
2307  else if (INFILE(_PHR_X11_1) || INFILE(_PHR_X11_2)) {
2308  INTERESTING(lDebug ? "PHR(X11)" : "X11");
2309  }
2310  else if (INFILE(_LT_X11_STYLE)) {
2311  INTERESTING(lDebug ? "X11-style(6)" : "X11-style");
2312  }
2313  /*
2314  * ISC License
2315  */
2316  if (INFILE(_PHR_ISC_1) || INFILE(_PHR_ISC_2) || HASTEXT(_URL_ISC, REG_EXTENDED)) {
2317  INTERESTING(lDebug ? "PHR(ISC)" : "ISC");
2318  lmem[_mISC] = 1;
2319  }
2320  else if (INFILE(_LT_MIT_4) && INFILE(_PHR_NO_WARRANTY_12)) {
2321  INTERESTING(lDebug ? "ISC(MIT-style(4))" : "ISC");
2322  lmem[_mISC] = 1;
2323  }
2324  else if (INFILE(_LT_MIT_8) && INFILE(_CR_ISC)) {
2325  INTERESTING(lDebug ? "ISC(MIT-style(8))" : "ISC");
2326  lmem[_mISC] = 1;
2327  }
2329  /*
2330  * NTP License, note that NTP license text is detected with _LT_BSD_2
2331  */
2332  if (INFILE(_TITLE_NTP)) {
2333  INTERESTING("NTP");
2334  lmem[_mNTP] = 1;
2335  }
2337  /* MirOS License (MirOS) */
2338  if (INFILE(_TITLE_MIROS)) {
2339  INTERESTING("MirOS");
2340  lmem[_mMIT] = 1;
2341  }
2343  /* Libpng license */
2344  if (INFILE(_TITLE_LIBPNG)) {
2345  INTERESTING("Libpng");
2346  }
2347  else if (INFILE(_LT_W3C_1)) {
2348  if (INFILE(_CR_W3C)) {
2349  INTERESTING(lDebug ? "W3C(1)" : "W3C");
2350  }
2351  else {
2352  INTERESTING(lDebug ? "W3C-style(1)" : "W3C-style");
2353  }
2354  lmem[_fW3C] = 1;
2355  }
2356  else if (!lmem[_mNTP] && !lmem[_mPYTHON] && !lmem[_fBSD] && INFILE(_LT_W3C_2)) {
2357  if (INFILE(_LT_W3C_19980720)) {
2358  INTERESTING("W3C-19980720");
2359  }
2360  else if (INFILE(_CR_W3C)) {
2361  INTERESTING(lDebug ? "W3C(2)" : "W3C");
2362  }
2363  else {
2364  INTERESTING(lDebug ? "W3C-style(2)" : "W3C-style");
2365  }
2366  lmem[_fW3C] = 1;
2367  }
2368  else if (INFILE(_LT_W3C_3)) {
2369  if (INFILE(_LT_W3C_8)) {
2370  if (INFILE(_LT_W3C_20021231)) {
2371  INTERESTING("W3C");
2372  }
2373  else if (INFILE(_LT_W3C_20150513)) {
2374  INTERESTING("W3C-20150513");
2375  }
2376  }
2377  else if (INFILE(_CR_W3C)) {
2378  INTERESTING(lDebug ? "W3C(3)" : "W3C");
2379  }
2380  else if (INFILE(_LT_W3Cref4)) {
2381  INTERESTING(lDebug ? "W3C(ref4)" : "W3C");
2382  }
2383  else {
2384  INTERESTING(lDebug ? "W3C-style(3)" : "W3C-style");
2385  }
2386  lmem[_fW3C] = 1;
2387  }
2388  else if (INFILE(_LT_W3C_4) && NOT_INFILE(_LT_PNG_ZLIB_2)) {
2389  if (INFILE(_CR_W3C)) {
2390  INTERESTING(lDebug ? "W3C(4)" : "W3C");
2391  }
2392  else {
2393  INTERESTING(lDebug ? "W3C-style(4)" : "W3C-style");
2394  }
2395  lmem[_fW3C] = 1;
2396  }
2397  else if (INFILE(_LT_W3C_5)) {
2398  if (INFILE(_CR_W3C)) {
2399  INTERESTING(lDebug ? "W3C(5)" : "W3C");
2400  }
2401  else {
2402  INTERESTING(lDebug ? "W3C-style(5)" : "W3C-style");
2403  }
2404  lmem[_fW3C] = 1;
2405  }
2406  else if (INFILE(_LT_W3C_6)) {
2407  if (INFILE(_CR_W3C)) {
2408  INTERESTING(lDebug ? "W3C(6)" : "W3C");
2409  }
2410  else {
2411  INTERESTING(lDebug ? "W3C-style(6)" : "W3C-style");
2412  }
2413  lmem[_fW3C] = 1;
2414  }
2415  else if (INFILE(_LT_W3C_7)) {
2416  if (INFILE(_CR_W3C)) {
2417  INTERESTING(lDebug ? "W3C(7)" : "W3C");
2418  }
2419  else if (INFILE(_LT_OGC)) {
2420  INTERESTING("OGC");
2421  }
2422  else {
2423  INTERESTING(lDebug ? "W3C-style(7)" : "W3C-style");
2424  }
2425  lmem[_fW3C] = 1;
2426  }
2427  else if (INFILE(_LT_W3Cref1)) {
2428  INTERESTING(lDebug ? "W3C(ref1)" : "W3C");
2429  lmem[_fW3C] = 1;
2430  }
2431  else if (INFILE(_LT_W3Cref2)) {
2432  INTERESTING(lDebug ? "W3C(ref2)" : "W3C");
2433  lmem[_fW3C] = 1;
2434  }
2435  else if (INFILE(_LT_W3Cref3)) {
2436  INTERESTING(lDebug ? "W3C(ref3)" : "W3C");
2437  lmem[_fW3C] = 1;
2438  }
2439  else if (INFILE(_LT_W3Cref4)) {
2440  INTERESTING(lDebug ? "W3C(ref4)" : "W3C");
2441  lmem[_fW3C] = 1;
2442  }
2443  else if (URL_INFILE(_URL_W3C_20021231)) {
2444  INTERESTING(lDebug ? "W3C-20021231(url)" : "W3C");
2445  lmem[_fW3C] = 1;
2446  }
2447  else if (URL_INFILE(_URL_W3C_IP)) {
2448  INTERESTING(lDebug ? "W3C-IP(url)" : "W3C-IP");
2449  lmem[_fW3C] = 1;
2450  }
2451  else if (URL_INFILE(_URL_W3C)) {
2452  INTERESTING(lDebug ? "W3C(url)" : "W3C");
2453  lmem[_fW3C] = 1;
2454  }
2455  else if (!lmem[_mMIT] && INFILE(_LT_MIT_3)) {
2456  if (INFILE(_LT_NTP_0)) {
2457  INTERESTING("NTP-0");
2458  }
2459  else if (mCR_MIT()) {
2460  INTERESTING(lDebug ? "MIT(8)" : "MIT");
2461  }
2462  else {
2463  INTERESTING(lDebug ? "MIT-style(6)" : "MIT-style");
2464  }
2465  lmem[_mMIT] = 1;
2466  }
2467  else if (!lmem[_mMIT] && INFILE(_LT_MIT_4)) {
2468  if (mCR_MIT()) {
2469  INTERESTING(lDebug ? "MIT(9)" : "MIT");
2470  }
2471  else if (!lmem[_mISC] && mCR_FSF()) {
2472  INTERESTING(lDebug ? "FSF(7)" : "FSF");
2473  }
2474  else if (!lmem[_mISC]) {
2475  INTERESTING(lDebug ? "MIT-style(13)" : "MIT-style");
2476  }
2477  lmem[_mMIT] = 1;
2478  }
2479  else if (!lmem[_mMIT] && INFILE(_LT_MIT_8)) {
2480  if (INFILE(_CR_VIXIE)) {
2481  INTERESTING("Vixie");
2482  }
2483  else if (INFILE(_LT_0BSD)) {
2484  INTERESTING("0BSD");
2485  }
2486  else if (mCR_MIT()) {
2487  INTERESTING(lDebug ? "MIT(10)" : "MIT");
2488  }
2489  else if (HASTEXT(_TEXT_TU_BERLIN, 0) && HASTEXT(_LT_FREE_87,0)) {
2490  INTERESTING("TU-Berlin-2.0");
2491  }
2492  else {
2493  INTERESTING(lDebug ? "MIT-style(8)" : "MIT-style");
2494  }
2495  lmem[_mMIT] = 1;
2496  }
2497  else if (INFILE(_LT_MIT_9)) {
2498  if (INFILE(_CR_SLEEPYCAT)) {
2499  MEDINTEREST(lDebug ? "Sleepycat(2)" : "Sleepycat");
2500  }
2501  else if (INFILE(_CR_BSDCAL)) {
2502  INTERESTING(lDebug ? "BSD(mit)" : "BSD");
2503  lmem[_fBSD] = 1;
2504  }
2505  else if (INFILE(_CR_SUN)) {
2506  INTERESTING(lDebug ? "SUN(mit)" : "SUN");
2507  lmem[_fBSD] = 1;
2508  }
2509  else if (!lmem[_mMIT] && mCR_MIT()) {
2510  INTERESTING(lDebug ? "MIT(11)" : "MIT");
2511  lmem[_mMIT] = 1;
2512  }
2513  else if (!lmem[_mMIT]) {
2514  /*
2515  * Tcl/Tk license has MIT phrase
2516  */
2517  if (INFILE(_LT_TCL)) {
2518  INTERESTING("TCL");
2519  lmem[_fTCL] = 1;
2520  }
2521  else {
2522  INTERESTING(lDebug ? "MIT-style(9)" : "MIT-style");
2523  lmem[_mMIT] = 1;
2524  }
2525  }
2526  }
2527  else if (INFILE(_LT_MIT_10)) {
2528  if (!lmem[_mMIT] && mCR_MIT()) {
2529  INTERESTING(lDebug ? "MIT(12)" : "MIT");
2530  lmem[_mMIT] = 1;
2531  }
2532  else {
2533  INTERESTING(lDebug ? "MIT-style(10)" : "MIT-style");
2534  lmem[_mMIT] = 1;
2535  }
2536  }
2537  else if ((INFILE(_LT_MIROS_PREAMBLE) || INFILE(_TITLE_MIROS)) && INFILE(_LT_MIT_11)) {
2538  INTERESTING(lDebug ? "MIT-style(MirOS)" : "MirOS");
2539  lmem[_mMIT] = 1;
2540  }
2541  else if (INFILE(_LT_MIT_11)) {
2542  INTERESTING(lDebug ? "MIT-style(11)" : "MIT-style");
2543  lmem[_mMIT] = 1;
2544  }
2545  else if (!lmem[_mMIT] && INFILE(_LT_MITDOC)) {
2546  if (mCR_MIT()) {
2547  INTERESTING(lDebug ? "MIT(13)" : "MIT");
2548  }
2549  else {
2550  INTERESTING(lDebug ? "MIT-style(12)" : "MIT-style");
2551  }
2552  lmem[_mMIT] = 1;
2553  }
2554  else if (!lmem[_mMIT] && INFILE(_LT_MIT_0) && NOT_INFILE(_LT_ECL)) {
2555  INTERESTING(lDebug ? "MIT(0)" : "MIT-style");
2556  lmem[_mMIT] = 1;
2557  }
2558  else if (INFILE(_LT_MIT_14)) {
2559  INTERESTING(lDebug ? "MIT-style(14)" : "MIT-style");
2560  lmem[_mMIT] = 1;
2561  }
2562  else if (INFILE(_LT_MIT_15)) {
2563  INTERESTING(lDebug ? "MIT-style(15)" : "ISC-style");
2564  lmem[_mMIT] = 1;
2565  }
2566  else if (INFILE(_LT_MPL_OR_MITX)) {
2567  if (!lmem[_mMPL]) {
2568  cp = MPLVERS();
2569  INTERESTING(lDebug ? "MPL(with-MIT)" : cp);
2570  lmem[_mMPL] = 1;
2571  }
2572  if (!lmem[_mMIT]) {
2573  INTERESTING(lDebug ? "MIT(with-MPL)" : "MIT");
2574  lmem[_mMIT] = 1;
2575  }
2576  }
2577  else if (!lmem[_mMIT] && (URL_INFILE(_URL_MIT) || URL_INFILE(_URL_MIT_ROCK))) {
2578  INTERESTING(lDebug ? "MIT(url)" : "MIT");
2579  lmem[_mMIT] = 1;
2580  }
2581  else if (HASTEXT(_TEXT_TU_BERLIN, 0) && HASTEXT(_LT_FREE_87,0)) {
2582  INTERESTING("TU-Berlin-1.0");
2583  }
2584  else if (INFILE(_LT_NIST_1) && INFILE(_LT_NIST_2)) {
2585  INTERESTING(lDebug ? "NIST" : "MIT-style");
2586  }
2587  else if (INFILE(_LT_FSFAP)) {
2588  INTERESTING("FSFAP");
2589  }
2591  /*
2592  * Generic CopyLeft licenses
2593  */
2594  if (INFILE(_LT_COPYLEFT_1)) {
2595  INTERESTING("CopyLeft[1]");
2596  }
2597  else if (INFILE(_LT_COPYLEFT_2)) {
2598  INTERESTING("CopyLeft[2]");
2599  }
2601  /*
2602  * OpenContent license
2603  */
2604  if (INFILE(_LT_OPENCONTENT)) {
2605  if (INFILE(_TITLE_OPENCL10)) {
2606  INTERESTING("OCL-1.0");
2607  }
2608  else if (INFILE(_TITLE_OPENCL)) {
2609  INTERESTING("OCL");
2610  }
2611  else {
2612  INTERESTING("OCL-style");
2613  }
2614  }
2616  /*
2617  * jpeg/netpbm and png/zlib and others...
2618  */
2619  if (INFILE(_TITLE_ZLIB)) {
2620  INTERESTING("Zlib");
2621  }
2622  else if (INFILE (_LT_TRUECRYPT_30)) {
2623  INTERESTING("TrueCrypt-3.0");
2624  }
2625  else if (INFILE(_TITLE_LIBPNG)) {
2626  INTERESTING("Libpng");
2627  }
2628  /* IJG */
2629  else if (INFILE(_LT_JPEG_1)) {
2630  INTERESTING(lDebug ? "JPEG(1)" : "IJG");
2631  lmem[_fIJG] = 1;
2632  }
2633  else if (INFILE(_LT_JPEG_2) && HASTEXT(_TITLE_IJG_2, 0)) {
2634  INTERESTING(lDebug ? "JPEG(2)" : "IJG");
2635  lmem[_fIJG] = 1;
2636  }
2637  /* Zlib */
2638  else if (INFILE(_SPDX_zlib_acknowledgement)) {
2639  INTERESTING("zlib-acknowledgement");
2640  }
2641  else if (!lmem[_fREAL] && (INFILE(_SPDX_Zlib))) {
2642  INTERESTING("Zlib");
2643  }
2644  else if (INFILE(_LT_PNG_ZLIB_1) && HASTEXT(_LT_PNG_ZLIB_CLAUSE_1, 0) && HASTEXT(_LT_PNG_ZLIB_CLAUSE_2, REG_EXTENDED) && HASTEXT(_LT_PNG_ZLIB_CLAUSE_3, 0)) {
2645  INTERESTING(lDebug ? "ZLIB(1)" : "Zlib");
2646  }
2647  else if (INFILE(_LT_PNG_ZLIBref4) && NOT_INFILE(_LT_PNG_ZLIBref4_EXHIBIT)) {
2648  INTERESTING(lDebug ? "ZLIB(6)" : "Zlib");
2649  }
2650  else if (!lmem[_fW3C] && INFILE(_LT_PNG_ZLIB_2)) {
2651  if (INFILE(_LT_libmng_2007_Clause_1)) {
2652  if (HASTEXT(_LT_libmng_2007_1, 0)) {
2653  INTERESTING("libmng-2007");
2654  }
2655  else if (INFILE(_LT_libpng_20_Clause_1)) {
2656  INTERESTING("libpng-2.0");
2657  }
2658  }
2659  else {
2660  INTERESTING(lDebug ? "PNG/ZLIB(2)" : "Libpng");
2661  }
2662  }
2663  else if (INFILE(_LT_PNG_ZLIBref1)) {
2664  INTERESTING(lDebug ? "ZLIB(3)" : "Zlib");
2665  }
2666  else if (INFILE(_LT_PNG_ZLIBref2)) {
2667  INTERESTING(lDebug ? "ZLIB(4)" : "Zlib");
2668  }
2669  else if (INFILE(_LT_PNG_ZLIBref3)) { /* might be zlib/libpng license, not sure */
2670  INTERESTING(lDebug ? "ZLIB(5)" : "Zlib-possibility");
2671  }
2672  else if (!LVAL(_TEXT_GNU_LIC_INFO) && (URL_INFILE(_URL_ZLIB_1) || URL_INFILE(_URL_ZLIB_2))) {
2673  INTERESTING(lDebug ? "ZLIB(url)" : "Zlib");
2674  }
2675 
2676  if (INFILE(_LT_INFO_ZIP) || URL_INFILE(_URL_INFO_ZIP)) {
2677  INTERESTING("Info-ZIP");
2678  }
2680  /*
2681  * IETF (primarily docs, RFCs, and protocol/standard proposals) . This
2682  * one is a little strange as text-formatters that print this license
2683  * will occasionally split the text across a page boundary. Here we
2684  * look for 2 separate footprints.
2685  */
2686  if (INFILE(_LT_IETF_1) || INFILE(_LT_IETF_2) || INFILE(_LT_IETF_3) ||
2687  INFILE(_LT_IETF_4)) {
2688  if (mCR_IETF()) {
2689  INTERESTING("IETF");
2690  }
2691  else if (INFILE(_LT_IETF_5)) {
2692  INTERESTING("IETF");
2693  }
2694  else if (HASTEXT(_LT_IETF_7, 0)) {
2695  INTERESTING("IETF");
2696  }
2697  else if (INFILE(_CR_OASIS)) {
2698  INTERESTING("OASIS");
2699  }
2700  else {
2701  INTERESTING("IETF-style");
2702  }
2703  }
2704  /*
2705  * IETF Trust's Legal Provisions
2706  */
2707  else if (INFILE(_LT_IETF_6)) {
2708  INTERESTING("IETF");
2709  }
2710  /*
2711  * Contributions to IETF Standard Process
2712  */
2713  else if (INFILE(_LT_IETF_7)) {
2714  INTERESTING("IETF-contribution");
2715  }
2717  /*
2718  * CDDL
2719  */
2720  if (INFILE(_PHR_CDDL_1) || HASTEXT(_PHR_CDDL_2, REG_EXTENDED)) {
2721  cp = CDDLVERS();
2722  INTERESTING(cp);
2723  lmem[_mCDDL] = 1;
2724  }
2726  /*
2727  * MPL (Mozilla)
2728  * ... Sun SISSL and one Mozilla licensing derivative share wording
2729  */
2730  if (!lmem[_fREAL] && NOT_INFILE(_LT_CPALref) && NOT_INFILE(_TITLE_GSOAP) &&
2731  (INFILE(_LT_MPL_OR) || INFILE(_TITLE_MPL_ref))) {
2732  cp = MPLVERS(); /* NPL, too */
2733  INTERESTING(lDebug ? "MPL/NPL#2" : cp);
2734  lmem[_mMPL] = 1;
2735  }
2736  if (INFILE(_LT_CPALref)) {
2737  if (INFILE(_TITLE_CPAL10)) {
2738  INTERESTING(lDebug ? "CPAL_v1.0(#2)" : "CPAL-1.0");
2739  lmem[_mMPL] = 1;
2740  lmem[_fATTRIB] = 1;
2741  }
2742  else if (INFILE(_TITLE_CPAL)) {
2743  INTERESTING(lDebug ? "CPAL(#2)" : "CPAL");
2744  lmem[_mMPL] = 1;
2745  lmem[_fATTRIB] = 1;
2746  }
2747  }
2748  else if (INFILE(_LT_CPAL_V1_ref)) {
2749  INTERESTING(lDebug ? "CPAL_v1.0(#3)" : "CPAL-1.0");
2750  lmem[_mMPL] = 1;
2751  lmem[_fATTRIB] = 1;
2752  }
2753  if (!lmem[_mMPL] && INFILE(_LT_MPL_2)) {
2754  if (INFILE(_TITLE_SISSL)) {
2755  cp = SISSLVERS();
2756  INTERESTING(lDebug ? "SISSL(MPL)" : cp);
2757  lmem[_mSUN] = 1;
2758  }
2759  else if (INFILE(_TITLE_SUN_PL10)) {
2760  INTERESTING("SPL-1.0");
2761  lmem[_mSUN] = 1;
2762  }
2763  else if (INFILE(_TITLE_SUN_PL)) {
2764  INTERESTING("SPL");
2765  lmem[_mSUN] = 1;
2766  }
2767  else if (INFILE(_TITLE_IDPL_V10)) {
2768  INTERESTING("IDPL-1.0");
2769  lmem[_mMPL] = 1;
2770  }
2771  else if (INFILE(_TITLE_IDPL)) {
2772  INTERESTING("IDPL");
2773  lmem[_mMPL] = 1;
2774  }
2775  else if (INFILE(_TITLE_INTERBASE)) {
2776  INTERESTING("Interbase-1.0");
2777  lmem[_mMPL] = 1;
2778  }
2779  else if (INFILE(_TITLE_NETIZEN_V10)) {
2780  INTERESTING("NOSL-1.0");
2781  lmem[_mMPL] = 1;
2782  }
2783  else if (INFILE(_TITLE_NETIZEN)) {
2784  INTERESTING(lDebug ? "NOSL(#1)" : "NOSL");
2785  lmem[_mMPL] = 1;
2786  }
2787  else if (INFILE(_TITLE_TPL10)) {
2788  INTERESTING(lDebug ? "TPL(v1.0#1)" : "MPL.TPL-1.0");
2789  lmem[_mMPL] = 1;
2790  }
2791  else if (INFILE(_TITLE_TPL)) {
2792  INTERESTING(lDebug ? "TPL(#1)" : "MPL.TPL");
2793  lmem[_mMPL] = 1;
2794  }
2795  else if (INFILE(_TITLE_GSOAP_V13)) {
2796  INTERESTING("gSOAP-1.3b");
2797  lmem[_mGSOAP] = 1;
2798  }
2799  else if (INFILE(_TITLE_GSOAP)) {
2800  INTERESTING("gSOAP");
2801  lmem[_mGSOAP] = 1;
2802  }
2803  else if (INFILE(_TITLE_FLASH2XML10)) {
2804  INTERESTING("Flash2xml-1.0");
2805  }
2806  else if (INFILE(_TITLE_NOKIA10A)) {
2807  INTERESTING("Nokia");
2808  lmem[_mMPL] = 1;
2809  }
2810  else if (INFILE(_LT_NOKIA)) {
2811  INTERESTING("Nokia");
2812  lmem[_mMPL] = 1;
2813  }
2814  else if (INFILE(_TITLE_OPENPL10)) {
2815  INTERESTING("OPL-1.0");
2816  }
2817  else if (INFILE(_TITLE_SNIA_V11)) {
2818  INTERESTING("SNIA-1.1");
2819  }
2820  else if (INFILE(_TITLE_SNIA_V10)) {
2821  INTERESTING("SNIA-1.0");
2822  }
2823  else if (INFILE(_TITLE_CPAL10)) {
2824  INTERESTING(lDebug ? "CPAL_v1.0(#1)" : "CPAL-1.0");
2825  lmem[_mMPL] = 1;
2826  lmem[_fATTRIB] = 1;
2827  }
2828  else if (INFILE(_TITLE_CPAL)) {
2829  INTERESTING(lDebug ? "CPAL(#1)" : "CPAL");
2830  lmem[_mMPL] = 1;
2831  lmem[_fATTRIB] = 1;
2832  }
2833  else if (HASTEXT(_TEXT_MOZNET, REG_EXTENDED)) {
2834  if (INFILE(_TITLE_SUGARCRM_PL)) {
2835  INTERESTING("SugarCRM-1.1.3");
2836  lmem[_mMPL] = 1;
2837  lmem[_fATTRIB] = 1;
2838  }
2839  else if (!lmem[_mMPL] && !lmem[_fREAL] && INFILE(_TITLE_MOZNET_PL)) {
2840  cp = MPLVERS(); /* NPL, too */
2841  INTERESTING(lDebug ? "MPL/NPL#1" : cp);
2842  lmem[_mMPL] = 1;
2843  }
2844  }
2845  else if (INFILE(_TITLE_RHeCos_V11)) {
2846  INTERESTING("RHeCos-1.1");
2847  }
2848  else if (INFILE(_TITLE_CYGNUS_ECOS_V10)) {
2849  INTERESTING("Cygnus-eCos-1.0");
2850  }
2851  else if (INFILE(_TITLE_H2_V10)) {
2852  INTERESTING("H2-1.0");
2853  }
2854  else {
2855  if (!lmem[_mCDDL]) {
2856  INTERESTING("MPL-style");
2857  lmem[_mMPL] = 1;
2858  }
2859  }
2860  }
2861  else if (!lmem[_mMPL] && (INFILE(_LT_NPLref) || INFILE(_LT_NPL_1))) {
2862  cp = MPLVERS(); /* NPL, too */
2863  INTERESTING(lDebug ? "MPL/NPL#3" : cp);
2864  lmem[_mMPL] = 1;
2865  }
2866  else if (!lmem[_mMPL] && INFILE(_LT_MPLref1)) {
2867  cp = MPLVERS(); /* NPL, too */
2868  INTERESTING(lDebug ? "MPL/NPL-ref#1" : cp);
2869  lmem[_mMPL] = 1;
2870  }
2871  else if (!lmem[_mMPL] && INFILE(_LT_IDPLref)) {
2872  if (INFILE(_TITLE_IDPL_V10)) {
2873  INTERESTING(lDebug ? "IDPL-v1(ref)" : "IDPL-1.0");
2874  }
2875  else {
2876  INTERESTING(lDebug ? "IDPL(ref)" : "IDPL");
2877  }
2878  lmem[_mMPL] = 1;
2879  }
2880  else if (!lmem[_mMPL] && !lmem[_mLIBRE] && !lmem[_fREAL] &&
2881  !LVAL(_TEXT_GNU_LIC_INFO) && INFILE(_LT_MPLref2)) {
2882  cp = MPLVERS(); /* NPL, too */
2883  INTERESTING(lDebug ? "MPL/NPL-ref#2" : cp);
2884  lmem[_mMPL] = 1;
2885  }
2886  else if (!lmem[_mMPL] && !lmem[_mLIBRE] && !lmem[_fREAL] &&
2887  !LVAL(_TEXT_GNU_LIC_INFO) && INFILE(_TITLE_MOZNET_PL)) {
2888  cp = MPLVERS(); /* NPL, too */
2889  INTERESTING(lDebug ? "MPL/NPL#4" : cp);
2890  lmem[_mMPL] = 1;
2891  }
2892  else if (!lmem[_mMPL] && INFILE(_TITLE_NETSCAPE_EULA)) {
2893  INTERESTING("NPL-EULA");
2894  lmem[_mMPL] = 0;
2895  }
2896  else if (INFILE(_LT_NPL_2)) {
2897  INTERESTING(lDebug ? "NPL(#1)" : "NPL");
2898  lmem[_mMPL] = 0;
2899  }
2900  else if (INFILE(_TITLE_OPENPL)) {
2901  INTERESTING(lDebug ? "OPL(title)" : "OPL-style");
2902  }
2904  /*
2905  * Microsoft licenses: open and proprietary/EULA
2906  */
2907  if (INFILE(_LT_MSCORP_SSLref)) {
2908  INTERESTING(lDebug ? "MS-SSL(ref)" : "MS-SSL");
2909  lmem[_fMSCORP] = 1;
2910  }
2911  if (INFILE(_LT_MSCORP_PL)) {
2912  int ms_l = INFILE(_LT_MSCORP_LIMITED);
2913  int ms_r = INFILE(_LT_MSCORP_RL);
2914  if (ms_r && ms_l) {
2915  INTERESTING("MS-LRL");
2916  }
2917  else if (ms_r) {
2918  INTERESTING(lDebug ? "MS-RL(#1)" : "MS-RL");
2919  }
2920  else if (ms_l) {
2921  INTERESTING("MS-LPL");
2922  }
2923  else {
2924  INTERESTING(lDebug ? "MS-PL(#1)" : "MS-PL");
2925  }
2926  }
2927  else if (INFILE(_LT_MSCORP_LIMITEDref1)) {
2928  INTERESTING("MS-LPL");
2929  lmem[_fMSCORP] = 1;
2930  }
2931 
2932  if (INFILE(_TEXT_MICROSOFT)) {
2933  if (INFILE(_LT_MSCORP_INDEMNIFY)) {
2934  INTERESTING("MS-indemnity");
2935  lmem[_fMSCORP] = 1;
2936  }
2937  else if (INFILE(_LT_MSCORP_IP_1)) {
2938  INTERESTING(lDebug ? "MS-IP(1)" : "MS-IP");
2939  lmem[_fMSCORP] = 1;
2940  }
2941  else if (INFILE(_LT_MSCORP_IP_2)) {
2942  INTERESTING(lDebug ? "MS-IP(2)" : "MS-IP");
2943  lmem[_fMSCORP] = 1;
2944  }
2945  else if (INFILE(_LT_MSCORP_PLref1)) {
2946  INTERESTING(lDebug ? "MS-PL(ref1)" : "MS-PL");
2947  lmem[_fMSCORP] = 1;
2948  }
2949  else if (INFILE(_LT_MSCORP_PLref2)) {
2950  INTERESTING(lDebug ? "MS-PL(ref2)" : "MS-PL");
2951  lmem[_fMSCORP] = 1;
2952  }
2953  else if (INFILE(_LT_MSCORP_PLref3)) {
2954  INTERESTING(lDebug ? "MS-PL(ref3)" : "MS-PL");
2955  lmem[_fMSCORP] = 1;
2956  }
2957  else if (INFILE(_LT_MSCORP_RLref)) {
2958  INTERESTING(lDebug ? "MS-RL(ref)" : "MS-RL");
2959  lmem[_fMSCORP] = 1;
2960  }
2961  else if (INFILE(_LT_MSCORP_REFLIC)) {
2962  INTERESTING("MRL");
2963  lmem[_fMSCORP] = 1;
2964  }
2965  else if (INFILE(_LT_MSCORP_EULA_1) ||
2966  INFILE(_TITLE_MSCORP_EULA)) {
2967  INTERESTING(lDebug ? "MS-EULA(1)" : "MS-EULA");
2968  lmem[_fMSCORP] = 1;
2969  }
2970  else if (INFILE(_LT_MSCORP_EULA_2)) {
2971  INTERESTING(lDebug ? "MS-EULA(2)" : "MS-EULA");
2972  lmem[_fMSCORP] = 1;
2973  }
2974  else if (INFILE(_LT_MSCORP_EULA_3)) {
2975  INTERESTING(lDebug ? "MS-EULA(3)" : "MS-EULA");
2976  lmem[_fMSCORP] = 1;
2977  }
2978  else if (INFILE(_LT_MSCORP_EULA_4)) {
2979  INTERESTING(lDebug ? "MS-EULA(4)" : "MS-EULA");
2980  lmem[_fMSCORP] = 1;
2981  }
2982  else if (INFILE(_LT_MSCORP_EULA_5)) {
2983  INTERESTING(lDebug ? "MS-EULA(5)" : "MS-EULA");
2984  lmem[_fMSCORP] = 1;
2985  }
2986  else if (INFILE(_LT_MSCORP_EULA_6)) {
2987  INTERESTING(lDebug ? "MS-EULA(6)" : "MS-EULA");
2988  lmem[_fMSCORP] = 1;
2989  }
2990  else if (INFILE(_LT_MSCORP_1)) {
2991  INTERESTING(lDebug ? "MS(1)" : "Microsoft");
2992  lmem[_fMSCORP] = 1;
2993  }
2994  else if (INFILE(_LT_MSCORP_2)) {
2995  INTERESTING(lDebug ? "MS(2)" : "Microsoft");
2996  lmem[_fMSCORP] = 1;
2997  }
2998  else if (INFILE(_LT_MSCORP_3)) {
2999  INTERESTING(lDebug ? "MS(3)" : "Microsoft");
3000  lmem[_fMSCORP] = 1;
3001  }
3002  else if (INFILE(_LT_MSCORP_4)) {
3003  INTERESTING(lDebug ? "MS(4)" : "Microsoft");
3004  lmem[_fMSCORP] = 1;
3005  }
3006  else if (INFILE(_LT_MSCORP_5)) {
3007  INTERESTING(lDebug ? "MS(5)" : "Microsoft");
3008  lmem[_fMSCORP] = 1;
3009  }
3010  else if (INFILE(_LT_MSCORPref1)) {
3011  INTERESTING("Microsoft");
3012  lmem[_fMSCORP] = 1;
3013  }
3014  }
3016  /*
3017  * Santa Cruz Operation (SCO)
3018  */
3019  if (INFILE(_LT_SCO_COMM) && INFILE(_CR_SCO)) {
3020  INTERESTING("SCO.commercial");
3021  }
3023  /*
3024  * Zonealarm
3025  */
3026  if (INFILE(_LT_ZONEALARM) && INFILE(_TITLE_ZONEALARM_EULA)) {
3027  INTERESTING("ZoneAlarm-EULA");
3028  }
3030  /*
3031  * Ximian
3032  */
3033  if (HASTEXT(_TEXT_XIMIAN, 0)) {
3034  if (INFILE(_CR_XIMIAN)) {
3035  if (INFILE(_LT_XIMIAN)) {
3036  if (INFILE(_TITLE_XIMIANLOGO10)) {
3037  INTERESTING("Ximian-1.0");
3038  }
3039  else if (INFILE(_TITLE_XIMIANLOGO)) {
3040  INTERESTING("Ximian");
3041  }
3042  }
3043  }
3044  }
3046  /*
3047  * Xerox
3048  */
3049  if (HASTEXT(_TEXT_XEROX, 0)) {
3050  if (INFILE(_LT_XEROX_1) || INFILE(_LT_XEROX_2)) {
3051  if (INFILE(_CR_XEROX_1) || INFILE(_CR_XEROX_2)) {
3052  INTERESTING("Xerox");
3053  }
3054  else {
3055  INTERESTING("Xerox-style");
3056  }
3057  }
3058  }
3060  /*
3061  * Artifex Software
3062  */
3063  if (INFILE(_LT_ARTIFEX) && INFILE(_CR_ARTIFEX)) {
3064  INTERESTING("Artifex");
3065  }
3067  /*
3068  * AGE logic
3069  */
3070  if (INFILE(_LT_AGE) && INFILE(_CR_AGE)) {
3071  INTERESTING("AGE-Logic");
3072  }
3074  /*
3075  * OpenSSL
3076  */
3077  if (INFILE(_LT_OPENSSLref1) || INFILE(_LT_OPENSSLref2) ||
3078  INFILE(_LT_OPENSSLref3) || INFILE(_LT_OPENSSLref4) ||
3079  INFILE(_LT_OPENSSLref6) || INFILE(_LT_OPENSSLref7) ||
3080  INFILE(_LT_OPENSSLref8) ) {
3081  INTERESTING(lDebug ? "OpenSSL(ref)" : "OpenSSL");
3082  }
3083  else if (INFILE(_SPDX_OpenSSL) || INFILE(_URL_OPENSSL)) {
3084  INTERESTING(lDebug ? "OpenSSL(phr)" : "OpenSSL");
3085  }
3087  /*
3088  * Dual OpenSSL SSLeay
3089  */
3090  if (INFILE(_LT_COMBINED_OPENSSL_SSLEAY)) {
3091  INTERESTING("OpenSSL");
3092  INTERESTING("SSLeay");
3093  }
3095  /*
3096  * Ruby. Ruby is a dual license which allows distribution also under GPL.
3097  * GPL was earlier recognized beside Ruby here but GPL was not identified
3098  * in all Ruby cases. Therefore GPL statements have bee removed.
3099  */
3100  if (INFILE(_LT_RUBY)) {
3101  INTERESTING("Ruby");
3102  lmem[_fRUBY] = 1;
3103  }
3104  else if (INFILE(_LT_RUBYref1)) {
3105  INTERESTING(lDebug ? "Ruby(ref1)" : "Ruby");
3106  }
3107  else if (INFILE(_LT_RUBYref2)) {
3108  INTERESTING(lDebug ? "Ruby(ref2)" : "Ruby");
3109  }
3110  else if (INFILE(_LT_RUBYref3)) {
3111  INTERESTING(lDebug ? "Ruby(ref3)" : "Ruby");
3112  }
3113  else if (INFILE(_LT_RUBYref4)) {
3114  INTERESTING(lDebug ? "Ruby(ref4)" : "Ruby");
3115  }
3116  else if (INFILE(_LT_RUBYref5)) {
3117  INTERESTING(lDebug ? "Ruby(ref5)" : "Ruby");
3118  }
3119  else if (INFILE(_LT_RUBYref6)) {
3120  INTERESTING(lDebug ? "Ruby(ref6)" : "Ruby");
3121  }
3123  /*
3124  * Python and EGenix.com look a bit alike
3125  * Q: should all these Python rhecks be a family-check like OpenLDAP?
3126  */
3127  if (INFILE(_LT_EGENIX_COM)) {
3128  INTERESTING("eGenix");
3129  }
3130  else if (INFILE(_LT_PYTHON_4)) {
3131  INTERESTING("Python");
3132  lmem[_mPYTHON] = 1;
3133  }
3134  else if (!lmem[_mPYTHON] && lmem[_mPYTH_TEXT]) {
3135  if (INFILE(_LT_PYTHON_1) || INFILE(_LT_PYTHON_2)) {
3136  if (INFILE(_LT_CNRI_PYTHON_GPL)) {
3137  INTERESTING("CNRI-Python-GPL-Compatible");
3138  lmem[_mGPL] = 1;
3139  }
3140  else if (INFILE(_CR_PYTHON) || INFILE(_TITLE_PYTHON)) {
3141  cp = PYTHVERS();
3142  INTERESTING(lDebug ? "Python(1)" : cp);
3143  }
3144  else if (INFILE(_LT_CNRI_PYTHON_1)) {
3145  INTERESTING("CNRI-Python");
3146  }
3147  else if (INFILE(_LT_CNRI_JYTHON)) {
3148  INTERESTING("CNRI-Jython");
3149  }
3150  else {
3151  INTERESTING("Python-style");
3152  }
3153  lmem[_mPYTHON] = 1;
3154  }
3155  else if (INFILE(_SPDX_CNRI_Python_GPL_Compatible)) {
3156  INTERESTING("CNRI-Python-GPL-Compatible");
3157  }
3158  else if (INFILE(_SPDX_CNRI_Python)) {
3159  INTERESTING("CNRI-Python");
3160  }
3161  else if (INFILE(_LT_CNRI_PYTHON_2)) {
3162  INTERESTING("CNRI-Python");
3163  }
3164  else if (INFILE(_LT_PYTHON_3)) {
3165  cp = PYTHVERS();
3166  INTERESTING(lDebug ? "Python(4)" : cp);
3167  lmem[_mPYTHON] = 1;
3168  }
3169  else if (INFILE(_LT_PYTHONSTYLEref)) {
3170  cp = PYTHVERS();
3171  INTERESTING(lDebug ? "Python(ref1)" : "Python-style");
3172  lmem[_mPYTHON] = 1;
3173  }
3174  else if (!lmem[_mLIBRE] && (INFILE(_LT_PYTHONref1) ||
3175  INFILE(_LT_PYTHONref2))) {
3176  cp = PYTHVERS();
3177  INTERESTING(lDebug ? "Python(ref2)" : cp);
3178  lmem[_mPYTHON] = 1;
3179  }
3180  else if (!lmem[_mLIBRE] && !lmem[_fREAL] &&
3181  !LVAL(_TEXT_GNU_LIC_INFO) && INFILE(_LT_PYTHONref3)) {
3182  cp = PYTHVERS();
3183  INTERESTING(lDebug ? "Python(ref3)" : cp);
3184  lmem[_mPYTHON] = 1;
3185  }
3186  else if (!lmem[_mPYTHON] && URL_INFILE(_URL_PYTHON)) {
3187  cp = PYTHVERS();
3188  INTERESTING(lDebug ? "Python(url)" : cp);
3189  lmem[_mPYTHON] = 1;
3190  }
3191  else if (!lmem[_mPYTHON] && INFILE(_LT_PYTHON22ref)) {
3192  INTERESTING(lDebug ? "Python(22ref)" : "Python-2.2");
3193  lmem[_mPYTHON] = 1;
3194  }
3195  }
3197  /*
3198  * Intel
3199  */
3200  if (INFILE(_LT_INTEL) && NOT_INFILE(_LT_REAL_RPSL)) {
3201  INTERESTING(lDebug ? "Intel(8)" : "Intel");
3202  }
3203  else if (INFILE(_LT_INTEL_6)) {
3204  INTERESTING(lDebug ? "Intel(9)" : "Intel-other");
3205  }
3206  else if (INFILE(_LT_INTEL_7)) {
3207  INTERESTING(lDebug ? "Intel(10)" : "Intel-other");
3208  }
3209  else if (INFILE(_LT_INTEL_WLAN)) {
3210  INTERESTING("Intel-WLAN");
3211  }
3212  else if (INFILE(_LT_INTEL_ACPI)) {
3213  INTERESTING("Intel-ACPI");
3214  }
3215  else if (INFILE(_SPDX_Intel_ACPI)) {
3216  INTERESTING("Intel-ACPI");
3217  }
3218  else if (INFILE(_LT_ISSL_1) && INFILE(_LT_ISSL_2)) {
3219  INTERESTING("ISSL");
3220  }
3221  else if (!lmem[_fREAL] && INFILE(_SPDX_Intel)) {
3222  INTERESTING("Intel");
3223  }
3224  else if (HASTEXT(_TEXT_INTELCORP, 0)) {
3225  if (INFILE(_LT_INTEL_1)) {
3226  if (INFILE(_LT_INTEL_FW)) {
3227  INTERESTING(lDebug ? "Intel(2)" : "Intel-only-FW");
3228  }
3229  else {
3230  INTERESTING(lDebug ? "Intel(3)" : "Intel");
3231  }
3232  }
3233  else if (INFILE(_LT_INTEL_2)) {
3234  INTERESTING(lDebug ? "Intel(4)" : "Intel");
3235  }
3236  else if (INFILE(_LT_INTEL_3)) {
3237  INTERESTING(lDebug ? "Intel(5)" : "Intel");
3238  }
3239  else if (INFILE(_LT_INTEL_4)) {
3240  INTERESTING(lDebug ? "Intel(6)" : "Intel");
3241  }
3242  else if (INFILE(_LT_INTEL_RESTRICT)) {
3243  INTERESTING("Intel.RESTRICTED");
3244  }
3245  else if (INFILE(_LT_INTEL_BINARY) && HASTEXT(_TEXT_INTELCORPBINARY, 0) && HASTEXT(_TEXT_NOMODIFICATION, 0)) {
3246  INTERESTING("Intel-Binary");
3247  }
3248  }
3249  else if (INFILE(_LT_INTEL_5)) {
3250  INTERESTING(lDebug ? "CPL(Intel)" : "CPL");
3251  INTERESTING(lDebug ? "Intel(7)" : "Intel");
3252  }
3253  else if (INFILE(_LT_INTEL_EULA)) {
3254  INTERESTING("Intel-EULA");
3255  }
3257  /*
3258  * Bellcore
3259  */
3260  if (INFILE(_LT_BELLCORE)) {
3261  if (INFILE(_CR_BELLCORE)) {
3262  INTERESTING("Bellcore");
3263  }
3264  else {
3265  INTERESTING("Bellcore-style");
3266  }
3267  }
3269  /*
3270  * Purdue
3271  */
3272  if (INFILE(_LT_PURDUE) && INFILE(_CR_PURDUE) && HASTEXT(_TEXT_ALTERED_SOURCE, REG_EXTENDED) && HASTEXT(_TEXT_ORIGIN, 0)) {
3273  INTERESTING("Purdue");
3274  /* flag is set to avoid Cisco-style detection */
3275  lmem[_fPURDUE] = 1;
3276  }
3278  /*
3279  * Cisco systems
3280  */
3281  if (!lmem[_fPURDUE] && INFILE(_LT_CISCO)) {
3282  if (HASTEXT(_LT_PNG_ZLIB_CLAUSE_1, 0) &&
3283  HASTEXT(_LT_PNG_ZLIB_CLAUSE_2, REG_EXTENDED) &&
3284  HASTEXT(_LT_PNG_ZLIB_CLAUSE_3, 0)) {
3285  if (INFILE(_LT_Spencer_86_94_CLAUSE_1) && INFILE(_LT_Spencer_94_CLAUSE_2)) {
3286  INTERESTING("Spencer-94");
3287  }
3288  else {
3289  INTERESTING("Zlib-style");
3290  }
3291  }
3292  else if (INFILE(_CR_CISCO)) {
3293  INTERESTING("Cisco");
3294  }
3295  else {
3296  INTERESTING("Cisco-style");
3297  }
3298  }
3300  /*
3301  * HP
3302  */
3303  if (INFILE(_LT_HP_DEC)) {
3304  if (mCR_HP()) {
3305  INTERESTING(lDebug ? "HP(8)" : "HP");
3306  }
3307  else if (INFILE(_CR_ADOBE)) {
3308  INTERESTING(lDebug ? "Adobe(8)" : "Adobe");
3309  }
3310  else if (INFILE(_LT_GNUPLOT_1) && INFILE(_LT_GNUPLOT_2)) {
3311  INTERESTING("gnuplot");
3312  }
3313  else {
3314  INTERESTING(lDebug ? "HP-DEC-style(1)" : "HP-DEC-style");
3315  }
3316  }
3317  else if (HASTEXT(_TEXT_HP, REG_EXTENDED)) {
3318  if (INFILE(_LT_HP_1)) {
3319  INTERESTING(lDebug ? "HP(2)" : "HP");
3320  }
3321  else if (INFILE(_LT_HP_3) && INFILE(_LT_HP_snmp_pp)) {
3322  INTERESTING(lDebug ? "HP(3)" : "hp-snmp-pp");
3323  }
3324  else if (INFILE(_LT_HP_4)) {
3325  INTERESTING(lDebug ? "HP(4)" : "HP");
3326  }
3327  else if (INFILE(_LT_HP_5)) {
3328  INTERESTING(lDebug ? "HP(5)" : "HP");
3329  }
3330  else if (INFILE(_LT_HP_6)) {
3331  INTERESTING(lDebug ? "HP(6)" : "HP");
3332  }
3333  else if (INFILE(_LT_HP_7)) {
3334  INTERESTING(lDebug ? "HP(7)" : "HP");
3335  }
3336  else if (INFILE(_LT_COMPAQ_1)) {
3337  INTERESTING(lDebug ? "Compaq(1)" : "HP-Compaq");
3338  }
3339  else if (INFILE(_LT_HP_EULA1)) {
3340  INTERESTING(lDebug ? "HP-EULA(1)" : "HP-EULA");
3341  }
3342  else if (INFILE(_LT_HP_EULA2)) {
3343  INTERESTING(lDebug ? "HP-EULA(2)" : "HP-EULA");
3344  }
3345  else if (INFILE(_LT_HP_EULA3)) {
3346  INTERESTING(lDebug ? "HP-EULA(3)" : "HP-EULA");
3347  }
3348  else if (INFILE(_LT_HP_EULA4)) {
3349  INTERESTING(lDebug ? "HP-EULA(4)" : "HP-EULA");
3350  }
3351  else if (INFILE(_LT_COMPAQ_EULA)) {
3352  INTERESTING(lDebug ? "Compaq(EULA)" : "HP-Compaq");
3353  }
3354  else if (INFILE(_LT_HP_PROPRIETARY_1)) {
3355  INTERESTING(lDebug ? "HP-prop(1)" : "HP-Proprietary");
3356  }
3357  else if (INFILE(_LT_HP_PROPRIETARY_2)) {
3358  INTERESTING(lDebug ? "HP-prop(2)" : "HP-Proprietary");
3359  }
3360  else if (INFILE(_LT_HP_PROPRIETARY_3)) {
3361  INTERESTING(lDebug ? "HP-prop(3)" : "HP-Proprietary");
3362  }
3363  else if (INFILE(_LT_HP_IBM_1)) {
3364  INTERESTING(lDebug ? "HP+IBM(1)" : "HP+IBM");
3365  }
3366  else if (INFILE(_LT_HP_IBM_2)) {
3367  INTERESTING(lDebug ? "HP+IBM(2)" : "HP+IBM");
3368  }
3369  else if (!lmem[_mHP] && INFILE(_CR_DEC) && INFILE(_LT_DEC_1)) {
3370  INTERESTING(lDebug ? "HP-DEC(3)" : "HP-DEC");
3371  lmem[_mHP] = 1;
3372  }
3373  else if (!lmem[_mHP] && INFILE(_CR_DEC) && INFILE(_LT_DEC_2)) {
3374  INTERESTING(lDebug ? "HP-DEC(4)" : "HP-DEC");
3375  lmem[_mHP] = 1;
3376  }
3377  else if (INFILE(_LT_EDS_1) && INFILE(_CR_EDS)) {
3378  INTERESTING(lDebug ? "HP-EDS(1)" : "HP");
3379  }
3380  else if (INFILE(_LT_EDS_2) && INFILE(_CR_EDS)) {
3381  INTERESTING(lDebug ? "HP-EDS(2)" : "HP");
3382  }
3383  }
3384  else if (!lmem[_mHP] && INFILE(_LT_DEC_1)) {
3385  INTERESTING(lDebug ? "HP-DEC-style(2)" : "HP-DEC-style");
3386  }
3387  else if (!lmem[_mHP] && INFILE(_LT_DEC_2)) {
3388  INTERESTING(lDebug ? "HP-DEC-style(3)" : "HP-DEC-style");
3389  }
3390  else if (INFILE(_LT_HP_4)) {
3391  INTERESTING(lDebug ? "HP-style(1)" : "HP-style");
3392  }
3393  else if (INFILE(_LT_COMPAQ_1)) {
3394  INTERESTING(lDebug ? "HP-style(2)" : "HP-style");
3395  }
3396  else if (INFILE(_LT_EDS_1)) {
3397  INTERESTING(lDebug ? "HP-EDS(1#2)" : "HP");
3398  }
3399  else if (INFILE(_LT_EDS_2)) {
3400  INTERESTING(lDebug ? "HP-EDS(2#2)" : "HP");
3401  }
3403  /*
3404  * SUN Microsystems
3405  */
3406  if (!lmem[_mSUN] && (INFILE(_CR_SUN) || INFILE(_TEXT_MICROSYSTEMS))) {
3407  if (INFILE(_LT_SUN_PROPRIETARY) || INFILE(_LT_SUN_PROPRIETARY_2) || INFILE(_LT_SUN_PROPRIETARY_3)) {
3408  INTERESTING(lDebug ? "Sun(Prop)" : "Sun-Proprietary");
3409  lmem[_mSUN] = 1;
3410  }
3411  else if (INFILE(_LT_SUN_RPC)) {
3412  INTERESTING("Sun-RPC");
3413  lmem[_mSUN] = 1;
3414  }
3415  else if (INFILE(_LT_SUN_1)) {
3416  if (INFILE(_LT_SUN_FREE)) {
3417  INTERESTING(lDebug ? "Sun(Freeware)" : "Freeware");
3418  }
3419  else {
3420  INTERESTING(lDebug ? "Sun(3)" : "Sun");
3421  }
3422  lmem[_mSUN] = 1;
3423  }
3424  else if (INFILE(_LT_SUN_2)) {
3425  INTERESTING(lDebug ? "Sun(4)" : "Sun-Proprietary");
3426  lmem[_mSUN] = 1;
3427  }
3428  else if (INFILE(_LT_SUN_3)) {
3429  INTERESTING(lDebug ? "Sun(5)" : "Sun");
3430  lmem[_mSUN] = 1;
3431  }
3432  else if (INFILE(_LT_SUN_4)) {
3433  INTERESTING(lDebug ? "Sun(6)" : "Sun");
3434  lmem[_mSUN] = 1;
3435  }
3436  else if (INFILE(_LT_SUN_5)) {
3437  INTERESTING(lDebug ? "Sun(7)" : "Freeware");
3438  lmem[_mSUN] = 1;
3439  }
3440  else if (INFILE(_LT_SUN_6)) {
3441  INTERESTING(lDebug ? "Sun(8)" : "BSD-style");
3442  lmem[_mSUN] = 1;
3443  }
3444  else if (INFILE(_LT_SUN_NC)) {
3445  INTERESTING("Sun.Non-commercial");
3446  lmem[_mSUN] = 1;
3447  }
3448  else if (INFILE(_LT_SUNrestrict)) {
3449  INTERESTING("Sun.RESTRICTED");
3450  lmem[_mSUN] = 1;
3451  }
3452  else if (INFILE(_LT_SUN_BCLA_1) && INFILE(_TITLE_SUN_BCLA)) {
3453  INTERESTING(lDebug ? "BCLA(1)" : "Sun-BCLA");
3454  lmem[_mSUN] = 1;
3455  }
3456  else if (INFILE(_LT_SUN_BCLA_2)) {
3457  INTERESTING(lDebug ? "BCLA(2)" : "Sun-BCLA");
3458  lmem[_mSUN] = 1;
3459  }
3460  else if (INFILE(_LT_SUN_BCLAref)) {
3461  INTERESTING(lDebug ? "BCLA(ref)" : "Sun-BCLA");
3462  lmem[_mSUN] = 1;
3463  }
3464  else if (INFILE(_LT_SUN_ENTITLE)) {
3465  INTERESTING(lDebug ? "Sun(entitlement)" : "Sun");
3466  lmem[_mSUN] = 1;
3467  }
3468  else if (INFILE(_LT_SUN_ANYagreement)) {
3469  INTERESTING("Sun-EULA");
3470  lmem[_mSUN] = 1;
3471  }
3472  else if (INFILE(_LT_SUN_JAVA)) {
3473  INTERESTING("Sun-Java");
3474  lmem[_mSUN] = 1;
3475  }
3476  else if (INFILE(_LT_SUN_IP)) {
3477  INTERESTING("Sun-IP");
3478  lmem[_mSUN] = 1;
3479  lmem[_fIP] = 1;
3480  }
3481  else if (INFILE(_LT_SUN_SCA)) {
3482  INTERESTING("Sun-SCA");
3483  lmem[_mSUN] = 1;
3484  }
3485  else if (INFILE(_LT_SUN_SCSLref)) {
3486  if (INFILE(_TITLE_SCSL_V23)) {
3487  INTERESTING("SCSL-2.3");
3488  }
3489  else if (INFILE(_TITLE_SCSL_V30)) {
3490  INTERESTING("SCSL-3.0");
3491  }
3492  else {
3493  INTERESTING("SCSL");
3494  }
3495  lmem[_mSUN] = 1;
3496  }
3497  else if (INFILE(_TITLE_SUN_SCSL_TSA) &&
3498  INFILE(_LT_SUN_SCSL_TSA)) {
3499  if (INFILE(_TITLE_TSA_10)) {
3500  INTERESTING("SCSL-TSA-1.0");
3501  }
3502  else {
3503  INTERESTING("SCSL-TSA");
3504  }
3505  lmem[_mSUN] = 1;
3506  }
3507  else if (INFILE(_LT_SUN_SISSLref1)
3508  || INFILE(_LT_SUN_SISSLref2)) {
3509  cp = SISSLVERS();
3510  INTERESTING(lDebug ? "SISSL(ref#1)" : cp);
3511  lmem[_mSUN] = 1;
3512  }
3513  }
3514  else if (!lmem[_fREAL] && INFILE(_LT_SUN_PLref)) {
3515  INTERESTING(lDebug ? "Sun-PL(ref)" : "SPL");
3516  lmem[_mSUN] = 1;
3517  }
3518  else if (!lmem[_mSUN] && URL_INFILE(_URL_SUN_BINARY_V150)) {
3519  INTERESTING("Sun-BCLA-1.5.0");
3520  lmem[_mSUN] = 1;
3521  }
3522  else if (!lmem[_mSUN] && URL_INFILE(_URL_SUN_BINARY)) {
3523  INTERESTING(lDebug ? "BCLA(url)" : "Sun-BCLA");
3524  lmem[_mSUN] = 1;
3525  }
3526  else if (!lmem[_mSUN] && INFILE(_LT_SUN_GRAPHICS)) {
3527  INTERESTING(lDebug ? "Sun(8)" : "Sun");
3528  lmem[_mSUN] = 1;
3529  }
3530  else if (!lmem[_mSUN] && INFILE(_LT_SUN_GRAPHICS)) {
3531  INTERESTING(lDebug ? "Sun(9)" : "Sun");
3532  lmem[_mSUN] = 1;
3533  }
3534  else if ((!lmem[_mSUN] && INFILE(_LT_SUN_SISSLref1)) ||
3535  INFILE(_LT_SUN_SISSLref2)) {
3536  cp = SISSLVERS();
3537  INTERESTING(lDebug ? "SISSL(ref#2)" : cp);
3538  lmem[_mSUN] = 1;
3539  }
3540  else if (!lmem[_mSUN] && URL_INFILE(_URL_SISSL)) {
3541  cp = SISSLVERS();
3542  INTERESTING(lDebug ? "SISSL(url)" : cp);
3543  lmem[_mSUN] = 1;
3544  }
3546  if (INFILE(_LT_SUN_PRO)) {
3547  INTERESTING(lDebug ? "SunPro" : "Freeware");
3548  }
3550  /*
3551  * IBM
3552  */
3553  if (INFILE(_TEXT_IBM)) {
3554  if (INFILE(_LT_IBM_RECIP)) {
3555  INTERESTING("IBM-reciprocal");
3556  }
3557  else if (INFILE(_LT_IBM_4)) {
3558  INTERESTING(lDebug ? "IBM(4)" : "IBM-dhcp");
3559  }
3560  else if (INFILE(_LT_IBM_1)) {
3561  INTERESTING(lDebug ? "IBM(1)" : "MIT-style");
3562  }
3563  else if (INFILE(_LT_IBM_3)) {
3564  INTERESTING(lDebug ? "IBM(3)" : "MIT-style");
3565  }
3566  else if (INFILE(_LT_IBM_2)) {
3567  INTERESTING(lDebug ? "IBM(2)" : "IBM");
3568  }
3569  else if (INFILE(_LT_IBM_OWNER)) {
3570  INTERESTING(lDebug ? "IBM(4)" : "IBM");
3571  }
3572  else if (INFILE(_LT_IBM_JIKES)) {
3573  INTERESTING("IBM-JCL");
3574  }
3575  else if (INFILE(_LT_IBM_COURIER)) {
3576  INTERESTING("IBM-Courier");
3577  }
3578  else if (INFILE(_LT_IBM_EULA)) {
3579  INTERESTING(lDebug ? "IBM-EULA(1)" : "IBM-EULA");
3580  }
3581  else if (INFILE(_PHR_IBM_EULA)) {
3582  INTERESTING(lDebug ? "IBM-EULA(2)" : "IBM-EULA");
3583  }
3584  else if (INFILE(_LT_IBM_PIBS)) {
3585  INTERESTING("IBM-pibs");
3586  }
3587  else if (INFILE(_LT_IBM_AS_IS)) {
3588  INTERESTING("IBM-as-is");
3589  }
3590  }
3592  /*
3593  * Motorola
3594  */
3595  if (INFILE(_CR_MOT_1) || INFILE(_CR_MOT_2)) {
3596  if (INFILE(_LT_MOT_1)) {
3597  INTERESTING(lDebug ? "Motorola(1)" : "Motorola");
3598  }
3599  else if (INFILE(_LT_MOT_2)) {
3600  INTERESTING(lDebug ? "Motorola(2)" : "Motorola");
3601  }
3602  }
3603  if (HASTEXT(_TITLE_MOTOROLA_MOBILE, 0)) {
3604  INTERESTING("Motorola-Mobile-SLA");
3605  }
3607  /*
3608  * Java
3609  */
3610  if (INFILE(_LT_JAVA_WSDL4J)) {
3611  INTERESTING("Java-WSDL4J");
3612  }
3613  else if (INFILE(_LT_JAVA_WSDL_SCHEMA)) {
3614  INTERESTING("Java-WSDL-Schema");
3615  }
3616  else if (INFILE(_LT_JAVA_WSDL_POLICY)) {
3617  INTERESTING("Java-WSDL-Policy");
3618  }
3619  else if (INFILE(_LT_JAVA_WSDL_ENUM)) {
3620  INTERESTING("Java-WSDL-Spec");
3621  }
3622  else if (INFILE(_LT_MULTICORP_1)) {
3623  INTERESTING(lDebug ? "Java-Multi(1)" : "Java-Multi-Corp");
3624  }
3625  else if (INFILE(_LT_MULTICORP_2)) {
3626  INTERESTING(lDebug ? "Java-Multi(2)" : "Java-Multi-Corp");
3627  }
3629  /*
3630  * Mibble
3631  */
3632  if (INFILE(_LT_MIBBLE)) {
3633  if (INFILE(_TITLE_MIBBLE_28)) {
3634  INTERESTING("Mibble-2.8");
3635  }
3636  else {
3637  INTERESTING("Mibble");
3638  }
3639  }
3641  /*
3642  * Comtrol Corp
3643  */
3644  if (INFILE(_CR_COMTROL) && INFILE(_LT_COMTROL)) {
3645  INTERESTING("Comtrol");
3646  }
3648  /*
3649  * TrollTech
3650  */
3651  if (INFILE(_LT_TROLLTECH) && INFILE(_CR_TROLLTECH)) {
3652  INTERESTING("Trolltech");
3653  }
3654  else if (INFILE(_LT_QT_COMMref)) {
3655  INTERESTING("Qt.Commercial");
3656  }
3657  else if (INFILE(_LT_QT_PROPRIETARY) || INFILE(_TITLE_QT_PROPRIETARY)) {
3658  INTERESTING("Qt.Commercial");
3659  }
3661  /*
3662  * SNIA (Storage Network Industry) public license
3663  */
3664  if (!lmem[_mMPL] && !lmem[_mSUN] && INFILE(_LT_SNIA_PL)) {
3665  if (INFILE(_TITLE_SNIA_V11)) {
3666  INTERESTING("SNIA-1.1");
3667  }
3668  else if (INFILE(_TITLE_SNIA_V10)) {
3669  INTERESTING("SNIA-1.0");
3670  }
3671  else {
3672  INTERESTING("SNIA");
3673  }
3674  }
3675  else if (INFILE(_LT_SNIAref)) {
3676  if (INFILE(_TITLE_SNIA_V11)) {
3677  INTERESTING(lDebug ? "SNIA-1.1(ref)" : "SNIA-1.1");
3678  }
3679  else if (INFILE(_TITLE_SNIA_V10)) {
3680  INTERESTING(lDebug ? "SNIA-1.0(ref)" : "SNIA-1.0");
3681  }
3682  else {
3683  INTERESTING(lDebug ? "SNIA(ref)" : "SNIA");
3684  }
3685  }
3686  else if (URL_INFILE(_URL_SNIA_V11)) {
3687  INTERESTING(lDebug ? "SNIA-1.1(url)" : "SNIA-1.1");
3688  }
3689  else if (URL_INFILE(_URL_SNIA)) {
3690  INTERESTING(lDebug ? "SNIA(url)" : "SNIA");
3691  }
3693  /*
3694  * BEA
3695  */
3696  if (HASTEXT(_TEXT_BEASYS, 0)) {
3697  if (INFILE(_LT_BEA_1)) {
3698  INTERESTING(lDebug ? "BEA(1)" : "BEA");
3699  }
3700  else if (INFILE(_LT_BEA_2)) {
3701  INTERESTING(lDebug ? "BEA(2)" : "BEA");
3702  }
3703  }
3705  /*
3706  * ADOBE/FRAME
3707  */
3708  if (HASTEXT(_TEXT_ADOBE_FRAME, REG_EXTENDED)) {
3709  if (INFILE(_LT_ADOBE_1)) {
3710  INTERESTING(lDebug ? "Adobe(1)" : "Adobe");
3711  }
3712  else if (!lmem[_mMIT] && INFILE(_LT_ADOBE_2)) {
3713  INTERESTING(lDebug ? "Adobe(2)" : "Adobe");
3714  }
3715  else if (INFILE(_LT_ADOBE_3)) {
3716  INTERESTING(lDebug ? "Adobe(3)" : "Adobe");
3717  }
3718  else if (INFILE(_LT_ADOBE_4)) {
3719  INTERESTING(lDebug ? "Adobe(4)" : "Adobe-EULA");
3720  }
3721  else if (INFILE(_LT_ADOBE_5)) {
3722  INTERESTING(lDebug ? "Adobe(5)" : "Adobe-EULA");
3723  }
3724  else if (INFILE(_LT_ADOBE_6)) {
3725  INTERESTING(lDebug ? "Adobe(6)" : "Adobe-EULA");
3726  }
3727  else if (INFILE(_LT_ADOBE_7)) {
3728  INTERESTING(lDebug ? "Adobe(7)" : "Adobe-EULA");
3729  }
3730  else if (INFILE(_LT_FRAME)) {
3731  INTERESTING(lDebug ? "Adobe(Frame)" : "Adobe");
3732  }
3733  else if (INFILE(_LT_ADOBE_SRC) || INFILE(_TITLE_ADOBE_SRC)) {
3734  INTERESTING(lDebug ? "Adobe(src)" : "Adobe-2006");
3735  }
3736  else if (INFILE(_LT_ADOBE_DATA)) {
3737  INTERESTING(lDebug ? "Adobe(data)" : "Adobe");
3738  }
3739  else if (INFILE(_LT_ADOBE_EULA)) {
3740  INTERESTING("Adobe-EULA");
3741  }
3742  else if (INFILE(_LT_ADOBE_AFM)) {
3743  INTERESTING("APAFML");
3744  }
3745  else if (HASTEXT(_TITLE_ADOBE_DNG, 0)) {
3746  INTERESTING("Adobe-DNG");
3747  }
3748  else if (INFILE(_LT_ADOBE_AFMPARSE_1) && INFILE(_LT_ADOBE_AFMPARSE_2)) {
3749  INTERESTING("Afmparse");
3750  }
3751  else if (INFILE(_LT_ADOBE_OTHER)) {
3752  INTERESTING(lDebug ? "Adobe(other)" : "Adobe");
3753  }
3754  else if (INFILE(_LT_ADOBE_SUB)) {
3755  INTERESTING(lDebug ? "Adobe(sub)" : "Adobe");
3756  }
3757  }
3759  /*
3760  * Docbook and Open Source Metadata Framework
3761  */
3762  if (INFILE(_LT_DOCBOOK)) {
3763  if (HASTEXT(_TEXT_DOCBOOK, 0)) {
3764  INTERESTING("DOCBOOK");
3765  }
3766  else if (HASTEXT(_TEXT_METADATA, 0)) {
3767  INTERESTING("OMF");
3768  }
3769  else {
3770  INTERESTING("DOCBOOK-style");
3771  }
3772  }
3774  /*
3775  * MP3 decoder
3776  */
3777  if (INFILE(_LT_MPEG3)) {
3778  INTERESTING("MPEG3-decoder");
3779  }
3781  /*
3782  * Google
3783  */
3784  if (INFILE(_LT_GOOGLE_1)) {
3785  INTERESTING(lDebug ? "Google(1)" : "Google");
3786  }
3787  else if (INFILE(_LT_GOOGLE_2)) {
3788  INTERESTING(lDebug ? "Google(2)" : "Google");
3789  }
3791  /*
3792  * Mandriva
3793  */
3794  if (INFILE(_LT_MANDRIVA)) {
3795  INTERESTING("Mandriva");
3796  }
3798  /*
3799  * Irondoc
3800  */
3801  if (INFILE(_LT_IRONDOC)) {
3802  INTERESTING("IronDoc");
3803  }
3805  /*
3806  * Quarterdeck Office Systems
3807  */
3808  if (INFILE(_LT_QUARTERDECK) && INFILE(_CR_QUARTERDECK)) {
3809  INTERESTING("QuarterDeck");
3810  }
3812  /*
3813  * Electronic Book Technologies
3814  */
3815  if (INFILE(_LT_EBT)) {
3816  if(INFILE(_CR_EBT)) {
3817  INTERESTING("EBT");
3818  } else {
3819  INTERESTING("EBT-style");
3820  }
3821  }
3823  /*
3824  * SGML
3825  */
3826  if (HASTEXT(_TEXT_SGMLUG, 0) && INFILE(_LT_SGML)) {
3827  INTERESTING("SGML");
3828  }
3830  /*
3831  * LaTeX (KOMA-Script)
3832  */
3833  if (HASTEXT(_TEXT_LATEX, REG_EXTENDED)) {
3834  if (INFILE(_LT_LATEXPL_1) || INFILE(_LT_LATEXPL_2) ||
3835  INFILE(_LT_LATEXPL_3)) {
3836  cp = LPPLVERS();
3837  INTERESTING(lDebug ? "LPPL(1)" : cp);
3838  }
3839  else if (INFILE(_LT_LATEX)) {
3840  cp = LPPLVERS();
3841  INTERESTING(lDebug ? "LPPL(2)" : cp);
3842  }
3843  else if (INFILE(_LT_LATEXPLref1) || INFILE(_LT_LATEXPLref2) ||
3844  INFILE(_LT_LATEXPLref3)) {
3845  cp = LPPLVERS();
3846  INTERESTING(lDebug ? "LPPL(3)" : cp);
3847  }
3848  else if (INFILE(_LT_LATEXref1)) {
3849  cp = LPPLVERS();
3850  INTERESTING(lDebug ? "LPPL(4)" : cp);
3851  }
3852  else if (INFILE(_LT_LATEXref2)) {
3853  cp = LPPLVERS();
3854  INTERESTING(lDebug ? "LPPL(5)" : cp);
3855  }
3856  else if (INFILE(_LT_LATEXref3)) {
3857  cp = LPPLVERS();
3858  INTERESTING(lDebug ? "LPPL(6)" : cp);
3859  }
3860  else if (INFILE(_LT_LATEXref4)) {
3861  cp = LPPLVERS();
3862  INTERESTING(lDebug ? "LPPL(7)" : cp);
3863  }
3864  else if (INFILE(_LT_LATEXref5)) {
3865  cp = LPPLVERS();
3866  INTERESTING(lDebug ? "LPPL(8)" : cp);
3867  }
3868  else if (URL_INFILE(_URL_LATEX)) {
3869  cp = LPPLVERS();
3870  INTERESTING(lDebug ? "LPPL(url)" : cp);
3871  }
3872  }
3874  /*
3875  * QPL
3876  */
3877  if (INFILE(_LT_QPL) || INFILE(_LT_QPLref)) {
3878  if (INFILE(_TITLE_QPL10_1) || INFILE(_TITLE_QPL10_2)) {
3879  INTERESTING("QPL-1.0");
3880  lmem[_mQPL] = 1;
3881  }
3882  else if (INFILE(_TITLE_QPL)) {
3883  INTERESTING("QPL");
3884  lmem[_mQPL] = 1;
3885  }
3886  }
3888  /*
3889  * FREE Public License (not really open/free) and GHOSTSCRIPT
3890  */
3891  if (HASTEXT(_TEXT_GHOSTSCRIPT, 0)) {
3892  if (INFILE(_LT_GS)) {
3893  if (INFILE(_TITLE_GS11)) {
3894  INTERESTING("Ghostscript-GPL-1.1");
3895  }
3896  else {
3897  INTERESTING(lDebug ? "GS-GPL(1)" : "Ghostscript-GPL");
3898  }
3899  }
3900  else if (INFILE(_CR_ALADDIN) || INFILE(_CR_ARTOFCODE)) {
3901  if (INFILE(_LT_GS_GNU1) || INFILE(_LT_GS_GNU2)) {
3902  INTERESTING("GNU-Ghostscript");
3903  }
3904  else if (INFILE(_LT_GNU_1) && INFILE(_LT_GNU_2)) {
3905  INTERESTING(lDebug ? "GS-GPL(2)" : "Ghostscript-GPL");
3906  }
3907  else if (INFILE(_LT_FREEPL) || INFILE(_LT_FREEPLref)) {
3908  INTERESTING(lDebug ? "Aladdin(Closed-Source!)" : "Aladdin");
3909  if (INFILE(_PHR_NOT_OPEN)) {
3910  INTERESTING(lDebug ? "Aladdin(Closed-Source!)" : "Aladdin");
3911  lmem[_mALADDIN] = 1;
3912  }
3913  else {
3914  INTERESTING(lDebug ? "Aladdin-Ghostscript" : "Aladdin");
3915  }
3916  }
3917  else if (INFILE(_LT_ALADDIN_RESTRICT)) {
3918  INTERESTING(lDebug ? "Aladdin(RESTRICTED)": "Aladdin");
3919  }
3920  }
3921  else if (INFILE(_LT_AFPL)) {
3922  INTERESTING("AFPL-Ghostscript");
3923  }
3924  }
3925  else if (INFILE(_LT_FREEPLref_1)) {
3926  INTERESTING("Aladdin");
3927  }
3928  else if (INFILE(_LT_FREEPL) || INFILE(_LT_FREEPLref)) {
3929  INTERESTING("Free-PL");
3930  }
3931  /*
3932  * IPTC (International Press Telecommunications Council)
3933  */
3934  else if (INFILE(_TITLE_IPTC) || INFILE(_LT_IPTC_2)) {
3935  INTERESTING("IPTC");
3936  }
3937  else if (INFILE(_LT_IPTC_1) && mCR_IPTC()) {
3938  INTERESTING("IPTC");
3939  }
3940  /*
3941  * Macromedia
3942  */
3943  else if (INFILE(_TITLE_MACROMEDIA_EULA)) {
3944  INTERESTING("MacroMedia-RPSL");
3945  }
3946  /*
3947  * Ontopia
3948  */
3949  else if (INFILE(_LT_ONTOPIA) && INFILE(_TITLE_ONTOPIA)) {
3950  INTERESTING("Ontopia");
3951  }
3953  /*
3954  * Ascender
3955  */
3956  if (INFILE(_LT_ASCENDER_EULA) && INFILE(_TITLE_ASCENDER_EULA)) {
3957  INTERESTING("Ascender-EULA");
3958  }
3960  /*
3961  * ADAPTEC
3962  */
3963  if (INFILE(_LT_ADAPTEC_OBJ)) {
3964  INTERESTING("Adaptec.RESTRICTED");
3965  }
3966  else if (INFILE(_CR_ADAPTEC) && INFILE(_LT_ADAPTEC_GPL)) {
3967  INTERESTING("Adaptec-GPL");
3968  }
3970  /*
3971  * Artistic and Perl
3972  */
3973  if (INFILE(_LT_PERL_1)) {
3974  INTERESTING(lDebug ? "Artistic(Perl#1)" : "Artistic-1.0-Perl");
3975  if (!lmem[_mGPL]) {
3976  INTERESTING("Dual-license");
3977  INTERESTING(lDebug ? "GPL(Perl#1)" : "GPL-1.0-or-later");
3978  }
3979  }
3980  else if (INFILE(_LT_PERL_2)) {
3981  INTERESTING(lDebug ? "Artistic(Perl#2)" : "Artistic-1.0-Perl");
3982  if (!lmem[_mGPL]) {
3983  INTERESTING("Dual-license");
3984  INTERESTING(lDebug ? "GPL(Perl#2)" : "GPL-1.0-or-later");
3985  }
3986  }
3987  else if (INFILE(_LT_PERL_3)) {
3988  if (INFILE(_LT_Spencer_86_94_CLAUSE_1) &&
3989  HASTEXT(_LT_PNG_ZLIB_CLAUSE_1, 0) &&
3990  HASTEXT(_LT_PNG_ZLIB_CLAUSE_2, REG_EXTENDED)) {
3991  INTERESTING("Spencer-86");
3992  }
3993  else if (!lmem[_fOPENLDAP] && !TRYGROUP(famOPENLDAP)) {
3994  INTERESTING(lDebug ? "Artistic(Perl#3)" : "Artistic-1.0");
3995  }
3996  }
3997  /*
3998  * Licensed "same as perl itself" will actually be Artistic AND GPL, per
3999  * Larry Wall and the documented licensing terms of "perl"
4000  */
4001  else if (INFILE(_LT_PERLref1)) {
4002  INTERESTING(lDebug ? "Artistic(Perl-ref1)" : "Artistic-1.0-Perl");
4003  if (!lmem[_mGPL]) {
4004  INTERESTING("Dual-license");
4005  INTERESTING(lDebug ? "GPL(Perl-ref1)" : "GPL-1.0-or-later");
4006  }
4007  }
4008  else if (PERL_INFILE(_LT_PERLref2)) {
4009  INTERESTING(lDebug ? "Artistic(Perl-ref2)" : "Artistic-1.0-Perl");
4010  if (!lmem[_mGPL]) {
4011  INTERESTING("Dual-license");
4012  INTERESTING(lDebug ? "GPL(Perl-ref2)" : "GPL-1.0-or-later");
4013  }
4014  }
4015  else if (INFILE(_LT_PERLref3)) {
4016  INTERESTING(lDebug ? "Artistic(Perl-ref3)" : "Artistic-1.0-Perl");
4017  if (!lmem[_mGPL]) {
4018  INTERESTING("Dual-license");
4019  INTERESTING(lDebug ? "GPL(Perl-ref3)" : "GPL-1.0-or-later");
4020  }
4021  }
4022  else if (INFILE(_LT_PERLref4)) {
4023  INTERESTING(lDebug ? "Artistic(Perl-ref4)" : "Artistic-1.0-Perl");
4024  if (!lmem[_mGPL]) {
4025  INTERESTING("Dual-license");
4026  INTERESTING(lDebug ? "GPL(Perl-ref4)" : "GPL-1.0-or-later");
4027  }
4028  }
4029  else if (INFILE(_LT_PERLref5)) {
4030  INTERESTING(lDebug ? "Artistic(Perl-ref5)" : "Artistic-1.0-Perl");
4031  if (!lmem[_mGPL]) {
4032  INTERESTING("Dual-license");
4033  INTERESTING(lDebug ? "GPL(Perl-ref5)" : "GPL-1.0-or-later");
4034  }
4035  }
4036  else if (INFILE(_TITLE_CLARTISTIC)) {
4037  INTERESTING("ClArtistic");
4038  lmem[_fCLA] = 1;
4039  }
4040  else if (!lmem[_fREAL] && !LVAL(_TEXT_GNU_LIC_INFO) &&
4041  (INFILE(_LT_ART_1) || INFILE(_LT_ARTref1) ||
4042  INFILE(_LT_ARTref2) || INFILE(_LT_ARTref3) ||
4043  INFILE(_LT_ARTref4) || PERL_INFILE(_LT_ARTref5) ||
4044  PERL_INFILE(_LT_ARTref6))) {
4045  if (INFILE(_TITLE_OGTSL)) {
4046  INTERESTING("OGTSL");
4047  }
4048  else if (!lmem[_mLIBRE] && !lmem[_fOPENLDAP] &&
4049  !TRYGROUP(famOPENLDAP)) {
4050  if (INFILE(_LT_ART_V2) || INFILE(_TITLE_ART20)) {
4051  INTERESTING(lDebug ? "Artistic(v2.0#1)" : "Artistic-2.0");
4052  }
4053  else if (INFILE(_PHR_Artistic_20)) {
4054  INTERESTING("Artistic-2.0");
4055  }
4056  else if (INFILE(_TITLE_NBPL_V10)) {
4057  INTERESTING("NBPL-1.0");
4058  lmem[_fARTISTIC] = 1;
4059  }
4060  else if(HASTEXT(_PHR_ARTISTIC_PERL, 0)) {
4061  INTERESTING("Artistic-1.0-Perl");
4062  lmem[_fARTISTIC] = 1;
4063  }
4064  else if (HASTEXT(_PHR_ARTISTIC_CLAUSE8, 0))
4065  {
4066  INTERESTING("Artistic-1.0-cl8");
4067  lmem[_fARTISTIC] = 1;
4068  }
4069  else {
4070  INTERESTING(lDebug ? "Artistic(v1.0#other)" : "Artistic-1.0");
4071  lmem[_fARTISTIC] = 1;
4072  }
4073  }
4074  }
4075  else if (INFILE(_LT_ART_2) && INFILE(_TITLE_ART20)) {
4076  INTERESTING(lDebug ? "Artistic(v2.0#2)" : "Artistic-2.0");
4077  }
4078  else if (INFILE(_FILE_ART1) || INFILE(_FILE_ART2)) {
4079  INTERESTING(lDebug ? "Artistic(deb)" : "Artistic-1.0");
4080  }
4081  else if (URL_INFILE(_URL_ART)) {
4082  INTERESTING(lDebug ? "Artistic(url)" : "Artistic-1.0");
4083  }
4085  /*
4086  * LDP, Manpages, OASIS, GPDL, Linux-HOWTO and Linux-doc
4087  */
4088  if (INFILE(_TITLE_LDPL20)) {
4089  INTERESTING("LDPL-2.0");
4090  }
4091  else if (INFILE(_TITLE_LDPL1A)) {
4092  INTERESTING("LDPL-1A");
4093  }
4094  else if (INFILE(_LT_LDPL)) {
4095  INTERESTING(lDebug ? "LDPL(1)" : "LDPL");
4096  }
4097  else if (INFILE(_LT_LDPLref1)) {
4098  INTERESTING(lDebug ? "LDPL(ref1)" : "LDPL");
4099  }
4100  else if (INFILE(_LT_LDPLref2)) {
4101  INTERESTING(lDebug ? "LDPL(ref2)" : "LDPL");
4102  }
4103  else if (INFILE(_LT_LDPLref3)) {
4104  INTERESTING(lDebug ? "LDPL(ref3)" : "LDPL");
4105  }
4106  /*
4107  * GNU-Manpages, Software in the Public Interest (Debian), aka SPI
4108  */
4109  else if (INFILE(_LT_SPI)) {
4110  if (INFILE(_LT_MANPAGE)) {
4111  INTERESTING("GNU-Manpages");
4112  }
4113  else if (!lmem[_fGPL]) {
4114  if (INFILE(_CR_SPI)) {
4115  INTERESTING("Debian-SPI");
4116  }
4117  else {
4118  INTERESTING("Debian-SPI-style");
4119  }
4120  }
4121  }
4122  else if (INFILE(_LT_GPDLref)) {
4123  INTERESTING(lDebug ? "GPDL(1)" : "GPDL");
4124  }
4125  else if (INFILE(_TITLE_GPDL)) {
4126  INTERESTING(lDebug ? "GPDL(2)" : "GPDL");
4127  }
4128  else if (INFILE(_LT_FREEBSD_DOC) && INFILE(_TITLE_FREEBSD_DOC)) {
4129  INTERESTING("FreeBSD-Doc");
4130  }
4131  else if (INFILE(_LT_LINUX_HOWTO)) {
4132  INTERESTING("Linux-HOWTO");
4133  }
4134  else if (INFILE(_LT_LINUXDOC)) {
4135  INTERESTING("LinuxDoc");
4136  }
4137  else if (INFILE(_LT_IEEE_DOC)) {
4138  INTERESTING("IEEE-Doc");
4139  }
4141  /*
4142  * U-Washington
4143  */
4144  if (INFILE(_LT_UW1)) {
4145  if (INFILE(_CR_UWASHINGTON)) {
4146  INTERESTING("U-Wash.Free-Fork");
4147  }
4148  else {
4149  INTERESTING(lDebug ? "U-Wash-style(1)" : "U-Wash-style");
4150  }
4151  }
4152  else if (INFILE(_LT_UW2)) {
4153  if (INFILE(_CR_UWASHINGTON)) {
4154  INTERESTING(lDebug ? "U-Wash(2)" : "U-Washington");
4155  }
4156  else {
4157  INTERESTING(lDebug ? "U-Wash-style(2)" : "U-Wash-style");
4158  }
4159  }
4160  else if (INFILE(_LT_UW3)) {
4161  if (INFILE(_CR_UWASHINGTON)) {
4162  INTERESTING(lDebug ? "U-Wash(3)" : "U-Washington");
4163  }
4164  else {
4165  INTERESTING(lDebug ? "U-Wash-style(3)" : "U-Wash-style");
4166  }
4167  }
4168  else if (INFILE(_LT_UW4)) {
4169  if (INFILE(_CR_UWASHINGTON)) {
4170  INTERESTING(lDebug ? "U-Wash(4)" : "U-Washington");
4171  }
4172  else {
4173  INTERESTING(lDebug ? "U-Wash-style(4)" : "U-Wash-style");
4174  }
4175  }
4177  /*
4178  * WU-ftpd (not the school north of Oregon!
4179  */
4180  if (INFILE(_LT_WU_FTPD)) {
4181  if (INFILE(_TITLE_WU_FTPD) || INFILE(_CR_WASHU)) {
4182  INTERESTING(lDebug ? "Wash-U(1)" : "Wash-U-StLouis");
4183  }
4184  else {
4185  INTERESTING("Wash-U-style");
4186  }
4187  }
4188  else if (INFILE(_LT_WU_FTPDref)) {
4189  INTERESTING(lDebug ? "Wash-U(ref)" : "Wash-U-StLouis");
4190  }
4191  /*
4192  * Delaware
4193  */
4194  else if (INFILE(_LT_DELAWARE)) {
4195  if (INFILE(_CR_DELAWARE)) {
4196  INTERESTING("U-Del");
4197  }
4198  else {
4199  INTERESTING("U-Del-style");
4200  }
4201  }
4202  /*
4203  * Princeton
4204  */
4205  else if (INFILE(_LT_PRINCETON) && NOT_INFILE(_TITLE_WORDNET)) {
4206  if (INFILE(_CR_PRINCETON)) {
4207  INTERESTING("Princeton");
4208  }
4209  else {
4210  INTERESTING("Princeton-style");
4211  }
4212  }
4213  /*
4214  * University of Michigan
4215  */
4216  else if (INFILE(_LT_UMICHIGAN_1)) {
4217  if (INFILE(_CR_MICHIGAN)) {
4218  INTERESTING(lDebug ? "U-Mich(1)" : "U-Michigan");
4219  }
4220  else {
4221  INTERESTING(lDebug ? "U-Mich-style(1)" : "U-Mich-style");
4222  }
4223  }
4224  else if (INFILE(_LT_UMICHIGAN_2)) {
4225  if (INFILE(_CR_MICHIGAN)) {
4226  INTERESTING(lDebug ? "U-Mich(2)" : "U-Michigan");
4227  }
4228  else {
4229  INTERESTING(lDebug ? "U-Mich-style(2)" : "U-Mich-style");
4230  }
4231  }
4232  /*
4233  * Southern Cal
4234  */
4235  else if (INFILE(_LT_USC_NC)) {
4236  if (INFILE(_CR_USC)) {
4237  INTERESTING("USC.Non-commercial");
4238  }
4239  else {
4240  INTERESTING(lDebug ? "NonC(5)" : "Non-commercial");
4241  }
4242  }
4243  else if (INFILE(_LT_USC)) {
4244  if (INFILE(_CR_USC)) {
4245  INTERESTING("USC");
4246  }
4247  else {
4248  INTERESTING("USC-style");
4249  }
4250  }
4251  /*
4252  * Unversity Corporation for Atmospheric Research (UCAR)
4253  */
4254  else if (INFILE(_LT_UCAR_1) && INFILE(_LT_UCAR_2)) {
4255  INTERESTING("UCAR");
4256  }
4257  else if (INFILE(_LT_UCAR_3) && INFILE(_CR_UCAR)) {
4258  if (INFILE(_CR_UCAR)) {
4259  INTERESTING("UCAR");
4260  }
4261  else {
4262  INTERESTING("UCAR-style");
4263  }
4264  }
4265  /*
4266  * Stanford
4267  */
4268  else if (INFILE(_LT_STANFORD)) {
4269  if (INFILE(_CR_STANFORD)) {
4270  INTERESTING("Stanford");
4271  }
4272  else {
4273  INTERESTING("Stanford-style");
4274  }
4275  }
4276  /*
4277  * U-Cambridge
4278  */
4279  else if (INFILE(_LT_CAMBRIDGE)) {
4280  if (HASTEXT(_LT_MSNTP, 0)) {
4281  INTERESTING("MSNTP");
4282  }
4283  else if (INFILE(_CR_CAMBRIDGE_1) || INFILE(_CR_CAMBRIDGE_2)) {
4284  INTERESTING("U-Cambridge");
4285  }
4286  else {
4287  INTERESTING("U-Cambridge-style");
4288  }
4289  }
4290  /*
4291  * Columbia University
4292  */
4293  else if (INFILE(_CR_COLUMBIA) && INFILE(_LT_COLUMBIA)) {
4294  INTERESTING("U-Columbia");
4295  }
4296  /*
4297  * University of Notre Dame (Different from Boost!)
4298  */
4299  if (INFILE(_LT_ND_1)) {
4300  if (INFILE(_CR_NOTREDAME)) {
4301  INTERESTING(lDebug ? "ND(1)" : "NotreDame");
4302  }
4303  else {
4304  INTERESTING(lDebug ? "ND-style(1)" : "NotreDame-style");
4305  }
4306  }
4307  else if (INFILE(_LT_ND_2)) {
4308  if (INFILE(_CR_NOTREDAME)) {
4309  INTERESTING(lDebug ? "ND(2)" : "NotreDame");
4310  }
4311  else {
4312  INTERESTING(lDebug ? "ND-style(2)" : "NotreDame-style");
4313  }
4314  }
4315  else if (INFILE(_LT_ND_3)) {
4316  if (INFILE(_CR_NOTREDAME)) {
4317  INTERESTING(lDebug ? "ND(3)" : "NotreDame");
4318  }
4319  else {
4320  INTERESTING(lDebug ? "ND-style(3)" : "NotreDame-style");
4321  }
4322  }
4324  /*
4325  * Boost references
4326  */
4327  if (!lmem[_mMIT] && INFILE(_LT_BOOST_2)) {
4328  if (INFILE(_CR_BOOST)) {
4329  INTERESTING(lDebug ? "Boost(2)" : "BSL-1.0");
4330  }
4331  else {
4332  INTERESTING(lDebug ? "Boost-style(2)" : "BSL-style");
4333  }
4334  }
4335  else if (INFILE(_LT_BOOSTref1)) {
4336  if (INFILE(_TITLE_BOOST10) || INFILE(_PHR_BOOST_V10) ||
4337  URL_INFILE(_URL_BOOST_10)) {
4338  INTERESTING(lDebug ? "Boost1.0(ref)" : "BSL-1.0");
4339  }
4340  else {
4341  INTERESTING(lDebug ? "Boost(ref)" : "BSL-1.0");
4342  }
4343  }
4344  else if (INFILE(_LT_BOOST_GRAPH)) {
4345  INTERESTING(lDebug ? "Boost(graph)" : "BSL-1.0");
4346  }
4347  else if (INFILE(_LT_BOOST_LAMBDA)) {
4348  INTERESTING(lDebug ? "Boost(lambda)" : "BSL-1.0");
4349  }
4350  else if (URL_INFILE(_URL_BOOST_10)) {
4351  INTERESTING(lDebug ? "Boost-1.0(ref)" : "BSL-1.0");
4352  }
4353  /*
4354  * Sleepycat NON-Commerical
4355  */
4356  else if (INFILE(_LT_SLEEPYCAT_NC)) {
4357  INTERESTING("Sleepycat.Non-commercial");
4358  }
4360  /*
4361  * Vim license
4362  */
4363  if ((INFILE(_LT_Vim_1) || INFILE(_LT_Vim_2)) && INFILE(_TITLE_Vim)) {
4364  INTERESTING("Vim");
4365  }
4366  else if (INFILE(_PHR_Vim)) {
4367  INTERESTING("Vim");
4368  }
4370  /*
4371  * Vixie license
4372  */
4373  if (INFILE(_LT_VIXIE)) {
4374  INTERESTING("Vixie-license");
4375  }
4377  /*
4378  * Yahoo!
4379  */
4380  if (INFILE(_LT_YAHOO_1)) {
4381  if (INFILE(_LT_YAHOO_BINARY)) {
4382  INTERESTING("Yahoo-EULA");
4383  }
4384  else {
4385  INTERESTING("YPL");
4386  }
4387  }
4388  if(INFILE(_TITLE_YPL_V10)) {
4389  INTERESTING("YPL-1.0");
4390  }
4391  else if(INFILE(_TITLE_YPL_V11)) {
4392  INTERESTING("YPL-1.1");
4393  }
4395  /*
4396  * Public Use
4397  */
4398  if (INFILE(_LT_PUBLIC_USE)) {
4399  if (INFILE(_TITLE_PUBUSE_V10)) {
4400  INTERESTING("Public-Use-1.0");
4401  }
4402  else {
4403  INTERESTING("Public-Use");
4404  }
4405  }
4407  /*
4408  * Apple
4409  */
4410  if (INFILE(_TEXT_APPLE)) {
4411  if (INFILE(_LT_MIT_12)) {
4412  INTERESTING(lDebug ? "Apple MIT License" : "AML");
4413  }
4414  else if (INFILE(_LT_APPLE_1)) {
4415  INTERESTING(lDebug ? "Apple(1)" : "Apple");
4416  }
4417  else if (INFILE(_LT_APPLE_2)) {
4418  INTERESTING(lDebug ? "Apple(2)" : "Apple");
4419  }
4420  else if (INFILE(_LT_APPLE_3)) { /* squeak license */
4421  INTERESTING(lDebug ? "Apple(3)" : "Apple");
4422  }
4423  else if (INFILE(_LT_APPLE_4)) { /* squeak license */
4424  INTERESTING(lDebug ? "Apple(4)" : "Apple-EULA");
4425  }
4426  else if (INFILE(_LT_APPLE_FONTFORGE)) {
4427  INTERESTING("Apple.FontForge");
4428  }
4429  else if (INFILE(_LT_APPLE_SAMPLE)) {
4430  INTERESTING("Apple.Sample");
4431  }
4432  else if (INFILE(_LT_APSLref1) || INFILE(_LT_APSLref2) ||
4433  INFILE(_TITLE_APSL)) {
4434  if (INFILE(_TITLE_APSL20)) {
4435  INTERESTING("APSL-2.0");
4436  }
4437  else if (INFILE(_TITLE_Ferris)) {
4438  INTERESTING(lDebug ? "Ferris-1.2" : "APSL-style");
4439  }
4440  else if (INFILE(_TITLE_APSL_style)) {
4441  INTERESTING("APSL-style");
4442  }
4443  else if (INFILE(_TITLE_APSL12)) {
4444  INTERESTING("APSL-1.2");
4445  }
4446  else if (INFILE(_TITLE_APSL11)) {
4447  INTERESTING("APSL-1.1");
4448  }
4449  else if (INFILE(_TITLE_APSL10)) {
4450  INTERESTING("APSL-1.0");
4451  }
4452  else {
4453  INTERESTING("APSL");
4454  }
4455  }
4456  else if (INFILE(_LT_ACDL)) {
4457  INTERESTING("ACDL");
4458  }
4459  else if (INFILE(_TITLE_APPLE_SLA)) {
4460  INTERESTING(lDebug ? "Apple(SLA)" : "Apple-EULA");
4461  }
4462  else if (URL_INFILE(_URL_APSL)) {
4463  INTERESTING(lDebug ? "APSL(url)" : "APSL");
4464  }
4465  else if (URL_INFILE(_URL_ACDL)) {
4466  INTERESTING(lDebug ? "ACDL(url)" : "ACDL");
4467  }
4468  }
4470  /*
4471  * Redland
4472  */
4473  if (INFILE(_LT_REDLAND)) {
4474  INTERESTING("Redland");
4475  }
4477  /*
4478  * Red Hat and Fedora
4479  */
4480  if (INFILE(_LT_RH_PKGS)) {
4481  if (INFILE(_LT_RH_NONCOMMERCIAL)) {
4482  INTERESTING(lDebug ? "RH(NC)" : "RedHat.Non-commercial");
4483  lmem[_mREDHAT] = 1;
4484  }
4485  else if (INFILE(_LT_RH_FEDORA)) {
4486  INTERESTING(lDebug ? "Fedora(1)" : "Fedora");
4487  lmem[_mREDHAT] = 1;
4488  }
4489  }
4490  else if (INFILE(_LT_RH_REDHAT)) {
4491  INTERESTING(lDebug ? "RH(2)" : "RedHat");
4492  lmem[_mREDHAT] = 1;
4493  }
4494  else if (INFILE(_LT_RH_SPECIFIC)) {
4495  INTERESTING(lDebug ? "RH(4)" : "RedHat-specific");
4496  lmem[_mREDHAT] = 1;
4497  }
4498  else if (INFILE(_LT_FEDORA)) {
4499  INTERESTING(lDebug ? "Fedora(2)" : "Fedora");
4500  lmem[_mREDHAT] = 1;
4501  }
4502  else if (INFILE(_LT_FEDORA_CLA) || INFILE(_TITLE_FEDORA_CLA)) {
4503  INTERESTING("FedoraCLA");
4504  lmem[_mREDHAT] = 1;
4505  }
4506  else if (INFILE(_CR_REDHAT)) {
4507  if (INFILE(_LT_RH_1)) {
4508  INTERESTING(lDebug ? "RH(1)" : "RedHat");
4509  lmem[_mREDHAT] = 1;
4510  }
4511  else if (INFILE(_LT_RH_EULA)) {
4512  INTERESTING("RedHat-EULA");
4513  lmem[_mREDHAT] = 1;
4514  }
4515  }
4517  /*
4518  * SUSE/Novell/UnitedLinux
4519  */
4520  if (INFILE(_CR_SUSE) && INFILE(_PHR_YAST_CR)) {
4521  INTERESTING("YaST.SuSE");
4522  }
4523  else if (INFILE(_TITLE_NOVELL_EULA)) {
4524  INTERESTING("Novell-EULA");
4525  }
4526  else if (INFILE(_TITLE_UL_EULA)) {
4527  INTERESTING("UnitedLinux-EULA");
4528  }
4529  else if (INFILE(_LT_NOVELL)) {
4530  INTERESTING("Novell");
4531  lmem[_fIP] = 1;
4532  }
4533  else if (INFILE(_LT_NOVELL_IP_1)) {
4534  INTERESTING(lDebug ? "Novell-IP(1)" : "Novell-IP");
4535  lmem[_fIP] = 1;
4536  }
4537  else if (INFILE(_LT_NOVELL_IP_2)) {
4538  INTERESTING(lDebug ? "Novell-IP(2)" : "Novell-IP");
4539  lmem[_fIP] = 1;
4540  }
4542  /*
4543  * Epson Public license
4544  */
4545  if (INFILE(_LT_EPSON_PL) && INFILE(_TITLE_EPSON_PL)) {
4546  INTERESTING("Epson-PL");
4547  }
4548  else if (INFILE(_LT_EPSON_EULA) && INFILE(_TITLE_EPSON_EULA)) {
4549  INTERESTING("Epson-EULA");
4550  }
4552  /*
4553  * Open Publication license
4554  */
4555  if (INFILE(_LT_OPENPUBL_1) || INFILE(_LT_OPENPUBL_2)) {
4556  if (INFILE(_TITLE_OPENPUBL04)) {
4557  INTERESTING("Open-PL-0.4");
4558  }
4559  else if (INFILE(_TITLE_OPENPUBL10) || URL_INFILE(_URL_OPEN_PL_V10)) {
4560  INTERESTING("Open-PL-1.0");
4561  }
4562  else if (INFILE(_TITLE_OPENPUBL)) {
4563  INTERESTING("Open-PL");
4564  }
4565  else {
4566  INTERESTING("Open-PL-style");
4567  }
4568  }
4569  else if (INFILE(_LT_OPENPUBLref)) {
4570  INTERESTING(lDebug ? "Open-PL(ref)" : "Open-PL");
4571  }
4573  /*
4574  * Free Art License
4575  */
4576  if (INFILE(_LT_FREEART_V10)) {
4577  INTERESTING("FAL-1.0");
4578  }
4579  else if (INFILE(_LT_FREEART_V13)) {
4580  INTERESTING("FAL-1.3");
4581  }
4583  /*
4584  * RSA Security, Inc.
4585  */
4586  if (INFILE(_LT_RSA_4)) {
4587  INTERESTING(lDebug ? "RSA(4)" : "RSA-MD");
4588  }
4589  else if (INFILE(_LT_RSA_5)) {
4590  INTERESTING(lDebug ? "RSA(5)" : "RSA-DNS");
4591  }
4592  else if (INFILE (_LT_RSA_CRYPTOKI_1) && INFILE(_LT_RSA_CRYPTOKI_2)){
4593  INTERESTING("RSA-Cryptoki");
4594  }
4595  else if (INFILE(_LT_RSA_3)) {
4596  INTERESTING(lDebug ? "RSA(3)" : "RSA-Security");
4597  }
4598  else if (INFILE(_CR_RSA)) {
4599  if (INFILE(_LT_RSA_1)) {
4600  INTERESTING(lDebug ? "RSA(1)" : "RSA-Security");
4601  }
4602  else if (INFILE(_LT_RSA_2)) {
4603  INTERESTING(lDebug ? "RSA(2)" : "RSA-Security");
4604  }
4605  }
4607  /* Some licenses only deal with fonts */
4608  if (HASTEXT(_TEXT_FONT, 0)) {
4609  /*
4610  * AGFA Monotype
4611  */
4612  if (INFILE(_LT_AGFA)) {
4613  INTERESTING("AGFA.RESTRICTED");
4614  }
4615  else if (INFILE(_LT_AGFA_EULA)) {
4616  INTERESTING("AGFA-EULA");
4617  }
4618  /*
4619  * Bigelow and Holmes
4620  */
4621  if (INFILE(_LT_BH_FONT)) {
4622  if (INFILE(_CR_BH)) {
4623  INTERESTING("BH-Font");
4624  }
4625  else {
4626  INTERESTING("BH-Font-style");
4627  }
4628  }
4630  /*
4631  * BIZNET
4632  */
4633  if (INFILE(_LT_BIZNET)) {
4634  if (INFILE(_CR_BIZNET)) {
4635  INTERESTING("BIZNET");
4636  }
4637  else {
4638  INTERESTING("BIZNET-style");
4639  }
4640  }
4642  /*
4643  * BITSTREAM
4644  */
4645  if (INFILE(_LT_BITSTREAM_1)) {
4646  INTERESTING(lDebug ? "Bitstream(2)" : "Bitstream");
4647  }
4648  else if (INFILE(_LT_BITSTREAM_2)) {
4649  INTERESTING(lDebug ? "Bitstream(3)" : "Bitstream");
4650  }
4652  /*
4653  * Larabie Fonts
4654  */
4655  if (INFILE(_LT_LARABIE_EULA) && INFILE(_TITLE_LARABIE_EULA)) {
4656  INTERESTING("Larabie-EULA");
4657  }
4659  /*
4660  * Baekmuk Fonts and Hwan Design
4661  */
4662  if (INFILE(_LT_BAEKMUK_1)) {
4663  INTERESTING("Baekmuk-Font");
4664  }
4665  else if (INFILE(_LT_BAEKMUK_2)) {
4666  INTERESTING("Baekmuk.Hwan");
4667  }
4669  /*
4670  * Information-Technology Promotion Agency (IPA)
4671  */
4672  if (INFILE(_LT_IPA_EULA)) {
4673  INTERESTING("IPA-Font-EULA");
4674  }
4676  /*
4677  * Arphic Public License
4678  */
4679  if (INFILE(_LT_ARPHIC)) {
4680  if (INFILE(_CR_ARPHIC)) {
4681  INTERESTING("Arphic-Font-PL");
4682  }
4683  else {
4684  INTERESTING("Arphic-style");
4685  }
4686  }
4687  }
4689  /*
4690  * AT&T
4691  */
4692  if (INFILE(_LT_ATT_1)) {
4693  if (INFILE(_CR_ATT)) {
4694  INTERESTING(lDebug ? "ATT(1)" : "ATT");
4695  }
4696  else {
4697  INTERESTING(lDebug ? "ATT-style(1)" : "ATT-style");
4698  }
4699  }
4700  else if (INFILE(_LT_ATT_2)) {
4701  if (!lmem[_fBSD] && INFILE(_CR_BSDCAL)) {
4702  INTERESTING(lDebug ? "BSD(14)" : "BSD");
4703  lmem[_fBSD] = 1;
4704  }
4705  else if (INFILE(_CR_ATT) || INFILE(_CR_LUCENT)) {
4706  INTERESTING(lDebug ? "ATT(2)" : "ATT");
4707  }
4708  else {
4709  INTERESTING(lDebug ? "ATT-style(2)" : "ATT-style");
4710  }
4711  }
4712  else if (INFILE(_LT_ATT_SRC_1) || INFILE(_LT_ATT_SRC_2)) {
4713  if (INFILE(_TITLE_ATT_SRC_12D)) {
4714  INTERESTING("ATT-Source-1.2d");
4715  }
4716  else if (INFILE(_TITLE_ATT_SRC_10)) {
4717  INTERESTING("ATT-Source-1.0");
4718  }
4719  else {
4720  INTERESTING("ATT-Source");
4721  }
4722  }
4723  else if (INFILE(_LT_ATT_NONCOMMERC1) || INFILE(_LT_ATT_NONCOMMERC2)) {
4724  INTERESTING("ATT.Non-commercial");
4725  }
4727  /*
4728  * Silicon Graphics
4729  */
4730  if (INFILE(_TITLE_SGI_V10)) {
4731  INTERESTING("SGI-B-1.0");
4732  }
4733  else if (INFILE(_TITLE_SGI_V11)) {
4734  INTERESTING("SGI-B-1.1");
4735  }
4736  else if (INFILE(_TITLE_SGI_V20)) {
4737  INTERESTING("SGI-B-2.0");
4738  }
4739  else if (INFILE(_LT_SGI_1)) {
4740  if (HASTEXT(_PHR_SGI_LIBTIFF, REG_EXTENDED)) {
4741  INTERESTING("libtiff");
4742  }
4743  else if (HASTEXT(_PHR_LIBTIFF_STYLE, REG_EXTENDED)) {
4744  INTERESTING("libtiff-style");
4745  }
4746  }
4747  else if (INFILE(_LT_SGI_2)) {
4748  if (INFILE(_LT_SGI_V10)) {
4749  INTERESTING("SGI-B-1.0");
4750  }
4751  else if (INFILE(_LT_SGI_V11)) {
4752  INTERESTING("SGI-B-1.1");
4753  }
4754  else if (INFILE(_LT_SGI_V20)) {
4755  INTERESTING("SGI-B-2.0");
4756  }
4757  else if (INFILE(_CR_SGI) || URL_INFILE(_URL_SGI)) {
4758  INTERESTING("SGI");
4759  }
4760  }
4761  else if (INFILE(_LT_SGI_1)) {
4762  if (INFILE(_CR_SGI) || URL_INFILE(_URL_SGI)) {
4763  INTERESTING("SGI-style");
4764  }
4765  }
4766  else if (INFILE(_LT_SGI_FREEW)) {
4767  INTERESTING("SGI-Freeware");
4768  }
4769  else if (INFILE(_LT_SGI_GLX)) {
4770  if (INFILE(_TITLE_SGI_GLX_V10)) {
4771  INTERESTING(lDebug ? "SGI_GLX(1.0)" : "SGI_GLX-1.0");
4772  }
4773  else {
4774  INTERESTING("SGI_GLX");
4775  }
4776  }
4777  else if (INFILE(_LT_SGI_GLXref) && INFILE(_CR_SGI)) {
4778  if (INFILE(_TITLE_SGI_GLX_V10)) {
4779  INTERESTING(lDebug ? "SGI_GLX(10ref)" : "SGI_GLX-1.0");
4780  }
4781  else {
4782  INTERESTING(lDebug ? "SGI_GLX(ref)" : "SGI_GLX");
4783  }
4784  }
4785  else if (INFILE(_LT_SGI_PROPRIETARY) && INFILE(_CR_SGI)) {
4786  INTERESTING("SGI-Proprietary");
4787  }
4789  /*
4790  * 3DFX (Glide)
4791  */
4792  if (INFILE(_CR_3DFX_1) || INFILE(_CR_3DFX_2)) {
4793  if (INFILE(_LT_GLIDE_3DFX)) {
4794  INTERESTING("Glide");
4795  }
4796  else if (INFILE(_LT_GLIDE_GPL)) {
4797  INTERESTING("3DFX-PL");
4798  }
4799  }
4800  /*
4801  * Nvidia Corp
4802  */
4803  else if (INFILE(_LT_NVIDIA_EULA_3)) {
4804  INTERESTING(lDebug ? "Nvidia(1)" : "Nvidia-EULA-a");
4805  }
4806  else if (INFILE(_CR_NVIDIA) && INFILE(_LT_NVIDIA)) {
4807  INTERESTING(lDebug ? "Nvidia(2)" : "Nvidia");
4808  }
4809  else if (INFILE(_LT_NVIDIA_EULA_2)) {
4810  INTERESTING(lDebug ? "Nvidia(3)" : "Nvidia-EULA-b");
4811  }
4812  else if (INFILE(_LT_NVIDIA_EULA_1) || INFILE(_TITLE_NVIDIA)) {
4813  INTERESTING(lDebug ? "Nvidia(4)" : "Nvidia-EULA-b");
4814  }
4815  else if (INFILE(_LT_NVIDIA_1)) {
4816  INTERESTING(lDebug ? "Nvidia(5)" : "Nvidia");
4817  }
4818  /*
4819  * ATI Corp
4820  */
4821  else if (INFILE(_TITLE_ATI_EULA) && INFILE(_LT_ATI_EULA)) {
4822  INTERESTING("ATI-EULA");
4823  }
4824  /*
4825  * Agere Systems
4826  */
4827  else if (INFILE(_TITLE_AGERE_EULA) && INFILE(_LT_AGERE_EULA)) {
4828  INTERESTING("Agere-EULA");
4829  }
4831  /*
4832  * KD Tools, AB
4833  */
4834  if (INFILE(_TITLE_KDAB_EULA)) {
4835  if (INFILE(_LT_KDAB_1)) {
4836  INTERESTING(lDebug ? "KDAB(1)" : "KD-Tools-EULA");
4837  }
4838  if (INFILE(_LT_KDAB_2)) {
4839  INTERESTING(lDebug ? "KDAB(2)" : "KD-Tools-EULA");
4840  }
4841  }
4843  /*
4844  * KDE
4845  */
4846  if (INFILE(_PHR_KDE_FILE) && INFILE(_LT_KDE)) {
4847  INTERESTING("KDE");
4848  }
4850  /*
4851  * Broadcom
4852  */
4853  if (INFILE(_LT_BROADCOM_EULA) && INFILE(_CR_BROADCOM)) {
4854  INTERESTING("Broadcom-EULA");
4855  }
4857  /*
4858  * DARPA (Defense Advanved Research Projects Agency)
4859  */
4860  if (INFILE(_LT_DARPA_COUGAAR_1)) {
4861  INTERESTING("DARPA-Cougaar");
4862  }
4863  else if (INFILE(_LT_DARPA)) {
4864  INTERESTING("DARPA");
4865  }
4867  /*
4868  * Tektronix
4869  */
4870  if (INFILE(_LT_TEKTRONIX)) {
4871  if (INFILE(_CR_TEKTRONIX)) {
4872  INTERESTING("Tektronix");
4873  }
4874  else {
4875  INTERESTING("Tektronix-style");
4876  }
4877  }
4879  /*
4880  * Open Market, Inc
4881  */
4882  if (INFILE(_LT_CADENCE) && INFILE(_CR_CADENCE)) {
4883  INTERESTING("Cadence");
4884  }
4886  /*
4887  * Open Market, Inc
4888  */
4889  if (INFILE(_LT_OPENMKT)) {
4890  INTERESTING("OpenMarket");
4891  }
4893  /*
4894  * Unicode
4895  */
4896  if (!lmem[_fUNICODE]) {
4897  if (INFILE(_TITLE_UNICODE)) {
4898  INTERESTING(lDebug ? "Unicode(4)" : "Unicode");
4899  }
4900  else if (INFILE(_LT_UNICODE_1) && INFILE(_CR_UNICODE)) {
4901  INTERESTING(lDebug ? "Unicode(1)" : "Unicode");
4902  }
4903  else if (INFILE(_LT_UNICODE_2)) {
4904  INTERESTING(lDebug ? "Unicode(2)" : "Unicode");
4905  }
4906  else if (INFILE(_LT_UNICODE_3)) {
4907  INTERESTING(lDebug ? "Unicode(3)" : "Unicode");
4908  }
4909  else if (INFILE(_LT_UNICODE_4)) {
4910  INTERESTING(lDebug ? "Unicode(4)" : "Unicode-TOU");
4911  }
4912  else if (URL_INFILE(_URL_UNICODE)) {
4913  INTERESTING(lDebug ? "Unicode(5)" : "Unicode-TOU");
4914  }
4915  else if (INFILE(_TITLE_UNICODE_TOU) && INFILE(_LT_UNICODE_TOU)) {
4916  INTERESTING("Unicode-TOU");
4917  }
4919  }
4920  /*
4921  * Software Research Assoc
4922  */
4923  if (INFILE(_LT_SRA) && INFILE(_CR_SRA)) {
4924  INTERESTING("SW-Research");
4925  }
4927  /*
4928  * MITRE Collaborative Virtual Workspace (CVW) License
4929  */
4930  if (INFILE(_LT_MITRE_1)) {
4931  if (INFILE(_CR_MITRE)) {
4932  INTERESTING(lDebug ? "MitreCVW(1)" : "MitreCVW");
4933  }
4934  else if (INFILE(_TITLE_CVW)) {
4935  INTERESTING(lDebug ? "MitreCVW(2)" : "MitreCVW");
4936  }
4937  else {
4938  INTERESTING("MitreCVW-style");
4939  }
4940  }
4941  else if (INFILE(_LT_MITRE_2)) {
4942  INTERESTING(lDebug ? "Mitre(2)" : "Mitre");
4943  }
4945  /*
4946  * Jabber, Motosoto
4947  */
4948  if (INFILE(_LT_JABBER_1)) {
4949  if (INFILE(_TITLE_MOTOSOTO091)) {
4950  INTERESTING("Motosoto");
4951  }
4952  else if (INFILE(_TITLE_JABBER)) {
4953  INTERESTING("Jabber");
4954  }
4955  }
4956  else if (INFILE(_LT_JABBER_2)) {
4957  if (INFILE(_TITLE_JABBER_V10)) {
4958  INTERESTING(lDebug ? "Jabber(1.0)" : "Jabber-1.0");
4959  }
4960  else {
4961  INTERESTING(lDebug ? "Jabber(2)" : "Jabber");
4962  }
4963  }
4964  else if (URL_INFILE(_URL_JABBER)) {
4965  INTERESTING(lDebug ? "Jabber(url)" : "Jabber");
4966  }
4968  /*
4969  * CPL, Lucent Public License, Eclipse PL
4970  */
4971  int _epl = 0;
4972  if (INFILE(_LT_CPL_1) || INFILE(_LT_CPL_2)) {
4973  if (INFILE(_TITLE_IBM_PL20)) {
4974  INTERESTING("IPL-2.0");
4975  }
4976  else if (INFILE(_TITLE_IBM_PL10)) {
4977  INTERESTING("IPL-1.0");
4978  }
4979  else if (INFILE(_TITLE_IBM_PL)) {
4980  INTERESTING("IPL");
4981  }
4982  else if (INFILE(_TITLE_OpenGroup)) {
4983  INTERESTING("OpenGroup");
4984  }
4985  else if (INFILE(_TITLE_EPL10)) {
4986  INTERESTING(lDebug ? "Eclipse(v.0#1)" : "EPL-1.0");
4987  _epl = 1;
4988  }
4989  else if (INFILE(_TITLE_EPL20)) {
4990  INTERESTING(lDebug ? "Eclipse(v.2#1)" : "EPL-2.0");
4991  _epl = 1;
4992  }
4993  else if (INFILE(_TITLE_EPL) && NOT_INFILE(_TITLE_EPL_IGNORE)) {
4994  INTERESTING(lDebug ? "Eclipse(#1)" : "EPL");
4995  _epl = 1;
4996  }
4997  else if (INFILE(_TITLE_LUCENT102)) {
4998  INTERESTING("LPL-1.02");
4999  }
5000  else if (INFILE(_TITLE_LUCENT10)) {
5001  INTERESTING("LPL-1.0");
5002  }
5003  else if (NOT_INFILE(_LT_CA)) {
5004  cp = CPLVERS();
5005  INTERESTING(lDebug ? "CPL(#1)" : cp);
5006  }
5007  }
5008  else if (INFILE(_LT_LPL_102)) {
5009  INTERESTING("LPL-1.02");
5010  }
5011  else if (!lmem[_fREAL] && INFILE(_LT_CPLref1) && NOT_INFILE(_TITLE_EPL10)) {
5012  cp = CPLVERS();
5013  INTERESTING(lDebug ? "CPL(ref)" : cp);
5014  }
5015  else if (URL_INFILE(_URL_CPL)) {
5016  cp = CPLVERS();
5017  INTERESTING(lDebug ? "CPL(url)" : cp);
5018  }
5019  else if (INFILE(_PHR_CPL_05)) {
5020  INTERESTING(lDebug ? "CPL(0.5)" : "CPL-0.5");
5021  }
5022  else if (INFILE(_PHR_CPL_10)) {
5023  INTERESTING(lDebug ? "CPL(0.5)" : "CPL-1.0");
5024  }
5025  else if (INFILE(_LT_IBM_PLref1)) {
5026  INTERESTING(lDebug ? "IBM-PL(ref)" : "IPL");
5027  }
5028  else if (URL_INFILE(_URL_IBM_PL)) {
5029  INTERESTING(lDebug ? "IBM-PL(url)" : "IPL");
5030  }
5032  /* More EPL cases */
5033  if (!_epl) {
5034  if (INFILE(_LT_EPL20ref_1)) {
5035  INTERESTING(lDebug ? "Eclipse(ref#2)" : "EPL-2.0");
5036  }
5037  else if (INFILE(_LT_EPL10ref_1) || INFILE(_LT_EPL10ref_2) || HASTEXT(_LT_EPL10ref_3, REG_EXTENDED)) {
5038  INTERESTING(lDebug ? "Eclipse(ref#2)" : "EPL-1.0");
5039  }
5040  else if (INFILE(_LT_EPLref)) {
5041  if (INFILE(_TITLE_EPL10)) {
5042  INTERESTING(lDebug ? "Eclipse(v.0#2)" : "EPL-1.0");
5043  }
5044  else if (INFILE(_TITLE_EPL20)) {
5045  INTERESTING(lDebug ? "Eclipse(v.2#2)" : "EPL-2.0");
5046  }
5047  else {
5048  INTERESTING(lDebug ? "Eclipse(#2)" : "EPL");
5049  }
5050  }
5051  else if (INFILE(_LT_EPL10ref_1)) {
5052  INTERESTING(lDebug ? "Eclipse(ref#2)" : "EPL-1.0");
5053  }
5054  else if (INFILE(_LT_EPL) && NOT_INFILE(_TITLE_EPL_IGNORE)) {
5055  if (INFILE(_TITLE_EPL10ref_1)) {
5056  INTERESTING(lDebug ? "Eclipse(v1.0#2)" : "EPL-1.0");
5057  }
5058  if (INFILE(_TITLE_EPL20ref_1)) {
5059  INTERESTING(lDebug ? "Eclipse(v1.0#2)" : "EPL-2.0");
5060  }
5061  }
5062  }
5064  /*
5065  * SyBase/Watcom
5066  */
5067  if (INFILE(_LT_SYBASE)) {
5068  if (INFILE(_TITLE_SYBASE10)) {
5069  INTERESTING("Watcom-1.0");
5070  }
5071  else {
5072  INTERESTING("Watcom");
5073  }
5074  }
5076  /*
5077  * Ricoh
5078  */
5079  if (INFILE(_LT_RICOH)) {
5080  if (INFILE(_TITLE_RICOH10)) {
5081  INTERESTING("RSCPL");
5082  }
5083  }
5085  /*
5086  * OCLC
5087  */
5088  if (INFILE(_LT_OCLC)) {
5089  if (INFILE(_TITLE_OCLC20)) {
5090  INTERESTING("OCLC-2.0");
5091  }
5092  else if (INFILE(_TITLE_OCLC10)) {
5093  INTERESTING("OCLC-1.0");
5094  }
5095  else {
5096  INTERESTING("OCLC");
5097  }
5098  }
5100  /*
5101  * Educational Community License
5102  */
5103  if (INFILE(_LT_ECL1)) {
5104  INTERESTING("ECL-1.0");
5105  lmem[_mMIT] = 1;
5106  }
5107  else if (INFILE(_LT_ECL2)) {
5108  INTERESTING("ECL-2.0");
5109  lmem[_mMIT] = 1;
5110  }
5111  else if (INFILE(_LT_ECL)) {
5112  INTERESTING(lDebug ? "ECL(1)" : "ECL-1.0");
5113  lmem[_mMIT] = 1;
5114  }
5116  /*
5117  * EU DataGrid and Condor PL
5118  */
5119  if (INFILE(_LT_EU)) {
5120  if (INFILE(_TITLE_CONDOR_V10)) {
5121  INTERESTING("Condor-1.0");
5122  } else if (INFILE(_TITLE_CONDOR_V11)) {
5123  INTERESTING("Condor-1.1");
5124  }
5125  else {
5126  INTERESTING("EUDatagrid");
5127  }
5128  }
5129  else if (URL_INFILE(_URL_EUDatagrid)) {
5130  INTERESTING("EUDatagrid");
5131  }
5133  /*
5134  * Adaptive Public License
5135  */
5136  if (INFILE(_LT_ADAPTIVE)) {
5137  if (INFILE(_TITLE_ADAPTIVE10)) {
5138  INTERESTING("APL-1.0");
5139  }
5140  else {
5141  INTERESTING("APL");
5142  }
5143  lmem[_fAPL] = 1;
5144  }
5146  /*
5147  * gSOAP Public License
5148  */
5149  if (!lmem[_mGSOAP] && INFILE(_LT_GSOAPref13)) {
5150  INTERESTING("gSOAP-1.3b");
5151  }
5152  else if (!lmem[_mGSOAP] && INFILE(_LT_GSOAPref)) {
5153  INTERESTING("gSOAP");
5154  }
5156  /*
5157  * Computer Associates
5158  */
5159  if (INFILE(_LT_CA)) {
5160  if (INFILE(_TITLE_CA11)) {
5161  INTERESTING("CATOSL-1.1");
5162  }
5163  else {
5164  INTERESTING("CA");
5165  }
5166  }
5167  else if (INFILE(_TITLE_CA)) {
5168  INTERESTING("CATOSL");
5169  }
5171  /*
5172  * Frameworx
5173  */
5174  if (INFILE(_LT_FRAMEWORX)) {
5175  if (INFILE(_TITLE_FRAMEWORX10)) {
5176  INTERESTING("Frameworx-1.0");
5177  }
5178  else {
5179  INTERESTING("Frameworx");
5180  }
5181  }
5183  /*
5184  * NASA
5185  */
5186  if (INFILE(_LT_NASA)) {
5187  if (INFILE(_TITLE_NASA13)) {
5188  INTERESTING("NASA-1.3");
5189  }
5190  else {
5191  INTERESTING("NASA");
5192  }
5193  }
5195  /*
5196  * Freetype
5197  */
5198  if (INFILE(_LT_FREETYPE)) {
5199  if (INFILE(_TITLE_CATHARON)) {
5200  INTERESTING(lDebug ? "Catharon(1)" : "Catharon");
5201  }
5202  else if (INFILE(_CR_CATHARON)) {
5203  INTERESTING(lDebug ? "Catharon(2)" : "Catharon");
5204  }
5205  else if (INFILE(_TITLE_FREETYPE)) {
5206  INTERESTING("FTL");
5207  }
5208  else {
5209  INTERESTING("FTL-style");
5210  }
5211  }
5212  else if (INFILE(_LT_FTL)) {
5213  INTERESTING("FTL");
5214  }
5215  else if (INFILE(_TITLE_FTL)|| INFILE(_SPDX_FTL)) {
5216  INTERESTING("FTL");
5217  }
5218  else if (INFILE(_LT_CATHARON)) {
5219  INTERESTING(lDebug ? "Catharon(3)" : "Catharon");
5220  }
5221  else if (INFILE(_LT_FREETYPEref)) {
5222  INTERESTING(lDebug ? "FTL(ref)" : "FTL");
5223  }
5225  /*
5226  * Eiffel Forum License
5227  */
5228  if (INFILE(_LT_EIFFEL)) {
5229  if (INFILE(_TITLE_EIFFEL2)) {
5230  INTERESTING("EFL-2.0");
5231  }
5232  else if (INFILE(_TITLE_EIFFEL1)) {
5233  INTERESTING("EFL-1.0");
5234  }
5235  else {
5236  INTERESTING("EFL");
5237  }
5238  }
5239  else if (INFILE(_LT_EIFFEL_20)) {
5240  INTERESTING("EFL-2.0");
5241  }
5242  else if (INFILE(_LT_EIFFEL_1)) {
5243  INTERESTING("EFL");
5244  }
5246  /*
5247  * BISON, Nethack, etc.
5248  */
5249  if (!lmem[_fGPL] && (INFILE(_LT_BISON) || INFILE(_LT_BISONref))) {
5250  if (INFILE(_TITLE_NETHACK)) {
5251  INTERESTING("NGPL");
5252  }
5253  else {
5254  INTERESTING("BISON");
5255  }
5256  }
5258  /*
5259  * Open Software License (OSL) and Academic Free License (AFL) are similar
5260  */
5261  if (INFILE(_LT_OSL_BAD)) {
5262  cp = (INFILE(_TITLE_AFL) ? AFLVERS() : OSLVERS());
5263  INTERESTING(lDebug? "OSL(bad)" : cp);
5264  }
5265  else if (INFILE(_LT_OSLref1)) {
5266  cp = OSLVERS();
5267  INTERESTING(lDebug? "OSL(ref1)" : cp);
5268  }
5269  else if (INFILE(_LT_OSLref2)) {
5270  cp = OSLVERS();
5271  INTERESTING(lDebug? "OSL(ref2)" : cp);
5272  }
5273  else if (INFILE(_LT_AFL)) {
5274  cp = (INFILE(_TITLE_AFL) ? AFLVERS() : OSLVERS());
5275  INTERESTING(lDebug? "AFL#1" : cp);
5276  }
5277  else if (INFILE(_TITLE_OSL21) && NOT_INFILE(_TITLE_OSL21_EXHIBIT)) {
5278  cp = OSLVERS();
5279  INTERESTING(lDebug? "OSL(T2.1)" : cp);
5280  }
5281  else if (INFILE(_TITLE_AFL21)) {
5282  cp = AFLVERS();
5283  INTERESTING(lDebug? "AFL(T2.1)" : cp);
5284  }
5285  else if (INFILE(_TITLE_OSL30) && NOT_INFILE(_TITLE_OSL30_EXHIBIT)) {
5286  cp = OSLVERS();
5287  INTERESTING(lDebug? "OSL(T3.0)" : cp);
5288  }
5289  else if (INFILE(_TITLE_AFL30)) {
5290  cp = AFLVERS();
5291  INTERESTING(lDebug? "AFL(T3.0)" : cp);
5292  }
5293  else if (URL_INFILE(_URL_OSL11)) {
5294  INTERESTING(lDebug ? "OSL_v1.1(url)" : "OSL-1.1");
5295  }
5296  else if (URL_INFILE(_URL_OSL)) {
5297  INTERESTING(lDebug ? "OSL(url)" : "OSL");
5298  }
5299  else if (URL_INFILE(_URL_AFL)) {
5300  INTERESTING(lDebug ? "AFL(url)" : "AFL");
5301  }
5303  /*
5304  * There are occasions where something is licensed under *either* AFL
5305  * or OSL, so don't keep AFL-refs in the if-then-else-if chain here.
5306  */
5307  if (INFILE(_LT_AFLref1)) {
5308  cp = AFLVERS();
5309  INTERESTING(lDebug? "AFL(ref1)" : cp);
5310  }
5311  else if (INFILE(_LT_AFLref2)) {
5312  cp = AFLVERS();
5313  INTERESTING(lDebug? "AFL(ref2)" : cp);
5314  }
5316  /*
5317  * Inner Net license
5318  */
5319  if (INFILE(_LT_INNERNET)) {
5320  if (INFILE(_TITLE_INNERNET200)) {
5321  INTERESTING("InnerNet-2.00");
5322  }
5323  else if (HASTEXT(_TEXT_INNERNET, 0)) {
5324  INTERESTING("InnerNet");
5325  }
5326  else {
5327  INTERESTING("InnerNet-style");
5328  }
5329  }
5330  else if (INFILE(_LT_INNERNETref_V2)) {
5331  INTERESTING(lDebug ? "InnetNet(v2ref)" : "InnerNet-2.00");
5332  }
5334  /*
5335  * Open Government Licence
5336  */
5337  if (INFILE(_TITLE_OGL_UK)) {
5338  if (INFILE(_TITLE_OGL_UK_10)) {
5339  INTERESTING("OGL-UK-1.0");
5340  }
5341  else if (INFILE(_TITLE_OGL_UK_20)) {
5342  INTERESTING("OGL-UK-2.0");
5343  }
5344  else if (INFILE(_TITLE_OGL_UK_30)) {
5345  INTERESTING("OGL-UK-3.0");
5346  }
5347  /* Full OGL license texts have reference to Creative Commons */
5348  if (HASTEXT(_LT_CC_ref, REG_EXTENDED)) {
5349  lmem[_fCCBY] = 1;
5350  }
5351  }
5353  /*
5354  * Creative Commons Public License, Mindterm, and the Reciprocal PL
5355  */
5356  if (!lmem[_fCCBY] && HASTEXT(_LT_CC_ref, REG_EXTENDED)) {
5357  cp = CCVERS();
5358  INTERESTING(lDebug ? "CC(ref)" : cp);
5359  }
5360  else if (INFILE(_LT_CCPL)) {
5361  if (INFILE(_LT_RECIP_1) || INFILE(_LT_RECIP_2)) {
5362  if (INFILE(_TITLE_RPL15)) {
5363  INTERESTING(lDebug ? "RPL-1.5#1" : "RPL-1.5");
5364  }
5365  else if (INFILE(_TITLE_RPL11)) {
5366  INTERESTING(lDebug ? "RPL-1.1#1" : "RPL-1.1");
5367  }
5368  else if (INFILE(_TITLE_RPL10)) {
5369  INTERESTING(lDebug ? "RPL-1.0#1" : "RPL-1.0");
5370  }
5371  else {
5372  INTERESTING(lDebug ? "RPL#1" : "RPL");
5373  }
5374  }
5375  }
5376  else if (INFILE(_LT_RECIP15)) {
5377  INTERESTING("RPL-1.5");
5378  }
5379  else if (INFILE(_TITLE_MINDTERM)) {
5380  INTERESTING("MindTerm");
5381  }
5382  else if (INFILE(_LT_RECIP_1) || INFILE(_LT_RECIP_2)) {
5383  if (INFILE(_TITLE_RPL15)) {
5384  INTERESTING(lDebug ? "RPL-1.5#2" : "RPL-1.5");
5385  }
5386  else if (INFILE(_TITLE_RPL11)) {
5387  INTERESTING(lDebug ? "RPL-1.1#2" : "RPL-1.1");
5388  }
5389  else if (INFILE(_TITLE_RPL10)) {
5390  INTERESTING(lDebug ? "RPL-1.0#2" : "RPL-1.0");
5391  }
5392  else {
5393  INTERESTING(lDebug ? "RPL#2" : "RPL");
5394  }
5395  }
5396  /*
5397  * For some reason license text strings were defined for few
5398  * Creative Commons licenses.
5399  */
5400  else if (INFILE(_LT_CC_BY_SA_30)) {
5401  INTERESTING("CC-BY-SA-3.0");
5402  }
5403  else if (INFILE(_LT_CC_BY_SA_25)) {
5404  INTERESTING("CC-BY-SA-2.5");
5405  }
5406  else if (INFILE(_LT_CC_BY_NC_30)) {
5407  INTERESTING("CC-BY-NC-3.0");
5408  }
5409  else if (INFILE(_LT_CC_BY_ND_30)) {
5410  INTERESTING("CC-BY-ND-3.0");
5411  }
5413  if (URL_INFILE(_URL_RPL)) {
5414  INTERESTING(lDebug ? "RPL(url)" : "RPL");
5415  }
5416  else if (URL_INFILE(_URL_CCLGPL)) {
5417  cp = LGPLVERS();
5418  INTERESTING(lDebug ? "CC-LGPL(url)" : cp);
5419  }
5420  else if (URL_INFILE(_URL_CCGPL)) {
5421  cp = GPLVERS();
5422  INTERESTING(lDebug ? "CC-GPL(url)" : cp);
5423  }
5425  /*
5426  * SpikeSource
5427  */
5428  if (INFILE(_CR_SPIKESOURCE) && INFILE(_LT_SPIKESOURCE)) {
5429  INTERESTING("SpikeSource");
5430  }
5432  /*
5433  * Legato systems
5434  */
5435  if (INFILE(_LT_LEGATO_1) || INFILE(_LT_LEGATO_2)) {
5436  INTERESTING("Legato");
5437  }
5439  /*
5440  * Paradigm associates
5441  */
5442  if (INFILE(_LT_PARADIGM) && INFILE(_CR_PARADIGM)) {
5443  INTERESTING("Paradigm");
5444  }
5446  /*
5447  * Wintertree Software
5448  */
5449  if (INFILE(_LT_WINTERTREE)) {
5450  INTERESTING("Wintertree");
5451  }
5453  /*
5454  * Genivia
5455  */
5456  if (INFILE(_LT_GENIVIAref)) {
5457  INTERESTING("Genivia.Commercial");
5458  }
5460  /*
5461  * Open Directory License
5462  */
5463  if (INFILE(_LT_ODL)) {
5464  INTERESTING("ODL");
5465  }
5467  /*
5468  * Open Directory License
5469  */
5470  if (INFILE(_LT_OSD)) {
5471  INTERESTING("OSD");
5472  }
5474  /*
5475  * Zveno
5476  */
5477  if (INFILE(_LT_ZVENO) && INFILE(_CR_ZVENO)) {
5478  INTERESTING("Zveno");
5479  }
5481  /*
5482  * Brainstorm
5483  */
5484  if (INFILE(_LT_BRAINSTORM_EULA) && INFILE(_TITLE_BRAINSTORM_EULA)) {
5485  INTERESTING("BrainStorm-EULA");
5486  }
5488  /*
5489  * AOL
5490  */
5491  if (INFILE(_LT_AOL_EULA)) {
5492  INTERESTING("AOL-EULA");
5493  }
5495  /*
5496  * Algorithmics
5497  */
5498  if (INFILE(_LT_ALGORITHMICS)) {
5499  INTERESTING("Algorithmics");
5500  }
5502  /*
5503  * Pixware
5504  */
5505  if (INFILE(_LT_PIXWARE_EULA)) {
5506  INTERESTING("Pixware-EULA");
5507  }
5509  /*
5510  * Compuserve
5511  */
5512  if (HASTEXT(_TEXT_COMPUSERVE, 0) && INFILE(_LT_COMPUSERVE)) {
5513  INTERESTING("CompuServe");
5514  }
5516  /*
5517  * Advanved Micro Devices (AMD)
5518  */
5519  if (INFILE(_CR_AMD) && INFILE(_LT_AMD)) {
5520  INTERESTING("AMD");
5521  }
5522  else if (INFILE(_LT_AMD_EULA) && INFILE(_TITLE_AMD_EULA)) {
5523  INTERESTING("AMD-EULA");
5524  }
5526  /*
5527  * OMRON Corp
5528  */
5529  if ((INFILE(_CR_OMRON_1) || INFILE(_CR_OMRON_2)) &&
5530  (INFILE(_LT_OMRON1) || INFILE(_LT_OMRON2))) {
5531  INTERESTING(lDebug ? "OMRON(2)" : "OMRON");
5532  }
5534  /*
5535  * MetroLink
5536  */
5537  if (INFILE(_TITLE_METROLINK)) {
5538  if (INFILE(_LT_METRO)) {
5539  if (INFILE(_LT_METRO_NONFREE)) {
5540  INTERESTING("MetroLink-nonfree");
5541  }
5542  else {
5543  INTERESTING("MetroLink");
5544  }
5545  }
5546  }
5547  else if (INFILE(_LT_METROLINKref)) {
5548  INTERESTING(lDebug ? "MetroLink(ref)" : "MetroLink");
5549  }
5551  /*
5552  * University of Edinburgh (and a CMU derivative)
5553  */
5554  if (INFILE(_LT_EDINBURGH_1)) {
5555  if (mCR_CMU()) {
5556  INTERESTING(lDebug ? "CMU(3)" : "CMU");
5557  lmem[_mCMU] = 1;
5558  }
5559  else if (mCR_EDIN()) {
5560  INTERESTING(lDebug ? "U-Edinburgh(1)" : "U-Edinburgh");
5561  }
5562  else {
5563  INTERESTING(lDebug ? "UE-style(1)" : "U-Edinburgh-style");
5564  }
5565  }
5566  else if (INFILE(_LT_EDINBURGH_2)) {
5567  if (mCR_EDIN()) {
5568  INTERESTING(lDebug ? "U-Edinburgh(2)" : "U-Edinburgh");
5569  }
5570  else {
5571  INTERESTING(lDebug ? "UE-style(2)" : "U-Edinburgh-style");
5572  }
5573  }
5575  /*
5576  * Older CMU (including the weird "fnord" text) licenses.
5577  * Note that SPDX listed MIT-CMU license is detected earlier.
5578  */
5579  if (!lmem[_mCMU] && INFILE(_LT_CMU_1)) {
5580  if (!lmem[_mREDHAT] && INFILE(_CR_REDHAT)) {
5581  INTERESTING(lDebug ? "RH(5)" : "RedHat");
5582  lmem[_mREDHAT] = 1;
5583  }
5584  else if (INFILE(_CR_NRL)) {
5585  INTERESTING("NRL");
5586  }
5587  else if (!lmem[_mCMU] && mCR_CMU()) {
5588  INTERESTING(lDebug ? "CMU(5)" : "CMU");
5589  lmem[_mCMU] = 1;
5590  }
5591  else {
5592  INTERESTING("CMU-style");
5593  lmem[_mCMU] = 1;
5594  }
5595  }
5596  else if (!lmem[_mCMU] && INFILE(_LT_CMU_2) && mCR_CMU()) {
5597  INTERESTING(lDebug ? "CMU(6)" : "CMU");
5598  lmem[_mCMU] = 1;
5599  }
5600  else if (INFILE(_LT_CMU_3)) {
5601  INTERESTING(lDebug ? "CMU(7)" : "CMU");
5602  lmem[_mCMU] = 1;
5603  }
5604  else if (INFILE(_LT_CMU_4)) {
5605  INTERESTING(lDebug ? "CMU(8)" : "CMU");
5606  lmem[_mCMU] = 1;
5607  }
5608  else if (INFILE(_LT_CMU_5)) {
5609  INTERESTING(lDebug ? "CMU(9)" : "CMU");
5610  lmem[_mCMU] = 1;
5611  }
5612  else if (INFILE(_LT_CMU_6)) {
5613  INTERESTING(lDebug ? "CMU(10)" : "CMU");
5614  lmem[_mCMU] = 1;
5615  }
5617  /*
5618  * University of Chicago
5619  */
5620  if (INFILE(_CR_UCHICAGO) && INFILE(_LT_UCHICAGO)) {
5621  INTERESTING("U-Chicago");
5622  }
5624  /*
5625  * University of Utah
5626  */
5627  if (INFILE(_CR_UUTAH) && INFILE(_LT_UUTAH)) {
5628  INTERESTING("U-Utah");
5629  }
5631  /*
5632  * University of British Columbia
5633  */
5634  if (INFILE(_CR_UBC) && INFILE(_LT_UBC)) {
5635  INTERESTING("U-BC");
5636  }
5638  /*
5639  * ImageMagick Studios - DON'T RECALL THE TEXT FOR THIS LICENSE!
5640  */
5641  if (INFILE(_LT_IMAGEMAGICK)) {
5642  if (INFILE(_CR_IMAGEMAGICK)) {
5643  INTERESTING("ImageMagick");
5644  }
5645  else {
5646  INTERESTING("ImageMagick-style");
5647  }
5648  }
5649  else if (URL_INFILE(_URL_IMAGEMAGICK)) {
5650  INTERESTING(lDebug ? "ImageMagick(url)" : "ImageMagick");
5651  }
5653  /*
5654  * Riverbank
5655  */
5656  if (INFILE(_LT_RIVERBANK) && INFILE(_TITLE_RIVERBANK_EULA)) {
5657  INTERESTING("Riverbank-EULA");
5658  }
5660  /*
5661  * Polyserve
5662  */
5663  if (INFILE(_CR_POLYSERVE) && INFILE(_LT_POLYSERVE)) {
5664  INTERESTING("Polyserve-CONFIDENTIAL");
5665  }
5667  /*
5668  * Fujitsu Limited
5669  */
5670  if (INFILE(_CR_FUJITSU) && INFILE(_LT_FUJITSU)) {
5671  INTERESTING("Fujitsu");
5672  }
5674  /*
5675  * Cypress Semiconductor
5676  */
5677  if (INFILE(_CR_CYPRESS) && INFILE(_LT_CYPRESS)) {
5678  INTERESTING("Cypress-FW");
5679  }
5680  /*
5681  * Keyspan
5682  */
5683  else if (INFILE(_CR_KEYSPAN) && INFILE(_LT_KEYSPAN)) {
5684  INTERESTING("Keyspan-FW");
5685  }
5686  /*
5687  * ATMEL
5688  */
5689  else if (INFILE(_CR_ATMEL) && INFILE(_LT_ATMEL)) {
5690  INTERESTING("ATMEL-FW");
5691  }
5693  /*
5694  * Quest Software
5695  */
5696  if (INFILE(_LT_QUEST_EULA) && INFILE(_TITLE_QUEST_EULA)) {
5697  INTERESTING("Quest-EULA");
5698  }
5700  /*
5701  * International Organization for Standarization
5702  */
5703  if (INFILE(_LT_IOS) && INFILE(_CR_IOS)) {
5704  INTERESTING("IOS");
5705  }
5707  /*
5708  * Garmin Ltd.
5709  */
5710  if (INFILE(_LT_GARMIN_EULA) && INFILE(_TITLE_GARMIN_EULA)) {
5711  INTERESTING("Garmin-EULA");
5712  }
5714  /*
5715  * AVM GmbH
5716  */
5717  if (INFILE(_CR_AVM)) {
5718  if (INFILE(_LT_AVM_1)) {
5719  INTERESTING(lDebug ? "AVM(1)" : "AVM");
5720  }
5721  else if (INFILE(_LT_AVM_2)) {
5722  INTERESTING(lDebug ? "AVM(2)" : "AVM");
5723  }
5724  }
5725  else if (INFILE(_LT_AVM_3)) {
5726  INTERESTING(lDebug ? "AVM(3)" : "AVM");
5727  }
5729  /*
5730  * Fair license
5731  */
5732  if (INFILE(_LT_FAIR)) {
5733  if (INFILE(_TITLE_FAIR)) {
5734  INTERESTING("Fair");
5735  }
5736  else {
5737  INTERESTING("Fair-style");
5738  }
5739  }
5741  /*
5742  * GCA (Majordomo)
5743  */
5744  if (INFILE(_LT_GCA)) {
5745  if (INFILE(_TITLE_MAJORDOMO11)) {
5746  INTERESTING("Majordomo-1.1");
5747  }
5748  else {
5749  INTERESTING("Majordomo");
5750  }
5751  }
5753  /*
5754  * Zeus Technology -- this one is kind of a corner-case since the wording
5755  * is VERY general. If there's a Zeus copyright with the license text,
5756  * spell it out; else, look for the same text in the "generic" section.
5757  */
5758  if (INFILE(_CR_ZEUS) && INFILE(_LT_ZEUS)) {
5759  INTERESTING("Zeus");
5760  }
5762  /*
5763  * Information-technology promotion agency
5764  */
5765  if (!lmem[_mXOPEN] && INFILE(_LT_XOPEN_1)) {
5766  if (!lmem[_mOSF] && INFILE(_CR_OSF)) {
5767  INTERESTING(lDebug ? "OSF(2)" : "OSF");
5768  lmem[_mOSF] = 1;
5769  }
5770  else if (INFILE(_CR_UI)) {
5771  INTERESTING(lDebug ? "UI(2)" : "Unix-Intl");
5772  }
5773  else if (INFILE(_CR_XOPEN)) {
5774  INTERESTING(lDebug ? "XOpen(2)" : "X/Open");
5775  lmem[_mXOPEN] = 1;
5776  }
5777  else if (INFILE(_CR_IPA)) {
5778  INTERESTING("IPA");
5779  }
5780  else if (!lmem[_mSUN] && INFILE(_CR_SUN)) {
5781  INTERESTING(lDebug ? "Sun(10)" : "Sun");
5782  lmem[_mSUN] = 1;
5783  }
5784  else {
5785  INTERESTING("X/Open-style");
5786  }
5787  }
5788  /* This one is funky - it includes part of the copyright */
5789  else if (!lmem[_mXOPEN] && INFILE(_LT_XOPEN_2)) {
5790  INTERESTING(lDebug ? "XOpen(3)" : "X/Open");
5791  lmem[_mXOPEN] = 1;
5792  }
5794  /*
5795  * Interlink networks EULA (seen in HP proprietary code)
5796  */
5797  if (INFILE(_LT_INTERLINK_EULA) && INFILE(_TITLE_INTERLINK_EULA)) {
5798  INTERESTING("Interlink-EULA");
5799  }
5801  /*
5802  * Mellanox Technologies
5803  */
5804  if (INFILE(_LT_MELLANOX) && INFILE(_CR_MELLANOX)) {
5805  INTERESTING("Mellanox");
5806  }
5808  /*
5809  * nCipher Corp
5810  */
5811  if (INFILE(_LT_NCIPHER) && INFILE(_CR_NCIPHER)) {
5812  INTERESTING("nCipher");
5813  }
5815  /*
5816  * Distributed Processing Technology Corp
5817  */
5818  if (INFILE(_CR_DPTC) && INFILE(_LT_DPTC)) {
5819  INTERESTING("DPTC");
5820  }
5821  /*
5822  * Distributed Management Task Force
5823  */
5824  else if (HASTEXT(_TEXT_REPRODUCED, 0) && INFILE(_CR_DMTF) &&
5825  INFILE(_LT_DMTF)) {
5826  INTERESTING("DMTF");
5827  lmem[_fATTRIB] = 1;
5828  }
5830  /*
5831  * DSC Technologies Corp
5832  */
5833  if (INFILE(_CR_DSCT) && INFILE(_LT_DSCT)) {
5834  INTERESTING("DSCT");
5835  }
5837  /*
5838  * Epinions, Inc.
5839  */
5840  if (INFILE(_CR_EPINIONS) && INFILE(_LT_EPINIONS)) {
5841  INTERESTING("Epinions");
5842  }
5844  /*
5845  * MITEM, Ltd
5846  */
5847  if (INFILE(_CR_MITEM) && INFILE(_LT_MITEM)) {
5848  INTERESTING("MITEM");
5849  }
5851  /*
5852  * Cylink corp
5853  */
5854  if ((INFILE(_LT_CYLINK_ISC_1) || INFILE(_LT_CYLINK_ISC_2))) {
5855  INTERESTING("Cylink-ISC");
5856  }
5858  /*
5859  * SciTech software
5860  */
5861  if (INFILE(_CR_SCITECH) && INFILE(_LT_SCITECH)) {
5862  INTERESTING("SciTech");
5863  }
5865  /*
5866  * OReilly and Associates
5867  */
5868  if (INFILE(_LT_OREILLY_1)) {
5869  if (INFILE(_CR_OREILLY)) {
5870  INTERESTING("OReilly");
5871  }
5872  else {
5873  INTERESTING("OReilly-style");
5874  }
5875  }
5876  else if (INFILE(_LT_OREILLY_2)) {
5877  if (INFILE(_CR_OREILLY)) {
5878  INTERESTING(lDebug ? "OReilly-2" : "OReilly");
5879  }
5880  else {
5881  INTERESTING(lDebug ? "OReilly-st-2" : "OReilly-style");
5882  }
5883  }
5885  /*
5886  * Bit-Torrent
5887  */
5888  if (INFILE(_LT_BITTORRENT)) {
5889  if (INFILE(_TITLE_BITTORRENT11)) {
5890  INTERESTING("BitTorrent-1.1");
5891  }
5892  else if (INFILE(_TITLE_BITTORRENT10)) {
5893  INTERESTING("BitTorrent-1.0");
5894  }
5895  else {
5896  INTERESTING("BitTorrent");
5897  }
5898  }
5899  else if (INFILE(_LT_BITTORRENT_V11)) {
5900  INTERESTING("BitTorrent-1.1");
5901  }
5902  else if (INFILE(_LT_BITTORRENT_V10)) {
5903  INTERESTING("BitTorrent-1.0");
5904  }
5905  else if (INFILE(_LT_BITTORRENTref)) {
5906  INTERESTING(lDebug ? "BitTorrent(ref)" : "BitTorrent");
5907  }
5909  /*
5910  * Open Software Foundation
5911  */
5912  if (INFILE(_LT_OSF_1)) {
5913  if (INFILE(_CR_OSF)) {
5914  INTERESTING(lDebug ? "OSF(3)" : "OSF");
5915  lmem[_mOSF] = 1;
5916  }
5917  else {
5918  INTERESTING(lDebug ? "OSF-style(1)" : "OSF-style");
5919  }
5920  }
5921  else if (INFILE(_LT_OSF_2)) {
5922  if (INFILE(_CR_OSF)) {
5923  INTERESTING(lDebug ? "OSF(4)" : "OSF");
5924  lmem[_mOSF] = 1;
5925  }
5926  else if (INFILE(_LT_CMU_8)) {
5927  INTERESTING(lDebug ? "CMU(11)" : "CMU");
5928  }
5929  else {
5930  INTERESTING(lDebug ? "OSF-style(2)" : "OSF-style");
5931  }
5932  }
5934  /*
5935  * OpenLDAP (if not already determined above -- the OpenLDAP public license
5936  * borrows text from LOTS of different sources)
5937  */
5938  if (!lmem[_fBSD] && lmem[_tOPENLDAP] && !lmem[_fOPENLDAP]) {
5939  if (INFILE(_LT_OPENLDAP_1)) {
5940  if (!TRYGROUP(famOPENLDAP)) {
5941  INTERESTING("OLDAP-style");
5942  }
5943  }
5944  else if (INFILE(_LT_OPENLDAP_2)) {
5945  INTERESTING("OLDAP");
5946  }
5947  }
5949  /*
5950  * The Knuth license is sufficiently bizarre enough it belongs down here,
5951  * towards the end of the search
5952  *****
5953  * Lachman Associates - includes a proprietary-to-the-max paragraph
5954  * IoSoft Ltd.
5955  */
5956  if (INFILE(_CR_KNUTH) && INFILE(_LT_KNUTH_1)) {
5957  INTERESTING(lDebug ? "Knuth(1)" : "D.E.Knuth");
5958  }
5959  else if (INFILE(_LT_KNUTH_2)) {
5960  INTERESTING(lDebug ? "Knuth(2)" : "D.E.Knuth");
5961  }
5962  else if (INFILE(_LT_KNUTH_STYLE)) {
5963  INTERESTING("Knuth-style");
5964  }
5965  else if (INFILE(_LT_LACHMAN_SECRET)) {
5966  INTERESTING("Lachman-Proprietary");
5967  }
5968  else if (INFILE(_LT_IOSOFT_SRCONLY)) {
5969  INTERESTING("IoSoft.COMMERCIAL");
5970  }
5972  /*
5973  * The Free Software License
5974  */
5975  if (INFILE(_LT_FREE_SW)) {
5976  INTERESTING("Free-SW");
5977  }
5978  /*
5979  * NOT free software and explicitly free software
5980  */
5981  else if (INFILE(_PHR_NOT_FREE_SW)) {
5982  if (INFILE(_LT_NOT_FREE) && INFILE(_CR_WTI)) {
5983  INTERESTING("WTI.Not-free");
5984  }
5985  else {
5986  INTERESTING("Not-Free");
5987  }
5988  }
5990  /*
5991  * Code Project Open License
5992  */
5993  if (INFILE(_LT_CPOL)) {
5994  if (HASTEXT(_LT_CPOL_V102, REG_EXTENDED)) {
5995  INTERESTING("CPOL-1.02");
5996  } else {
5997  INTERESTING("CPOL");
5998  }
5999  }
6001  /*
6002  * Macrovision
6003  */
6004  if (INFILE(_LT_MACROV_IA) && INFILE(_PHR_MACROVISION)) {
6005  if (INFILE(_PHR_EULA)) {
6006  INTERESTING("Macrovision-EULA");
6007  }
6008  else {
6009  INTERESTING("Macrovision");
6010  }
6011  }
6013  /*
6014  * VMware
6015  */
6016  if (INFILE(_LT_VMWARE) && INFILE(_TITLE_VMWARE)) {
6017  INTERESTING("VMware-EULA");
6018  }
6020  /*
6021  * UCWARE.com
6022  */
6023  if (INFILE(_LT_UCWARE_EULA_1) || INFILE(_LT_UCWARE_EULA_2)) {
6024  INTERESTING("UCWare-EULA");
6025  }
6027  /*
6028  * InfoSeek Corp
6029  */
6030  if (INFILE(_LT_INFOSEEK) && INFILE(_CR_INFOSEEK)) {
6031  INTERESTING("InfoSeek");
6032  }
6034  /*
6035  * Trident Microsystems
6036  */
6037  if (INFILE(_LT_TRIDENT_EULA) && INFILE(_CR_TRIDENT)) {
6038  INTERESTING("Trident-EULA");
6039  }
6041  /*
6042  * ARJ Software Inc
6043  */
6044  if (INFILE(_LT_ARJ) && INFILE(_CR_ARJ)) {
6045  INTERESTING("ARJ");
6046  }
6048  /*
6049  * Piriform Ltd
6050  */
6051  if (INFILE(_LT_PIRIFORM) && INFILE(_CR_PIRIFORM)) {
6052  INTERESTING("Piriform");
6053  }
6055  /*
6056  * Design Science License (DSL)
6057  */
6058  if (INFILE(_LT_DSL)) {
6059  INTERESTING("DSL");
6060  }
6062  /*
6063  * Skype
6064  */
6065  if (INFILE(_TITLE_SKYPE) && INFILE(_LT_SKYPE)) {
6066  INTERESTING("Skype-EULA");
6067  }
6069  /*
6070  * Hauppauge
6071  */
6072  if (INFILE(_LT_HAUPPAUGE)) {
6073  INTERESTING("Hauppauge");
6074  }
6076  /*
6077  * Platform Computing Corp (or a generic on-your-intranet-only restriction)
6078  */
6079  if (INFILE(_LT_INTRANET_ONLY)) {
6080  if (INFILE(_CR_PLATFORM_COMP)) {
6081  INTERESTING(lDebug ? "Platfm(1)" : "Platform-Computing(RESTRICTED)");
6082  } else {
6083  MEDINTEREST("Intranet-only");
6084  }
6085  } else if (INFILE(_LT_NOT_INTERNET)) {
6086  if (INFILE(_CR_PLATFORM_COMP)) {
6087  INTERESTING(lDebug ? "Platfm(2)" : "Platform-Computing(RESTRICTED)");
6088  } else {
6089  MEDINTEREST("Not-Internet");
6090  }
6091  }
6093  /*
6094  * Curl
6095  */
6096  if (URL_INFILE(_URL_CURL)) {
6097  INTERESTING(lDebug ? "Curl(URL)" : "curl");
6098  }
6100  /*
6101  * ID Software
6102  */
6103  if (INFILE(_LT_ID_EULA)) {
6104  INTERESTING("ID-EULA");
6105  }
6107  /*
6108  * M+ Fonts Project
6109  */
6110  if (INFILE(_LT_MPLUS_FONT) && INFILE(_CR_MPLUS)) {
6111  INTERESTING("M-Plus-Project");
6112  }
6114  /*
6115  * Powder Development
6116  */
6117  if (INFILE(_LT_POWDER)) {
6118  INTERESTING("Powder-Proprietary");
6119  }
6121  /*
6122  * Against DRM
6123  */
6124  if (INFILE(_LT_AGAINST_DRM)) {
6125  INTERESTING("AgainstDRM");
6126  }
6128  /*
6129  * The TeXinfo exception clause
6130  */
6131  if (INFILE(_LT_TEX_EXCEPT)) {
6132  INTERESTING(lDebug ? "TeX-except" : "TeX-exception");
6133  }
6135  /*
6136  * The U.S. Gummint
6137  */
6138  if (INFILE(_LT_USGOVT_1)) {
6139  if (INFILE(_CR_URA)) {
6140  MEDINTEREST("URA.govt");
6141  }
6142  else {
6143  MEDINTEREST(lDebug ? "Govt-Wk(1)" : "Govt-work");
6144  }
6145  }
6146  else if (INFILE(_LT_USGOVT_2)) {
6147  /*
6148  * mpich2
6149  */
6150  if (INFILE(_LT_MPICH2)) {
6151  INTERESTING("mpich2");
6152  }
6153  else {
6154  MEDINTEREST(lDebug ? "Govt-Wk(2)" : "Govt-work");
6155  }
6156  }
6157  else if (INFILE(_LT_USGOVT_RIGHTS1) && INFILE(_LT_PUBLIC)) {
6158  MEDINTEREST(lDebug ? "US-Govt(1)" : "Govt-rights");
6159  }
6160  else if (INFILE(_LT_USGOVT_RIGHTS2)) {
6161  MEDINTEREST(lDebug ? "US-Govt(2)" : "Govt-rights");
6162  }
6164  /*
6165  * AACA (Ada Conformity Assessment Authority)
6166  */
6167  if (INFILE(_LT_ACAA_RIGHTS) && INFILE(_LT_PUBLIC)) {
6168  INTERESTING("ACAA");
6169  }
6171  /*
6172  * Zend Engine License
6173  */
6174  if (INFILE(_LT_ZEND_1) || URL_INFILE(_URL_ZEND)) {
6175  INTERESTING("Zend-2.0");
6176  }
6177  else if (INFILE(_LT_ZEND_2)) {
6178  INTERESTING("Zend-1.0");
6179  }
6181  /*
6182  * WebM
6183  * Changed to BSD-3-Clause, WebM is not OSI nor SPDX recognized license
6184  */
6185  if (URL_INFILE(_URL_WEBM)) {
6186  INTERESTING(lDebug ? "WebM" : "BSD-3-Clause");
6187  }
6189  /* Dyade Public License
6190  * http://old.koalateam.com/jackaroo/DYADE_PUBLIC_LICENSE.TXT
6191  */
6192  if (INFILE(_LT_DYADE) && INFILE(_LT_DYADE_2))
6193  {
6194  INTERESTING("Dyade");
6195  }
6196  /*
6197  * Zimbra
6198  */
6199  if (INFILE(_TITLE_ZIMBRA_13)) {
6200  INTERESTING("Zimbra-1.3");
6201  }
6202  else if (INFILE(_TITLE_ZIMBRA_12)) {
6203  INTERESTING("Zimbra-1.2");
6204  }
6205  else if (INFILE(_TITLE_ZIMBRA)) {
6206  INTERESTING("Zimbra");
6207  }
6209  /*
6210  * Open Database
6211  */
6212  if (INFILE(_TITLE_ODBL)) {
6213  INTERESTING("ODbL-1.0");
6214  lmem[_fODBL] = 1;
6215  }
6217  /*
6218  * Multics
6219  */
6220  if (INFILE(_LT_MULTICS)) {
6221  INTERESTING("Multics");
6222  }
6224  /*
6225  * H2
6226  * Note, H2 title is also checked in MPL section
6227  */
6228  if (INFILE(_TITLE_H2_V10)) {
6229  INTERESTING("H2-1.0");
6230  }
6232  /*
6233  * CRYPTOGAMS
6234  */
6235  if (INFILE(_LT_CRYPTOGAMS)) {
6236  INTERESTING("Cryptogams");
6237  }
6239  /*
6240  * Cygnus-eCos-1.0
6241  * Note, Cygnus-eCos title is also checked in MPL section
6242  */
6243  if (INFILE(_TITLE_CYGNUS_ECOS_V10)) {
6244  INTERESTING("Cygnus-eCos-1.0");
6245  }
6247  /*
6248  * RHeCos-1.1
6249  * Note, RHeCos-1.1 title is also checked in MPL section
6250  */
6251  if (INFILE(_TITLE_RHeCos_V11)) {
6252  INTERESTING("RHeCos-1.1");
6253  }
6255  /*
6256  * TMate
6257  * Note, TMate is also recognized with BSD-2-Clause detection
6258  */
6259  if (INFILE(_TITLE_TMATE)) {
6260  INTERESTING("TMate");
6261  }
6263  /*
6264  * Abstyles
6265  */
6266  if (INFILE(_LT_ABSTYLES_1) && INFILE(_LT_ABSTYLES_2)) {
6267  INTERESTING("Abstyles");
6268  }
6270  /*
6271  * Amazon Digital Services License
6272  */
6273  if (INFILE(_LT_ADSL) && INFILE(_CR_AMAZON)) {
6274  INTERESTING("ADSL");
6275  }
6277  /*
6278  * CrystalStacker License
6279  */
6280  if (HASTEXT(_LT_CRYSTALSTACKER, REG_EXTENDED)) {
6281  INTERESTING("CrystalStacker");
6282  }
6284  /*
6285  * 3GPP
6286  */
6287  if (INFILE(_LT_3GPP)) {
6288  INTERESTING("3GPP");
6289  }
6291  /*
6292  * ITU-T
6293  */
6294  if (INFILE(_LT_ITU_T_1) || INFILE(_LT_ITU_T_2) || HASTEXT(_TITLE_ITU_T, 0)) {
6295  INTERESTING("ITU-T");
6296  }
6298  /*
6299  * Sun Public License
6300  */
6301  if (!lmem[_mSUN] && !lmem[_mMPL]) {
6302  if (INFILE(_TITLE_SUN_PL10)) {
6303  INTERESTING("SPL-1.0");
6304  }
6305  else if (!lmem[_fREAL] && INFILE(_TITLE_SUN_PL)) {
6306  INTERESTING("SPL");
6307  }
6308  }
6310  /*
6311  * libtiff, note that license text is detected earlier
6312  */
6313  if (INFILE(_PHR_LIBTIFF)) {
6314  INTERESTING("libtiff");
6315  }
6317  /*
6318  * Imlib2
6319  */
6320  if (INFILE(_PHR_Imlib2)) {
6321  INTERESTING("Imlib2");
6322  }
6324  /*
6325  * Wide Open License (WOL)
6326  */
6327  if (INFILE(_TITLE_WOL) || INFILE(_URL_WOL)) {
6328  INTERESTING("WOL");
6329  }
6331  /*
6332  * naist-2003
6333  */
6334  if (INFILE(_LT_NAIST_2003) && HASTEXT(_TEXT_NAIST, 0)) {
6335  INTERESTING("naist-2003");
6336  }
6338  /*
6339  * EDL-1.0
6340  */
6341  if (INFILE(_TITLE_EDL_V10)) {
6342  INTERESTING("EDL-1.0");
6343  }
6345  /*
6346  * HSQLDB
6347  */
6348  if (INFILE(_LT_HSQLDB_1) || INFILE(_LT_HSQLDB_2) || INFILE(_LT_HSQLDB_3)) {
6349  INTERESTING("HSQLDB");
6350  }
6352  /*
6353  * Sony Computer Entertainment (SCEA) Shared Source License
6354  */
6355  if (INFILE(_TITLE_SCEA)) {
6356  INTERESTING("SCEA");
6357  }
6359  /*
6360  * OpenMap
6361  */
6362  if (INFILE(_TITLE_OPENMAP)) {
6363  INTERESTING("OpenMap");
6364  lmem[_fPDDL] = 1;
6365  }
6367  /*
6368  * ICU 1.8.1
6369  */
6370  if (INFILE(_LT_ICU_1) || INFILE(_TITLE_ICU) || INFILE(_SPDX_ICU)) {
6371  INTERESTING("ICU");
6372  }
6373  else if (INFILE(_PHR_ICU_1)) {
6374  INTERESTING("ICU");
6375  }
6377  /*
6378  * Ubuntu Font License
6379  */
6380  if (INFILE(_TITLE_UBUNTU_FONT)) {
6381  INTERESTING("ubuntu-font-1.0");
6382  lmem[_fPDDL] = 1;
6383  }
6385  /*
6386  * ODC Attribution License
6387  */
6388  if (INFILE(_LT_ODC)) {
6389  INTERESTING("ODC-By-1.0");
6390  pd = 0;
6391  }
6393  /*
6394  * Community Data License Agreement
6395  */
6396  if (INFILE(_TITLE_CDLA_Permissive_10)) {
6397  INTERESTING("CDLA-Permissive-1.0");
6398  }
6399  else if (INFILE(_TITLE_CDLA_Sharing_10)) {
6400  INTERESTING("CDLA-Sharing-1.0");
6401  }
6403  /*
6404  * Toolbar2000
6405  */
6406  if (INFILE(_TITLE_Toolbar2000) || INFILE(_URL_Toolbar2000)) {
6407  INTERESTING("Toolbar2000");
6408  }
6410  /*
6411  * unboundID-ldap-sdk
6412  */
6413  if (INFILE(_TITLE_unboundID_ldap_sdk) || INFILE(_LT_unboundID_ldap_sdk)) {
6414  INTERESTING("unboundID-ldap-sdk");
6415  }
6417  /*
6418  * BlueOak-1.0.0
6419  */
6420  if (INFILE(_TITLE_BlueOak_100) || URL_INFILE(_URL_BlueOak_100)) {
6421  INTERESTING("BlueOak-1.0.0");
6422  }
6423  else if (INFILE(_LT_BlueOak_100_Purpose) && INFILE(_LT_BlueOak_100_Acceptance)) {
6424  INTERESTING("BlueOak-1.0.0");
6425  }
6427  /*
6428  * CERN-OHL
6429  */
6430  if (INFILE(_TITLE_CERN_OHL_11)) {
6431  INTERESTING("CERN-OHL-1.1");
6432  }
6433  else if (INFILE(_TITLE_CERN_OHL_12)) {
6434  INTERESTING("CERN-OHL-1.2");
6435  }
6437  /*
6438  * MulanPSL
6439  */
6440  if (INFILE(_TITLE_MulanPSL_10) || URL_INFILE(_URL_MulanPSL) || INFILE(_LT_MulanPSL_10)) {
6441  INTERESTING("MulanPSL-1.0");
6442  }
6444  /*
6445  * SSH
6446  */
6447  if (INFILE(_LT_FREE_72) && HASTEXT(_LT_SSH, REG_EXTENDED)) {
6448  if (INFILE(_LT_SSH_OpenSSH)) {
6449  INTERESTING("SSH-OpenSSH");
6450  }
6451  else {
6452  INTERESTING("SSH-short");
6453  }
6454  }
6456 
6457  SPDXREF();
6459  EXCEPTIONS();
6461 
6462  /*
6463  * The Stallman paper "Why Software Should Be Free" is a red-herring.
6464  * His 1986 interview in Byte magazine also is, too.
6465  */
6466  if ((INFILE(_TITLE_RMS_WSSBF) && INFILE(_PHR_RMS1) &&
6467  INFILE(_PHR_RMS2)) || INFILE(_TITLE_RMS_BYTE86)) {
6468  if (lDiags) {
6469  printf("... RMS propaganda\n");
6470  }
6471  lmem[_fDOC] = 1;
6472  }
6474  /*
6475  * If there's a no-warranty statement in the file, remember the regex.
6476  * Ditto for phrase stating restrictions.
6477  */
6478  if (maxInterest != IL_HIGH) {
6479  for (i = 0; i < NNOWARRANTY; i++) {
6480  if (INFILE((j = _NO_WARRANTY_first+i))) {
6481  nw = j;
6482  break;
6483  }
6484  }
6485  }
6486  addLicence(cur.theMatches,"NoWarranty");
6487 
6488  /*
6489  * Statements about IP (Intellectual Property) rights
6490  */
6491  if (!lmem[_fIP] && INFILE(_LT_GEN_IP_1)) {
6492  INTERESTING(lDebug ? "IP(1)" : "IP-claim");
6493  }
6494  else if (!lmem[_fIP] && INFILE(_LT_GEN_IP_2) && NOT_INFILE(_TITLE_MIROS)) {
6495  INTERESTING(lDebug ? "IP(2)" : "IP-claim");
6496  }
6497  else if (!lmem[_fIP] && INFILE(_LT_GEN_IP_3)) {
6498  INTERESTING(lDebug ? "IP(3)" : "IP-claim");
6499  }
6501  /*
6502  * Dual licenses
6503  */
6504  if (INFILE(_LT_DUAL_LICENSE_0) && NOT_INFILE(_TITLE_NOSL)) {
6505  MEDINTEREST(lDebug ? "Dual-license(0)" : "Dual-license");
6506  }
6507  else if (INFILE(_LT_DUAL_LICENSE_22)) {
6508  MEDINTEREST(lDebug ? "Dual-license(22)" : "Dual-license");
6509  }
6510  else if (INFILE(_LT_DUAL_LICENSE_1) && NOT_INFILE(_TITLE_NOSL)) {
6511  MEDINTEREST(lDebug ? "Dual-license(1)" : "Dual-license");
6512  }
6513  else if (INFILE(_LT_DUAL_LICENSE_2)) {
6514  MEDINTEREST(lDebug ? "Dual-license(2)" : "Dual-license");
6515  }
6516  else if (INFILE(_LT_DUAL_LICENSE_3) && NOT_INFILE(_LT_DUAL_LICENSE_3_EXHIBIT)) {
6517  MEDINTEREST(lDebug ? "Dual-license(3)" : "Dual-license");
6518  }
6519  else if (INFILE(_LT_DUAL_LICENSE_4)) {
6520  MEDINTEREST(lDebug ? "Dual-license(4)" : "Dual-license");
6521  }
6522  else if (INFILE(_LT_DUAL_LICENSE_5)) {
6523  MEDINTEREST(lDebug ? "Dual-license(5)" : "Dual-license");
6524  }
6525  else if (INFILE(_LT_DUAL_LICENSE_6)) {
6526  MEDINTEREST(lDebug ? "Dual-license(6)" : "Dual-license");
6527  }
6528  else if (INFILE(_LT_DUAL_LICENSE_7)) {
6529  MEDINTEREST(lDebug ? "Dual-license(7)" : "Dual-license");
6530  }
6531  else if (INFILE(_LT_DUAL_LICENSE_8)) {
6532  MEDINTEREST(lDebug ? "Dual-license(8)" : "Dual-license");
6533  }
6534  else if (INFILE(_LT_DUAL_LICENSE_9)) {
6535  MEDINTEREST(lDebug ? "Dual-license(9)" : "Dual-license");
6536  }
6537  else if (INFILE(_LT_DUAL_LICENSE_10)) {
6538  MEDINTEREST(lDebug ? "Dual-license(10)" : "Dual-license");
6539  }
6540  else if (INFILE(_LT_DUAL_LICENSE_11)) {
6541  MEDINTEREST(lDebug ? "Dual-license(11)" : "Dual-license");
6542  }
6543  else if (INFILE(_LT_DUAL_LICENSE_12)) {
6544  MEDINTEREST(lDebug ? "Dual-license(12)" : "Dual-license");
6545  }
6546  else if (INFILE(_LT_DUAL_LICENSE_13)) {
6547  INTERESTING(lDebug ? "Dual-license(13)" : "Dual-license");
6548  INTERESTING("BSD");
6549  INTERESTING("MIT");
6550  /*
6551  * A special case for NomosTestfiles/Dual-license/respond.js
6552  * that has two dual-license statements.
6553  */
6554  if (!lmem[_mGPL]) {
6555  if (INFILE(_LT_DUAL_LICENSE_16)) {
6556  INTERESTING(lDebug ? "GPLV2(Dual-license(16))" : "GPL-2.0-only");
6557  }
6558  }
6559  }
6560  else if (INFILE(_LT_DUAL_LICENSE_14)) {
6561  INTERESTING(lDebug ? "Dual-license(14)" : "Dual-license");
6562  INTERESTING("BSD");
6563  if (!lmem[_mGPL]) {
6564  INTERESTING("GPL");
6565  }
6566  }
6567  else if (INFILE(_LT_DUAL_LICENSE_15)) {
6568  MEDINTEREST(lDebug ? "Dual-license(15)" : "Dual-license");
6569  }
6570  else if (INFILE(_LT_DUAL_LICENSE_16)) {
6571  INTERESTING(lDebug ? "Dual-license(16)" : "Dual-license");
6572  INTERESTING("MIT");
6573  INTERESTING(lDebug ? "GPLV2(Dual-license(16))" : "GPL-2.0-only");
6574  }
6575  else if (INFILE(_LT_DUAL_LICENSE_17)) {
6576  MEDINTEREST(lDebug ? "Dual-license(17)" : "Dual-license");
6577  }
6578  else if (INFILE(_LT_DUAL_LICENSE_18)) {
6579  MEDINTEREST(lDebug ? "Dual-license(18)" : "Dual-license");
6580  }
6581  else if (INFILE(_LT_DUAL_LICENSE_19)) {
6582  MEDINTEREST(lDebug ? "Dual-license(19)" : "Dual-license");
6583  }
6584  else if (INFILE(_LT_DUAL_LICENSE_20)) {
6585  MEDINTEREST(lDebug ? "Dual-license(20)" : "Dual-license");
6586  }
6587  else if (INFILE(_LT_DUAL_LICENSE_21)) {
6588  MEDINTEREST(lDebug ? "Dual-license(21)" : "Dual-license");
6589  }
6590  else if (INFILE(_LT_DUAL_LICENSE_23)) {
6591  MEDINTEREST(lDebug ? "Dual-license(23)" : "Dual-license");
6592  }
6593  else if (INFILE(_LT_DUAL_LICENSE_24)) {
6594  MEDINTEREST(lDebug ? "Dual-license(24)" : "Dual-license");
6595  }
6596  else if (INFILE(_LT_DUAL_LICENSE_25)) {
6597  MEDINTEREST(lDebug ? "Dual-license(25)" : "Dual-license");
6598  }
6599  else if (INFILE(_LT_DUAL_LICENSE_26)) {
6600  MEDINTEREST(lDebug ? "Dual-license(26)" : "Dual-license");
6601  }
6602  else if (INFILE(_LT_DUAL_LICENSE_27)) {
6603  MEDINTEREST(lDebug ? "Dual-license(27)" : "Dual-license");
6604  }
6605  else if (INFILE(_LT_DUAL_LICENSE_28)) {
6606  MEDINTEREST(lDebug ? "Dual-license(28)" : "Dual-license");
6607  }
6608  else if (INFILE(_LT_DUAL_LICENSE_29) && NOT_INFILE(_LT_MPL_SECONDARY_LICENSE)) {
6609  MEDINTEREST(lDebug ? "Dual-license(29)" : "Dual-license");
6610  }
6611  else if (INFILE(_LT_DUAL_LICENSE_30)) {
6612  MEDINTEREST(lDebug ? "Dual-license(30)" : "Dual-license");
6613  }
6614  else if (INFILE(_LT_DUAL_LICENSE_31)) {
6615  MEDINTEREST(lDebug ? "Dual-license(31)" : "Dual-license");
6616  }
6617  else if (INFILE(_LT_DUAL_LICENSE_32)) {
6618  MEDINTEREST(lDebug ? "Dual-license(32)" : "Dual-license");
6619  }
6620  else if (INFILE(_LT_DUAL_LICENSE_33)) {
6621  MEDINTEREST(lDebug ? "Dual-license(33)" : "Dual-license");
6622  }
6623  else if (INFILE(_LT_DUAL_LICENSE_34)) {
6624  MEDINTEREST(lDebug ? "Dual-license(34)" : "Dual-license");
6625  }
6626  else if (HASTEXT(_LT_DUAL_LICENSE_35, 0)) {
6627  MEDINTEREST(lDebug ? "Dual-license(35)" : "Dual-license");
6628  /*
6629  * GPL is not detected correctly in this case, therefore it is set here.
6630  */
6631  INTERESTING("GPL");
6632  }
6633  else if (INFILE(_LT_DUAL_LICENSE_36)) {
6634  MEDINTEREST(lDebug ? "Dual-license(36)" : "Dual-license");
6635  }
6636  else if (INFILE(_LT_DUAL_LICENSE_37)) {
6637  MEDINTEREST(lDebug ? "Dual-license(37)" : "Dual-license");
6638  }
6639  else if (INFILE(_LT_DUAL_LICENSE_38)) {
6640  MEDINTEREST(lDebug ? "Dual-license(38)" : "Dual-license");
6641  }
6642  else if (INFILE(_LT_DUAL_LICENSE_39)) {
6643  MEDINTEREST(lDebug ? "Dual-license(39)" : "Dual-license");
6644  }
6645  else if (INFILE(_LT_DUAL_LICENSE_40)) {
6646  MEDINTEREST(lDebug ? "Dual-license(40)" : "Dual-license");
6647  }
6648  else if (INFILE(_LT_DUAL_LICENSE_41)) {
6649  MEDINTEREST(lDebug ? "Dual-license(41)" : "Dual-license");
6650  }
6651  else if (INFILE(_LT_DUAL_LICENSE_42)) {
6652  MEDINTEREST(lDebug ? "Dual-license(42)" : "Dual-license");
6653  }
6654  else if (INFILE(_LT_DUAL_LICENSE_43)) {
6655  MEDINTEREST(lDebug ? "Dual-license(43)" : "Dual-license");
6656  }
6657  else if (HASTEXT(_LT_DUAL_LICENSE_44, 0)) {
6658  MEDINTEREST(lDebug ? "Dual-license(44)" : "Dual-license");
6659  }
6660  else if (INFILE(_LT_DUAL_LICENSE_45)) {
6661  MEDINTEREST(lDebug ? "Dual-license(45)" : "Dual-license");
6662  INTERESTING("MIT");
6663  }
6664  else if (HASTEXT(_LT_DUAL_LICENSE_46, REG_EXTENDED)) {
6665  MEDINTEREST(lDebug ? "Dual-license(46)" : "Dual-license");
6666  }
6667  else if (HASTEXT(_LT_DUAL_LICENSE_47, REG_EXTENDED) && NOT_INFILE(_LT_MPL_SECONDARY_LICENSE)) {
6668  MEDINTEREST(lDebug ? "Dual-license(47)" : "Dual-license");
6669  }
6670  else if (INFILE(_LT_DUAL_LICENSE_48)) {
6671  MEDINTEREST(lDebug ? "Dual-license(48)" : "Dual-license");
6672  }
6673  else if (HASTEXT(_LT_DUAL_LICENSE_49, REG_EXTENDED)) {
6674  MEDINTEREST(lDebug ? "Dual-license(49)" : "Dual-license");
6675  }
6677  /*
6678  * The Beer-ware license(!)
6679  */
6680  if (INFILE(_LT_BEERWARE)) {
6681  INTERESTING("Beerware");
6682  }
6684  /*
6685  * CMake license
6686  */
6687  if (URL_INFILE(_URL_CMAKE)) {
6688  INTERESTING("CMake");
6689  }
6691  /*
6692  * unRAR restriction
6693  */
6694  if (INFILE(_LT_UNRARref1) || INFILE(_LT_UNRARref2)) {
6695  INTERESTING("unRAR restriction");
6696  }
6698  /*
6699  * ANTLR Software Rights Notice
6700  */
6701  if (INFILE(_LT_ANTLR)) {
6702  INTERESTING("ANTLR-PD");
6703  lmem[_fANTLR] = 1;
6704  }
6706  /*
6707  * Creative Commons Zero v1.0 Universal
6708  */
6709  if (INFILE(_SPDX_CC0_10)) {
6710  INTERESTING("CC0-1.0");
6711  }
6712  else if (INFILE(_TITLE_CC0_10_1) || INFILE(_PHR_CC0_1) || INFILE(_PHR_CC0_2)) {
6713  INTERESTING("CC0-1.0");
6714  }
6715  else if (INFILE(_SPDX_CC0)) {
6716  INTERESTING("CC0");
6717  }
6719  /*
6720  * PA Font License (IPA)
6721  */
6722  if (INFILE(_TITLE_IPA)) {
6723  INTERESTING("IPA");
6724  }
6726  /*
6727  * European Union Public Licence
6728  */
6729  if (INFILE(_PHR_EUPL_10) || INFILE(_TITLE_EUPL_10)) {
6730  INTERESTING("EUPL-1.0");
6731  }
6732  else if (INFILE(_PHR_EUPL_11) || INFILE(_TITLE_EUPL_11)) {
6733  INTERESTING("EUPL-1.1");
6734  }
6735  else if (INFILE(_TITLE_EUPL_12)) {
6736  INTERESTING("EUPL-1.2");
6737  }
6738  else if (INFILE(_PHR_EUPL)) {
6739  INTERESTING("EUPL");
6740  }
6742  /* University of Illinois/NCSA Open Source License */
6743  if (!lmem[_fNCSA] && INFILE(_TITLE_NCSA) && NOT_INFILE(_TITLE_NCSA_EXHIBIT)) {
6744  INTERESTING(lDebug ? "NCSA(2)" : "NCSA");
6745  /* OZPLB-1.1 refers both to NCSA and OZPLB-1.1 licenses */
6746  if (INFILE(_TITLE_OZPLB_11)) {
6747  INTERESTING("OZPLB-1.1");
6748  }
6749  lmem[_fBSD] = 1;
6750  lmem[_mMIT] = 1;
6751  }
6753  /* ODC Public Domain Dedication & License 1.0 */
6754  if (INFILE(_TITLE_PDDL)) {
6755  INTERESTING("PDDL-1.0");
6756  lmem[_fPDDL] = 1;
6757  }
6759  /* PostgreSQL License */
6760  if (INFILE(_TITLE_POSTGRES) || INFILE(_TITLE_POSTGRES_1)) {
6761  INTERESTING("PostgreSQL");
6762  lmem[_fBSD] = 1;
6763  }
6765  /* Sax Public Domain Notice */
6766  if (INFILE(_LT_SAX_PD)) {
6767  INTERESTING("SAX-PD");
6768  lmem[_fSAX] = 1;
6769  }
6771  /*
6772  * WTF Public "license"
6773  */
6774  if (INFILE(_LT_WTFPL)) {
6775  INTERESTING("WTFPL");
6776  }
6777  else if (INFILE(_LT_WTFPLref)) {
6778  INTERESTING(lDebug ? "WTFPL(ref)" : "WTFPL");
6779  }
6780  else if (INFILE(_LT_WTFPLref_1)) {
6781  INTERESTING(lDebug ? "WTFPL(ref#1)" : "WTFPL");
6782  }
6783  else if (INFILE(_PHR_WTFPL)) {
6784  INTERESTING(lDebug ? "WTFPL(phr)" : "WTFPL");
6785  }
6787  /* Independent JPEG Group License */
6788  if (!lmem[_fIJG]) {
6789  if (HASTEXT(_PHR_IJG_1, REG_EXTENDED)) {
6790  INTERESTING("IJG");
6791  }
6792  else if (HASTEXT(_PHR_IJG_2, 0)) {
6793  INTERESTING("IJG");
6794  }
6795  else if (HASTEXT(_TITLE_IJG_1, 0) && !HASTEXT(_PHR_IJG_INTERFACE_1, 0) && !HASTEXT(_PHR_IJG_INTERFACE_2, 0)) {
6796  INTERESTING("IJG");
6797  }
6798  /* Independent JPEG Group can be referenced without IJG license*/
6799  else if (HASTEXT(_TITLE_IJG_2, 0) && !HASTEXT(_PHR_IJG_INTERFACE_1, 0) && !HASTEXT(_PHR_IJG_INTERFACE_2, 0)) {
6800  INTERESTING("IJG-possibility");
6801  }
6803  }
6804  /* Netizen Open Source License */
6805  if (!lmem[_mMPL] && INFILE(_TITLE_NOSL)) {
6806  INTERESTING(lDebug ? "NOSL(#2)" : "NOSL");
6807  }
6809  /* Net Boolean Public License v1 */
6810  if (INFILE(_TITLE_NBPL_V10)) {
6811  INTERESTING("NBPL-1.0");
6812  }
6814  /* Flora License */
6815  if (INFILE(_TITLE_Flora_V10)) {
6816  INTERESTING("Flora-1.0");
6817  }
6818  else if (INFILE(_TITLE_Flora_V11)) {
6819  INTERESTING("Flora-1.1");
6820  }
6821  else if (URL_INFILE(_URL_Flora)) {
6822  INTERESTING("Flora");
6823  }
6825  /* Standard ML of New Jersey License */
6826  if (INFILE(_TITLE_SMLNJ)) {
6827  INTERESTING("SMLNJ");
6828  }
6830  /* Mozilla Public License possibility */
6831  if (!lmem[_mMPL] && INFILE(_TEXT_MPLV2) && INFILE(_URL_MPL20)) {
6832  INTERESTING("MPL-2.0");
6833  lmem[_mMPL] = 1;
6834  }
6835  else if (!lmem[_mMPL] && URL_INFILE(_URL_MPL_LATEST)) {
6836  INTERESTING(lDebug ? "MPL(latest)" : "MPL");
6837  }
6839  /* Citrix License */
6840  if (INFILE(_TITLE_CITRIX)) {
6841  INTERESTING("Citrix");
6842  lmem[_fCITRIX] = 1;
6843  }
6845  /* CUA office public license */
6846  if (INFILE(_TITLE_CUA10)) {
6847  INTERESTING("CUA-OPL-1.0");
6848  }
6850  /* the Erlang Public License */
6851  if (INFILE(_TITLE_ERLPL_ref)) {
6852  INTERESTING("ErlPL-1.1");
6853  }
6855  /* German Free Software License */
6856  if (INFILE(_TITLE_D_FSL_10) || INFILE(_TITLE_D_FSL_DE1_10) || INFILE(_TITLE_D_FSL_DE2_10) || INFILE(_TITLE_D_FSL_DE3_10) || INFILE(_TITLE_D_FSL_DE4_10))
6857  {
6858  INTERESTING("D-FSL-1.0");
6859  lmem[_mGPL] = 1;
6860  }
6862  /* CCLRC License */
6863  if (INFILE(_TITLE_CCLRC)) {
6864  INTERESTING("CCLRC");
6865  }
6867 
6868  /* Some GPL cases are still missing */
6869  if (!lmem[_mGPL] && (INFILE(_LT_GPL_V2_ref) || INFILE(_LT_GPL_V2_ref1) || INFILE(_LT_GPL_V2_ref2) || INFILE(_LT_GPL_V2_ref3) || INFILE(_LT_GPL_V2_ref4)))
6870  {
6871  INTERESTING(lDebug ? "GPL_V2_ref" : "GPL-2.0-only");
6872  lmem[_mGPL] = 1;
6873  }
6874  else if (!lmem[_mGPL] && INFILE(_LT_GPL_V3_ref))
6875  {
6876  INTERESTING(lDebug ? "GPL_V3_ref" : "GPL-3.0-only");
6877  lmem[_mGPL] = 1;
6878  }
6879  else if (!lmem[_mGPL] && INFILE(_LT_GPLref22))
6880  {
6881  INTERESTING(lDebug ? "GPLref22" : "GPL");
6882  lmem[_mGPL] = 1;
6883  }
6884  else if (!lmem[_mGPL] && NOT_INFILE(_LT_IGNORE_CLAUSE_2) && INFILE(_LT_GPLref21))
6885  {
6886  INTERESTING(lDebug ? "GPLref21" : "GPL");
6887  lmem[_mGPL] = 1;
6888  }
6890 
6891  /* MX4J License version 1.0 */
6892  if (INFILE(_LT_MX4J_V10))
6893  {
6894  INTERESTING("MX4J-1.0");
6895  }
6896  else if (INFILE(_LT_MX4J))
6897  {
6898  INTERESTING("MX4J");
6899  }
6901  /* postfix license */
6902  if (INFILE(_TITLE_POSTFIX))
6903  {
6904  INTERESTING("Postfix");
6905  }
6907  /* not public domain */
6908  if (HASTEXT(_LT_PUBDOM_NOTclaim, REG_EXTENDED)) {
6909  if (INFILE(_LT_PUBDOM_CC)) {
6910  INTERESTING(lDebug ? "Pubdom(CC)" : "CC-PDDC");
6911  pd = 1;
6912  }
6913  else {
6914  INTERESTING(LS_NOT_PD);
6915  pd = 0;
6916  }
6917  }
6919  /* LIBGCJ license */
6920  if (INFILE(_LT_LIBGCJ))
6921  {
6922  INTERESTING("LIBGCJ");
6923  }
6925  /* open cascade technology public license */
6926  if (INFILE(_TITLE_OPEN_CASCADE))
6927  {
6928  INTERESTING("OpenCASCADE-PL");
6929  }
6931  /* KnowledgeTree Public License */
6932  if (INFILE(_LT_KnowledgeTree_V11))
6933  {
6934  INTERESTING("KnowledgeTree-1.1");
6935  }
6937  /* Interbase Public License */
6938  if (INFILE(_LT_Interbase_V10))
6939  {
6940  INTERESTING("Interbase-1.0");
6941  }
6943  /* ClearSilver license */
6944  if (INFILE(_LT_ClearSilver))
6945  {
6946  INTERESTING("ClearSilver");
6947  }
6949  /* ACE, TAO, CIAO */
6950  if(INFILE(_LT_ACE)) {
6951  INTERESTING("ACE");
6952  }
6953  else if(INFILE(_LT_FACE)) {
6954  INTERESTING("FaCE");
6955  }
6957  /* JISP */
6958  if(INFILE(_LT_JISP)) {
6959  INTERESTING("JISP");
6960  }
6962  /* Qmail */
6963  if(INFILE(_LT_QMAIL)) {
6964  INTERESTING("Qmail");
6965  }
6967  /* Migemo */
6968  if(INFILE(_LT_MIGEMO)) {
6969  INTERESTING("Migemo");
6970  }
6972  /* Sendmail */
6973  if(INFILE(_LT_Sendmail_title) ) {
6974  INTERESTING("Sendmail");
6975  }
6977  /* Giftware */
6978  if(INFILE(_LT_GIFTWARE)) {
6979  INTERESTING("Giftware");
6980  }
6982  /* Logica opensource */
6983  if(INFILE(_LT_LOGICA)) {
6984  INTERESTING("Logica-OSL-1.0");
6985  }
6987  /* Unidex */
6988  if(INFILE(_LT_UNIDEX)) {
6989  INTERESTING("Unidex");
6990  }
6992  /* TCL License */
6993  if (!lmem[_fTCL]) {
6994  if (INFILE(_TITLE_TCL)) {
6995  INTERESTING("TCL");
6996  }
6997  else if (INFILE(_SPDX_TCL)) {
6998  INTERESTING("TCL");
6999  }
7000  else if (INFILE(_LT_TCL)) {
7001  INTERESTING("TCL");
7002  }
7003  }
7005  /* AndroidSDK-Commercial license */
7006  if (INFILE(_LT_GOOGLE_SDK)) {
7007  INTERESTING("AndroidSDK.Commercial");
7008  }
7010  /* Qhull license */
7011  if (INFILE(_PHR_Qhull)) {
7012  INTERESTING("Qhull");
7013  }
7015  /* OZPLB-1.0 license */
7016  if (INFILE(_PHR_OZPLB_10)) {
7017  INTERESTING("OZPLB-1.0");
7018  }
7020 
7021  /*
7022  * Some licenses say "licensed under the same terms as FOO".
7023  */
7024  gl.flags |= FL_SAVEBASE; /* save match buffer (if any) */
7025  if (*licStr == NULL_CHAR) {
7026  i = 0;
7027  if (INFILE(_LT_SAME_LICENSE_1)) {
7028  INTERESTING(lDebug ? "Same-lic-1" : "Same-license-as");
7029  i = 1;
7030  } else if (INFILE(_LT_SAME_LICENSE_2)) {
7031  INTERESTING(lDebug ? "Same-lic-2" : "Same-license-as");
7032  i = 2;
7033  }
7034  if (i) {
7035  if (cur.licPara == NULL_STR) {
7036  saveLicenseParagraph(cur.matchBase, isML, isPS, NO);
7037  }
7038  }
7039  }
7041  gl.flags |= ~FL_SAVEBASE; /* turn off, regardless */
7042  /*
7043  * ... and, there are several generic claims that "you are free to use this
7044  * software".
7045  * We call these claims "Freeware", because you can use the software free of charge,
7046  * but some other copyright holder exclusive rights are not granted in some cases.
7047  */
7048  if (*licStr == NULL_CHAR || pd >= 0) {
7049  for (i = 0; i < NFREECLAIM; i++) {
7050  if (CANSKIP(i, _KW_permission, _FREE_first_perm,
7051  _FREE_last_perm)) {
7052  i = _FREE_last_perm;
7053  continue;
7054  }
7055  if (CANSKIP(i, _KW_distribut, _FREE_first_dist,
7056  _FREE_last_dist)) {
7057  i = _FREE_last_dist;
7058  continue;
7059  }
7060  if (INFILE(_FREECLAIM_first+i)) {
7061  (void) strcpy(name, "Freeware");
7062  if (lDebug) {
7063  (void) sprintf(name+8, "(%d)", i+1);
7064  }
7065  INTERESTING(name);
7066  break;
7067  }
7068  }
7069  }
7071  /* Check for Public Domain */
7072  if (!lmem[_fANTLR] && !lmem[_fCLA] && !lmem[_mPYTHON] && !lmem[_mGFDL] &&
7073  !lmem[_fODBL] && !lmem[_fPDDL] && !lmem[_fRUBY] && !lmem[_fSAX] && !lmem[_fAPL] && !lmem[_mAPACHE] && !lmem[_mAPACHE10] && !lmem[_mAPACHE11] &&
7074  !lmem[_fARTISTIC] && !lmem[_fCITRIX] && !lmem[_mLGPL] && !lmem[_fBSD]&& NOT_INFILE(_TITLE_D_FSL_10)
7075  && !INFILE(_LT_CPOL)) {
7076  pd = checkPublicDomain(filetext, size, score, kwbm, isML, isPS);
7077  }
7079  /*
7080  * Some licenses point you to files/URLs...
7081  */
7082  if (*licStr == NULL_CHAR) {
7083  checkFileReferences(filetext, size, score, kwbm, isML, isPS);
7084  }
7086  /*
7087  * And, If no other licenses are present but there's a reference to
7088  * something being non-commercial, better note it now.
7089  */
7090 #if 0
7091  if (*licStr == NULL_CHAR && !HASKW(kwbm, _KW_public_domain))
7092 #endif
7093  if (maxInterest != IL_HIGH && !HASKW(kwbm, _KW_public_domain) &&
7094  NOT_INFILE(_PHR_COMMERC_NONCOMM)) {
7095  if (INFILE(_LT_NONCOMMERCIAL_1)) {
7096  INTERESTING(lDebug ? "NonC(1)" : "Non-commercial");
7097  }
7098  else if (INFILE(_LT_ZZNON_COMMERC1)) {
7099  INTERESTING(lDebug ? "NonC(2)" : "Non-commercial");
7100  }
7101  else if (INFILE(_LT_ZZNON_COMMERC2)) {
7102  INTERESTING(lDebug ? "NonC(3)" : "Non-commercial");
7103  }
7104  else if (HASTEXT(_TEXT_COMMERC, 0) &&
7105  INFILE(_PHR_NONCOMMERCIAL)) {
7106  INTERESTING(lDebug ? "NonC(4)" : "Non-commercial");
7107  }
7108  }
7109  if (INFILE(_LT_NOT_OPENSOURCE)) {
7110  INTERESTING("Not-OpenSource");
7111  }
7112  listClear(&whereList, NO); /* again, clear "unused" matches */
7114  /*
7115  * Look for footprints that declare something as proprietary... if we such
7116  * a statement, we care about the Copyright owner, too.
7117  */
7118  if (maxInterest != IL_HIGH) { /* if (*licStr == NULL_CHAR) { */
7119  j = 0; /* just a flag */
7120  if (INFILE(_LT_GEN_PROPRIETARY_1)) {
7121  INTERESTING(lDebug ? "Prop(1)" : "COMMERCIAL");
7122  j++;
7123  }
7124  else if (INFILE(_LT_GEN_PROPRIETARY_2)) {
7125  INTERESTING(lDebug ? "Prop(2)" : "COMMERCIAL");
7126  j++;
7127  }
7128  else if (INFILE(_LT_GEN_PROPRIETARY_3)) {
7129  INTERESTING(lDebug ? "Prop(3)" : "COMMERCIAL");
7130  j++;
7131  }
7132  else if (INFILE(_LT_GEN_PROPRIETARY_4)) {
7133  INTERESTING(lDebug ? "Prop(4)" : "COMMERCIAL");
7134  j++;
7135  }
7136  else if (INFILE(_LT_GEN_PROPRIETARY_5)) {
7137  INTERESTING(lDebug ? "Prop(5)" : "COMMERCIAL");
7138  j++;
7139  }
7140  else if (INFILE(_LT_GEN_PROPRIETARY_6)) {
7141  INTERESTING(lDebug ? "Prop(6)" : "COMMERCIAL");
7142  j++;
7143  }
7144  else if (INFILE(_LT_GEN_PROPRIETARY_7)) {
7145  INTERESTING(lDebug ? "Prop(7)" : "COMMERCIAL");
7146  j++;
7147  }
7148  else if (INFILE(_LT_GEN_PROPRIETARY_8)) {
7149  INTERESTING(lDebug ? "Prop(8)" : "COMMERCIAL");
7150  j++;
7151  }
7152  if (j) {
7153  checkCornerCases(filetext, size, score, kwbm, isML,
7154  isPS, nw, YES);
7155  }
7156  }
7157  listClear(&whereList, NO); /* again, clear "unused" matches */
7159  /*
7160  * END of license-footprint checking of known patterns/strings
7161  ******
7162  * Plan-B: look for things attorneys generally believe aren't "overly
7163  * legally-binding" or "uninterestring from a license perspective':
7164  * ... notable references to commercial, non-commercial, not-for-profit,
7165  * not-an-open-source-license, etc.
7166  */
7167  if (maxInterest != IL_HIGH) {
7168  if (INFILE(_LT_COMMERCIAL_1)) {
7169  INTERESTING(lDebug ? "COMM(1)" : "COMMERCIAL");
7170  }
7171  else if (INFILE(_LT_COMMERCIAL_2)) {
7172  INTERESTING(lDebug ? "COMM(2)" : "COMMERCIAL");
7173  }
7174  else if (HASTEXT(_LT_COMMERCIAL_3, REG_EXTENDED)) {
7175  if (HASTEXT(_LT_COMMERCIAL_Intel, REG_EXTENDED)) {
7176  INTERESTING("Intel.Commercial");
7177  } else if (HASTEXT(_LT_COMMERCIAL_Broadcom, REG_EXTENDED)) {
7178  INTERESTING("Broadcom.Commercial");
7179  } else {
7180  INTERESTING(lDebug ? "COMM(3)" : "COMMERCIAL");
7181  }
7182  }
7183  else if (INFILE(_LT_COMMERCIAL_4)) {
7184  if (HASTEXT(_LT_COMMERCIAL_Android_Fraunhofer, 0)) {
7185  INTERESTING("AndroidFraunhofer.Commercial");
7186  } else {
7187  INTERESTING(lDebug ? "COMM(4)" : "COMMERCIAL");
7188  }
7189  }
7190  else if (HASTEXT(_TEXT_BOOK, 0) && INFILE(_LT_BOOKPURCHASE)) {
7191  INTERESTING(lDebug ? "PurchBook" : "COMMERCIAL");
7192  }
7193  else if (INFILE(_LT_COMMERCIAL_5)) {
7194  INTERESTING(lDebug ? "COMM(5)" : "COMMERCIAL");
7195  }
7196  else if (INFILE(_LT_COMMERCIAL_6)) {
7197  INTERESTING(lDebug ? "COMM(6)" : "COMMERCIAL");
7198  }
7199  else if (INFILE(_LT_COMMERCIAL_7)) {
7200  INTERESTING(lDebug ? "COMM(7)" : "COMMERCIAL");
7201  }
7202  if (INFILE(_LT_NONPROFIT_1)) {
7203  MEDINTEREST(lDebug ? "NonP(1)" : "Non-profit");
7204  }
7205  else if (!lmem[_mPYTH_TEXT] && HASTEXT(_TEXT_PROFIT, 0) &&
7206  INFILE(_PHR_NONPROFIT)) {
7207  if (!(lmem[_fIETF] + lmem[_fDOC])) {
7208  MEDINTEREST(lDebug ? "NonP(2)" : "Non-profit");
7209  }
7210  }
7211  if (INFILE(_PHR_NO_SALE)) {
7212  MEDINTEREST("Not-for-sale");
7213  }
7214  if (!lmem[_mALADDIN] && INFILE(_PHR_NOT_OPEN)) {
7215  MEDINTEREST("NOT-Open-Source");
7216  }
7217  if (HASKW(kwbm, _KW_patent) && INFILE(_PHR_PATENT) && NOT_INFILE(_PHR_PATENT_NOT)) {
7218  MEDINTEREST("Patent-ref");
7219  }
7220  if (INFILE(_PHR_RESTRICT_RIGHTS)) {
7221  if (INFILE(_PHR_USGOVT_RESTRICT)) {
7222  MEDINTEREST("Govt-restrict");
7223  }
7224  else {
7225  MEDINTEREST("Restricted-rights");
7226  }
7227  }
7228  if (INFILE(_LT_EXPORTS_USA)) {
7229  MEDINTEREST("US-Export-restrict");
7230  }
7231  if (pd < 0) {
7232  checkPublicDomain(filetext, size, score, kwbm, isML, isPS);
7233  }
7234  }
7235  listClear(&whereList, NO); /* again, clear "unused" matches */
7237  /*
7238  * These "minimal-reference possibilities" MUST adhere to a prescribed
7239  * format: the name to be used MUST be the first of several name to match:
7240  * "(NAME identifier|NAME license|license NAME)"
7241  *****
7242  * Furthermore, licenses should be ordered from the most-specific to the
7243  * least-specific; e.g., look for LGPL_v3 before looking for LGPL -- the
7244  * strGrep() calls below ensure reporting only more-specific license
7245  * versions if found. For instance, if you order LGPL *before* LGPL_v3
7246  * we'll get both LGPLv3 and LGPL, which is redundant AND looks stupid.
7247  */
7248  if (*licStr == NULL_CHAR && HASKW(kwbm, _KW_license)) {
7249  for (i = 0, j = _MINlicense_first; i < NMINlicense; i++, j++) {
7250  if (dbgIdxGrep(j, filetext, lDiags)) {
7251  cp = strchr(_REGEX(j), ' ');
7252  if (cp == NULL_STR) {
7253  Assert(NO, "Bad reference[1] %d", j);
7254  continue;
7255  }
7256  *cp = NULL_CHAR;
7257  if (!(*licStr) || !strGrep(_REGEX(j)+1, licStr,
7258  REG_ICASE)) {
7259  (void) sprintf(name, "%s-possibility",
7260  _REGEX(j)+1);
7261  LOWINTEREST(name);
7262  }
7263  *cp = ' ';
7264  }
7265  }
7266  }
7267  listClear(&whereList, NO); /* again, clear "unused" matches */
7269  if (*licStr == NULL_CHAR && HASTEXT(_TEXT_SOURCE, 0)) {
7270  for (i = 0, j = _MINsource_first; i < NMINsource; i++, j++) {
7271  if (dbgIdxGrep(j, filetext, lDiags)) {
7272  cp = strchr(_REGEX(j), ' ');
7273  if (cp == NULL_STR) {
7274  Assert(NO, "Bad reference[2] %d", j);
7275  continue;
7276  }
7277  *cp = NULL_CHAR;
7278  if (!(*licStr) || !strGrep(_REGEX(j)+1, licStr,
7279  REG_ICASE)) {
7280  (void) sprintf(name, "%s-possibility",
7281  _REGEX(j)+1);
7282  LOWINTEREST(name);
7283  }
7284  *cp = ' ';
7285  }
7286  }
7287  }
7288  listClear(&whereList, NO); /* again, clear "unused" matches */
7290  if (*licStr == NULL_CHAR && HASTEXT(_KW_copyright, 0)) {
7291  for (i = 0, j = _MINcpyrt_first; i < NMINcpyrt; i++, j++) {
7292  if (dbgIdxGrep(j, filetext, lDiags)) {
7293  cp = strchr(_REGEX(j), ' ');
7294  if (cp == NULL_STR) {
7295  Assert(NO, "Bad reference[2] %d", j);
7296  continue;
7297  }
7298  *cp = NULL_CHAR;
7299  if (!(*licStr) || !strGrep(_REGEX(j)+1, licStr,
7300  REG_ICASE)) {
7301  (void) sprintf(name, "%s-possibility",
7302  _REGEX(j)+1);
7303  LOWINTEREST(name);
7304  }
7305  *cp = ' ';
7306  }
7307  }
7308  }
7309  listClear(&whereList, NO); /* again, clear "unused" matches */
7311  /*
7312  * NOW look for unclassified licenses, if we haven't found anything yet.
7313  * And avoid checking .po files -- message catalogues are known to have
7314  * false-positives.
7315  *****
7316  * FIX-ME: if a file contains ONLY a "no warranty" description/clause, it
7317  * will (currently) get flagged as an UnclassifiedLicense (so the check
7318  * for no-warranty was moved ABOVE this check in case we can use that info)
7319  */
7320  if (maxInterest != IL_HIGH && !lmem[_fDOC]) {
7321  if (!pd &&
7322  checkUnclassified(filetext, size, scp->score, isML,
7323  isPS, nw)) {
7324  strcpy(name, LS_UNCL);
7325  if (isPS) {
7326  strcat(name, "(PS)");
7327  }
7328  MEDINTEREST(name);
7329  checkCornerCases(filetext, size, score, kwbm, isML, isPS, nw, YES);
7330  }
7331 #ifdef UNKNOWN_CHECK_DEBUG
7332  else {
7333  printf("... NOT an Unclassified license, NW %d PD %d\n",
7334  nw, pd);
7335  }
7336 #endif /* UNKNOWN_CHECK_DEBUG */
7337  }
7338  listClear(&whereList, NO); /* clear "unused" matches */
7340  /*
7341  * If we still haven't found anything, check for the really-low interest
7342  * items such as copyrights, and references to keywords (patent/trademark)
7343  */
7344  if (maxInterest != IL_HIGH && pd <= 0) {
7345  checkCornerCases(filetext, size, score, kwbm, isML, isPS,
7346  nw, NO);
7347  }
7348 #ifdef MEMSTATS
7349  printf("DEBUG: static lists in parseLicenses():\n");
7350  listDump(&searchList, -1);
7351  memStats("parseLicenses: pre-Free");
7352 #endif /* MEMSTATS */
7353  listClear(&searchList, NO);
7354 #ifdef MEMSTATS
7355  memStats("parseLicenses: EOP");
7356 #endif /* MEMSTATS */
7357 #ifdef LTSR_DEBUG
7358  showLTCache("LTSR-results AFTER:");
7359 #endif /* LTSR_DEBUG */
7360 #ifdef FLAG_NO_COPYRIGHT
7361  if (!SEEN(_CR_ZZZANY)) {
7362  (void) INFILE(_CR_ZZZANY);
7363  }
7364  if (!SEEN(_CR_ZZZWRONG_1)) {
7365  (void) INFILE(_CR_ZZZWRONG_1);
7366  }
7367  if (LVAL(_CR_ZZZANY)+LVAL(_CR_ZZZWRONG_1)+
7368  HASREGEX(_CR_ZZZWRONG_2, filetext) == 0) {
7369  gl.flags |= FL_NOCOPYRIGHT;
7370  }
7371 #endif /* FLAG_NO_COPYRIGHT */
7372  listClear(&whCacheList, NO);
7373  if (whereList.used) {
7374  listClear(&whereList, NO); /* may already be cleared! */
7375  }
7376  return(licStr+1); /* don't include the leading comma */
7377 }
7378 
7387 char *sisslVersion(char *filetext, int size, int isML, int isPS)
7388 {
7389  char *lstr = NULL_STR;
7390 
7391 #ifdef PROC_TRACE
7392  traceFunc("== sisslVersion()\n");
7393 #endif /* PROC_TRACE */
7394 
7395  if (INFILE(_TITLE_SISSL_V11)) {
7396  lstr = "SISSL-1.1";
7397  }
7398  else if (INFILE(_TITLE_SISSL_V12)) {
7399  lstr = "SISSL-1.2";
7400  } else {
7401  lstr = "SISSL";
7402  }
7403  return lstr;
7404 }
7405 
7414 char *aslVersion(char *filetext, int size, int isML, int isPS)
7415 {
7416  char *lstr = NULL_STR;
7417 
7418 #ifdef PROC_TRACE
7419  traceFunc("== aslVersion()\n");
7420 #endif /* PROC_TRACE */
7421 
7422  /*
7423  * Exclude first non-Apache licenses
7424  */
7425  if (INFILE(_TITLE_PHORUM) || INFILE(_CR_PHORUM)) {
7426  lstr = "Phorum";
7427  lmem[_mAPACHE] = 1;
7428  }
7429  else if (INFILE(_CR_IMAGEMAGICK)) {
7430  lstr = "ImageMagick(Apache)";
7431  lmem[_mAPACHE] = 1;
7432  }
7433  /*
7434  * Apache-2.0 cases
7435  */
7436  else if (INFILE(_SPDX_Apache_20)) {
7437  lstr = (lDebug ? "Apache-2.0(SPDX)" : "Apache-2.0");
7438  lmem[_mAPACHE] = 1;
7439  }
7440  else if (INFILE(_TITLE_Apache_20)) {
7441  lstr = (lDebug ? "Apache-2(f)" : "Apache-2.0");
7442  lmem[_mAPACHE] = 1;
7443  }
7444  else if (INFILE(_PHR_Apache_20_ref1) || INFILE(_PHR_Apache_20_ref2) || INFILE(_PHR_Apache_20_ref3))
7445  {
7446  lstr = (lDebug ? "PHR_Apache_20_ref(1-5)" : "Apache-2.0");
7447  lmem[_mAPACHE] = 1;
7448  }
7449  else if (URL_INFILE(_URL_Apache_20)) {
7450  lstr = (lDebug ? "Apache-2.0(u)" : "Apache-2.0");
7451  lmem[_mAPACHE] = 1;
7452  }
7453  else if (INFILE(_LT_Apache_20) && NOT_INFILE(_TITLE_Flora_V10) && NOT_INFILE(_TITLE_Flora_V11) && !URL_INFILE(_URL_Flora))
7454  {
7455  lstr = (lDebug ? "Apache(2.0#2)" : "Apache-2.0");
7456  lmem[_mAPACHE] = 1;
7457  }
7458  else if (INFILE(_PHR_Apache_20_ref4) || INFILE(_PHR_Apache_20_ref5) || INFILE(_PHR_Apache_20_ref6) || INFILE(_PHR_Apache_20_ref7)) {
7459  lstr = (lDebug ? "Apache(2.0#3)" : "Apache-2.0");
7460  lmem[_mAPACHE] = 1;
7461  }
7462  else if (INFILE(_TITLE_Apache_20)) {
7463  lstr = (lDebug ? "Apache(2.0#4)" : "Apache-2.0");
7464  lmem[_mAPACHE] = 1;
7465  }
7466  else if (URL_INFILE(_URL_Apache_20_1)) {
7467  lstr = (lDebug ? "Apache2(url#1)" : "Apache-2.0");
7468  lmem[_mAPACHE] = 1;
7469  }
7470  else if (URL_INFILE(_URL_Apache_20_2)) {
7471  lstr = (lDebug ? "Apache2(url#2)" : "Apache-2.0");
7472  lmem[_mAPACHE] = 1;
7473  }
7474  /*
7475  * Apache-1.1 cases
7476  */
7477  else if (INFILE(_SPDX_Apache_11)) {
7478  lstr = (lDebug ? "Apache-1.1(SPDX)" : "Apache-1.1");
7479  lmem[_mAPACHE11] = 1;
7480  }
7481  else if (INFILE(_TITLE_Apache_11)) {
7482  lstr = (lDebug ? "Apache-1.1(f)" : "Apache-1.1");
7483  lmem[_mAPACHE11] = 1;
7484  }
7485  else if (URL_INFILE(_URL_Apache_11)) {
7486  lstr = (lDebug ? "Apache-1.1(u)" : "Apache-1.1");
7487  lmem[_mAPACHE11] = 1;
7488  }
7489  else if (INFILE(_LT_Apache_11_CLAUSE_3) && INFILE(_LT_Apache_11_CLAUSE_4) && INFILE(_LT_Apache_11_CLAUSE_5)) {
7490  lstr = (lDebug ? "Apache-1.1(clauses)" : "Apache-1.1");
7491  lmem[_mAPACHE11] = 1;
7492  }
7493  else if (INFILE(_PHR_Apache_11_ref1)) {
7494  lstr = (lDebug ? "Apache(1.1#phr)" : "Apache-1.1");
7495  lmem[_mAPACHE11] = 1;
7496  }
7497  /*
7498  * Apache-1.0 cases
7499  */
7500  else if (INFILE(_SPDX_Apache_10)) {
7501  lstr = (lDebug ? "Apache-1.0(SPDX)" : "Apache-1.0");
7502  lmem[_mAPACHE10] = 1;
7503  }
7504  else if (INFILE(_PHR_Apache_ref2)) {
7505  lstr = (lDebug ? "Apache-1.0(f)" : "Apache-1.0");
7506  lmem[_mAPACHE10] = 1;
7507  }
7508  else if (INFILE(_LT_Apache_10_CLAUSE_4)) {
7509  lstr = (lDebug ? "Apache-1.0(g)" : "Apache-1.0");
7510  lmem[_mAPACHE10] = 1;
7511  }
7512  else if (URL_INFILE(_URL_Apache_10)) {
7513  lstr = (lDebug ? "Apache-1.0(u)" : "Apache-v1.0");
7514  lmem[_mAPACHE10] = 1;
7515  }
7516  /*
7517  * BSD-style cases
7518  */
7519  else if (INFILE(_LT_BSD_1)) {
7520  if (INFILE(_CR_APACHE) || INFILE(_TITLE_Apache)) {
7521  if (INFILE(_PHR_Apache_20_ref6)) {
7522  lstr = (lDebug ? "Apache-20_ref6" : "Apache-2.0");
7523  lmem[_mAPACHE] = 1;
7524  }
7525  else if (INFILE(_PHR_Apache_11_ref2)) {
7526  lstr = (lDebug ? "Apache(1.1#2)" : "Apache-1.1");
7527  lmem[_mAPACHE11] = 1;
7528  }
7529  else if ((INFILE(_PHR_Apache_ref2) || INFILE(_LT_Apache_10_CLAUSE_4))) {
7530  lstr = (lDebug ? "Apache(1.0#2)" : "Apache-1.0");
7531  lmem[_mAPACHE10] = 1;
7532  }
7533  else {
7534  lstr = (lDebug ? "Apache(title)" : "Apache");
7535  lmem[_mAPACHE] = 1;
7536  }
7537  }
7538  }
7539  /*
7540  * Apache without versions
7541  */
7542  else if (!lmem[_fREAL] && INFILE(_SPDX_Apache)) {
7543  lstr = (lDebug ? "Apache(SPDX)" : "Apache");
7544  lmem[_mAPACHE] = 1;
7545  }
7546  else if (INFILE(_PHR_Apache_ref1)) {
7547  INTERESTING(lDebug ? "Apache(ref#1)" : "Apache");
7548  lmem[_mAPACHE] = 1;
7549  }
7550  else if (INFILE(_PHR_Apache_ref4)) {
7551  lstr = (lDebug ? "Apache(ref#3)" : "Apache");
7552  lmem[_mAPACHE] = 1;
7553  }
7554  else if (INFILE(_PHR_Apache_ref3)) {
7555  lstr = (lDebug ? "Apache(ref#4)" : "Apache");
7556  lmem[_mAPACHE] = 1;
7557  }
7558  else if (URL_INFILE(_URL_Apache_1)) {
7559  lstr = (lDebug ? "Apache(url#1)" : "Apache");
7560  lmem[_mAPACHE] = 1;
7561  }
7562  else if (URL_INFILE(_URL_Apache_2)) {
7563  lstr = (lDebug ? "Apache(url#2)" : "Apache");
7564  lmem[_mAPACHE] = 1;
7565  }
7566  else if (INFILE(_PHR_Apache_ref6)) {
7567  lstr = (lDebug ? "Apache(ref#6)" : "Apache");
7568  lmem[_mAPACHE] = 1;
7569  }
7570  /*
7571  * _LT_Apache_1 and _2 cannot be identified in any Apache license
7572  * versions. They have been defined in very early nomos versions. They
7573  * are kept here, although, there are no special test cases for them.
7574  */
7575  else if (INFILE(_LT_Apache_1)) {
7576  lstr = (lDebug ? "Apache(1)" : "Apache");
7577  lmem[_mAPACHE] = 1;
7578  }
7579  else if (INFILE(_LT_Apache_2)) {
7580  lstr = (lDebug ? "Apache(2)" : "Apache");
7581  lmem[_mAPACHE] = 1;
7582  }
7583  else if (INFILE(_LT_APACHESTYLEref)) {
7584  lstr = ("Apache-style");
7585  lmem[_mAPACHE] = 1;
7586  }
7587  return lstr;
7588 }
7589 
7598 char *mplNplVersion(char *filetext, int size, int isML, int isPS)
7599 {
7600  char *lstr = NULL_STR;
7601 
7602 #ifdef PROC_TRACE
7603  traceFunc("== mplNplVersion()\n");
7604 #endif /* PROC_TRACE */
7605 
7606  if (INFILE(_TITLE_MPL11_OR_LATER)) {
7607  lstr = "MPL-1.1+";
7608  }
7609  else if (INFILE(_LT_MPL11_ref)) {
7610  lstr = "MPL-1.1";
7611  }
7612  else if (INFILE(_TITLE_NPL11_MPL)) {
7613  lstr = "NPL-1.1";
7614  }
7615  else if (INFILE(_TITLE_MPL11) && INFILE(_TITLE_MPL_style)) {
7616  lstr = "MPL-1.1-style";
7617  }
7618  else if (INFILE(_TITLE_SUGARCRM_PL)) {
7619  lstr = "SugarCRM-1.1.3";
7620  lmem[_mMPL] = 1;
7621  lmem[_fATTRIB] = 1;
7622  }
7623  else if (INFILE(_TITLE_MPL11) && !HASTEXT(_LT_NP_AME, REG_EXTENDED)) {
7624  lstr = "MPL-1.1";
7625  }
7626  else if (INFILE(_TITLE_MPL20_EXCEPTION)) {
7627  lstr = "MPL-2.0-no-copyleft-exception";
7628  }
7629  else if (INFILE(_TITLE_MPL20) || URL_INFILE(_URL_MPL20) || HASTEXT(_LT_MPL20_ref, REG_EXTENDED)) {
7630  lstr = "MPL-2.0";
7631  }
7632  else if (INFILE(_TITLE_MPL10) && INFILE(_TITLE_ERLPL)) {
7633  lstr = "ErlPL-1.1";
7634  }
7635  else if (INFILE(_TITLE_MPL10)) {
7636  lstr = "MPL-1.0";
7637  }
7638  else if (INFILE(_TITLE_MPL_EULA_30)) {
7639  lstr = "MPL-EULA-3.0";
7640  }
7641  else if (INFILE(_TITLE_MPL_EULA_20)) {
7642  lstr = "MPL-EULA-2.0";
7643  }
7644  else if (INFILE(_TITLE_MPL_EULA_11)) {
7645  lstr = "MPL-EULA-1.1";
7646  }
7647  else if (URL_INFILE(_URL_NPL10)) {
7648  lstr = (lDebug ? "NPL1.0(url)" : "NPL-1.0");
7649  }
7650  else if (URL_INFILE(_URL_NPL11)) {
7651  lstr = (lDebug ? "NPL1.1(url)" : "NPL-1.1");
7652  }
7653  else if (URL_INFILE(_URL_MPL10)) {
7654  lstr = (lDebug ? "MPL1.0(url)" : "MPL-1.0");
7655  }
7656  else if (URL_INFILE(_URL_MPL11)) {
7657  lstr = (lDebug ? "MPL1.1(url)" : "MPL-1.1");
7658  }
7659  else if (INFILE(_FILE_MPL10)) {
7660  lstr = (lDebug ? "MPL1.0(file)" : "MPL-1.0");
7661  }
7662  else if (INFILE(_FILE_MPL11)) {
7663  lstr = (lDebug ? "MPL1.1(file)" : "MPL-1.1");
7664  }
7665  else if (INFILE(_TITLE_NPL11_OR_LATER)) {
7666  lstr = "NPL-1.1+";
7667  }
7668  else if (INFILE(_TITLE_NPL11)) {
7669  lstr = "NPL-1.1";
7670  }
7671  else if (INFILE(_TITLE_NPL10)) {
7672  lstr = "NPL-1.0";
7673  }
7674  else if (URL_INFILE(_URL_NPL)) {
7675  lstr = (lDebug ? "NPL(url)" : "NPL");
7676  }
7677  else if (INFILE(_SPDX_MPL_10)) {
7678  lstr = "MPL-1.0";
7679  }
7680  else if (INFILE(_SPDX_MPL_11)) {
7681  lstr = "MPL-1.1";
7682  }
7683  else if (INFILE(_SPDX_MPL_20_no_copyleft_exception)) {
7684  lstr = "MPL-2.0-no-copyleft-exception";
7685  }
7686  else if (INFILE(_SPDX_MPL_20)) {
7687  lstr = "MPL-2.0";
7688  }
7689  else if (URL_INFILE(_URL_MPL_LATEST)) {
7690  lstr = (lDebug ? "MPL(latest)" : "MPL");
7691  }
7692  else if (URL_INFILE(_URL_MPL)) {
7693  lstr = (lDebug ? "MPL(url)" : "MPL");
7694  }
7695  else if (INFILE(_TITLE_NPL)) {
7696  lstr = "NPL";
7697  }
7698  else if (INFILE(_TITLE_MPL)) {
7699  lstr = "MPL";
7700  }
7701  else {
7702  lstr = (lDebug ? "MPL(last)" : "MPL");
7703  }
7704  return lstr;
7705 }
7706 
7715 char *realVersion(char *filetext, int size, int isML, int isPS, int ref)
7716 {
7717  char *lstr = NULL_STR;
7718 
7719 #ifdef PROC_TRACE
7720  traceFunc("== realVersion()\n");
7721 #endif /* PROC_TRACE */
7722 
7723  if (ref == _TITLE_RPSL) {
7724  if (INFILE(_TITLE_RPSL_V30)) {
7725  lstr = "RPSL-3.0";
7726  }
7727  else if (INFILE(_TITLE_RPSL_V20)) {
7728  lstr = "RPSL-2.0";
7729  }
7730  else if (INFILE(_TITLE_RPSL_V10)) {
7731  lstr = "RPSL-1.0";
7732  }
7733  else if (INFILE(_TITLE_RPSL)) {
7734  lstr = "RPSL";
7735  }
7736  }
7737  else if (ref == _TITLE_RCSL) {
7738  if (INFILE(_TITLE_RCSL_V30)) {
7739  lstr = "RCSL-3.0";
7740  }
7741  else if (INFILE(_TITLE_RCSL_V20)) {
7742  lstr = "RCSL-2.0";
7743  }
7744  else if (INFILE(_TITLE_RCSL_V10)) {
7745  lstr = "RCSL-1.0";
7746  }
7747  else if (INFILE(_TITLE_RCSL)) {
7748  lstr = "RCSL";
7749  }
7750  }
7751  else {
7752  lstr = "RealNetworks-Unknown";
7753  }
7754  return lstr;
7755 }
7756 
7765 char *pythonVersion(char *filetext, int size, int isML, int isPS)
7766 {
7767  char *lstr = NULL_STR;
7768 
7769 #ifdef PROC_TRACE
7770  traceFunc("== pythonVersion()\n");
7771 #endif /* PROC_TRACE */
7772 
7773  if (INFILE(_TITLE_PYTHON201)) {
7774  lstr = "Python-2.0.1";
7775  }
7776  else if (INFILE(_TITLE_PYTHON202)) {
7777  lstr = "Python-2.0.2";
7778  }
7779  else if (INFILE(_TITLE_PYTHON211)) {
7780  lstr = "Python-2.1.1";
7781  }
7782  else if (INFILE(_TITLE_PYTHON213)) {
7783  lstr = "Python-2.1.3";
7784  }
7785  else if (INFILE(_TITLE_PYTHON223)) {
7786  lstr = "Python-2.2.3";
7787  }
7788  else if (INFILE(_TITLE_PYTHON227)) {
7789  lstr = "Python-2.2.7";
7790  }
7791  else if (INFILE(_TITLE_PYTHON237)) {
7792  lstr = "Python-2.3.7";
7793  }
7794  else if (INFILE(_TITLE_PYTHON244)) {
7795  lstr = "Python-2.4.4";
7796  }
7797  else if (INFILE(_TITLE_PYTHON22)) {
7798  lstr = "Python-2.2";
7799  }
7800  else if (INFILE(_TITLE_PYTHON23)) {
7801  lstr = "Python-2.3";
7802  }
7803  else if (INFILE(_TITLE_PYTHON_20_1) || INFILE(_TITLE_PYTHON_20_2)) {
7804  lstr = "Python-2.0";
7805  }
7806  else {
7807  lstr = "Python";
7808  }
7809  return lstr;
7810 }
7811 
7820 char *aflVersion(char *filetext, int size, int isML, int isPS)
7821 {
7822  char *lstr = NULL_STR;
7823 
7824 #ifdef PROC_TRACE
7825  traceFunc("== aflVersion()\n");
7826 #endif /* PROC_TRACE */
7827 
7828  if (INFILE(_TITLE_AFL30)) {
7829  lstr = lDebug? "AFL(v3.0#1)" : "AFL-3.0";
7830  }
7831  else if (INFILE(_TITLE_AFL21)) {
7832  lstr = lDebug? "AFL(v2.1#1)" : "AFL-2.1";
7833  }
7834  else if (INFILE(_TITLE_AFL20)) {
7835  lstr = lDebug? "AFL(v2.0#1)" : "AFL-2.0";
7836  }
7837  else if (INFILE(_TITLE_AFL12)) {
7838  lstr = lDebug? "AFL(v1.2#1)" : "AFL-1.2";
7839  }
7840  else if (INFILE(_TITLE_AFL11)) {
7841  lstr = lDebug? "AFL(v1.1#1)" : "AFL-1.1";
7842  }
7843  else if (INFILE(_TITLE_AFL10)) {
7844  lstr = lDebug? "AFL(v1.0#1)" : "AFL-1.0";
7845  }
7846  else {
7847  lstr = "AFL";
7848  }
7849  return lstr;
7850 }
7851 
7860 char *oslVersion(char *filetext, int size, int isML, int isPS)
7861 {
7862  char *lstr = NULL_STR;
7863  /* */
7864 #ifdef PROC_TRACE
7865  traceFunc("== oslVersion()\n");
7866 #endif /* PROC_TRACE */
7867  /* */
7868  if (INFILE(_TITLE_NON_PROFIT_OSL30)) {
7869  lstr = "NPOSL-3.0";
7870  }
7871  else if (INFILE(_TITLE_OSL30)) {
7872  lstr = lDebug? "OSL(v3.0#1)" : "OSL-3.0";
7873  }
7874  else if (INFILE(_TITLE_OSL21)) {
7875  lstr = lDebug? "OSL(v2.1#1)" : "OSL-2.1";
7876  }
7877  else if (INFILE(_TITLE_OSL20)) {
7878  lstr = lDebug? "OSL(v2.0#1)" : "OSL-2.0";
7879  }
7880  else if (INFILE(_TITLE_OSL11)) {
7881  lstr = lDebug? "OSL(v1.1#1)" : "OSL-1.1";
7882  }
7883  else if (INFILE(_TITLE_OSL10)) {
7884  lstr = lDebug? "OSL(v1.0#1)" : "OSL-1.0";
7885  }
7886  else {
7887  lstr = "OSL";
7888  }
7889  return lstr;
7890 }
7891 
7900 char *cddlVersion(char *filetext, int size, int isML, int isPS)
7901 {
7902  char *lstr = NULL_STR;
7903  /* */
7904 #ifdef PROC_TRACE
7905  traceFunc("== cddlVersion()\n");
7906 #endif /* PROC_TRACE */
7907  /* */
7908  if (INFILE(_TITLE_CDDL_10)) {
7909  lstr = "CDDL-1.0";
7910  }
7911  else if (INFILE(_SPDX_CDDL_10)) {
7912  INTERESTING("CDDL-1.0");
7913  }
7914  else if (URL_INFILE(_URL_CDDL_10)) {
7915  lstr = "CDDL-1.0";
7916  }
7917  else if (INFILE(_TITLE_CDDL_11)) {
7918  lstr = "CDDL-1.1";
7919  }
7920  else if (INFILE(_SPDX_CDDL_11)) {
7921  INTERESTING("CDDL-1.1");
7922  }
7923  else if (URL_INFILE(_URL_CDDL)) {
7924  lstr = "CDDL";
7925  }
7926  else {
7927  lstr = "CDDL";
7928  }
7929  return lstr;
7930 }
7931 
7940 char *lpplVersion(char *filetext, int size, int isML, int isPS)
7941 {
7942  char *lstr = NULL_STR;
7943  /* */
7944 #ifdef PROC_TRACE
7945  traceFunc("== lpplVersion()\n");
7946 #endif /* PROC_TRACE */
7947  /* */
7948  if (INFILE(_PHR_LATEX_PL13A_OR_LATER_1) ||
7949  INFILE(_PHR_LATEX_PL13A_OR_LATER_2)) {
7950  if (INFILE(_LT_LATEX_PREAMBLE)) {
7951  lstr = lDebug ? "LPPL-v1.3a(#1)" : "LPPL-1.3a";
7952  }
7953  else {
7954  lstr = "LPPL-1.3a+";
7955  }
7956  }
7957  else if (INFILE(_TITLE_LATEX_PL13A) || INFILE(_PHR_LATEX_PL13A)) {
7958  lstr = lDebug ? "LPPL-v1.3a(#2)" : "LPPL-1.3a";
7959  }
7960  else if (INFILE(_PHR_LATEX_PL13B_OR_LATER_1) ||
7961  INFILE(_PHR_LATEX_PL13B_OR_LATER_2)) {
7962  if (INFILE(_LT_LATEX_PREAMBLE)) {
7963  lstr = lDebug ? "LPPL-v1.3b(#1)" : "LPPL-1.3b";
7964  }
7965  else {
7966  lstr = "LPPL-1.3b+";
7967  }
7968  }
7969  else if (INFILE(_TITLE_LATEX_PL13B) || INFILE(_PHR_LATEX_PL13B)) {
7970  lstr = lDebug ? "LPPL-v1.3b(#2)" : "LPPL-1.3b";
7971  }
7972  else if (INFILE(_PHR_LATEX_PL13C_OR_LATER_1) ||
7973  INFILE(_PHR_LATEX_PL13C_OR_LATER_2)) {
7974  if (INFILE(_LT_LATEX_PREAMBLE)) {
7975  lstr = lDebug ? "LPPL-v1.3c(#1)" : "LPPL-1.3c";
7976  }
7977  else {
7978  lstr = "LPPL-1.3c+";
7979  }
7980  }
7981  else if (INFILE(_TITLE_LATEX_PL13C) || INFILE(_PHR_LATEX_PL13C)) {
7982  lstr = lDebug ? "LPPL-v1.3c(#2)" : "LPPL-1.3c";
7983  }
7984  else if (INFILE(_PHR_LATEX_PL13_OR_LATER_1) ||
7985  INFILE(_PHR_LATEX_PL13_OR_LATER_2)) {
7986  if (INFILE(_LT_LATEX_PREAMBLE)) {
7987  lstr = lDebug ? "LPPL-v1.3(#1)" : "LPPL-1.3";
7988  }
7989  else {
7990  lstr = "LPPL-1.3+";
7991  }
7992  }
7993  else if (INFILE(_TITLE_LATEX_PL13) || INFILE(_PHR_LATEX_PL13)) {
7994  lstr = lDebug ? "LPPL-v1.3(#2)" : "LPPL-1.3";
7995  }
7996  else if (INFILE(_PHR_LATEX_PL12_OR_LATER_1) ||
7997  INFILE(_PHR_LATEX_PL12_OR_LATER_2)) {
7998  if (INFILE(_LT_LATEX_PREAMBLE)) {
7999  lstr = lDebug ? "LPPL-v1.2(#1)" : "LPPL-1.2";
8000  }
8001  else {
8002  lstr = "LPPL-1.2+";
8003  }
8004  }
8005  else if (INFILE(_TITLE_LATEX_PL12) || INFILE(_PHR_LATEX_PL12)) {
8006  lstr = lDebug ? "LPPL-v1.2(#2)" : "LPPL-1.2";
8007  }
8008  else if (INFILE(_PHR_LATEX_PL11_OR_LATER_1) ||
8009  INFILE(_PHR_LATEX_PL11_OR_LATER_2)) {
8010  if (INFILE(_LT_LATEX_PREAMBLE)) {
8011  lstr = lDebug ? "LPPL-v1.1(#1)" : "LPPL-1.1";
8012  }
8013  else {
8014  lstr = "LPPL-1.1+";
8015  }
8016  }
8017  else if (INFILE(_TITLE_LATEX_PL11) || INFILE(_PHR_LATEX_PL11)) {
8018  lstr = lDebug ? "LPPL-v1.1(#2)" : "LPPL-1.1";
8019  }
8020  else if (INFILE(_PHR_LATEX_PL10_OR_LATER_1) ||
8021  INFILE(_PHR_LATEX_PL10_OR_LATER_2)) {
8022  if (INFILE(_LT_LATEX_PREAMBLE)) {
8023  lstr = lDebug ? "LPPL-v1.0(#1)" : "LPPL-1.0";
8024  }
8025  else {
8026  lstr = "LPPL-1.0+";
8027  }
8028  }
8029  else if (INFILE(_TITLE_LATEX_PL10) || INFILE(_PHR_LATEX_PL10)) {
8030  lstr = lDebug ? "LPPL-v1.0(#2)" : "LPPL-1.0";
8031  }
8032  else {
8033  lstr = "LPPL";
8034  }
8035  return lstr;
8036 }
8037 
8046 char *agplVersion(char *filetext, int size, int isML, int isPS)
8047 {
8048  char *lstr = NULL_STR;
8049  /* */
8050 #ifdef PROC_TRACE
8051  traceFunc("== agplVersion()\n");
8052 #endif /* PROC_TRACE */
8053  /* */
8054  /*
8055  * Look for version 1 BEFORE version 3; the text of version 1 license says
8056  * you can also license it under GPL version 3... same reasoning goes with
8057  * the actual v3 license (vs the reference).
8058  */
8059  if (INFILE(_PHR_AGPL_10_or_later)
8060  || INFILE(_TITLE_AGPL_10_or_later)
8061  || INFILE(_SPDX_AGPL_10_or_later)
8062  || HASTEXT(_SPDX_AGPL_10plus, REG_EXTENDED)
8063  || HASTEXT(_PHR_AGPL_10plus, REG_EXTENDED))
8064  {
8065  lstr = "AGPL-1.0-or-later";
8066  }
8067  else if (INFILE(_PHR_FSF_V1_ONLY)
8068  || INFILE(_TITLE_AGPL_10_only)
8069  || INFILE(_SPDX_AGPL_10))
8070  {
8071  lstr = "AGPL-1.0-only";
8072  }
8073  else if (INFILE(_PHR_AGPL_30_or_later)
8074  || INFILE(_TITLE_AGPL_30_or_later_ref1)
8075  || INFILE(_TITLE_AGPL_30_or_later)
8076  || INFILE(_SPDX_AGPL_30_or_later)
8077  || HASTEXT(_SPDX_AGPL_30plus, REG_EXTENDED)
8078  || HASTEXT(_PHR_AGPL_30plus, REG_EXTENDED))
8079  {
8080  if (INFILE(_LT_AGPL_30)) {
8081  lstr = lDebug ? "Affero-v3(#1)" : "AGPL-3.0-only";
8082  }
8083  else {
8084  lstr = "AGPL-3.0-or-later";
8085  }
8086  }
8087  else if (HASTEXT(_PHR_AGPL_30_1, REG_EXTENDED) || INFILE(_SPDX_AGPL_30)) {
8088  lstr = "AGPL-3.0-only";
8089  }
8090  else if (GPL_INFILE(_PHR_FSF_V3_ONLY)) {
8091  if (INFILE(_TITLE_GPL3)) {
8092  lstr = lDebug ? "GPLv3(Affero#1)" : "GPL-3.0-only";
8093  }
8094  else if (INFILE(_LT_GPL3ref3)){
8095  lstr = lDebug ? "GPLv3(special)" : "GPL-3.0-only";
8096  }
8097  else {
8098  lstr = lDebug ? "Affero-v3(#2)" : "AGPL-3.0-only";
8099  }
8100  }
8101  else if (INFILE(_TITLE_AGPL_30_only)) {
8102  lstr = lDebug ? "Affero-v3(#3)" : "AGPL-3.0-only";
8103  }
8104  else if (INFILE(_TITLE_GPL3)) {
8105  lstr = lDebug ? "GPLv3(Affero#2)" : "GPL-3.0-only";
8106  }
8107  else if (URL_INFILE(_URL_AGPL3)) {
8108  lstr = lDebug ? "Affero-v3(url)" : "AGPL-3.0-only";
8109  }
8110  else {
8111  lstr = "AGPL";
8112  }
8113  return lstr;
8114 }
8115 
8124 char *gfdlVersion(char *filetext, int size, int isML, int isPS)
8125 {
8126  char *lstr = NULL_STR;
8127  /* */
8128 #ifdef PROC_TRACE
8129  traceFunc("== gfdlVersion()\n");
8130 #endif /* PROC_TRACE */
8131  /* */
8132  /*
8133  * Have to be careful here; the text of the 1.2 license says it's licensed
8134  * under 1.1 or later - have to be careful what we're looking for, and in a
8135  * specific order
8136  */
8137  if (INFILE(_TITLE_GFDL_V13_FULL_LICENSE)) {
8138  lstr = "GFDL-1.3";
8139  /* Full GFDL-1.3 license text has a reference to Creative Commons */
8140  if (HASTEXT(_LT_CC_ref, REG_EXTENDED)) {
8141  lmem[_fCCBY] = 1;
8142  }
8143  }
8144  else if (INFILE(_TITLE_GFDL_V13_OR_LATER)) {
8145  lstr = "GFDL-1.3-or-later";
8146  }
8147  else if (INFILE(_TITLE_GFDL_V13_ONLY)) {
8148  lstr = lDebug ? "GFDL-1.3(#1)" : "GFDL-1.3";
8149  }
8150  else if (INFILE(_TITLE_GFDL_V12_FULL_LICENSE)) {
8151  lstr = lDebug ? "GFDL-1.2-only(#1)" : "GFDL-1.2-only";
8152  }
8153  else if (INFILE(_PHR_FSF_V12_OR_LATER) ||
8154  INFILE(_TITLE_GFDL_V12_OR_LATER)) {
8155  lstr = "GFDL-1.2-or-later";
8156  }
8157  else if (INFILE(_TITLE_GFDL_V12_ONLY)) {
8158  lstr = lDebug ? "GFDL-1.2-only(#1)" : "GFDL-1.2-only";
8159  }
8160  else if (INFILE(_TITLE_GFDL_V11_FULL_LICENSE)) {
8161  lstr = lDebug ? "GFDL-1.1-only(#1)" : "GFDL-1.1-only";
8162  }
8163  else if (INFILE(_PHR_FSF_V11_OR_LATER) ||
8164  INFILE(_TITLE_GFDL_V11_OR_LATER)) {
8165  lstr = "GFDL-1.1-or-later";
8166  }
8167  else if (INFILE(_TITLE_GFDL_V11_ONLY)) {
8168  lstr = lDebug ? "GFDL-1.1-only(#1)" : "GFDL-1.1-only";
8169  }
8170  else if (INFILE(_PHR_FSF_V12_ONLY)) {
8171  lstr = lDebug ? "GFDL-1.2-only(#2)" : "GFDL-1.2-only";
8172  }
8173  else if (INFILE(_PHR_FSF_V11_ONLY)) {
8174  lstr = lDebug ? "GFDL-1.1-only(#2)" : "GFDL-1.1-only";
8175  }
8176  else {
8177  lstr = "GFDL";
8178  }
8179  return lstr;
8180 }
8181 
8190 char *lgplVersion(char *filetext, int size, int isML, int isPS)
8191 {
8192  char *lstr = NULL_STR;
8193  /* */
8194 #ifdef PROC_TRACE
8195  traceFunc("== lgplVersion()\n");
8196 #endif /* PROC_TRACE */
8197  /* */
8198  if ((INFILE(_PHR_LGPL21_OR_LATER_1)
8199  || INFILE(_PHR_LGPL21_OR_LATER_2)
8200  || HASTEXT(_PHR_LGPL21_OR_LATER_3, REG_EXTENDED)
8201  || HASTEXT(_PHR_LGPL21_OR_LATER_4, REG_EXTENDED))
8202  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
8203  {
8204  if (INFILE(_TITLE_LGPL_KDE)) {
8205  lstr = "LGPL-2.1-or-later-KDE-exception";
8206  }
8207  else {
8208  lstr = "LGPL-2.1-or-later";
8209  }
8210  }
8211  else if ((INFILE(_PHR_LGPL3_OR_LATER)
8212  || INFILE(_PHR_LGPL3_OR_LATER_ref1)
8213  || INFILE(_PHR_LGPL3_OR_LATER_ref2)
8214  || HASTEXT(_PHR_LGPL3_OR_LATER_ref3, REG_EXTENDED)
8215  || HASTEXT(_SPDX_LGPL_30plus, REG_EXTENDED)
8216  || HASTEXT(_PHR_LGPL_30plus, REG_EXTENDED))
8217  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
8218  {
8219  lstr = "LGPL-3.0-or-later";
8220  }
8221  else if (INFILE(_LT_LGPL3ref) && NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
8222  lstr = "LGPL-3.0-only";
8223  lmem[_mLGPL] = 1;
8224  }
8225  else if (GPL_INFILE(_PHR_LGPL3_ONLY)
8226  || INFILE(_FILE_LGPLv3)
8227  || GPL_INFILE(_PHR_LGPL3_ONLY_ref1)
8228  || GPL_INFILE(_PHR_LGPL3_ONLY_ref2))
8229  {
8230  lstr = "LGPL-3.0-only";
8231  }
8232  else if (INFILE(_PHR_LGPL21_ONLY)
8233  || INFILE(_FILE_LGPLv21)
8234  || URL_INFILE(_URL_LGPL_V21)
8235  || INFILE(_PHR_LGPL21_ONLY_ref)
8236  || INFILE(_PHR_LGPL21_ONLY_ref2)
8237  || INFILE(_PHR_LGPL21_ONLY_ref3)
8238  || INFILE(_PHR_LGPL21_ONLY_ref4))
8239  {
8240  lstr = "LGPL-2.1-only";
8241  }
8242  else if ((INFILE(_PHR_LGPL2_OR_LATER)
8243  || HASTEXT(_PHR_LGPL2_OR_LATER_2, REG_EXTENDED)
8244  || HASTEXT(_PHR_LGPL2_OR_LATER_3, REG_EXTENDED))
8245  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
8246  {
8247  lstr = "LGPL-2.0-or-later";
8248  }
8249  else if (RM_INFILE(_PHR_LGPL2_ONLY) || RM_INFILE(_PHR_LGPL2_ONLY_ref1) || INFILE(_FILE_LGPLv2)) {
8250  lstr = "LGPL-2.0-only";
8251  }
8252  else if (INFILE(_PHR_LGPL1_OR_LATER) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8253  lstr = "LGPL-1.0-or-later";
8254  }
8255  else if (INFILE(_PHR_LGPL1_ONLY) || INFILE(_PHR_FSF_V1_ONLY)) {
8256  lstr = "LGPL-1.0-only";
8257  }
8258  else if (URL_INFILE(_URL_CCLGPL_V21)) {
8259  lstr = lDebug ? "CC-LGPL-2.1" : "LGPL-2.1-only";
8260  }
8261  else if (INFILE(_LT_CC_GPL) || INFILE(_TITLE_CC_LGPL)) {
8262  lstr = "CC-LGPL";
8263  }
8264  else if (NY_INFILE(_TEXT_LGPLV3) && NOT_INFILE(_TEXT_LGPLV3_FOOTNOTE) &&
8265  HASREGEX(_TEXT_LGPLV3, filetext)) {
8266  lstr = lDebug ? "LGPL-v3(#2)" : "LGPL-3.0-only";
8267  }
8268  else if (INFILE(_TEXT_LGPLV21) &&
8269  HASREGEX(_TEXT_LGPLV21, filetext)) {
8270  lstr = lDebug ? "LGPL-v2.1(#2)" : "LGPL-2.1-only";
8271  }
8272  else if (INFILE(_TEXT_LGPLV2) &&
8273  HASREGEX(_TEXT_LGPLV2, filetext)) {
8274  lstr = lDebug ? "LGPL-v2(#2)" : "LGPL-2.0-only";
8275  }
8276  else if (INFILE(_SPDX_LGPL_20)) {
8277  lstr = "LGPL-2.0-only";
8278  }
8279  else if (INFILE(_SPDX_LGPL_21)) {
8280  lstr = "LGPL-2.1-only";
8281  }
8282  else if (INFILE(_SPDX_LGPL_30)) {
8283  lstr = "LGPL-3.0-only";
8284  }
8285  else {
8286  lstr = "LGPL";
8287  }
8288  return lstr;
8289 }
8290 
8299 char *gplVersion(char *filetext, int size, int isML, int isPS)
8300 {
8301  char *cp, *lstr = NULL_STR;
8302  /* */
8303 #ifdef PROC_TRACE
8304  traceFunc("== gplVersion()\n");
8305 #endif /* PROC_TRACE */
8306  /* */
8307 
8308  /*
8309  * GPL-3.0-only cases
8310  */
8311  if (GPL_INFILE(_PHR_GPL3_OR_LATER_ref2)
8312  || GPL_INFILE(_PHR_GPL3_OR_LATER_ref3)
8313  || GPL_INFILE(_PHR_GPL3_OR_LATER)
8314  || GPL_INFILE(_PHR_GPL3_OR_LATER_ref1)
8315  || HASTEXT(_SPDX_GPL_30plus, REG_EXTENDED)
8316  || HASTEXT(_PHR_GPL_30plus, REG_EXTENDED))
8317  {
8318  if (!HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8319  lstr = "GPL-3.0-or-later";
8320  if (INFILE(_PHR_GPL2_OR_LATER_1)) {
8321  lstr = "GPL-2.0-or-later,GPL-3.0-or-later";
8322  }
8323  }
8324  }
8325  else if (GPL_INFILE(_PHR_FSF_V3_ONLY)
8326  || GPL_INFILE(_PHR_GPL3_ONLY)
8327  || INFILE(_FILE_GPLv3)
8328  || GPL_INFILE(_PHR_GPL3_ONLY_ref1)
8329  || GPL_INFILE(_PHR_GPL3_ONLY_ref2)) {
8330  lstr = lDebug ? "GPL-v3(#2)" : "GPL-3.0-only";
8331  if (INFILE(_PHR_GPL2_OR_LATER_1))
8332  {
8333  lstr = "GPL-2.0-or-later,GPL-3.0-only";
8334  }
8335  }
8336  else if (NY_INFILE(_TEXT_GPLV3) && NOT_INFILE(_TEXT_GPLV3_FOOTNOTE) &&
8337  HASREGEX(_TEXT_GPLV3, filetext)) {
8338  lstr = lDebug ? "GPL-v3(#3)" : "GPL-3.0-only";
8339  }
8340  /*
8341  * GPL-2.0-only cases
8342  */
8343  else if (HASTEXT(_LT_GPL_V2_NAMED_later, REG_EXTENDED) || INFILE(_TITLE_GPL2_ref1_later)) {
8344  lstr = lDebug ? "GPLV2+(named)" : "GPL-2.0-or-later";
8345  }
8346  else if (HASTEXT(_SPDX_GPL_20_or_later, REG_EXTENDED)) {
8347  lstr = lDebug ? "GPL-2.0-or-later(SPDX)" : "GPL-2.0-or-later";
8348  }
8349  else if (INFILE(_PHR_GPL2_OR_LATER_1)) {
8350  if (INFILE(_TITLE_GPL_KDE)) {
8351  lstr = "GPL-2.0-or-laterKDEupgradeClause";
8352  }
8353  else if (INFILE(_PHR_GPL2_ONLY_2) || INFILE(_PHR_GPL2_ONLY_3)) {
8354  lstr = "GPL-2.0-only";
8355  }
8356  else if (!HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8357  lstr = lDebug ? "PHR(GPL2_OR_LATER#3)" : "GPL-2.0-or-later";
8358  }
8359  else if (INFILE(_TITLE_GPL2_ref1) || INFILE(_TITLE_GPL2_ref2)) {
8360  lstr = lDebug ? "GPL-2.0-only(title)" : "GPL-2.0-only";
8361  }
8362  }
8363  else if (HASTEXT(_SPDX_GPL_20, REG_EXTENDED)) {
8364  lstr = lDebug ? "GPL-2.0-only(SPDX)" : "GPL-2.0-only";
8365  }
8366  else if (INFILE(_PHR_GPL2_ONLY_4)) {
8367  lstr = "GPL-2.0-only";
8368  }
8369  else if (INFILE(_PHR_GPL2_ONLY_5)) {
8370  lstr = "GPL-2.0-only";
8371  }
8372  else if (GPL_INFILE(_PHR_GPL2_OR_GPL3)) {
8373  lstr = "GPL-2.0-only,GPL-3.0-only";
8374  }
8375  else if (INFILE(_PHR_FSF_V2_ONLY) || INFILE(_PHR_GPL2_ONLY) || INFILE(_PHR_GPL2_ONLY_1) ||
8376  INFILE(_FILE_GPLv2) || INFILE(_LT_GPL_V2_NAMED)) {
8377  lstr = lDebug ? "GPL-v2(#2)" : "GPL-2.0-only";
8378  }
8379  else if (INFILE(_LT_GPL_V2_ref5)) {
8380  lstr = lDebug ? "GPL-2.0-only(ref5)" : "GPL-2.0-only";
8381  }
8382  else if (NY_INFILE(_TEXT_GPLV2)) {
8383  lstr = lDebug ? "GPL-v2(#3)" : "GPL-2.0-only";
8384  }
8385  /*
8386  * GPL-1.0-only cases
8387  */
8388  else if (GPL_INFILE(_PHR_FSF_V1_OR_LATER)
8389  || INFILE(_PHR_GPL1_OR_LATER)
8390  || HASTEXT(_SPDX_GPL_10plus, REG_EXTENDED)
8391  || HASTEXT(_PHR_GPL_10plus, REG_EXTENDED))
8392  {
8393  if (INFILE(_TITLE_GPL1)) {
8394  lstr = lDebug ? "GPL-v1(#1)" : "GPL-1.0-only";
8395  }
8396  else if (!HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8397  lstr = "GPL-1.0-or-later";
8398  }
8399  }
8400  else if (INFILE(_PHR_FSF_V1_ONLY) || INFILE(_PHR_GPL1_ONLY)) {
8401  lstr = lDebug ? "GPL-v1(#2)" : "GPL-1.0-only";
8402  }
8403  else if (URL_INFILE(_URL_CCGPL_V2)) {
8404  lstr = "GPL-2.0-only";
8405  }
8406  else if (INFILE(_LT_CC_GPL) || INFILE(_TITLE_CC_GPL)) {
8407  lstr = lDebug ? "GPL(CC_GPL)" : "GPL";
8408  }
8409  else if (NY_INFILE(_TEXT_GPLV1) &&
8410  HASREGEX(_TEXT_GPLV1, filetext)) {
8411  lstr = lDebug ? "GPL-v1(#3)" : "GPL-1.0-only";
8412  }
8413  else if (HASTEXT(_SPDX_GPL_10, REG_EXTENDED)) {
8414  lstr = lDebug ? "GPL-1.0-only(SPDX)" : "GPL-1.0-only";
8415  }
8416  else if (HASTEXT(_SPDX_GPL_30, REG_EXTENDED)) {
8417  lstr = lDebug ? "GPL-3.0-only(SPDX)" : "GPL-3.0-only";
8418  }
8419  /* special case for Debian copyright files
8420  Moved from the beginning here under else if ... is this anymore needed
8421  */
8422  else if (INFILE(_TEXT_GPLV3_CR) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8423  lstr = "GPL-3.0-only";
8424  }
8425  else if (INFILE(_FILE_GPL1) || INFILE(_FILE_GPL2)) {
8426  lstr = lDebug ? "GPL(deb)" : "GPL";
8427  }
8428  /*
8429  * MODULE("GPL") cannot be unambiguously interpreted as GPL-2.0-only
8430  * license. Same statement is used also outside Linux kernel.
8431  * Furthermore, many of the files which have this MODULE statement,
8432  * have explicit GPL license statement. Therefore this is changed
8433  * to GPL.
8434  */
8435  else if (INFILE(_TITLE_MODULE_LICENSE_GPL)) {
8436  lstr = lDebug ? "GPL(linux-kernel)" : "GPL";
8437  }
8438  /*
8439  * Finally let's see if there is a type error in license version
8440  */
8441  else if (INFILE(_PHR_GPL21_OR_LATER) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8442  lstr = "GPL-2.1+[sic]";
8443  }
8444  else if (INFILE(_PHR_FSF_V21_ONLY) || INFILE(_PHR_GPL21_ONLY)) {
8445  lstr = lDebug ? "GPL-v2.1[sic]" : "GPL-2.1[sic]";
8446  }
8447  /*
8448  * Special case, HACK: "Debian packaging ... licensed under GPL"
8449  *****
8450  * IF we've scanned the regex that might contain it, then kludge.buf != NULL.
8451  * Make darn sure that pointer IS set to NULL before leaving this routine.
8452  */
8453  if (lstr == NULL_STR && kludge.base != NULL_STR) {
8454 #ifdef PHRASE_DEBUG
8455  printf("GPL-META-CHECK: base %p, so %d eo %d\n",
8456  kludge.base, kludge.sso, kludge.seo);
8457 #endif /* PHRASE_DEBUG */
8458  cp = kludge.base + (kludge.sso < 256 ? 0 : kludge.sso-256);
8459  if (HASREGEX(_LT_GPL_META_DEBIAN, cp)) {
8460  lstr = "GPL-Meta";
8461  }
8462  kludge.base = NULL_STR;
8463  }
8464  if (lstr == NULL_STR && NOT_INFILE(_PHR_JYTHON_NOTGPL) && !HASTEXT(_TITLE_QT_GPL_EXCEPTION_10, 0) && !HASTEXT(_LT_OPENBSD_GPL_EXCEPTION, 0)) {
8465  lstr = lDebug ? "GPL(NULL)" : "GPL";
8466  }
8467  return lstr;
8468 }
8469 
8478 char *cplVersion(char *filetext, int size, int isML, int isPS)
8479 {
8480  char *lstr = NULL_STR;
8481  /* */
8482 #ifdef PROC_TRACE
8483  traceFunc("== cplVersion()\n");
8484 #endif /* PROC_TRACE */
8485  /* */
8486  if (INFILE(_TITLE_CPL_10)) {
8487  lstr = "CPL-1.0";
8488  }
8489  else if (URL_INFILE(_URL_CPL_10)) {
8490  lstr = "CPL-1.0";
8491  }
8492  else if (INFILE(_TITLE_CPL_05)) {
8493  lstr = "CPL-0.5";
8494  }
8495  else {
8496  lstr = "CPL";
8497  }
8498  return lstr;
8499 }
8500 
8509 char *ccVersion(char *filetext, int size, int isML, int isPS)
8510 {
8511  char *lstr = NULL_STR;
8512  /* */
8513 #ifdef PROC_TRACE
8514  traceFunc("== ccVersion()\n");
8515 #endif /* PROC_TRACE */
8516  /*
8517  * Creative Commons Attribution-ShareAlike
8518  */
8519  if (INFILE(_TITLE_CC_BY_SA_10) || URL_INFILE(_URL_CC_BY_SA_10)) {
8520  lstr = "CC-BY-SA-1.0";
8521  }
8522  else if (INFILE(_TITLE_CC_BY_SA_20) || URL_INFILE(_URL_CC_BY_SA_20)) {
8523  lstr = "CC-BY-SA-2.0";
8524  }
8525  else if (INFILE(_TITLE_CC_BY_SA_25) || URL_INFILE(_URL_CC_BY_SA_25)) {
8526  lstr = "CC-BY-SA-2.5";
8527  }
8528  else if (INFILE(_TITLE_CC_BY_SA_30) || URL_INFILE(_URL_CC_BY_SA_30)) {
8529  lstr = "CC-BY-SA-3.0";
8530  }
8531  else if (INFILE(_PHR_CC_BY_SA_30)) {
8532  lstr = "CC-BY-SA-3.0";
8533  }
8534  else if (INFILE(_TITLE_CC_BY_SA_40) || URL_INFILE(_URL_CC_BY_SA_40)) {
8535  lstr = "CC-BY-SA-4.0";
8536  }
8537  else if (URL_INFILE(_URL_CC_BY_SA_20)) {
8538  lstr = "CC-BY-SA-2.0";
8539  }
8540  else if (INFILE(_TITLE_CC_BY_SA) || URL_INFILE(_URL_CC_BY_SA)) {
8541  lstr = lDebug ? "CCA-SA(1)" : "CC-BY-SA";
8542  }
8543  /*
8544  * Creative Commons Attribution-NonCommercial-ShareAlike
8545  */
8546  else if (INFILE(_TITLE_CC_BY_NC_SA_40) || URL_INFILE(_URL_CC_BY_NC_SA_40)) {
8547  lstr = "CC-BY-NC-SA-4.0";
8548  }
8549  else if (INFILE(_TITLE_CC_BY_NC_SA_30) || URL_INFILE(_URL_CC_BY_NC_SA_30)) {
8550  lstr = "CC-BY-NC-SA-3.0";
8551  }
8552  else if (INFILE(_TITLE_CC_BY_NC_SA_25) || URL_INFILE(_URL_CC_BY_NC_SA_25)) {
8553  lstr = "CC-BY-NC-SA-2.5";
8554  }
8555  else if (INFILE(_TITLE_CC_BY_NC_SA_20) || URL_INFILE(_URL_CC_BY_NC_SA_20)) {
8556  lstr = "CC-BY-NC-SA-2.0";
8557  }
8558  else if (INFILE(_TITLE_CC_BY_NC_SA_10) || URL_INFILE(_URL_CC_BY_NC_SA_10)) {
8559  lstr = "CC-BY-NC-SA-1.0";
8560  }
8561  /*
8562  * Creative Commons NonCommercial NoDerivs
8563  */
8564  else if (INFILE(_TITLE_CC_BY_NC_ND_40) || URL_INFILE(_URL_CC_BY_NC_ND_40)) {
8565  lstr = "CC-BY-NC-ND-4.0";
8566  }
8567  else if (INFILE(_TITLE_CC_BY_NC_ND_30) || URL_INFILE(_URL_CC_BY_NC_ND_30)) {
8568  lstr = "CC-BY-NC-ND-3.0";
8569  }
8570  else if (INFILE(_TITLE_CC_BY_NC_ND_25) || URL_INFILE(_URL_CC_BY_NC_ND_25)) {
8571  lstr = "CC-BY-NC-ND-2.5";
8572  }
8573  else if (INFILE(_TITLE_CC_BY_NC_ND_20) || URL_INFILE(_URL_CC_BY_NC_ND_20)) {
8574  lstr = "CC-BY-NC-ND-2.0";
8575  }
8576  else if (INFILE(_TITLE_CC_BY_NC_ND_10) || INFILE(_TITLE_CC_BY_NC_ND_10_1) || URL_INFILE(_URL_CC_BY_NC_ND_10)) {
8577  lstr = "CC-BY-NC-ND-1.0";
8578  }
8579  /*
8580  * Creative Commons NonCommercial
8581  */
8582  else if (INFILE(_TITLE_CC_BY_NC_40) || URL_INFILE(_URL_CC_BY_NC_40)) {
8583  lstr = "CC-BY-NC-4.0";
8584  }
8585  else if (INFILE(_TITLE_CC_BY_NC_30) || URL_INFILE(_URL_CC_BY_NC_30)) {
8586  lstr = "CC-BY-NC-3.0";
8587  }
8588  else if (INFILE(_TITLE_CC_BY_NC_25) || URL_INFILE(_URL_CC_BY_NC_25)) {
8589  lstr = "CC-BY-NC-2.5";
8590  }
8591  else if (INFILE(_TITLE_CC_BY_NC_20) || URL_INFILE(_URL_CC_BY_NC_20)) {
8592  lstr = "CC-BY-NC-2.0";
8593  }
8594  else if (INFILE(_TITLE_CC_BY_NC_10) || URL_INFILE(_URL_CC_BY_NC_10)) {
8595  lstr = "CC-BY-NC-1.0";
8596  }
8597  /*
8598  * Creative Commons Attribution-NoDerivatives
8599  */
8600  else if (INFILE(_TITLE_CC_BY_ND_40) || URL_INFILE(_URL_CC_BY_ND_40)) {
8601  lstr = "CC-BY-ND-4.0";
8602  }
8603  else if (INFILE(_TITLE_CC_BY_ND_30) || URL_INFILE(_URL_CC_BY_ND_30)) {
8604  lstr = "CC-BY-ND-3.0";
8605  }
8606  else if (INFILE(_TITLE_CC_BY_ND_25) || URL_INFILE(_URL_CC_BY_ND_25)) {
8607  lstr = "CC-BY-ND-2.5";
8608  }
8609  else if (INFILE(_TITLE_CC_BY_ND_20) || URL_INFILE(_URL_CC_BY_ND_20)) {
8610  lstr = "CC-BY-ND-2.0";
8611  }
8612  else if (INFILE(_TITLE_CC_BY_ND_10) || URL_INFILE(_URL_CC_BY_ND_10)) {
8613  lstr = "CC-BY-ND-1.0";
8614  }
8615  /*
8616  * Creative Commons Attribution
8617  */
8618  else if (INFILE(_TITLE_CC_BY_10) || URL_INFILE(_URL_CC_BY_10)) {
8619  lstr = "CC-BY-1.0";
8620  }
8621  else if (INFILE(_TITLE_CC_BY_20) || URL_INFILE(_URL_CC_BY_20)) {
8622  lstr = "CC-BY-2.0";
8623  }
8624  else if (INFILE(_TITLE_CC_BY_25) || URL_INFILE(_URL_CC_BY_25)) {
8625  lstr = "CC-BY-2.5";
8626  }
8627  else if (INFILE(_TITLE_CC_BY_30) || URL_INFILE(_URL_CC_BY_30)) {
8628  lstr = "CC-BY-3.0";
8629  }
8630  else if (INFILE(_TITLE_CC_BY_40) || URL_INFILE(_URL_CC_BY_40)) {
8631  lstr = "CC-BY-4.0";
8632  }
8633  /*
8634  * Creative Commons CC0
8635  */
8636  else if (INFILE(_TITLE_CC0_10_2)) {
8637  lstr = lDebug ? "CC0(2)" : "CC0-1.0";
8638  }
8639  else if (INFILE(_PHR_CC0_2)) {
8640  lstr = lDebug ? "CC0(2)" : "CC0-1.0";
8641  }
8642  else if (URL_INFILE(_URL_CC0)) {
8643  lstr = lDebug ? "CC0(URL)" : "CC0-1.0";
8644  }
8645  else if (URL_INFILE(_URL_CC_PDDC)) {
8646  lstr = lDebug ? "CC(PD)" : "CC-PDDC";
8647  pd = 1;
8648  }
8649  else if (INFILE(_TITLE_CCPL)) {
8650  INTERESTING("CCPL");
8651  }
8652  else if (INFILE(_TITLE_CC_BY)) {
8653  lstr = lDebug ? "CCA(1)" : "CC-BY";
8654  }
8655  else {
8656  lstr = lDebug ? "CCA(def)" : "CC-BY";
8657  }
8658  lmem[_fCCBY] = 1;
8659  return lstr;
8660 }
8661 
8678 int findPhrase(int index, char *filetext, int size, int isML, int isPS,
8679  int qType)
8680 {
8681  char *ptr = NULL_STR;
8682  char *q = ltsr+index;
8683  char *cp = 0;
8684  int ret;
8685  int i;
8686  int j;
8687  int n;
8688  int wordMatch = 0;
8689  int metaKludge = 0;
8690  int saved = 0;
8691  int sso;
8692  int seo;
8693  item_t *sp;
8694  item_t *op;
8695  list_t *lp;
8696  licText_t *ltp;
8697 #ifdef PARSE_STOPWATCH
8698  DECL_TIMER; /* timer declaration */
8699  char timerName[64];
8700 #endif /* PARSE_STOPWATCH */
8701 
8702 #if defined(PROC_TRACE) || defined(PHRASE_DEBUG) || defined(DOCTOR_DEBUG)
8703  traceFunc("== findPhrase(%d, %p, %d, %d, %d, %d)\n", index, filetext,
8704  size, isML, isPS, qType);
8705  traceFunc("... (regex) \"%s\"\n", _REGEX(index));
8706  traceFunc("... (seed) \"%s\"\n", _SEED(index));
8707 #endif /* PROC_TRACE || PHRASE_DEBUG || DOCTOR_DEBUG */
8708 
8709  ltp = licText + index; /* &licText[index] */
8710  if (ltp->tseed == NULL_STR) {
8711  LOG_FATAL("Regex #%d not suitable for findPhrase()", index)
8712  Bail(-__LINE__);
8713  }
8714  *q |= LTSR_SMASK; /* init: tested, no match */
8715 #ifdef PARSE_STOPWATCH
8716  (void) sprintf(timerName, "findPhrase(%03d): ", index);
8717  START_TIMER;
8718 #endif /* PARSE_STOPWATCH */
8719 #if (DEBUG > 5)
8720  printf("findPhrase: firstword[%d] == \"%s\", used = %d\n", index,
8721  ltp->tseed, searchList.used);
8722 #endif /* DEBUG > 5 */
8723  /*
8724  * See if the first-word of the requested entry has been searched
8725  * previously. The entry we get from listGetItem() refCount (val) field is:
8726  * =0 if this is the first search for this word (non-zero == "seen it"!)
8727  * <0 if the word was NOT FOUND
8728  * >0 if we have doctored-text results cached
8729  */
8730  if ((sp = listGetItem(&searchList, ltp->tseed)) == NULL_ITEM) {
8731  LOG_FATAL("search cache")
8732  Bail(-__LINE__);
8733  }
8734  if (sp->refCount < 0) { /* tseed not found in text */
8735  sp->refCount--;
8736 #ifdef PARSE_STOPWATCH
8737  END_TIMER; /* stop the timer */
8738  (void) strcat(timerName, "Cache-NO - ");
8739  (void) strcat(timerName, ltp->tseed);
8740  PRINT_TIMER(timerName, 0);
8741 #endif /* PARSE_STOPWATCH */
8742  return(0);
8743  }
8744  else if (sp->refCount == 0) { /* e.g., first occurence */
8745 
8746  /*
8747  * Since this is the first search of this word, see if it's in the text.
8748  * NOTE: getInstances() returns a pointer to static (non-allocated) storage
8749  */
8750  if ((cur.nLines) <= 5) {
8751  i = 1;
8752  j = 2;
8753  } else if ((size / cur.nLines) <= 10) {
8754  i = 2;
8755  j = 4;
8756  } else {
8757  i = 3;
8758  j = 6;
8759  }
8760 
8761  /* change to not get record offsets since there is a good sized memory
8762  leak in that code */
8763  //ptr = getInstances(filetext, size, i, j, sp->str, YES);
8764  ptr = getInstances(filetext, size, i, j, sp->str, NO);
8765 
8766  if (ptr == NULL_STR) {
8767  sp->refCount = -1;
8768  /* sp->buf = NULL_STR; */
8769 #ifdef PARSE_STOPWATCH
8770  END_TIMER; /* stop the timer */
8771  (void) strcat(timerName, "tseed-NO - ");
8772  (void) strcat(timerName, ltp->tseed);
8773  PRINT_TIMER(timerName, 0);
8774 #endif /* PARSE_STOPWATCH */
8775  return(0); /* known !match */
8776  }
8777  sp->buf = copyString(ptr, "paragraph");
8778 #ifdef MEMSTATS
8779  printf("... adding %d bytes (search-lookup: \"%s\")\n",
8780  strlen(sp->buf), sp->str);
8781 #endif /* MEMSTATS */
8782  /*
8783  * If the search-seed and regex are the same, we found what we're looking
8784  * for. Else, use doctorBuffer() to strip out punctuation, XML/HTML
8785  * directives, etc.
8786  */
8787 #ifdef PARSE_STOPWATCH
8788  START_TIMER;
8789 #endif /* PARSE_STOPWATCH */
8790 #ifdef DOCTOR_DEBUG
8791  printf(" ... doctoring buffer for \"%s\"\n", sp->str);
8792 #endif /* DOCTOR_DEBUG */
8793  (void) doctorBuffer(sp->buf, isML, isPS, NO);
8794 #ifdef PARSE_STOPWATCH
8795  RESET_TIMER;
8796  (void) sprintf(timerName, "... doctor(%03d): %s (%d)",
8797  index, ltp->tseed, strlen(sp->buf));
8798  PRINT_TIMER(timerName, 0);
8799 #endif /* PARSE_STOPWATCH */
8800  }
8801  sp->refCount++; /* incr ref-count for this seed */
8802  /*
8803  * We need populate the list of "paragraph matches" with offsets in the
8804  * doctored-up buffers; this seems the best place to do it.
8805  */
8806  op = listGetItem(&cur.offList, sp->str);
8807  if (op->nMatch <= 0) {
8808  LOG_FATAL("File-offset list, nMatch(%s): bad entry", sp->str)
8809  Bail(-__LINE__);
8810  }
8811 #if DEBUG>5
8812  printf("matches for key \"%s\": %d\n", sp->str, op->nMatch);
8813 #endif /* DEBUG>5 */
8814  n = strlen(sp->buf);
8815  lp = (list_t *)op->bList;
8816  if ((lp) && (lp->items[0].bDocLen == 0)) {
8817  if (op->nMatch == 1) {
8818  lp->items[0].bDocLen = n;
8819  } else {
8820  ptr = sp->buf;
8821  i = j = 0; /* i is index, j is total offset */
8822  while (strGrep(" xyzzy ", ptr, REG_ICASE)) {
8823  lp->items[i++].bDocLen = j + cur.regm.rm_so;
8824  ptr += cur.regm.rm_eo;
8825  j += (cur.regm.rm_eo + 7); /* strlen(" xyzzy ") */
8826  }
8827  lp->items[i].bDocLen = n + 7; /* last paragraph */
8828  }
8829  }
8830  if (ltp->tseed == ltp->regex) { /* e.g., regex IS seed/key */
8831  wordMatch++;
8832  ret = 1;
8833  } else {
8834  metaKludge = ((qType == 2) && (index == _LT_GPLref1));
8835  if (metaKludge || qType == 4) {
8836  saved = 1;
8837  gl.flags |= FL_SAVEBASE;
8838  }
8839  ret = HASREGEX_RI(index, sp->buf);
8840  if (saved) {
8841  if (ret) {
8842  kludge.base = cur.matchBase;
8843  kludge.sso = cur.regm.rm_so;
8844  kludge.seo = cur.regm.rm_eo;
8845  }
8846  gl.flags &= ~FL_SAVEBASE;
8847  }
8848  }
8849  sso = cur.regm.rm_so; /* do NOT modify this!! */
8850  seo = cur.regm.rm_eo; /* ... or this, either! */
8851  if (ret && !wordMatch) {
8852  *q = LTSR_YES; /* remember this "yes" search result */
8853 
8854  /*
8855  * VERY low-level string-search kludges happen here. This is VERY ugly!!
8856  *****
8857  * If we used idxGrep to search for "GPL" in a "doctored" buffer, we do NOT
8858  * want to match "lesser GPL" or "library GPL" in our searches (it's the
8859  * wrong license name/title). Unfortunately, two aliases for LGPL are
8860  * exactly those above. If we match "GPL" with a wildcard preceeding it, it
8861  * JUST MIGHT BE those words. Rather than perform 2 exclusionary searches
8862  * one for "lesser gpl" and another for "library gpl", look here and if we
8863  * find it, (ugh) KLUDGE the return value to indicate "no match"...
8864  *****
8865  * However, since it's here, it's now extensible. Next search-string kludge
8866  * (that cannot be quickly fixed via changing a regex) should be number 2.
8867  * Just make a new macro (defined above parseLicenses), ala GPL_INFILE().
8868  */
8869  if ((qType > 0) && !wordMatch) {
8870  if ((qType > 4) || (qType < 0)) {
8871  LOG_FATAL("Unknown string-search kludge %d", qType)
8872  Bail(-__LINE__);
8873  }
8874  /*
8875  * Special filter #1: over-write matched text with commas -- this choice is
8876  * significant because doctorBuffer() ensures 'stripped' text has no commas
8877  */
8878  if (qType == 1) { /* destroy text-match */
8879  cp = sp->buf+seo;
8880  ptr = sp->buf+sso;
8881  ltsr[index] = 0; /* reset search cache */
8882  while (ptr <= cp) {
8883  *ptr++ = ',';
8884  }
8885 #ifdef DEBUG
8886  if (lDiags) {
8887  printf("Now, buf %p contains:\n%s\n",
8888  sp->buf, (char *)sp->buf);
8889  }
8890 #endif /* DEBUG */
8891  /*
8892  * Special filter #2: various checks to make sure LGPL/GFDL/GPL license
8893  * references are not confused -- they CAN look quite similar. Specifically
8894  * we don't want to confuse a SINGLE reference to the LGPL as a reference to
8895  * the GPL. BUT -- sometimes references to BOTH are in the same file.
8896  */
8897  }
8898  if ((qType == 2) &&
8899  HASREGEX(_TEXT_LGPL_NOT_GPL, sp->buf+sso) &&
8900  !HASREGEX(_TEXT_GPL_NOT_LGPL, sp->buf+sso) &&
8901  NOT_INFILE(_TEXT_LGPL_DETAILS) &&
8902  NOT_INFILE(_TEXT_LICSET)) {
8903  if (lDiags) {
8904  printf("... \"GPL\" -> LGPL (%d)\n",
8905  index);
8906  }
8907  ltsr[_TEXT_LGPL_NOT_GPL] = LTSR_YES;
8908  ret = 0;
8909  *q = LTSR_NO; /* oops, make that a "no" */
8910  } else if ((qType == 2) &&
8911  HASREGEX(_TEXT_GFDL_NOT_GPL, sp->buf+sso)) {
8912  if (lDiags) {
8913  printf("... \"GPL\" -> GFDL (%d)\n",
8914  index);
8915  }
8916  ltsr[_TEXT_GFDL_NOT_GPL] = LTSR_YES;
8917  ret = 0;
8918  *q = LTSR_NO;
8919  } else if ((index == _LT_GPL3ref) && (qType == 2)) {
8920  if (HASREGEX(_PHR_QEMU_NOT_GPLV3, sp->buf+sso)) {
8921  if (lDiags) {
8922  printf("... \"GPL\" -> QEMU\n");
8923  }
8924  ltsr[_PHR_QEMU_NOT_GPLV3] = LTSR_YES;
8925  ret = 0;
8926  *q = LTSR_NO;
8927  } else if (INFILE(_PHR_SCF_HOWTO)) {
8928  if (lDiags) {
8929  printf("... SCF-Howto\n");
8930  }
8931  ret = 0;
8932  *q = LTSR_NO;
8933  } else if (HASREGEX(_TEXT_DRBD_NOT_GPL3, sp->buf)) {
8934  if (lDiags) {
8935  printf("... mysgl/DRBD\n");
8936  }
8937  ltsr[_TEXT_DRBD_NOT_GPL3] = LTSR_YES;
8938  ret = 0;
8939  *q = LTSR_NO;
8940  }
8941 #ifdef GPLV2_BEATS_GPLV3
8942  else if (strNbuf(sp->buf+sso, "version 2")) {
8943  if (sp->buf + sso + cur.regm.rm_eo <
8944  sp->buf + seo) {
8945  if (lDiags) {
8946  printf("... v%c!\n", *cp);
8947  }
8948  ret = 0;
8949  *q = LTSR_NO;
8950  }
8951  }
8952 #endif /* GPLV2_BEATS_GPLV3 */
8953  } else if ((index == _PHR_GPL3_OR_LATER) &&
8954  (qType == 2) &&
8955  strNbuf(sp->buf+sso, "v2 ")) {
8956  if (lDiags) {
8957  printf("... v2 and version 3\"\n");
8958  }
8959  ret = 0;
8960  *q = LTSR_NO;
8961  } else if ((index == _PHR_GPL3_OR_LATER) &&
8962  (qType == 2) &&
8963  HASREGEX(_TEXT_NOT_GPLV3_DRAFT, sp->buf+sso)) {
8964  if (lDiags) {
8965  printf("... exclude \"GPLv3 draft\"\n");
8966  }
8967  ltsr[_TEXT_NOT_GPLV3_DRAFT] = LTSR_YES;
8968  ret = 0;
8969  *q = LTSR_NO;
8970  } else if ((index == _PHR_GPL3_ONLY) &&
8971  (qType == 2) &&
8972  HASREGEX(_TEXT_NOT_LIBSTDC, sp->buf+sso)) {
8973  if (lDiags) {
8974  printf("... exclude libstdc vers\"\n");
8975  }
8976  ltsr[_TEXT_NOT_LIBSTDC] = LTSR_YES;
8977  ret = 0;
8978  *q = LTSR_NO;
8979  }
8980  /*
8981  * POSIX regex matches the longest string possible, and a '3' can follow a
8982  * "version 2 or later phrase" -- we want to match the '2'. "Vim" has this:
8983  *****
8984  * e) When the GNU General Public License (GPL) applies to the changes,
8985  * you may distribute the modified code under the GNU GPL version 2 or
8986  * any later version.
8987  * 3) A message must be added, at least in the output of the ":version"
8988  * command and in the intro screen, such that the user ...
8989  *****
8990  * So... if there's a NUMBER (!= '3') between the word "version" and the
8991  * end-of-match (at sp->buf+seo), that matches the number AND NOT the 3.
8992  */
8993  else if ((qType == 2) &&
8994  ((index == _PHR_GPL3_ONLY) || (index == _PHR_LGPL3_ONLY))) {
8995  if (strNbuf(sp->buf+sso, "version") ||
8996  strNbuf(sp->buf+sso, "v3")) {
8997  cp = sp->buf + cur.regm.rm_eo;
8998  } else {
8999  cp = sp->buf + seo; /* "nil" loop */
9000  }
9001  for (ptr = sp->buf+seo; cp < ptr; cp++) {
9002  if (isdigit(*cp) && *cp != '3') {
9003  if (lDiags) {
9004  printf("... vers %c!\n",
9005  *cp);
9006  }
9007  ret = 0;
9008  *q = LTSR_NO;
9009  break;
9010  }
9011  }
9012  } else if (index == _PHR_FSF_V3_ONLY && qType == 2) {
9013  if (strNbuf(sp->buf+sso, "version")) {
9014 #ifdef GPLV2_BEATS_GPLV3
9015  ptr = sp->buf + sso + cur.regm.rm_so + 7;
9016 #endif /* GPLV2_BEATS_GPLV3 */
9017  cp = strchr(sp->buf+sso, '3');
9018  if (strncasecmp(cp, "3 tlb", 5) == 0) {
9019  if (lDiags) {
9020  printf("... v3 tlb\n");
9021  }
9022  ret = 0;
9023  *q = LTSR_NO;
9024  }
9025 #ifdef GPLV2_BEATS_GPLV3
9026  else if ((*ptr == ' ') && (*(ptr+1) == '2')) {
9027  if (lDiags) {
9028  printf("... v2, !v3\n");
9029  }
9030  ret = 0;
9031  *q = LTSR_NO;
9032  }
9033 #endif /* GPLV2_BEATS_GPLV3 */
9034  }
9035  else if (strNbuf(sp->buf+sso, "v3")) {
9036  cp = sp->buf + sso + cur.regm.rm_so;
9037  if (strncasecmp(cp-4, "arm ", 4) == 0) {
9038  if (lDiags) {
9039  printf("... arm v3\n");
9040  }
9041  ret = 0;
9042  *q = LTSR_NO;
9043  } else if (strncasecmp(cp, "v3020 ",
9044  6) == 0) {
9045  if (lDiags) {
9046  printf("... v3020\n");
9047  }
9048  ret = 0;
9049  *q = LTSR_NO;
9050  }
9051  }
9052  } else if ((index == _LT_LGPL_OR) &&
9053  (strncasecmp(sp->buf+sso, "or fitness f", 12) == 0)) {
9054  if (lDiags) {
9055  printf("... merch-or-fitness\n");
9056  }
9057  ret = 0;
9058  *q = LTSR_NO;
9059  } else if ((index == _LT_GPLref1) &&
9060  (qType == 2) &&
9061  INFILE(_PHR_LIC_CHANGE)) {
9062  if (lDiags) {
9063  printf("... exclude lic-change\"\n");
9064  }
9065  ret = 0;
9066  *q = LTSR_NO;
9067  } else if ((qType == 2) && (sso > 4)) {
9068  cp = sp->buf+sso-4;
9069  if (strncasecmp(cp, "not ", 4) == 0) {
9070  if (lDiags) {
9071  printf("... NOT l?gpl-ish\n");
9072  }
9073  ret = 0;
9074  *q = LTSR_NO; /* "no" */
9075  }
9076  } else if (qType == 3 && INFILE(_PHR_ARTISTIC_DESC1)) {
9077  /*
9078  Special filter #3: match specific versions of Perl
9079  references, but not all
9080  */
9081  if (lDiags) {
9082  printf("... exclude artistic defn\"\n");
9083  }
9084  ret = 0;
9085  *q = LTSR_NO;
9086  } else if (qType == 4) {
9087  /*
9088  Special filter #4: look for a numerical version
9089  number IFF NOT IN a string of (at least) 4 numerical
9090  characters (signifying a year/datestamp)
9091  */
9092  char *x;
9093  x = cp = cur.matchBase + sso;
9094  ptr = cp - (sso < 100 ? sso : 100);
9095  while (!isdigit(*cp)) {
9096  cp++;
9097  }
9098  if (isdigit(*(cp+1)) && isdigit(*(cp+2)) && isdigit(*(cp+3))) {
9099  if (lDiags) {
9100  printf("... don't want year\n");
9101  }
9102  ret = 0;
9103  *q = LTSR_NO;
9104  } else if (HASREGEX(_TEXT_GNU_HELLO_23, ptr)) {
9105  if (lDiags) {
9106  printf("... gnu example\n");
9107  }
9108  ret = 0;
9109  *q = LTSR_NO;
9110  }
9111 #ifdef GPLV2_BEATS_GPLV3
9112  else if (strncasecmp(x-5, "v2 or ", 5) == 0) {
9113  if (lDiags) {
9114  printf("... v2 or v3\n");
9115  }
9116  ret = 0;
9117  *q = LTSR_NO;
9118  }
9119 #endif /* GPLV2_BEATS_GPLV3 */
9120  /*
9121  * Special case - don't know where better to look for this... other strings
9122  * match TEXT_GPLV3 and should be filtered. This should be a fairly low
9123  * frequency check.
9124  */
9125  else if (index == _TEXT_GPLV3) {
9126  x = cur.matchBase + seo;
9127  if (isdigit(*x) && *x != '0') {
9128  if (lDiags) {
9129  printf("... v3#!0\n");
9130  }
9131  ret = 0;
9132  *q = LTSR_NO;
9133  }
9134  }
9135  }
9136  }
9137 #if (DEBUG > 5)
9138  printf(">>===> \"%s\"\n", ltp->regex);
9139 #endif /* DEBUG > 5 */
9140  }
9141 #ifdef PARSE_STOPWATCH
9142  END_TIMER; /* stop the timer */
9143  (void) sprintf(timerName, "findPhrase(%03d): RET=%d (%s:%d)", index,
9144  ret, ltp->tseed, strlen(sp->buf));
9145  PRINT_TIMER(timerName, 0);
9146 #endif /* PARSE_STOPWATCH */
9147  if (lDiags && ret) {
9148  printRegexMatch(index, NO);
9149  /* locateRegex(filetext, op, index, size, sso, seo); */
9150  }
9151  return(ret);
9152 }
9153 
9168 void locateRegex(char *text, item_t *op, int index, int size, int sso, int seo)
9169 {
9170  int i;
9171  int j;
9172  int n;
9173  int off;
9174  int len;
9175  item_t *sp;
9176  list_t *lp = (list_t *)op->bList;
9177  char *cp;
9178  char *ptr;
9179  char *start;
9180  char save;
9181 
9182 #if defined(PROC_TRACE) || defined(PHRASE_DEBUG)
9183  traceFunc("== locateRegex(%p, %p, %d, %d, %d, %d)\n", text, op, index,
9184  size, sso, seo);
9185 #endif /* PROC_TRACE || PHRASE_DEBUG */
9186 
9187  /*
9188  * First step, simplest case - try to locate the regex in the file. It
9189  * *might* be that easy (but not very often, it turns out).
9190  */
9191  if (idxGrep(index, text, REG_ICASE|REG_EXTENDED)) {
9192  saveRegexLocation(index, cur.regm.rm_so,
9193  cur.regm.rm_eo - cur.regm.rm_so, YES);
9194  return;
9195  }
9196  /*
9197  * Regex is not directly in the raw text file, so now we need to try to
9198  * map a location from a 'doctored buffer' to a location in the original
9199  * text file. Not impossible, yet not overly straight-forward.
9200  */
9201 #ifdef DEBUG
9202  listDump(lp, NO);
9203  printf("Doc-buffer match @ %d:%d\n", sso, seo);
9204  printf("Possible \"%s\" entries to search: %d (%d)\n", op->str,
9205  op->nMatch, lp->used);
9206  for (n = i = 0; (sp=listIterate(lp)); i++) {
9207  printf("Ent[%d]: bDocLen %d (len %d) == file %d+%d (%d)\n",
9208  i, sp->bDocLen, (sp->bDocLen)-n, sp->bStart, sp->bLen,
9209  sp->bStart+sp->bLen);
9210  n = sp->bDocLen;
9211  }
9212 #endif /* DEBUG */
9213  /*
9214  * At this point, the matched phrase should be bounded by {sso} and {seo}
9215  * as offsets within the doctored buffer we're scanning. We also have a
9216  * mapping of offsets within the doctored buffer to more-or-less where it
9217  * exists in the original (raw text) file -- so go find it. Walk through the
9218  * offsets-list; the entry with the LOWEST end-of-doctored-buffer offset
9219  * exceeding the value of 'sso' IS the paragraph where we found the regex.
9220  */
9221  i = -1;
9222  j = -1;
9223  n = 0;
9224  while ((sp = listIterate(lp))) {
9225  if (sso > sp->bDocLen) {
9226  n = sp->bDocLen;
9227  continue;
9228  }
9229  i = sp->bStart;
9230  j = sp->bLen;
9231 #ifdef DEBUG
9232  printf("sso(%d), limit(%d), Possible: @%d+%d\n", sso,
9233  sp->bDocLen, i, j);
9234 #endif /* DEBUG */
9235  listIterationReset(lp);
9236  break;
9237  }
9238  if (i < 0) { /* something is wrong... */
9239  LOG_FATAL("Cannot map reduced-text to raw file contents (#%d)", index)
9240  Bail(-__LINE__);
9241  }
9242  /*
9243  * Remember, the length of text matched in the doctored-buffer will likely
9244  * not match the length of the "same" (unmodified) text in the raw file!
9245  * And, an offset within the doctored buffer CANNOT be any larger than the
9246  * corresponding text segment in the raw file (we only _remove_ characters).
9247  * Next, find the last occurrence (in the raw file) of the last word in
9248  * the license-footprint
9249  */
9250  sso -= n;
9251  seo -= n;
9252  off = i + sso;
9253  len = j - sso;
9254 #ifdef DEBUG
9255  printf("WINDOW-first: offset %d, len %d\n", off, len);
9256 #endif /* DEBUG */
9257  /*printf("BUF: %s\n", sp->buf);*/
9258  start = _REGEX(index);
9259  cp = start + licSpec[index].text.csLen - 1; /* 'end' of regex */
9260 #ifdef DEBUG
9261  printf("EO-Regex, cp == '%c'\n", *cp);
9262 #endif /* DEBUG */
9263  n = 0;
9264  while (*cp == ' ') {
9265  cp--;
9266  }
9267  while ((n == 1) || ((cp != start) && (*cp != ' ') && (*cp != ')') &&
9268  (*cp != '}'))) {
9269  if (*cp == ']') {
9270  n = 1;
9271  } else if (*cp == '[') {
9272  n = 0;
9273  }
9274  if (cp == _REGEX(index)) {
9275  cp = ":no:match";
9276  break;
9277  }
9278  cp--;
9279  }
9280  if (*cp == ')') {
9281  cp--;
9282  n = 1;
9283  while (n) {
9284  if (*cp == '(') {
9285  n--;
9286  } else if (*cp == ')') {
9287  n++;
9288  }
9289  /*printf("'%c' -- n %d\n", *cp, n);*/
9290  if (cp != start) {
9291  cp--;
9292  }
9293  }
9294  while ((cp != start) && (*cp != ' ') && (*cp != '.') && (*cp != ')')
9295  && (*cp != ']') && (*cp != '}')) {
9296  /*printf("skip '%c'...\n", *cp);*/
9297  cp--;
9298  }
9299 #ifdef DEBUG
9300  printf("_END_@%ld '%c'\n", cp-_REGEX(index), *cp);
9301 #endif /* DEBUG */
9302  }
9303  if (cp != start) {
9304  if (*cp != '.') {
9305  cp++;
9306  }
9307  if ((*cp == '?') || (*cp == '+')) {
9308  cp++;
9309  }
9310  }
9311  ptr = sp->buf + sso;
9312  i = j = 0;
9313 #ifdef DEBUG
9314  printf("SEARCH @foot is now \"%s\"\n", cp);
9315 #endif /* DEBUG */
9316  while (strGrep(cp, ptr, REG_ICASE|REG_EXTENDED)) {
9317  i++;
9318  ptr += cur.regm.rm_eo;
9319  j += cur.regm.rm_eo;
9320 #ifdef DEBUG
9321  printf("Found match (%d bytes) @ offset %d (%d tot)\n",
9322  cur.regm.rm_eo - cur.regm.rm_so, cur.regm.rm_so, j);
9323 #endif /* DEBUG */
9324  }
9325 #ifdef DEBUG
9326  printf("Total # of matches == %d\n", i);
9327 #endif /* DEBUG */
9328  if (i && j) {
9329  len = j;
9330 #ifdef DEBUG
9331  printf("WINDOW-adjst: offset %d, len %d\n", off, len);
9332 #endif /* DEBUG */
9333  } else {
9334  Assert(NO, "Regex \"%s\" (foot-end) not in raw text", cp);
9335  }
9336  /*
9337  * Then, find the first occurrence (in the raw file) of the first word
9338  * in the license-footprint; the exception here is that if the "last word"
9339  * turned out to be the entire regex, then the "first word" will be, too.
9340  */
9341  if (cp != start) {
9342  cp = _REGEX(index);
9343  j = 1;
9344 #ifdef DEBUG
9345  printf("BO-Regex, cp == '%c'\n", *cp);
9346 #endif /* DEBUG */
9347  while (*cp == ' ') {
9348  cp++;
9349  }
9350  while (*cp && (*cp != ' ') && (*cp != '.') && (*cp != '(') &&
9351  (*cp != '{')) {
9352  if (*cp == '[') {
9353  if (*(cp + 1) == '^') {
9354  j = 0;
9355  }
9356  while (*cp && (*cp != ']')) {
9357  cp++;
9358  }
9359  if (*(cp+1) && (*(cp+1) == '?')) {
9360  cp++;
9361  }
9362  if (j) {
9363  cp++;
9364  break;
9365  }
9366  }
9367  cp++;
9368  }
9369  if (*cp == '(') {
9370  /*printf("Start@%d '%c'\n", cp-_REGEX(index), *cp);*/
9371  for (n = 1, cp++; n; cp++) {
9372  /*printf("... '%c'\n", *cp);*/
9373  if ((*cp == '(') && (*(cp-1) != '\\')) {
9374  n++;
9375  } else if ((*cp == ')') && (*(cp-1) != '\\')) {
9376  n--;
9377  }
9378  }
9379  while (*cp && (*cp != ' ') && (*cp != '.') && (*cp != '(') &&
9380  (*cp != '[')) {
9381  cp++;
9382  }
9383  /*printf("_END_@%d '%c'\n", cp-_REGEX(index), *cp);*/
9384  }
9385  if ((*cp == '?') ||
9386  (*cp == '+') ||
9387  ((*cp == '.') && (*(cp-1) == '\\'))) {
9388  cp++;
9389  }
9390  if (*cp) {
9391  save = *cp;
9392  *cp = NULL_CHAR;
9393 #ifdef DEBUG
9394  printf("SEARCH @head is now \"%s\"\n", _REGEX(index));
9395 #endif /* DEBUG */
9396  ptr = sp->buf+sso;
9397  if (strGrep(_REGEX(index), ptr,
9398  REG_ICASE|REG_EXTENDED)) {
9399  len -= cur.regm.rm_so;
9400  off += cur.regm.rm_so;
9401  } else {
9402  LOG_NOTICE("Regex \"%s\" (foot-start) not in raw text", _REGEX(index));
9403  }
9404  *cp = save; /* restore to original text */
9405  }
9406 #ifdef DEBUG
9407  else {
9408  LOG_NOTICE("Nothing to trim from the front (*cp == NULL)");
9409  }
9410 #endif /* DEBUG */
9411  }
9412 #ifdef DEBUG
9413  else {
9414  printf("Hey, last-word IS the entire regex!\n");
9415  }
9416 #endif /* DEBUG */
9417  saveRegexLocation(index, off, len, YES);
9418 #ifdef DEBUG
9419  printf("WINDOW-FINAL: offset %d, len %d\n", off, len);
9420 #endif /* DEBUG */
9421  /*
9422  * At this point, the window is as small as we can (reasonably) make it,
9423  * given that we mundged the original file-text and didn't make a complete
9424  * map of every character. The variable off contains the start of the
9425  * window (the absolute offset within the raw file) and the variable len
9426  * contains the length of the text window.
9427  *****
9428  * DON'T FORGET that some license-footprints are determined merely by
9429  * searching for a string in the raw-text file (calling idxGrep()), e.g.,
9430  * not using the doctored buffers. See fileHasPatt() for details.
9431  *****
9432  * And finally, note how the list of entries matched (in 'whereList') is
9433  * manipulated -- see the very bottom of "addRef()".
9434  */
9435  if ((off + len) > size) {
9436  LOG_FATAL("off %d + len %d (== %d) exceeds filesize %d!", off, len, off + len, size);
9437  Bail(-__LINE__);
9438  }
9439  return;
9440 }
9441 
9449 void saveRegexLocation(int index, int offset, int length, int saveCache)
9450 {
9451  item_t *ip;
9452  item_t *sp;
9453 
9454 #if defined(PROC_TRACE) || defined(PHRASE_DEBUG)
9455  traceFunc("== saveRegexLocation(%d, %d, %d, %d)\n", index, offset, length,
9456  saveCache);
9457 #endif /* PROC_TRACE || PHRASE_DEBUG */
9458 
9459  (void) sprintf(name, "reg%04d", index);
9460  sp = listGetItem(&whereList, name);
9461  sp->bIndex = whereList.used;
9462  sp->bStart = offset;
9463  sp->bLen = length;
9464  if (saveCache) {
9465  ip = listGetItem(&whCacheList, name);
9466  ip->bIndex = index;
9467  ip->bStart = offset;
9468  ip->bLen = length;
9469  }
9470  return;
9471 }
9472 
9473 
9474 void saveUnclBufLocation(int bufNum)
9475 {
9476  item_t *p;
9477  item_t *bp;
9478  list_t *lp;
9479 
9480 #if defined(PROC_TRACE) || defined(PHRASE_DEBUG)
9481  traceFunc("== saveUnclBufLocation(%d, %d, %d, %d)\n", bufNum);
9482 #endif /* PROC_TRACE || PHRASE_DEBUG */
9483 
9484  listClear(&whereList, NO); /* empty all prior matches */
9485  p = listGetItem(&cur.offList, _REGEX(_LEGAL_first));
9486  lp = (list_t *) p->bList;
9487  (void) sprintf(name, "buf%05d", bufNum);
9488  p = listGetItem(lp, name);
9489  bp = listGetItem(&whereList, LS_UNCL);
9490  bp->bStart = p->bStart;
9491  bp->bLen = p->bLen;
9492  bp->bIndex = -1;
9493  return;
9494 }
9495 
9501 void addRef(char *str, int interest)
9502 {
9503  item_t *p;
9504  char *bp;
9505  char *sp = str;
9506  if(!(str && str[0]))
9507  return;
9508 
9509 #ifdef PROC_TRACE
9510  traceFunc("== addRef(\"%s\", %d)\n", str, interest);
9511 #endif /* PROC_TRACE */
9512 
9513 #if defined(DEBUG)
9514  listDump(&whereList, YES);
9515 #endif /* DEBUG */
9516  /*
9517  * Add this to the list of individual pieces found, and mark the license
9518  * to make generating a license-summary easier. The general strategy is
9519  * to COMPLETELY ignore anything NOT considered 'noteworthy'. So if the
9520  * license is noteworthy, we add one to the count, so that we can call
9521  * listCount() on the list to find if there's a 'real license' in here.
9522  * see makeLicenseSummary() in license.c for more details.
9523  *****
9524  * This little trick is also used in distroReport() and rawSourceReport(),
9525  * see report.c
9526  */
9527  if (str == NULL_STR) {
9528  Assert(YES, "license detected != NULL");
9529  }
9530  if (*str == NULL_CHAR) {
9531  Assert(YES, "license string not start with NULL");
9532  }
9533  bp = licStr+refOffset;
9534  *bp++ = ',';
9535  /*
9536  CDB - Opportunity for optimization via memcpy
9537  */
9538  while (*sp) {
9539  *bp++ = *sp++;
9540  }
9541  *bp = NULL_CHAR;
9542  refOffset = bp - licStr;
9543  /*
9544  * Stuff this license in to several lists:
9545  * - parseList is used to create a package "computed license summary"
9546  * - briefList is used to compute a "terse/brief" license summary
9547  */
9548  p = listGetItem(&cur.parseList, str);
9549  if (interest) {
9550  p->iFlag++;
9551  if (interest > IL_LOW) {
9552  p->iLevel = interest;
9553  }
9554  }
9555  if (interest > maxInterest) {
9556  maxInterest = interest;
9557  }
9558  if (lDiags && whereList.used) {
9559  int i = 0;
9560  listSort(&whereList, SORT_BY_COUNT_ASC);
9561  printf("WINDOW for \"%s\": ", str);
9562  while ((p = listIterate(&whereList))) {
9563  if (i++ > 0) {
9564  printf(", ");
9565  }
9566  printf("%d+%d", p->bStart, p->bLen);
9567  }
9568  printf("\n");
9569  }
9570  listClear(&whereList, NO);
9571 #ifdef DEBUG
9572  if (lDiags) {
9573  printf("++ \"%s\" [int=%d]\n", str, interest);
9574  }
9575 #endif /* DEBUG */
9576 
9577  addLicence(cur.theMatches,str);
9578 
9579  return;
9580 }
9581 
9587 int famOPENLDAP(char *filetext, int size, int isML, int isPS)
9588 {
9589  int ret = 0;
9590 
9591  if (lmem[_tOPENLDAP]) {
9592  if (INFILE(_TITLE_OPENLDAP25)) {
9593  INTERESTING("OLDAP-2.5");
9594  ret = 1;
9595  }
9596  else if (INFILE(_TITLE_OPENLDAP26)) {
9597  INTERESTING("OLDAP-2.6");
9598  ret = 1;
9599  }
9600  else if (INFILE(_TITLE_OPENLDAP27)) {
9601  INTERESTING("OLDAP-2.7");
9602  ret = 1;
9603  }
9604  else if (INFILE(_TITLE_OPENLDAP28)) {
9605  INTERESTING("OLDAP-2.8");
9606  ret = 1;
9607  }
9608  else if (INFILE(_TITLE_OPENLDAP201)) {
9609  INTERESTING("OLDAP-2.0.1");
9610  ret = 1;
9611  }
9612  else if (INFILE(_TITLE_OPENLDAP20)) {
9613  INTERESTING("OLDAP-2.0");
9614  ret = 1;
9615  }
9616  else if (INFILE(_TITLE_OPENLDAP21)) {
9617  INTERESTING("OLDAP-2.1");
9618  ret = 1;
9619  }
9620  else if (INFILE(_TITLE_OPENLDAP221) || INFILE(_SPDX_OLDAP_221)) {
9621  INTERESTING("OLDAP-2.2.1");
9622  ret = 1;
9623  }
9624  else if (INFILE(_TITLE_OPENLDAP222) || INFILE(_SPDX_OLDAP_222)) {
9625  INTERESTING("OLDAP-2.2.2");
9626  ret = 1;
9627  }
9628  else if (INFILE(_TITLE_OPENLDAP22)) {
9629  INTERESTING("OLDAP-2.2");
9630  ret = 1;
9631  }
9632  else if (INFILE(_TITLE_OPENLDAP11)) {
9633  INTERESTING("OLDAP-1.1");
9634  ret = 1;
9635  }
9636  else if (INFILE(_TITLE_OPENLDAP23)) {
9637  INTERESTING("OLDAP-2.3");
9638  ret = 1;
9639  }
9640  else if (INFILE(_TITLE_OPENLDAP24)) {
9641  INTERESTING("OLDAP-2.4");
9642  ret = 1;
9643  }
9644  else if (INFILE(_TITLE_OPENLDAP12)) {
9645  INTERESTING("OLDAP-1.2");
9646  ret = 1;
9647  }
9648  else if (INFILE(_TITLE_OPENLDAP13)) {
9649  INTERESTING("OLDAP-1.3");
9650  ret = 1;
9651  }
9652  else if (INFILE(_TITLE_OPENLDAP14)) {
9653  INTERESTING("OLDAP-1.4");
9654  ret = 1;
9655  }
9656  else if (INFILE(_CR_OPENLDAP) && INFILE(_TITLE_OPENLDAP)) {
9657  INTERESTING("OLDAP");
9658  ret = 1;
9659  }
9660  }
9661  lmem[_fOPENLDAP] = ret;
9662  return(ret);
9663 }
9664 
9665 
9689 int checkUnclassified(char *filetext, int size, int score,
9690  int isML, int isPS, int nw)
9691 {
9692  char *buf;
9693  char *curptr;
9694  char *cp;
9695  int m = 0;
9696 #ifdef UNKNOWN_CHECK_DEBUG
9697  int pNum = 0;
9698 #endif /* UNKNOWN_CHECK_DEBUG */
9699  int i = 0;
9700 
9701 #ifdef PROC_TRACE
9702  traceFunc("== checkUnclassified(%p, %d, %d, %d, %d, %d)\n", filetext,
9703  size, score, isML, isPS, nw);
9704 #endif /* PROC_TRACE */
9705 
9706  /*
9707  * Based on experience, this is a good place to look for false-positives:
9708  *****
9709  * Occasionally IETF documents (RFCs, technical descriptions and the like)
9710  * have enough text to trip the unclassified-license detector falsely.
9711  * As a first quick check, see if there's an IETF copyright in the file
9712  * and if so, avoid this (somewhat expensive) check.
9713  *****
9714  * The "Debian social contract" has some very legal-looking verbage, too.
9715  */
9716  if (mCR_IETF()) {
9717  return(0);
9718  }
9719  if (INFILE(_LT_DEB_CONTRACT) || INFILE(_LT_DEB_CONTRACTref)){
9720  INTERESTING("Debian-social-DFSG");
9721  return(0);
9722  }
9723  if (INFILE(_LT_TROLLTECH)) {
9724  return(1);
9725  }
9726 
9727  /*
9728  * A Generic EULA 'qualifies' as an UnclassifiedLicense, or the clause 'License agreement' as an UnclassifiedLicense, check this
9729  * one before trying the word-matching magic checks (below).
9730  */
9731  gl.flags |= FL_SAVEBASE; /* save match buffer (if any) */
9732  m = INFILE(_LT_GEN_EULA) || INFILE(_LT_LG) || INFILE(_LT_GENERIC_UNCLASSIFIED);
9733  /* gl.flags & ~FL_SAVEBASE; CDB -- This makes no sense, given line above */
9734  if (m) {
9735  if (cur.licPara == NULL_STR && cur.matchBase) {
9736  saveLicenseParagraph(cur.matchBase, isML, isPS, NO);
9737  }
9738  return(1);
9739  }
9740  checknw = nw;
9741  /*
9742  * Look for paragraphs of text that could be licenses. We'll check the
9743  * resulting text for 4 types of different words (all in proximity leads
9744  * us to believe it's a license of some sort). If we don't get a paragraph
9745  * to search based on the first set of words, look no further.
9746  */
9747 #ifdef UNKNOWN_CHECK_DEBUG
9748  printf("... first regex: \"%s\"\n", _REGEX(_LEGAL_first));
9749 #endif /* UNKNOWN_CHECK_DEBUG */
9750  if ((buf = getInstances(filetext, size, gl.uPsize, gl.uPsize,
9751  _REGEX(_LEGAL_first), YES)) == NULL_STR) {
9752 #ifdef UNKNOWN_CHECK_DEBUG
9753  printf("... getInstances returns NULL\n");
9754 #endif /* UNKNOWN_CHECK_DEBUG */
9755  return(0);
9756  }
9757  if (lDiags) {
9758  printRegexMatch(_LEGAL_first, NO);
9759  }
9760  /*
9761  * Without examining each paragraph, make sure the file contains the
9762  * components we're looking for... if not, don't check any further.
9763  */
9764  if (/*size > 102400 && */
9765  !match3(_LEGAL_first, buf, score, NO, isML, isPS)) {
9766 #ifdef UNKNOWN_CHECK_DEBUG
9767  printf("... first check fails\n");
9768 #endif /* UNKNOWN_CHECK_DEBUG */
9769  return(0);
9770  }
9771  /*
9772  * buf now points to a series of paragraphs that have 6 lines above
9773  * AND below the regex we've matched, PLUS a separator line between
9774  * each paragraph. The LAST paragraph doesn't have a separator-line.
9775  *****
9776  * For the sake of the search, make the separator line 'disappear'.
9777  */
9778  curptr = buf;
9779  while (idxGrep(_UTIL_XYZZY, curptr, 0)) {
9780  cp = curptr + cur.regm.rm_so;
9781  *cp = NULL_CHAR;
9782 #ifdef UNKNOWN_CHECK_DEBUG
9783  printf("DEBUG: paragraph #%d:\n[START-PARA]\n%s\n[END-PARA]\n",
9784  ++pNum, curptr);
9785 #endif /* UNKNOWN_CHECK_DEBUG */
9786  i++;
9787  /*
9788  * Now that we have our 'paragraph span', check the contents of the
9789  * paragraph for the other 3 groups of words. A match in EACH group
9790  * (plus other criteria checked, of course) means we've likely found
9791  * as-of-yet unclassified license.
9792  *****
9793  * A generic "no warranty" paragraph also looks like a license, so in
9794  * that case don't return a false positive.
9795  */
9796  if (match3(_LEGAL_first, curptr, score, YES, isML, isPS)) {
9797  saveUnclBufLocation(i);
9798  return(1);
9799  }
9800 #ifdef UNKNOWN_CHECK_DEBUG
9801  else {
9802  printf("DEBUG: match() returns 0, look again\n");
9803  }
9804 #endif /* UNKNOWN_CHECK_DEBUG */
9805  /*
9806  * NO-match means this paragraph doesn't contain the magic words we
9807  * seek. However, this file still _may_ contain the magic paragraph --
9808  * it'll be searched in this while-loop until either the magic OR
9809  * end-of-file is found)...
9810  */
9811  *cp++ = '='; /* reset line */
9812  if ((cp = findEol(cp)) == NULL_STR) {
9813  LOG_FATAL("Cannot find delimeter!")
9814  Bail(-__LINE__);
9815  }
9816  curptr = cp+1;
9817  }
9818  /*
9819  * One last buffer to try...
9820  */
9821 #ifdef UNKNOWN_CHECK_DEBUG
9822  printf("DEBUG: %s paragraph (#%d):\n[START-PARA]\n%s\n[END-PARA]\n",
9823  pNum == 0 ? "ONLY" : "LAST", ++pNum, curptr);
9824 #endif /* UNKNOWN_CHECK_DEBUG */
9825  if (match3(_LEGAL_first, curptr, score, YES, isML, isPS)) {
9826  saveUnclBufLocation(++i);
9827  return(1);
9828  }
9829  return(0);
9830 }
9831 
9832 
9836 void checkFileReferences(char *filetext, int size, int score, int kwbm,
9837  int isML, int isPS)
9838 {
9839  int i;
9840 
9841 #ifdef PROC_TRACE
9842  traceFunc("== checkFileReferences(%p, %d, %d, 0x%x, %d, %d)\n", filetext,
9843  size, score, kwbm, isML, isPS);
9844 #endif /* PROC_TRACE */
9845  for (i = 0; i < NSEECOPYING; i++) {
9846  if (INFILE(_SEECOPYING_first+i)) {
9847  if (lDebug) {
9848  (void) sprintf(name, "Gen-CPY-%d", ++i);
9849  INTERESTING(name);
9850  } else {
9851  INTERESTING("See-file.COPYING");
9852  }
9853  return;
9854  }
9855  }
9856  /* */
9857  for (i = 0; i < NSEELICENSE; i++) {
9858  if (INFILE(_SEELICENSE_first+i)) {
9859  if (lDebug) {
9860  (void) sprintf(name, "Gen-CPY-%d", ++i);
9861  INTERESTING(name);
9862  } else {
9863  INTERESTING("See-file.LICENSE");
9864  }
9865  return;
9866  }
9867  }
9868  /* */
9869  for (i = 0; i < NSEEREADME; i++) {
9870  if (INFILE(_SEEREADME_first+i)) {
9871  if (lDebug) {
9872  (void) sprintf(name, "Gen-CPY-%d", ++i);
9873  INTERESTING(name);
9874  } else {
9875  INTERESTING("See-file.README");
9876  }
9877  return;
9878  }
9879  }
9880  /* */
9881  for (i = 0; i < NSEEOTHER; i++) {
9882  if (INFILE(_SEEOTHER_first+i)) {
9883  if (lDebug) {
9884  (void) sprintf(name, "Gen-CPY-%d", ++i);
9885  INTERESTING(name);
9886  } else {
9887  INTERESTING("See-doc.OTHER");
9888  }
9889  return;
9890  }
9891  }
9892  /* */
9893  if (INFILE(_LT_SEE_OUTPUT_1)) {
9894  INTERESTING(lDebug ? "Gen-EXC-1" : "GNU-style.EXECUTE");
9895  }
9896 #if 0
9897  else if (INFILE(_LT_SEE_OUTPUT_2)) {
9898  INTERESTING(lDebug ? "Gen-EXC-2" : "Free-SW.run-COMMAND");
9899  } else if (INFILE(_LT_SEE_OUTPUT_3)) {
9900  INTERESTING(lDebug ? "Gen-EXC-3" : "Free-SW.run-COMMAND");
9901  }
9902 #endif
9903  if(HASTEXT(_LT_SEE_COPYING_LICENSE_1, REG_EXTENDED) || HASTEXT(_LT_SEE_COPYING_LICENSE_2, REG_EXTENDED)) {
9904  INTERESTING("See-file");
9905  }
9906  else if (HASTEXT(_LT_SEE_URL, REG_EXTENDED) || HASTEXT(_LT_SEE_URL_ref1, REG_EXTENDED) || HASTEXT(_LT_SEE_URL_ref2, REG_EXTENDED) || HASTEXT(_LT_SEE_URL_ref3, REG_EXTENDED)) {
9907  INTERESTING("See-URL");
9908  }
9909  return;
9910 
9911 #ifdef OLD_VERSION
9912  if (INFILE(_LT_SEE_COPYING_1)) {
9913  INTERESTING(lDebug ? "Gen-CPY-1" : "See-file.COPYING");
9914  }
9915  else if (INFILE(_LT_SEE_COPYING_2)) {
9916  INTERESTING(lDebug ? "Gen-CPY-2" : "See-file.COPYING");
9917  }
9918  else if (INFILE(_LT_SEE_COPYING_3)) {
9919  INTERESTING(lDebug ? "Gen-CPY-3" : "See-file.COPYING");
9920  }
9921  else if (INFILE(_LT_SEE_COPYING_4)) {
9922  INTERESTING(lDebug ? "Gen-CPY-4" : "See-file.COPYING");
9923  }
9924  else if (INFILE(_LT_SEE_COPYING_5)) {
9925  INTERESTING(lDebug ? "Gen-CPY-5" : "See-file.COPYING");
9926  }
9927  else if (INFILE(_LT_SEE_COPYING_6)) {
9928  INTERESTING(lDebug ? "Gen-CPY-6" : "See-file.COPYING");
9929  }
9930  else if (INFILE(_LT_SEE_COPYING_7)) {
9931  INTERESTING(lDebug ? "Gen-CPY-7" : "See-file.COPYING");
9932  }
9933  else if (INFILE(_LT_SEE_COPYING_8)) {
9934  INTERESTING(lDebug ? "Gen-CPY-8" : "See-file.COPYING");
9935  }
9936  else if (INFILE(_LT_SEE_COPYING_9)) {
9937  INTERESTING(lDebug ? "Gen-CPY-9" : "See-file.COPYING");
9938  }
9939  else if (INFILE(_LT_SEE_COPYING_10)) {
9940  INTERESTING(lDebug ? "Gen-CPY-10" : "See-file.COPYING");
9941  }
9942  else if (INFILE(_LT_SEE_COPYING_LAST1)) {
9943  INTERESTING(lDebug ? "Gen-CPY-L1" : "See-file.COPYING");
9944  }
9945  else if (INFILE(_LT_SEE_COPYING_LAST2)) {
9946  INTERESTING(lDebug ? "Gen-CPY-L2" : "See-file.COPYING");
9947  }
9948  else if (INFILE(_LT_SEE_LICENSE_1)) {
9949  INTERESTING(lDebug ? "Gen-LIC-1" : "See-file.LICENSE");
9950  }
9951  else if (INFILE(_LT_SEE_LICENSE_2)) {
9952  INTERESTING(lDebug ? "Gen-LIC-2" : "See-file.LICENSE");
9953  }
9954  else if (INFILE(_LT_SEE_LICENSE_3)) {
9955  INTERESTING(lDebug ? "Gen-LIC-3" : "See-file.LICENSE");
9956  }
9957  else if (INFILE(_LT_SEE_LICENSE_4)) {
9958  INTERESTING(lDebug ? "Gen-LIC-4" : "See-file.LICENSE");
9959  }
9960  else if (INFILE(_LT_SEE_LICENSE_5)) {
9961  INTERESTING(lDebug ? "Gen-LIC-5" : "See-file.LICENSE");
9962  }
9963  else if (INFILE(_LT_SEE_LICENSE_6)) {
9964  INTERESTING(lDebug ? "Gen-LIC-6" : "See-file.LICENSE");
9965  }
9966  else if (INFILE(_LT_SEE_LICENSE_7)) {
9967  INTERESTING(lDebug ? "Gen-LIC-7" : "See-file.LICENSE");
9968  }
9969  else if (INFILE(_LT_SEE_LICENSE_8)) {
9970  INTERESTING(lDebug ? "Gen-LIC-8" : "See-file.LICENSE");
9971  }
9972  else if (INFILE(_LT_SEE_LICENSE_9)) {
9973  INTERESTING(lDebug ? "Gen-LIC-9" : "See-file.LICENSE");
9974  }
9975  else if (INFILE(_LT_SEE_LICENSE_10)) {
9976  INTERESTING(lDebug ? "Gen-LIC-10" : "See-file.LICENSE");
9977  }
9978  else if (INFILE(_LT_SEE_LICENSE_LAST1)) {
9979  INTERESTING(lDebug ? "Gen-LIC-L1" : "See-file.LICENSE");
9980  }
9981  else if (INFILE(_LT_SEE_LICENSE_LAST2)) {
9982  INTERESTING(lDebug ? "Gen-LIC-L2" : "See-file.LICENSE");
9983  }
9984  else if (INFILE(_LT_SEE_README_1)) {
9985  INTERESTING(lDebug ? "Gen-RDM-1" : "See-file.README");
9986  }
9987  else if (INFILE(_LT_SEE_README_2)) {
9988  INTERESTING(lDebug ? "Gen-RDM-2" : "See-file.README");
9989  }
9990  else if (INFILE(_LT_SEE_README_3)) {
9991  INTERESTING(lDebug ? "Gen-RDM-3" : "See-file.README");
9992  }
9993  else if (INFILE(_LT_SEE_README_4)) {
9994  INTERESTING(lDebug ? "Gen-RDM-4" : "See-file.README");
9995  }
9996  else if (INFILE(_LT_SEE_README_5)) {
9997  INTERESTING(lDebug ? "Gen-RDM-5" : "See-file.README");
9998  }
9999  else if (INFILE(_LT_SEE_README_6)) {
10000  INTERESTING(lDebug ? "Gen-RDM-6" : "See-file.README");
10001  }
10002  else if (INFILE(_LT_SEE_README_7)) {
10003  INTERESTING(lDebug ? "Gen-RDM-7" : "See-file.README");
10004  }
10005  else if (INFILE(_LT_SEE_README_LAST1)) {
10006  INTERESTING(lDebug ? "Gen-RDM-L1" : "See-file.README");
10007  }
10008  else if (INFILE(_LT_SEE_README_LAST2)) {
10009  INTERESTING(lDebug ? "Gen-RDM-L2" : "See-file.README");
10010  }
10011  else if (INFILE(_LT_SEE_OTHER_1)) {
10012  INTERESTING(lDebug ? "Gen-OTH-1" : "See-doc.OTHER");
10013  }
10014  else if (INFILE(_LT_SEE_OTHER_2)) {
10015  INTERESTING(lDebug ? "Gen-OTH-2" : "See-doc.OTHER");
10016  }
10017  else if (INFILE(_LT_SEE_OTHER_3)) {
10018  INTERESTING(lDebug ? "Gen-OTH-3" : "See-doc.OTHER");
10019  }
10020  else if (INFILE(_LT_SEE_OTHER_4)) {
10021  INTERESTING(lDebug ? "Gen-OTH-4" : "See-doc.OTHER");
10022  }
10023  else if (INFILE(_LT_SEE_OTHER_5)) {
10024  INTERESTING(lDebug ? "Gen-OTH-5" : "See-doc.OTHER");
10025  }
10026  else if (INFILE(_LT_SEE_OTHER_6)) {
10027  INTERESTING(lDebug ? "Gen-OTH-6" : "See-doc.OTHER");
10028  }
10029  else if (INFILE(_LT_SEE_OTHER_7)) {
10030  INTERESTING(lDebug ? "Gen-OTH-7" : "See-doc.OTHER");
10031  }
10032  else if (INFILE(_LT_SEE_OTHER_8)) {
10033  INTERESTING(lDebug ? "Gen-OTH-8" : "See-doc.OTHER");
10034  }
10035  else if (INFILE(_LT_SEE_OTHER_9)) {
10036  INTERESTING(lDebug ? "Gen-OTH-9" : "See-doc.OTHER");
10037  }
10038  else if (INFILE(_LT_SEE_OTHER_10)) {
10039  INTERESTING(lDebug ? "Gen-OTH-10" : "See-doc.OTHER");
10040  }
10041  else if (INFILE(_LT_SEE_OTHER_11)) {
10042  INTERESTING(lDebug ? "Gen-OTH-11" : "See-doc.OTHER");
10043  }
10044  else if (INFILE(_LT_SEE_OTHER_12)) {
10045  INTERESTING(lDebug ? "Gen-OTH-12" : "See-doc.OTHER");
10046  }
10047  else if (INFILE(_LT_SEE_OTHER_13)) {
10048  INTERESTING(lDebug ? "Gen-OTH-13" : "See-doc.OTHER");
10049  }
10050  else if (INFILE(_LT_SEE_OTHER_14)) {
10051  INTERESTING(lDebug ? "Gen-OTH-14" : "See-doc.OTHER");
10052  }
10053  else if (INFILE(_LT_SEE_OTHER_15)) {
10054  INTERESTING(lDebug ? "Gen-OTH-15" : "See-doc.OTHER");
10055  }
10056  else if (INFILE(_LT_SEE_OTHER_LAST1)) {
10057  INTERESTING(lDebug ? "Gen-OTH-L1" : "See-doc.OTHER");
10058  }
10059  else if (INFILE(_LT_SEE_OTHER_LAST2)) {
10060  INTERESTING(lDebug ? "Gen-OTH-L2" : "See-doc.OTHER");
10061  }
10062  else if (INFILE(_LT_SEE_OTHER_LAST3)) {
10063  INTERESTING(lDebug ? "Gen-OTH-L3" : "See-doc.OTHER");
10064  }
10065  else if (INFILE(_LT_SEE_OUTPUT_1)) {
10066  INTERESTING(lDebug ? "Gen-EXC-1" : "GNU-style.interactive");
10067  }
10068  return;
10069 #endif /* OLD_VERSION */
10070 }
10071 
10072 
10073 int checkPublicDomain(char *filetext, int size, int score, int kwbm,
10074  int isML, int isPS)
10075 {
10076  int ret;
10077 
10078 #ifdef PROC_TRACE
10079  traceFunc("== checkPublicDomain(%p, %d, %d, 0x%x, %d, %d)\n", filetext,
10080  size, score, kwbm, isML, isPS);
10081 #endif /* PROC_TRACE */
10082 
10083  if (pd >= 0) { /* already tried? */
10084  return(pd);
10085  }
10086  ret = 0; /* default answer is "no" */
10087  if (INFILE(_LT_PUBDOM_CC)) {
10088  INTERESTING(lDebug ? "Pubdom(CC)" : "CC-PDDC");
10089  ret = 1;
10090  } else if (INFILE(_LT_PUBDOM_ODC)) {
10091  INTERESTING(lDebug ? "Pubdom(ODC)" : LS_PD_CLM);
10092  ret = 1;
10093  } else if (INFILE(_LT_PUBDOM_PDD)) {
10094  INTERESTING(lDebug ? "Pubdom(PDD)" : LS_PD_CLM);
10095  ret = 1;
10096  } else if (INFILE(_LT_PUBDOM_USE)) {
10097  INTERESTING(lDebug ? "Pubdom(use)" : LS_PD_CLM);
10098  ret = 1;
10099  } else if (HASTEXT(_LT_PUBDOM_NOTclaim, REG_EXTENDED)) {
10100  INTERESTING(LS_NOT_PD);
10101  ret = 1;
10102  } else if (INFILE(_CR_PUBDOM)) {
10103  if (INFILE(_LT_PUBDOMNOTcpyrt)) {
10104  INTERESTING(LS_PD_CLM);
10105  } else {
10106  INTERESTING(LS_PD_CPRT);
10107  }
10108  ret = 1;
10109  } else if (INFILE(_CR_NONE)) {
10110  INTERESTING(lDebug ? "Pubdom(no-CR)" : LS_PD_CLM);
10111  ret = 1;
10112  } else if (INFILE(_LT_UNLIN) || URL_INFILE(_URL_UNLINref) || URL_INFILE(_URL_UNLIN)) {
10113  INTERESTING("Unlicense");
10114  ret = 1;
10115  } else if (INFILE(_LT_PUBDOM_1)) {
10116  INTERESTING(lDebug ? "Pubdom(1)" : LS_PD_CLM);
10117  ret = 1;
10118  } else if (INFILE(_LT_PUBDOM_2) && NOT_INFILE(_PHR_PUBLIC_FUNCT) && NOT_INFILE(_LT_NOTPUBDOM_1)) {
10119  INTERESTING(lDebug ? "Pubdom(2)" : LS_PD_CLM);
10120  ret = 1;
10121  } else if (INFILE(_LT_PUBDOM_3)) {
10122  INTERESTING(lDebug ? "Pubdom(3)" : LS_PD_CLM);
10123  ret = 1;
10124 #ifdef REMOVED_AS_TOO_BROAD
10125  } else if (INFILE(_LT_PUBDOM_4)) {
10126  INTERESTING(lDebug ? "Pubdom(4)" : LS_PD_CLM);
10127  ret = 1;
10128  } else if (INFILE(_LT_PUBDOM_5)) {
10129  INTERESTING(lDebug ? "Pubdom(5)" : LS_PD_CLM);
10130  ret = 1;
10131  } else if (INFILE(_LT_PUBDOM_6)) {
10132  INTERESTING(lDebug ? "No-more-copyright" : LS_PD_CLM);
10133  ret = 1;
10134 #endif // done removing too broad signatures
10135  } else if (INFILE(_LT_PUBDOM_7)) {
10136  INTERESTING(lDebug ? "Pubdom(7)" : LS_PD_CLM);
10137  ret = 1;
10138  } else if (INFILE(_LT_PUBDOM_8)) {
10139  INTERESTING(lDebug ? "Pubdom(8)" : LS_PD_CLM);
10140  ret = 1;
10141  } else if (INFILE(_LT_PUBDOM_9)) {
10142  INTERESTING(lDebug ? "Pubdom(9)" : LS_PD_CLM);
10143  ret = 1;
10144  } else if (INFILE(_LT_PUBDOM_10)) {
10145  if (INFILE(_LT_blessing)) {
10146  INTERESTING(lDebug ? "Pubdom(10)" : "blessing");
10147  }
10148  else {
10149  INTERESTING(lDebug ? "Pubdom(10)" : LS_PD_CLM);
10150  }
10151  ret = 1;
10152  } else if (INFILE(_URL_PUBDOM)) {
10153  INTERESTING(lDebug ? "Pubdom(URL)" : LS_PD_CLM);
10154  ret = 1;
10155  } else if (HASKW(kwbm, _KW_public_domain) && score <= 3) {
10156  INTERESTING(LS_PD_ONLY);
10157  ret = 1;
10158  }
10159  return(ret);
10160 }
10161 
10162 
10170 void checkCornerCases(char *filetext, int size, int score,
10171  int kwbm, int isML, int isPS, int nw, int force)
10172 {
10173 
10174 #ifdef PROC_TRACE
10175  traceFunc("== checkCornerCases(%p, %d, %d, %d, %d, %d, %d, %d)\n",
10176  filetext, size, score, kwbm, isML, isPS, nw, force);
10177 #endif /* PROC_TRACE */
10178 
10179  if (crCheck++) { /* only need to check this once */
10180  return;
10181  }
10182  if (INFILE(_LT_NOTATT_NOTBSD)) {
10183  LOWINTEREST("non-ATT-BSD");
10184  }
10185 
10186  /*
10187  * FINAL cases: (close to giving up) -- lowest-importance items
10188  */
10195  /*
10196  if (!(*licStr)) {
10197  if (HASTEXT(_TEXT_TRADEMARK, 0)) {
10198  LOWINTEREST(LS_TDMKONLY);
10199  }
10200  }
10201  */
10202  if (!(*licStr)) {
10203  /*
10204  * We may have matched something but ultimately determined there's nothing
10205  * significant or of any interest, so empty the list of any matches we may
10206  * have observed to this point.
10207  */
10208  listClear(&whereList, NO); /* force 'nothing to report' */
10209  }
10210  return;
10211 }
10212 
10213 int match3(int base, char *buf, int score, int save, int isML, int isPS)
10214 {
10215  int i;
10216  int j;
10217  char *cp;
10218  /* */
10219 #ifdef PROC_TRACE
10220 #ifdef PROC_TRACE_SWITCH
10221  if (gl.ptswitch)
10222 #endif /* PROC_TRACE_SWITCH */
10223  printf("== match3(%d, %p, %d, %d, %d, %d)\n", base, buf, score, save,
10224  isML, isPS);
10225 #else /* not PROC_TRACE */
10226 #ifdef UNKNOWN_CHECK_DEBUG
10227  printf("== match3(%d, %p, %d, %d, %d, %d)\n", base, buf, score, save,
10228  isML, isPS);
10229 #endif /* UNKNOWN_CHECK_DEBUG */
10230 #endif /* not PROC_TRACE */
10231  /* */
10232  for (i = 1; i <= 3; i++) {
10233  if (dbgIdxGrep(base+i, buf, (save && lDiags)) == 0) {
10234 #ifdef UNKNOWN_CHECK_DEBUG
10235  printf("match3: FAILED regex (%d)!\n", base+i);
10236 #endif /* UNKNOWN_CHECK_DEBUG */
10237  return(0);
10238  }
10239  }
10240 #ifdef UNKNOWN_CHECK_DEBUG
10241  printf("match3: Success (%s)!\n",
10242  (save ? "buffer-for-real" : "file-initial-check"));
10243 #endif /* UNKNOWN_CHECK_DEBUG */
10244  /*
10245  * Some "possible licenses" are technical descriptions that share some words
10246  * that typically appear in licenses (distribution, terms, permission(s)).
10247  *****
10248  * If we're checking a paragraph (e.g., "save" is non-zero), see if there are
10249  * other engineering-development-technical terms in the paragraph that tend
10250  * to NOT be present in licenses...
10251  */
10252  if (save) {
10253  for (j = i = 0, cp = buf; *cp; i++, cp++) {
10254  if (*cp & 0200) {
10255  j++;
10256  }
10257  }
10258 #ifdef UNKNOWN_CHECK_DEBUG
10259  printf("DEEBUG: %d bytes, %d 8-bit\n", i, j);
10260 #endif /* UNKNOWN_CHECK_DEBUG */
10261  if (j >= (i/2)) {
10262  if (lDiags) {
10263  printf("... no, >= 50 percent 8-bit characters\n");
10264  }
10265  return(0);
10266  }
10267  /*
10268  We need to allocate space for a doctored-up version of the candidate
10269  unknown-license paragraph, but it's ONLY used in this function. E.g.,
10270  make darn sure we free it up before exiting this function...
10271  */
10272  cp = copyString(buf, MTAG_TEXTPARA);
10273  doctorBuffer(cp, isML, isPS, NO);
10274  /*
10275  If we detected a no-warraty statement earlier, "checknw" is != 0.
10276  Look for a no-warrany statement in this candidate paragraph.
10277  If we find it, report failure for the paragraph and remember
10278  finding the no--warranty.
10279  */
10280  if (checknw && !idxGrep(checknw, cp, REG_ICASE|REG_EXTENDED)) {
10281  if (lDiags) {
10282  printf("... no, warranty regex %d\n", checknw);
10283  }
10284  checknw = 0;
10285  memFree(cp, MTAG_TEXTPARA);
10286  return(0);
10287  }
10288  /*
10289  False-positive-check: GNU/FSF template (often see in ".po"
10290  and ".c" files
10291 
10292  "This file is distributed under the same license as the
10293  package PACKAGE"
10294  */
10295  if (dbgIdxGrep(_LT_BOGUSTMPL, cp, lDiags)) {
10296  if (lDiags) {
10297  printf("... no, FSF-GNU template\n");
10298  }
10299  memFree(cp, MTAG_TEXTPARA);
10300  return(0);
10301  }
10302  /*
10303  * False-positive-check: GNU GPL preamble statements; these have been
10304  * "sprinkled" throughout files seen before, so check ALL of them.
10305  */
10306  if (dbgIdxGrep(_PHR_GNU_FREEDOM, cp, lDiags) ||
10307  dbgIdxGrep(_PHR_GNU_COPYING, cp, lDiags) ||
10308  dbgIdxGrep(_PHR_GNU_PROTECT, cp, lDiags)) {
10309  if (lDiags) {
10310  printf("... no, GNU-GPL preamble\n");
10311  }
10312  memFree(cp, MTAG_TEXTPARA);
10313  return(0);
10314  }
10315  if (lDiags) {
10316  printf("... candidate paragraph analysis:\n");
10317  }
10318  for (i = j = 0; i < NKEYWORDS; i++) {
10319  if (idxGrep_recordPositionDoctored(i + _KW_first, cp, REG_EXTENDED | REG_ICASE)) {
10320  if (lDiags) {
10321  printf("%s", j ? ", " : "KEYWORDS: ");
10322  printf("%s", _REGEX(i+_KW_first));
10323  }
10324  j++;
10325  }
10326  }
10327  if (lDiags) {
10328  if (j) {
10329  printf("\n");
10330  }
10331  printf("SCORES: para %d, file %d == %05.2f%% ", j,
10332  score, 100.0 * (float) j / (float) score);
10333  }
10334  /*
10335  Here, we guess that an UnclassifiedLicense exists in a paragraph
10336  when:
10337  + a paragraph has a keyword-score of at least 3 -OR-
10338  + ... a keyword-score of 2 *AND* is >= 50% of the file's
10339  total score
10340 
10341  It's likely we'll see a few false-positives with a
10342  keyword-score of 2 but there are cases where this works.
10343  We can filter out the 2-scores we see
10344  with the FILTER checks below...
10345  */
10346  if (j == 0) { /* no license-like keywords */
10347  if (lDiags) {
10348  printf("(ZERO legal keywords)\n");
10349  }
10350  memFree(cp, MTAG_TEXTPARA);
10351  return(0);
10352  }
10353  if (j >= 3 || (j == 2 && j*2 >= score)) {
10354  if (j >= 3 && lDiags) {
10355  printf("(LIKELY: para-score >= 2)\n");
10356  }
10357  else if (lDiags) {
10358  printf("(MAYBE: local percentage)\n");
10359  }
10360  }
10361  else {
10362  if (lDiags) {
10363  printf("(NOT LIKELY a license)\n");
10364 #if 0
10365 #endif
10366  printf("[FAILED]\n%s\n[/FAILED]\n", buf);
10367  }
10368  memFree(cp, MTAG_TEXTPARA);
10369  return(0);
10370  }
10371  /*
10372  Sure, there ARE paragraphs with these words that do NOT constitute a
10373  real license. Look for key words and phrases of them HERE. This list
10374  of filters will likely grow over time.
10375  */
10376  for (i = 0; i < NFILTER; i++) {
10377  if (dbgIdxGrep(_FILTER_first+i, buf, lDiags)) {
10378  if (lDiags) {
10379  printf("!! NO-LIC: filter %d\n", ++i);
10380  }
10381  memFree(cp, MTAG_TEXTPARA);
10382  return(0);
10383  }
10384  }
10385  if (cur.licPara == NULL_STR) {
10386  saveLicenseParagraph(buf, isML, isPS, YES);
10387  }
10388  memFree(cp, MTAG_TEXTPARA);
10389  }
10390 #ifdef UNKNOWN_CHECK_DEBUG
10391  else {
10392  printf("match3: Initial-check only (save == %d)\n", save);
10393  }
10394 #endif /* UNKNOWN_CHECK_DEBUG */
10395  return(1);
10396 }
10397 
10398 void saveLicenseParagraph(char *mtext, int isML, int isPS, int entireBuf)
10399 {
10400  char *cp;
10401  char *start;
10402  int index=0;
10403  int len;
10404  start = copyString(mtext, MTAG_TEXTPARA);
10405  if(!start)
10406  {
10407  LOG_FATAL("called saveLicenseParagraph without text")
10408  Bail(-__LINE__);
10409  }
10410 #ifdef PROC_TRACE
10411 #ifdef PROC_TRACE_SWITCH
10412  if (gl.ptswitch)
10413 #endif /* PROC_TRACE_SWITCH */
10414  printf("== saveLicenseParagraph(%p, %d, %d, %d)\n", mtext, isML, isPS, entireBuf);
10415 #endif /* PROC_TRACE */
10416  /* */
10417  if (entireBuf) {
10418  cur.licPara = copyString(mtext, MTAG_TEXTPARA);
10419  } else {
10420  if (cur.regm.rm_so < 50) {
10421  len = cur.regm.rm_eo + 80;
10422  } else {
10423  len = cur.regm.rm_eo + 130 - cur.regm.rm_so;
10424  index = cur.regm.rm_so - 50;
10425  }
10426  cur.licPara = memAlloc(len + 9, MTAG_TEXTPARA);
10427  (void) strcpy(cur.licPara, "... ");
10428  (void) strncpy(cur.licPara + 4, start + index, len);
10429  (void) strcpy(cur.licPara + len + 4, " ...");
10430  memFree(start, MTAG_TEXTPARA);
10431  }
10432 
10433  /*
10434  * Convert double-line-feed chars ("\r" and "\n" combos) to a single "\n"
10435  */
10436  for (cp = cur.licPara; *cp; cp++) {
10437  if ((*cp == '\n' || *cp == '\r') &&
10438  (*(cp+1) == '\r' || *(cp+1) == '\n')) {
10439  *cp = ' ';
10440  *(cp+1) = '\n';
10441  }
10442  }
10443  if (lDiags) {
10444  printf("[PERHAPS] (%p)\n%s\n[/PERHAPS]\n", cur.licPara, cur.licPara);
10445  }
10446  return;
10447 }
10448 
10457 void spdxReference(char *filetext, int size, int isML, int isPS)
10458 {
10459  if (INFILE(_SPDX_Glide)) {
10460  INTERESTING("Glide");
10461  }
10462  if (INFILE(_SPDX_Abstyles)) {
10463  INTERESTING("Abstyles");
10464  }
10465  if (INFILE(_SPDX_AFL_11)) {
10466  INTERESTING("AFL-1.1");
10467  }
10468  if (INFILE(_SPDX_AFL_12)) {
10469  INTERESTING("AFL-1.2");
10470  }
10471  if (INFILE(_SPDX_AFL_20)) {
10472  INTERESTING("AFL-2.0");
10473  }
10474  if (INFILE(_SPDX_AFL_21)) {
10475  INTERESTING("AFL-2.1");
10476  }
10477  if (INFILE(_SPDX_AFL_30)) {
10478  INTERESTING("AFL-3.0");
10479  }
10480  if (INFILE(_SPDX_AMPAS)) {
10481  INTERESTING("AMPAS");
10482  }
10483  if (INFILE(_SPDX_APL_10)) {
10484  INTERESTING("APL-1.0");
10485  }
10486  if (INFILE(_SPDX_Adobe_Glyph)) {
10487  INTERESTING("Adobe-Glyph");
10488  }
10489  if (INFILE(_SPDX_APAFML)) {
10490  INTERESTING("APAFML");
10491  }
10492  if (INFILE(_SPDX_Adobe_2006)) {
10493  INTERESTING("Adobe-2006");
10494  }
10495  if (INFILE(_SPDX_Afmparse)) {
10496  INTERESTING("Afmparse");
10497  }
10498  if (INFILE(_SPDX_Aladdin)) {
10499  INTERESTING("Aladdin");
10500  }
10501  if (INFILE(_SPDX_ADSL)) {
10502  INTERESTING("ADSL");
10503  }
10504  if (INFILE(_SPDX_AMDPLPA)) {
10505  INTERESTING("AMDPLPA");
10506  }
10507  if (INFILE(_SPDX_ANTLR_PD)) {
10508  INTERESTING("ANTLR-PD");
10509  }
10510  if (INFILE(_SPDX_AML)) {
10511  INTERESTING("AML");
10512  }
10513  if (INFILE(_SPDX_APSL_10)) {
10514  INTERESTING("APSL-1.0");
10515  }
10516  if (INFILE(_SPDX_APSL_11)) {
10517  INTERESTING("APSL-1.1");
10518  }
10519  if (INFILE(_SPDX_APSL_12)) {
10520  INTERESTING("APSL-1.2");
10521  }
10522  if (INFILE(_SPDX_APSL_20)) {
10523  INTERESTING("APSL-2.0");
10524  }
10525  if (INFILE(_SPDX_Artistic_10_Perl)) {
10526  INTERESTING("Artistic-1.0-Perl");
10527  }
10528  else if (INFILE(_SPDX_Artistic_10_cl8)) {
10529  INTERESTING("Artistic-1.0-cl8");
10530  }
10531  else if (INFILE(_SPDX_Artistic_10)) {
10532  INTERESTING("Artistic-1.0");
10533  }
10534  if (INFILE(_SPDX_Artistic_20)) {
10535  INTERESTING("Artistic-2.0");
10536  }
10537  if (INFILE(_SPDX_AAL)) {
10538  INTERESTING("AAL");
10539  }
10540  if (INFILE(_SPDX_Bahyph)) {
10541  INTERESTING("Bahyph");
10542  }
10543  if (INFILE(_SPDX_Barr)) {
10544  INTERESTING("Barr");
10545  }
10546  if (INFILE(_SPDX_Beerware)) {
10547  INTERESTING("Beerware");
10548  }
10549  if (INFILE(_SPDX_BitTorrent_10)) {
10550  INTERESTING("BitTorrent-1.0");
10551  }
10552  else if (INFILE(_SPDX_BitTorrent_11)) {
10553  INTERESTING("BitTorrent-1.1");
10554  }
10555  if (INFILE(_SPDX_blessing)) {
10556  INTERESTING("blessing");
10557  }
10558  if (INFILE(_SPDX_BlueOak_100)) {
10559  INTERESTING("BlueOak-1.0.0");
10560  }
10561  if (INFILE(_SPDX_BSL_10)) {
10562  INTERESTING("BSL-1.0");
10563  }
10564  if (INFILE(_SPDX_Borceux)) {
10565  INTERESTING("Borceux");
10566  }
10567  if (INFILE(_SPDX_0BSD)) {
10568  INTERESTING("0BSD");
10569  }
10570  if (INFILE(_SPDX_bzip2_105)) {
10571  INTERESTING("bzip2-1.0.5");
10572  }
10573  else if (INFILE(_SPDX_bzip2_106)) {
10574  INTERESTING("bzip2-1.0.6");
10575  }
10576  if (INFILE(_SPDX_Caldera)) {
10577  INTERESTING("Caldera");
10578  }
10579  if (INFILE(_SPDX_CC_PDDC)) {
10580  INTERESTING("CC-PDDC");
10581  }
10582  if (INFILE(_SPDX_CERN_OHL_P_20)) {
10583  INTERESTING("CERN-OHL-P-2.0");
10584  }
10585  else if (INFILE(_SPDX_CERN_OHL_S_20)) {
10586  INTERESTING("CERN-OHL-S-2.0");
10587  }
10588  else if (INFILE(_SPDX_CERN_OHL_W_20)) {
10589  INTERESTING("CERN-OHL-W-2.0");
10590  }
10591  else if (INFILE(_SPDX_CERN_OHL_12)) {
10592  INTERESTING("CERN-OHL-1.2");
10593  }
10594  else if (INFILE(_SPDX_CERN_OHL_11)) {
10595  INTERESTING("CERN-OHL-1.1");
10596  }
10597  if (INFILE(_SPDX_ClArtistic)) {
10598  INTERESTING("ClArtistic");
10599  }
10600  if (INFILE(_SPDX_CNRI_Jython)) {
10601  INTERESTING("CNRI-Jython");
10602  }
10603  if (INFILE(_SPDX_CPOL_102)) {
10604  INTERESTING("CPOL-1.02");
10605  }
10606  if (INFILE(_SPDX_CPAL_10)) {
10607  INTERESTING("CPAL-1.0");
10608  }
10609  if (INFILE(_SPDX_CPL_10)) {
10610  INTERESTING("CPL-1.0");
10611  }
10612  if (INFILE(_SPDX_CAL_10_Combined_Work_Exception)) {
10613  INTERESTING("CAL-1.0-Combined-Work-Exception");
10614  }
10615  else if (INFILE(_SPDX_CAL_10)) {
10616  INTERESTING("CAL-1.0");
10617  }
10618  if (INFILE(_SPDX_CATOSL_11)) {
10619  INTERESTING("CATOSL-1.1");
10620  }
10621  if (INFILE(_SPDX_Condor_11)) {
10622  INTERESTING("Condor-1.1");
10623  }
10624  if (INFILE(_SPDX_CC_BY_10)) {
10625  INTERESTING("CC-BY-1.0");
10626  }
10627  else if (INFILE(_SPDX_CC_BY_20)) {
10628  INTERESTING("CC-BY-2.0");
10629  }
10630  else if (INFILE(_SPDX_CC_BY_25)) {
10631  INTERESTING("CC-BY-2.5");
10632  }
10633  else if (INFILE(_SPDX_CC_BY_30_AT)) {
10634  INTERESTING("CC-BY-3.0-AT");
10635  }
10636  else if (INFILE(_SPDX_CC_BY_30)) {
10637  INTERESTING("CC-BY-3.0");
10638  }
10639  else if (INFILE(_SPDX_CC_BY_40)) {
10640  INTERESTING("CC-BY-4.0");
10641  }
10642  if (INFILE(_SPDX_CC_BY_ND_10)) {
10643  INTERESTING("CC-BY-ND-1.0");
10644  }
10645  else if (INFILE(_SPDX_CC_BY_ND_20)) {
10646  INTERESTING("CC-BY-ND-2.0");
10647  }
10648  else if (INFILE(_SPDX_CC_BY_ND_25)) {
10649  INTERESTING("CC-BY-ND-2.5");
10650  }
10651  else if (INFILE(_SPDX_CC_BY_ND_30)) {
10652  INTERESTING("CC-BY-ND-3.0");
10653  }
10654  else if (INFILE(_SPDX_CC_BY_ND_40)) {
10655  INTERESTING("CC-BY-ND-4.0");
10656  }
10657  if (INFILE(_SPDX_CC_BY_NC_10)) {
10658  INTERESTING("CC-BY-NC-1.0");
10659  }
10660  else if (INFILE(_SPDX_CC_BY_NC_20)) {
10661  INTERESTING("CC-BY-NC-2.0");
10662  }
10663  else if (INFILE(_SPDX_CC_BY_NC_25)) {
10664  INTERESTING("CC-BY-NC-2.5");
10665  }
10666  else if (INFILE(_SPDX_CC_BY_NC_30)) {
10667  INTERESTING("CC-BY-NC-3.0");
10668  }
10669  else if (INFILE(_SPDX_CC_BY_NC_40)) {
10670  INTERESTING("CC-BY-NC-4.0");
10671  }
10672  if (INFILE(_SPDX_CC_BY_NC_ND_10)) {
10673  INTERESTING("CC-BY-NC-ND-1.0");
10674  }
10675  else if (INFILE(_SPDX_CC_BY_NC_ND_20)) {
10676  INTERESTING("CC-BY-NC-ND-2.0");
10677  }
10678  else if (INFILE(_SPDX_CC_BY_NC_ND_25)) {
10679  INTERESTING("CC-BY-NC-ND-2.5");
10680  }
10681  else if (INFILE(_SPDX_CC_BY_NC_ND_30_IGO)) {
10682  INTERESTING("CC-BY-NC-ND-3.0-IGO");
10683  }
10684  else if (INFILE(_SPDX_CC_BY_NC_ND_30)) {
10685  INTERESTING("CC-BY-NC-ND-3.0");
10686  }
10687  else if (INFILE(_SPDX_CC_BY_NC_ND_40)) {
10688  INTERESTING("CC-BY-NC-ND-4.0");
10689  }
10690  if (INFILE(_SPDX_CC_BY_NC_SA_10)) {
10691  INTERESTING("CC-BY-NC-SA-1.0");
10692  }
10693  else if (INFILE(_SPDX_CC_BY_NC_SA_20)) {
10694  INTERESTING("CC-BY-NC-SA-2.0");
10695  }
10696  else if (INFILE(_SPDX_CC_BY_NC_SA_25)) {
10697  INTERESTING("CC-BY-NC-SA-2.5");
10698  }
10699  else if (INFILE(_SPDX_CC_BY_NC_SA_30)) {
10700  INTERESTING("CC-BY-NC-SA-3.0");
10701  }
10702  else if (INFILE(_SPDX_CC_BY_NC_SA_40)) {
10703  INTERESTING("CC-BY-NC-SA-4.0");
10704  }
10705  if (INFILE(_SPDX_CC_BY_SA_10)) {
10706  INTERESTING("CC-BY-SA-1.0");
10707  }
10708  else if (INFILE(_SPDX_CC_BY_SA_20)) {
10709  INTERESTING("CC-BY-SA-2.0");
10710  }
10711  else if (INFILE(_SPDX_CC_BY_SA_25)) {
10712  INTERESTING("CC-BY-SA-2.5");
10713  }
10714  else if (INFILE(_SPDX_CC_BY_SA_30_AT)) {
10715  INTERESTING("CC-BY-SA-3.0-AT");
10716  }
10717  else if (INFILE(_SPDX_CC_BY_SA_30)) {
10718  INTERESTING("CC-BY-SA-3.0");
10719  }
10720  else if (INFILE(_SPDX_CC_BY_SA_40)) {
10721  INTERESTING("CC-BY-SA-4.0");
10722  }
10723  if (INFILE(_SPDX_CDLA_Permissive_10)) {
10724  INTERESTING("CDLA-Permissive-1.0");
10725  }
10726  if (INFILE(_SPDX_CDLA_Sharing_10)) {
10727  INTERESTING("CDLA-Sharing-1.0");
10728  }
10729  if (INFILE(_SPDX_Crossword)) {
10730  INTERESTING("Crossword");
10731  }
10732  if (INFILE(_SPDX_CrystalStacker)) {
10733  INTERESTING("CrystalStacker");
10734  }
10735  if (INFILE(_SPDX_CUA_OPL_10)) {
10736  INTERESTING("CUA-OPL-1.0");
10737  }
10738  if (INFILE(_SPDX_Cube)) {
10739  INTERESTING("Cube");
10740  }
10741  if (INFILE(_SPDX_curl)) {
10742  INTERESTING("curl");
10743  }
10744  if (INFILE(_SPDX_D_FSL_10)) {
10745  INTERESTING("D-FSL-1.0");
10746  }
10747  if (INFILE(_SPDX_diffmark)) {
10748  INTERESTING("diffmark");
10749  }
10750  if (INFILE(_SPDX_WTFPL)) {
10751  INTERESTING("WTFPL");
10752  }
10753  if (HASTEXT(_SPDX_DOC, REG_EXTENDED) || HASTEXT(_PHR_DOC, REG_EXTENDED)) {
10754  INTERESTING("DOC");
10755  }
10756  if (INFILE(_SPDX_Dotseqn)) {
10757  INTERESTING("Dotseqn");
10758  }
10759  if (INFILE(_SPDX_DSDP)) {
10760  INTERESTING("DSDP");
10761  }
10762  if (INFILE(_SPDX_dvipdfm)) {
10763  INTERESTING("dvipdfm");
10764  }
10765  if (INFILE(_SPDX_EPL_10)) {
10766  INTERESTING("EPL-1.0");
10767  }
10768  else if (INFILE(_SPDX_EPL_20)) {
10769  INTERESTING("EPL-2.0");
10770  }
10771  if (INFILE(_SPDX_ECL_10)) {
10772  INTERESTING("ECL-1.0");
10773  }
10774  if (INFILE(_SPDX_ECL_20)) {
10775  INTERESTING("ECL-2.0");
10776  }
10777  if (INFILE(_SPDX_eGenix)) {
10778  INTERESTING("eGenix");
10779  }
10780  if (INFILE(_SPDX_EFL_10)) {
10781  INTERESTING("EFL-1.0");
10782  }
10783  if (INFILE(_SPDX_EFL_20)) {
10784  INTERESTING("EFL-2.0");
10785  }
10786  if (INFILE(_SPDX_Entessa)) {
10787  INTERESTING("Entessa");
10788  }
10789  if (INFILE(_SPDX_EPICS)) {
10790  INTERESTING("EPICS");
10791  }
10792  if (INFILE(_SPDX_ErlPL_11)) {
10793  INTERESTING("ErlPL-1.1");
10794  }
10795  if (INFILE(_SPDX_etalab_20)) {
10796  INTERESTING("etalab-2.0");
10797  }
10798  if (INFILE(_SPDX_EUDatagrid)) {
10799  INTERESTING("EUDatagrid");
10800  }
10801  if (INFILE(_SPDX_EUPL_10)) {
10802  INTERESTING("EUPL-1.0");
10803  }
10804  else if (INFILE(_SPDX_EUPL_11)) {
10805  INTERESTING("EUPL-1.1");
10806  }
10807  else if (INFILE(_SPDX_EUPL_12)) {
10808  INTERESTING("EUPL-1.2");
10809  }
10810  if (INFILE(_SPDX_Eurosym)) {
10811  INTERESTING("Eurosym");
10812  }
10813  if (HASTEXT(_SPDX_Fair, REG_EXTENDED) || HASTEXT(_PHR_Fair, REG_EXTENDED)) {
10814  INTERESTING("Fair");
10815  }
10816  if (INFILE(_SPDX_Frameworx_10)) {
10817  INTERESTING("Frameworx-1.0");
10818  }
10819  if (INFILE(_SPDX_FreeImage)) {
10820  INTERESTING("FreeImage");
10821  }
10822  if (INFILE(_SPDX_FSFAP)) {
10823  INTERESTING("FSFAP");
10824  }
10825  if (INFILE(_SPDX_FSFULLR)) {
10826  INTERESTING("FSFULLR");
10827  }
10828  else if (INFILE(_SPDX_FSFUL)) {
10829  INTERESTING("FSFUL");
10830  }
10831  if (INFILE(_SPDX_Giftware)) {
10832  INTERESTING("Giftware");
10833  }
10834  if (INFILE(_SPDX_GL2PS)) {
10835  INTERESTING("GL2PS");
10836  }
10837  if (INFILE(_SPDX_Glulxe)) {
10838  INTERESTING("Glulxe");
10839  }
10840  if (INFILE(_SPDX_GFDL_11_invariants_or_later)) {
10841  INTERESTING("GFDL-1.1-invariants-or-later");
10842  }
10843  else if (INFILE(_SPDX_GFDL_11_no_invariants_or_later)) {
10844  INTERESTING("GFDL-1.1-no-invariants-or-later");
10845  }
10846  else if (INFILE(_SPDX_GFDL_11_invariants_only)) {
10847  INTERESTING("GFDL-1.1-invariants-only");
10848  }
10849  else if (INFILE(_SPDX_GFDL_11_no_invariants_only)) {
10850  INTERESTING("GFDL-1.1-no-invariants-only");
10851  }
10852  else if (INFILE(_SPDX_GFDL_11_or_later)
10853  || HASTEXT(_SPDX_GFDL_11plus, REG_EXTENDED)
10854  || HASTEXT(_PHR_GFDL_11plus, REG_EXTENDED))
10855  {
10856  INTERESTING("GFDL-1.1-or-later");
10857  }
10858  else if (INFILE(_SPDX_GFDL_11)) {
10859  INTERESTING("GFDL-1.1-only");
10860  }
10861  else if (INFILE(_SPDX_GFDL_12_invariants_or_later)) {
10862  INTERESTING("GFDL-1.2-invariants-or-later");
10863  }
10864  else if (INFILE(_SPDX_GFDL_12_no_invariants_or_later)) {
10865  INTERESTING("GFDL-1.2-no-invariants-or-later");
10866  }
10867  else if (INFILE(_SPDX_GFDL_12_invariants_only)) {
10868  INTERESTING("GFDL-1.2-invariants-only");
10869  }
10870  else if (INFILE(_SPDX_GFDL_12_no_invariants_only)) {
10871  INTERESTING("GFDL-1.2-no-invariants-only");
10872  }
10873  else if (INFILE(_SPDX_GFDL_12_or_later)
10874  || HASTEXT(_SPDX_GFDL_12plus, REG_EXTENDED)
10875  || HASTEXT(_PHR_GFDL_12plus, REG_EXTENDED))
10876  {
10877  INTERESTING("GFDL-1.2-or-later");
10878  }
10879  else if (INFILE(_SPDX_GFDL_12)) {
10880  INTERESTING("GFDL-1.2-only");
10881  }
10882  else if (INFILE(_SPDX_GFDL_13_invariants_or_later)) {
10883  INTERESTING("GFDL-1.3-invariants-or-later");
10884  }
10885  else if (INFILE(_SPDX_GFDL_13_no_invariants_or_later)) {
10886  INTERESTING("GFDL-1.3-no-invariants-or-later");
10887  }
10888  else if (INFILE(_SPDX_GFDL_13_invariants_only)) {
10889  INTERESTING("GFDL-1.3-invariants-only");
10890  }
10891  else if (INFILE(_SPDX_GFDL_13_no_invariants_only)) {
10892  INTERESTING("GFDL-1.3-no-invariants-only");
10893  }
10894  else if (INFILE(_SPDX_GFDL_13_or_later)
10895  || HASTEXT(_SPDX_GFDL_13plus, REG_EXTENDED)
10896  || HASTEXT(_PHR_GFDL_13plus, REG_EXTENDED))
10897  {
10898  INTERESTING("GFDL-1.3-or-later");
10899  }
10900  else if (INFILE(_SPDX_GFDL_13)) {
10901  INTERESTING("GFDL-1.3");
10902  }
10903  if (INFILE(_SPDX_GLWTPL)) {
10904  INTERESTING("GLWTPL");
10905  }
10906  if (INFILE(_SPDX_gnuplot)) {
10907  INTERESTING("gnuplot");
10908  }
10909  if (INFILE(_SPDX_gSOAP_13b)) {
10910  INTERESTING("gSOAP-1.3b");
10911  }
10912  if (INFILE(_SPDX_HaskellReport)) {
10913  INTERESTING("HaskellReport");
10914  }
10915  if (INFILE(_SPDX_Hippocratic_21)) {
10916  INTERESTING("Hippocratic-2.1");
10917  }
10918  if (INFILE(_SPDX_HPND_sell_variant)) {
10919  INTERESTING("HPND-sell-variant");
10920  }
10921  else if (INFILE(_SPDX_HPND)) {
10922  INTERESTING("HPND");
10923  }
10924  if (INFILE(_SPDX_IBM_pibs)) {
10925  INTERESTING("IBM-pibs");
10926  }
10927  if (INFILE(_SPDX_IPL_10)) {
10928  INTERESTING("IPL-1.0");
10929  }
10930  if (INFILE(_SPDX_ImageMagick)) {
10931  INTERESTING("ImageMagick");
10932  }
10933  if (INFILE(_SPDX_iMatix)) {
10934  INTERESTING("iMatix");
10935  }
10936  if (INFILE(_SPDX_Imlib2)) {
10937  INTERESTING("Imlib2");
10938  }
10939  if (INFILE(_SPDX_IJG)) {
10940  INTERESTING("IJG");
10941  }
10942  if (INFILE(_SPDX_Info_ZIP)) {
10943  INTERESTING("Info-ZIP");
10944  }
10945  if (INFILE(_SPDX_Interbase_10)) {
10946  INTERESTING("Interbase-1.0");
10947  }
10948  if (INFILE(_SPDX_IPA)) {
10949  INTERESTING("IPA");
10950  }
10951  if (INFILE(_SPDX_ISC)) {
10952  INTERESTING("ISC");
10953  }
10954  if (INFILE(_SPDX_JasPer_20)) {
10955  INTERESTING("JasPer-2.0");
10956  }
10957  if (INFILE(_SPDX_JPNIC)) {
10958  INTERESTING("JPNIC");
10959  }
10960  if (INFILE(_SPDX_JSON)) {
10961  INTERESTING("JSON");
10962  }
10963  if (INFILE(_SPDX_Latex2e)) {
10964  INTERESTING("Latex2e");
10965  }
10966  if (INFILE(_SPDX_Leptonica)) {
10967  INTERESTING("Leptonica");
10968  }
10969  if (INFILE(_SPDX_LGPLLR)) {
10970  INTERESTING("LGPLLR");
10971  }
10972  if (INFILE(_SPDX_libpng_20)) {
10973  INTERESTING("libpng-2.0");
10974  }
10975  else if (INFILE(_SPDX_Libpng)) {
10976  INTERESTING("Libpng");
10977  }
10978  if (INFILE(_SPDX_libselinux_10)) {
10979  INTERESTING("libselinux-1.0");
10980  }
10981  if (INFILE(_SPDX_libtiff)) {
10982  INTERESTING("libtiff");
10983  }
10984  if (INFILE(_SPDX_LAL_12)) {
10985  INTERESTING("LAL-1.2");
10986  }
10987  if (INFILE(_SPDX_LAL_13)) {
10988  INTERESTING("LAL-1.3");
10989  }
10990  if (INFILE(_SPDX_LiLiQ_P_11)) {
10991  INTERESTING("LiLiQ-P-1.1");
10992  }
10993  if (INFILE(_SPDX_LiLiQ_Rplus_11)) {
10994  INTERESTING("LiLiQ-Rplus-1.1");
10995  }
10996  if (INFILE(_SPDX_LiLiQ_R_11)) {
10997  INTERESTING("LiLiQ-R-1.1");
10998  }
10999  if (INFILE(_SPDX_Linux_OpenIB)) {
11000  INTERESTING("Linux-OpenIB");
11001  }
11002  if (INFILE(_SPDX_LPL_102)) {
11003  INTERESTING("LPL-1.02");
11004  }
11005  else if (INFILE(_SPDX_LPL_10)) {
11006  INTERESTING("LPL-1.0");
11007  }
11008  if (INFILE(_SPDX_LPPL_10)) {
11009  INTERESTING("LPPL-1.0");
11010  }
11011  if (INFILE(_SPDX_LPPL_11)) {
11012  INTERESTING("LPPL-1.1");
11013  }
11014  if (INFILE(_SPDX_LPPL_12)) {
11015  INTERESTING("LPPL-1.2");
11016  }
11017  if (INFILE(_SPDX_LPPL_13a)) {
11018  INTERESTING("LPPL-1.3a");
11019  }
11020  if (INFILE(_SPDX_LPPL_13c)) {
11021  INTERESTING("LPPL-1.3c");
11022  }
11023  if (INFILE(_SPDX_MakeIndex)) {
11024  INTERESTING("MakeIndex");
11025  }
11026  if (INFILE(_SPDX_MTLL)) {
11027  INTERESTING("MTLL");
11028  }
11029  if (INFILE(_SPDX_MS_PL)) {
11030  INTERESTING("MS-PL");
11031  }
11032  if (INFILE(_SPDX_MS_RL)) {
11033  INTERESTING("MS-RL");
11034  }
11035  if (INFILE(_SPDX_MirOS)) {
11036  INTERESTING("MirOS");
11037  }
11038  if (INFILE(_SPDX_MITNFA)) {
11039  INTERESTING("MITNFA");
11040  }
11041  if (!lmem[_fREAL] && INFILE(_SPDX_Motosoto)) {
11042  INTERESTING("Motosoto");
11043  }
11044  if (INFILE(_SPDX_mpich2)) {
11045  INTERESTING("mpich2");
11046  }
11047  if (INFILE(_SPDX_MulanPSL_20)) {
11048  INTERESTING("MulanPSL-2.0");
11049  }
11050  else if (INFILE(_SPDX_MulanPSL_10)) {
11051  INTERESTING("MulanPSL-1.0");
11052  }
11053  if (INFILE(_SPDX_Multics)) {
11054  INTERESTING("Multics");
11055  }
11056  if (INFILE(_SPDX_Mup)) {
11057  INTERESTING("Mup");
11058  }
11059  if (INFILE(_SPDX_NASA_13)) {
11060  INTERESTING("NASA-1.3");
11061  }
11062  if (INFILE(_SPDX_Naumen)) {
11063  INTERESTING("Naumen");
11064  }
11065  if (INFILE(_SPDX_NBPL_10)) {
11066  INTERESTING("NBPL-1.0");
11067  }
11068  if (INFILE(_SPDX_NCGL_UK_20)) {
11069  INTERESTING("NCGL-UK-2.0");
11070  }
11071  if (INFILE(_SPDX_Net_SNMP)) {
11072  INTERESTING("Net-SNMP");
11073  }
11074  if (INFILE(_SPDX_NetCDF)) {
11075  INTERESTING("NetCDF");
11076  }
11077  if (INFILE(_SPDX_NGPL)) {
11078  INTERESTING("NGPL");
11079  }
11080  if (INFILE(_SPDX_NIST_PD_fallback)) {
11081  INTERESTING("NIST-PD-fallback");
11082  }
11083  else if (INFILE(_SPDX_NIST_PD)) {
11084  INTERESTING("NIST-PD");
11085  }
11086  if (INFILE(_SPDX_NOSL)) {
11087  INTERESTING("NOSL");
11088  }
11089  if (INFILE(_SPDX_NPL_10)) {
11090  INTERESTING("NPL-1.0");
11091  }
11092  if (INFILE(_SPDX_NPL_11)) {
11093  INTERESTING("NPL-1.1");
11094  }
11095  if (INFILE(_SPDX_Newsletr)) {
11096  INTERESTING("Newsletr");
11097  }
11098  if (INFILE(_SPDX_NLPL)) {
11099  INTERESTING("NLPL");
11100  }
11101  if (INFILE(_SPDX_Nokia) && NOT_INFILE(_LT_OPENSSL_NOKIA)) {
11102  INTERESTING("Nokia");
11103  }
11104  if (INFILE(_SPDX_NPOSL_30)) {
11105  INTERESTING("NPOSL-3.0");
11106  }
11107  if (INFILE(_SPDX_NLOD_10)) {
11108  INTERESTING("NLOD-1.0");
11109  }
11110  if (INFILE(_SPDX_Noweb)) {
11111  INTERESTING("Noweb");
11112  }
11113  if (INFILE(_SPDX_NRL)) {
11114  INTERESTING("NRL");
11115  }
11116  if (INFILE(_SPDX_NTP_0)) {
11117  INTERESTING("NTP-0");
11118  }
11119  else if (INFILE(_SPDX_NTP)) {
11120  INTERESTING("NTP");
11121  }
11122  if (INFILE(_SPDX_Nunit)) {
11123  INTERESTING("Nunit");
11124  }
11125  if (INFILE(_SPDX_O_UDA_10)) {
11126  INTERESTING("O-UDA-1.0");
11127  }
11128  if (INFILE(_SPDX_OCLC_20)) {
11129  INTERESTING("OCLC-2.0");
11130  }
11131  if (INFILE(_SPDX_ODbL_10)) {
11132  INTERESTING("ODbL-1.0");
11133  }
11134  if (INFILE(_SPDX_OGC_10)) {
11135  INTERESTING("OGC-1.0");
11136  }
11137  if (INFILE(_SPDX_PDDL_10)) {
11138  INTERESTING("PDDL-1.0");
11139  }
11140  if (INFILE(_SPDX_OCCT_PL)) {
11141  INTERESTING("OCCT-PL");
11142  }
11143  if (INFILE(_SPDX_ODC_By_10)) {
11144  INTERESTING("ODC-By-1.0");
11145  }
11146  if (INFILE(_SPDX_OGL_Canada_20)) {
11147  INTERESTING("OGL-Canada-2.0");
11148  }
11149  if (INFILE(_SPDX_OGL_UK_10)) {
11150  INTERESTING("OGL-UK-1.0");
11151  }
11152  else if (INFILE(_SPDX_OGL_UK_20)) {
11153  INTERESTING("OGL-UK-2.0");
11154  }
11155  else if (INFILE(_SPDX_OGL_UK_30)) {
11156  INTERESTING("OGL-UK-3.0");
11157  }
11158  if (INFILE(_SPDX_OGTSL)) {
11159  INTERESTING("OGTSL");
11160  }
11161  if (INFILE(_SPDX_OLDAP_11)) {
11162  INTERESTING("OLDAP-1.1");
11163  }
11164  else if (INFILE(_SPDX_OLDAP_12)) {
11165  INTERESTING("OLDAP-1.2");
11166  }
11167  else if (INFILE(_SPDX_OLDAP_13)) {
11168  INTERESTING("OLDAP-1.3");
11169  }
11170  else if (INFILE(_SPDX_OLDAP_14)) {
11171  INTERESTING("OLDAP-1.4");
11172  }
11173  else if (INFILE(_SPDX_OLDAP_201)) {
11174  INTERESTING("OLDAP-2.0.1");
11175  }
11176  else if (INFILE(_SPDX_OLDAP_20)) {
11177  INTERESTING("OLDAP-2.0");
11178  }
11179  else if (INFILE(_SPDX_OLDAP_21)) {
11180  INTERESTING("OLDAP-2.1");
11181  }
11182  else if (INFILE(_SPDX_OLDAP_221)) {
11183  INTERESTING("OLDAP-2.2.1");
11184  }
11185  else if (INFILE(_SPDX_OLDAP_222)) {
11186  INTERESTING("OLDAP-2.2.2");
11187  }
11188  else if (INFILE(_SPDX_OLDAP_22)) {
11189  INTERESTING("OLDAP-2.2");
11190  }
11191  else if (INFILE(_SPDX_OLDAP_23)) {
11192  INTERESTING("OLDAP-2.3");
11193  }
11194  else if (INFILE(_SPDX_OLDAP_24)) {
11195  INTERESTING("OLDAP-2.4");
11196  }
11197  else if (INFILE(_SPDX_OLDAP_25)) {
11198  INTERESTING("OLDAP-2.5");
11199  }
11200  else if (INFILE(_SPDX_OLDAP_26)) {
11201  INTERESTING("OLDAP-2.6");
11202  }
11203  else if (INFILE(_SPDX_OLDAP_27)) {
11204  INTERESTING("OLDAP-2.7");
11205  }
11206  else if (INFILE(_SPDX_OLDAP_28)) {
11207  INTERESTING("OLDAP-2.8");
11208  }
11209  if (INFILE(_SPDX_OML)) {
11210  INTERESTING("OML");
11211  }
11212  if (INFILE(_SPDX_OPL_10)) {
11213  INTERESTING("OPL-1.0");
11214  }
11215  if (INFILE(_SPDX_OSL_10)) {
11216  INTERESTING("OSL-1.0");
11217  }
11218  if (INFILE(_SPDX_OSL_11)) {
11219  INTERESTING("OSL-1.1");
11220  }
11221  if (INFILE(_SPDX_OSL_20)) {
11222  INTERESTING("OSL-2.0");
11223  }
11224  if (INFILE(_SPDX_OSL_21)) {
11225  INTERESTING("OSL-2.1");
11226  }
11227  if (INFILE(_SPDX_OSL_30)) {
11228  INTERESTING("OSL-3.0");
11229  }
11230  if (INFILE(_SPDX_OSET_PL_21)) {
11231  INTERESTING("OSET-PL-2.1");
11232  }
11233  if (INFILE(_SPDX_Parity_700)) {
11234  INTERESTING("Parity-7.0.0");
11235  }
11236  else if (INFILE(_SPDX_Parity_600)) {
11237  INTERESTING("Parity-6.0.0");
11238  }
11239  if (INFILE(_SPDX_PHP_301)) {
11240  INTERESTING("PHP-3.01");
11241  }
11242  else if (INFILE(_SPDX_PHP_30)) {
11243  INTERESTING("PHP-3.0");
11244  }
11245  if (INFILE(_SPDX_Plexus)) {
11246  INTERESTING("Plexus");
11247  }
11248  if (INFILE(_SPDX_PolyForm_Noncommercial_100)) {
11249  INTERESTING("PolyForm-Noncommercial-1.0.0");
11250  }
11251  else if (INFILE(_SPDX_PolyForm_Small_Business_100)) {
11252  INTERESTING("PolyForm-Small-Business-1.0.0");
11253  }
11254  if (INFILE(_SPDX_PostgreSQL)) {
11255  INTERESTING("PostgreSQL");
11256  }
11257  if (INFILE(_SPDX_PSF_20)) {
11258  INTERESTING("PSF-2.0");
11259  }
11260  if (INFILE(_SPDX_psfrag)) {
11261  INTERESTING("psfrag");
11262  }
11263  if (INFILE(_SPDX_psutils)) {
11264  INTERESTING("psutils");
11265  }
11266  if (INFILE(_SPDX_Python_20)) {
11267  INTERESTING("Python-2.0");
11268  }
11269  if (INFILE(_SPDX_QPL_10)) {
11270  INTERESTING("QPL-1.0");
11271  }
11272  if (INFILE(_SPDX_Qhull)) {
11273  INTERESTING("Qhull");
11274  }
11275  if (INFILE(_SPDX_Rdisc)) {
11276  INTERESTING("Rdisc");
11277  }
11278  if (INFILE(_SPDX_RPSL_10)) {
11279  INTERESTING("RPSL-1.0");
11280  }
11281  if (INFILE(_SPDX_RPL_11)) {
11282  INTERESTING("RPL-1.1");
11283  }
11284  if (INFILE(_SPDX_RPL_15)) {
11285  INTERESTING("RPL-1.5");
11286  }
11287  if (INFILE(_SPDX_RHeCos_11)) {
11288  INTERESTING("RHeCos-1.1");
11289  }
11290  if (INFILE(_SPDX_RSCPL)) {
11291  INTERESTING("RSCPL");
11292  }
11293  if (INFILE(_SPDX_RSA_MD)) {
11294  INTERESTING("RSA-MD");
11295  }
11296  if (INFILE(_SPDX_Ruby)) {
11297  INTERESTING("Ruby");
11298  }
11299  if (INFILE(_SPDX_SAX_PD)) {
11300  INTERESTING("SAX-PD");
11301  }
11302  if (INFILE(_SPDX_Saxpath)) {
11303  INTERESTING("Saxpath");
11304  }
11305  if (INFILE(_SPDX_SHL_051)) {
11306  INTERESTING("SHL-0.51");
11307  }
11308  else if (INFILE(_SPDX_SHL_05)) {
11309  INTERESTING("SHL-0.5");
11310  }
11311  if (INFILE(_SPDX_SCEA)) {
11312  INTERESTING("SCEA");
11313  }
11314  if (INFILE(_SPDX_SWL)) {
11315  INTERESTING("SWL");
11316  }
11317  if (INFILE(_SPDX_SMPPL)) {
11318  INTERESTING("SMPPL");
11319  }
11320  if (INFILE(_SPDX_Sendmail_823)) {
11321  INTERESTING("Sendmail-8.23");
11322  }
11323  else if (INFILE(_SPDX_Sendmail)) {
11324  INTERESTING("Sendmail");
11325  }
11326  if (INFILE(_SPDX_SGI_B_10)) {
11327  INTERESTING("SGI-B-1.0");
11328  }
11329  if (INFILE(_SPDX_SGI_B_11)) {
11330  INTERESTING("SGI-B-1.1");
11331  }
11332  if (INFILE(_SPDX_SGI_B_20)) {
11333  INTERESTING("SGI-B-2.0");
11334  }
11335  if (INFILE(_SPDX_SimPL_20)) {
11336  INTERESTING("SimPL-2.0");
11337  }
11338  if (INFILE(_SPDX_Sleepycat)) {
11339  INTERESTING("Sleepycat");
11340  }
11341  if (INFILE(_SPDX_SNIA)) {
11342  INTERESTING("SNIA");
11343  }
11344  if (INFILE(_SPDX_Spencer_86)) {
11345  INTERESTING("Spencer-86");
11346  }
11347  if (INFILE(_SPDX_Spencer_94)) {
11348  INTERESTING("Spencer-94");
11349  }
11350  if (INFILE(_SPDX_Spencer_99)) {
11351  INTERESTING("Spencer-99");
11352  }
11353  if (INFILE(_SPDX_SMLNJ)) {
11354  INTERESTING("SMLNJ");
11355  }
11356  if (INFILE(_SPDX_SSH_OpenSSH)) {
11357  INTERESTING("SSH-OpenSSH");
11358  }
11359  if (INFILE(_SPDX_SSH_short)) {
11360  INTERESTING("SSH-short");
11361  }
11362  if (INFILE(_SPDX_SSPL_10)) {
11363  INTERESTING("SSPL-1.0");
11364  }
11365  if (INFILE(_SPDX_SugarCRM_113)) {
11366  INTERESTING("SugarCRM-1.1.3");
11367  }
11368  if (INFILE(_SPDX_SISSL_12)) {
11369  INTERESTING("SISSL-1.2");
11370  }
11371  else if (!lmem[_fREAL] && INFILE(_SPDX_SISSL)) {
11372  INTERESTING("SISSL");
11373  }
11374  if (INFILE(_SPDX_SPL_10)) {
11375  INTERESTING("SPL-1.0");
11376  }
11377  if (INFILE(_SPDX_Watcom_10)) {
11378  INTERESTING("Watcom-1.0");
11379  }
11380  if (INFILE(_SPDX_TAPR_OHL_10)) {
11381  INTERESTING("TAPR-OHL-1.0");
11382  }
11383  if (INFILE(_SPDX_TCP_wrappers)) {
11384  INTERESTING("TCP-wrappers");
11385  }
11386  if (INFILE(_SPDX_Unlicense)) {
11387  INTERESTING("Unlicense");
11388  }
11389  if (INFILE(_SPDX_TMate)) {
11390  INTERESTING("TMate");
11391  }
11392  if (INFILE(_SPDX_TORQUE_11)) {
11393  INTERESTING("TORQUE-1.1");
11394  }
11395  if (INFILE(_SPDX_TOSL)) {
11396  INTERESTING("TOSL");
11397  }
11398  if (INFILE(_SPDX_TU_Berlin_10)) {
11399  INTERESTING("TU-Berlin-1.0");
11400  }
11401  else if (INFILE(_SPDX_TU_Berlin_20)) {
11402  INTERESTING("TU-Berlin-2.0");
11403  }
11404  if (INFILE(_SPDX_UCL_10)) {
11405  INTERESTING("UCL-1.0");
11406  }
11407  if (INFILE(_SPDX_Unicode_DFS_2015)) {
11408  INTERESTING("Unicode-DFS-2015");
11409  }
11410  if (INFILE(_SPDX_Unicode_DFS_2016)) {
11411  INTERESTING("Unicode-DFS-2016");
11412  }
11413  if (INFILE(_SPDX_Unicode_TOU)) {
11414  INTERESTING("Unicode-TOU");
11415  }
11416  if (INFILE(_SPDX_UPL_10)) {
11417  INTERESTING("UPL-1.0");
11418  }
11419  if (INFILE(_SPDX_NCSA)) {
11420  INTERESTING("NCSA");
11421  }
11422  if (INFILE(_SPDX_Vim)) {
11423  INTERESTING("Vim");
11424  }
11425  if (INFILE(_SPDX_VOSTROM)) {
11426  INTERESTING("VOSTROM");
11427  }
11428  if (INFILE(_SPDX_VSL_10)) {
11429  INTERESTING("VSL-1.0");
11430  }
11431  if (INFILE(_SPDX_W3C_20150513)) {
11432  INTERESTING("W3C-20150513");
11433  }
11434  else if (INFILE(_SPDX_W3C_19980720)) {
11435  INTERESTING("W3C-19980720");
11436  }
11437  else if (INFILE(_SPDX_W3C)) {
11438  INTERESTING("W3C");
11439  }
11440  if (INFILE(_SPDX_Wsuipa)) {
11441  INTERESTING("Wsuipa");
11442  }
11443  if (!lmem[_fREAL] && INFILE(_SPDX_Xnet)) {
11444  INTERESTING("Xnet");
11445  }
11446  if (INFILE(_SPDX_X11)) {
11447  INTERESTING("X11");
11448  }
11449  if (INFILE(_SPDX_Xerox)) {
11450  INTERESTING("Xerox");
11451  }
11452  if (INFILE(_SPDX_XFree86_11)) {
11453  INTERESTING("XFree86-1.1");
11454  }
11455  if (INFILE(_SPDX_xinetd)) {
11456  INTERESTING("xinetd");
11457  }
11458  if (INFILE(_SPDX_xpp)) {
11459  INTERESTING("xpp");
11460  }
11461  if (INFILE(_SPDX_XSkat)) {
11462  INTERESTING("XSkat");
11463  }
11464  if (INFILE(_SPDX_YPL_10)) {
11465  INTERESTING("YPL-1.0");
11466  }
11467  if (INFILE(_SPDX_YPL_11)) {
11468  INTERESTING("YPL-1.1");
11469  }
11470  if (INFILE(_SPDX_Zed)) {
11471  INTERESTING("Zed");
11472  }
11473  if (INFILE(_SPDX_Zend_20)) {
11474  INTERESTING("Zend-2.0");
11475  }
11476  if (INFILE(_SPDX_Zimbra_13)) {
11477  INTERESTING("Zimbra-1.3");
11478  }
11479  if (INFILE(_SPDX_Zimbra_14)) {
11480  INTERESTING("Zimbra-1.4");
11481  }
11482  return;
11483 }
11484 
11489 void copyleftExceptions(char *filetext, int size, int isML, int isPS)
11490 {
11491  if (INFILE(_SPDX_389_exception)) {
11492  INTERESTING("389-exception");
11493  }
11494  if (INFILE(_SPDX_Autoconf_exception_20)) {
11495  INTERESTING("Autoconf-exception-2.0");
11496  }
11497  if (INFILE(_SPDX_Autoconf_exception_30)) {
11498  INTERESTING("Autoconf-exception-3.0");
11499  }
11500  if (INFILE(_SPDX_Bison_exception_22)) {
11501  INTERESTING("Bison-exception-2.2");
11502  }
11503  if (INFILE(_SPDX_Bootloader_exception)) {
11504  INTERESTING("Bootloader-exception");
11505  }
11506  if (INFILE(_SPDX_Classpath_exception_20)) {
11507  INTERESTING("Classpath-exception-2.0");
11508  }
11509  if (INFILE(_SPDX_CLISP_exception_20)) {
11510  INTERESTING("CLISP-exception-2.0");
11511  }
11512  if (INFILE(_SPDX_DigiRule_FOSS_exception)) {
11513  INTERESTING("DigiRule-FOSS-exception");
11514  }
11515  if (INFILE(_SPDX_eCos_exception_20)) {
11516  INTERESTING("eCos-exception-2.0");
11517  }
11518  if (INFILE(_SPDX_Fawkes_Runtime_exception)) {
11519  INTERESTING("Fawkes-Runtime-exception");
11520  }
11521  if (INFILE(_SPDX_FLTK_exception)) {
11522  INTERESTING("FLTK-exception");
11523  }
11524  if (INFILE(_SPDX_Font_exception_20)) {
11525  INTERESTING("Font-exception-2.0");
11526  }
11527  if (INFILE(_SPDX_freertos_exception_20)) {
11528  INTERESTING("freertos-exception-2.0");
11529  }
11530  if (INFILE(_SPDX_GCC_exception_20)) {
11531  INTERESTING("GCC-exception-2.0");
11532  }
11533  if (INFILE(_SPDX_GCC_exception_31)) {
11534  INTERESTING("GCC-exception-3.1");
11535  }
11536  if (INFILE(_SPDX_gnu_javamail_exception)) {
11537  INTERESTING("gnu-javamail-exception");
11538  }
11539  if (INFILE(_SPDX_i2p_gpl_java_exception)) {
11540  INTERESTING("i2p-gpl-java-exception");
11541  }
11542  if (INFILE(_SPDX_Libtool_exception)) {
11543  INTERESTING("Libtool-exception");
11544  }
11545  if (INFILE(_SPDX_Linux_syscall_note)) {
11546  INTERESTING("Linux-syscall-note");
11547  }
11548  if (INFILE(_SPDX_LLVM_exception)) {
11549  INTERESTING("LLVM-exception");
11550  }
11551  if (INFILE(_SPDX_LZMA_exception)) {
11552  INTERESTING("LZMA-exception");
11553  }
11554  if (INFILE(_SPDX_mif_exception)) {
11555  INTERESTING("mif-exception");
11556  }
11557  if (INFILE(_SPDX_Nokia_Qt_exception_11)) {
11558  INTERESTING("Nokia-Qt-exception-1.1");
11559  }
11560  if (INFILE(_SPDX_OCCT_exception_10)) {
11561  INTERESTING("OCCT-exception-1.0");
11562  }
11563  if (INFILE(_SPDX_OpenJDK_assembly_exception_10)) {
11564  INTERESTING("OpenJDK-assembly-exception-1.0");
11565  }
11566  if (INFILE(_SPDX_openvpn_openssl_exception)) {
11567  INTERESTING("openvpn-openssl-exception");
11568  }
11569  if (INFILE(_SPDX_Qwt_exception_10)) {
11570  INTERESTING("Qwt-exception-1.0");
11571  }
11572  if (INFILE(_SPDX_u_boot_exception_20)) {
11573  INTERESTING("u-boot-exception-2.0");
11574  }
11575  if (INFILE(_SPDX_WxWindows_exception_31)) {
11576  INTERESTING("WxWindows-exception-3.1");
11577  }
11578  /*
11579  * Find exception phrases. There are similar phrases
11580  * in exception clauses. Therefore 'else if' structure
11581  * has to be used to get correct detections.
11582  */
11583  if (INFILE(_LT_389_exception)) {
11584  INTERESTING("389-exception");
11585  }
11586  else if (INFILE(_LT_Autoconf_exception_20)) {
11587  INTERESTING("Autoconf-exception-2.0");
11588  }
11589  else if (INFILE(_LT_GPL_EXCEPT_5) && INFILE(_LT_Autoconf_exception_30)) {
11590  INTERESTING("Autoconf-exception-3.0");
11591  }
11592  else if (INFILE(_PHR_Autoconf_exception_30)) {
11593  INTERESTING("Autoconf-exception-3.0");
11594  }
11595  else if (INFILE(_LT_Autoconf_exception_3)) {
11596  INTERESTING("Autoconf-exception");
11597  }
11598  else if (INFILE(_LT_Bison_exception_22)) {
11599  INTERESTING("Bison-exception-2.2");
11600  }
11601  else if (INFILE(_LT_Bison_exception_1) || INFILE(_LT_Bison_exception_2)) {
11602  INTERESTING("Bison-exception");
11603  }
11604  else if (INFILE(_LT_Bootloader_exception)) {
11605  INTERESTING("Bootloader-exception");
11606  }
11607  /* Contains similar text to classpath-exception */
11608  else if (INFILE(_LT_OpenJDK_assembly_exception_10_1) || HASTEXT(_LT_OpenJDK_assembly_exception_10_2, 0)) {
11609  INTERESTING("OpenJDK-assembly-exception-1.0");
11610  }
11611  else if (INFILE(_LT_GPL_EXCEPT_6)) {
11612  if (INFILE(_LT_mif_exception)) {
11613  INTERESTING("Fawkes-Runtime-exception");
11614  }
11615  else {
11616  INTERESTING("Classpath-exception-2.0");
11617  }
11618  }
11619  else if (INFILE(_LT_classpath_exception_1)) {
11620  INTERESTING("Classpath-exception-2.0");
11621  }
11622  else if (HASTEXT(_LT_CLISP_exception_20_1, 0) && INFILE(_LT_CLISP_exception_20_2)) {
11623  INTERESTING("CLISP-exception-2.0");
11624  }
11625  else if (HASTEXT(_TITLE_DigiRule_FOSS_exception, 0) || INFILE(_LT_DigiRule_FOSS_exception)) {
11626  INTERESTING("DigiRule-FOSS-exception");
11627  }
11628  else if (INFILE(_LT_eCos_exception) && INFILE(_LT_GPL_EXCEPT_7)) {
11629  INTERESTING("eCos-exception-2.0");
11630  }
11631  else if (HASTEXT(_LT_FLTK_exception, 0)) {
11632  INTERESTING("FLTK-exception");
11633  }
11634  else if (HASTEXT(_TEXT_FONT, REG_EXTENDED) || INFILE(_LT_FONT_EXCEPTION_20)) {
11635  INTERESTING("Font-exception-2.0");
11636  }
11637  else if (HASTEXT(_LT_freertos_exception_20, 0)) {
11638  INTERESTING("freertos-exception-2.0");
11639  }
11640  else if (INFILE(_LT_freertos_exception_1) || INFILE(_LT_freertos_exception_2)) {
11641  INTERESTING("freertos-exception");
11642  }
11643  else if (INFILE(_LT_GCC_exception_31_1) || INFILE(_LT_GCC_exception_31_2)) {
11644  INTERESTING("GCC-exception-3.1");
11645  }
11646  else if (INFILE(_LT_GCC_exception_20)) {
11647  INTERESTING("GCC-exception-2.0");
11648  }
11649  /* This wording is very similar to GCC_exception_20 */
11650  else if (INFILE(_LT_linking_exception_1)) {
11651  INTERESTING("linking-exception");
11652  }
11653  else if (HASTEXT(_TEXT_GCC, REG_EXTENDED)) {
11654  INTERESTING("GCC-exception");
11655  }
11656  else if (INFILE(_LT_gnu_javamail_exception_1) || INFILE(_LT_gnu_javamail_exception_2)) {
11657  INTERESTING("gnu-javamail-exception");
11658  }
11659  else if (INFILE(_LT_i2p_gpl_java_exception)) {
11660  INTERESTING("i2p-gpl-java-exception");
11661  }
11662  else if (INFILE(_LT_GPL_EXCEPT_1) || INFILE(_LT_GPL_EXCEPT_2)) {
11663  if (HASTEXT(_LT_Libtool_exception, 0)) {
11664  INTERESTING("Libtool-exception");
11665  }
11666  if (HASTEXT(_LT_Autoconf_exception_2, REG_EXTENDED) || INFILE(_LT_Autoconf_exception_1)) {
11667  INTERESTING("Autoconf-exception");
11668  }
11669  }
11670  else if (INFILE(_LT_Linux_syscall_note)) {
11671  INTERESTING("Linux-syscall-note");
11672  }
11673  else if (HASTEXT(_LT_LLVM_exception_1, 0) || HASTEXT(_LT_LLVM_exception_2, 0)) {
11674  INTERESTING("LLVM-exception");
11675  }
11676  else if (INFILE(_LT_LZMA_exception)) {
11677  INTERESTING("LZMA-exception");
11678  }
11679  else if (INFILE(_LT_mif_exception)) {
11680  INTERESTING("mif-exception");
11681  }
11682  else if (HASTEXT(_LT_OCCT_exception_10_1, REG_EXTENDED) || INFILE(_LT_OCCT_exception_10_2)) {
11683  INTERESTING("OCCT-exception-1.0");
11684  }
11685  else if (INFILE(_LT_openvpn_openssl_exception)) {
11686  INTERESTING("openvpn-openssl-exception");
11687  }
11688  else if (HASTEXT(_TITLE_QT_GPL_EXCEPTION_10, 0)) {
11689  INTERESTING("Qt-GPL-exception-1.0");
11690  }
11691  else if (HASTEXT(_LT_QT_GPL_EXCEPTION_10_1, 0) && INFILE(_LT_QT_GPL_EXCEPTION_10_2)) {
11692  INTERESTING("Qt-GPL-exception-1.0");
11693  }
11694  else if (HASTEXT(_LT_QT_GPL_EXCEPTION, 0) && HASTEXT(_LT_QT_GPL_EXCEPTION_10_3, 0)) {
11695  INTERESTING("Qt-GPL-exception-1.0");
11696  }
11697  else if (INFILE(_TITLE_Nokia_Qt_LGPL_exception_11)) {
11698  INTERESTING("Nokia-Qt-exception-1.1");
11699  }
11700  else if (INFILE(_TITLE_QT_LGPL_EXCEPTION_11)) {
11701  INTERESTING("Qt-LGPL-exception-1.1");
11702  }
11703  else if (INFILE(_LT_Qwt_exception_10_1)) {
11704  INTERESTING("Qwt-exception-1.0");
11705  }
11706  else if (HASTEXT(_LT_Qwt_exception_10_2, 0)) {
11707  INTERESTING("Qwt-exception-1.0");
11708  }
11709  else if (INFILE(_LT_WxWindows_exception_31)) {
11710  INTERESTING("WxWindows-exception-3.1");
11711  }
11712  /*
11713  * Full license text includes reference to LGPL-2.0-only
11714  * exception clause.
11715  */
11716  else if (INFILE(_PHR_WXWINDOWS_31)) {
11717  INTERESTING("WxWindows-exception-3.1");
11718  INTERESTING("LGPL-2.0-or-later");
11719  }
11720  /*
11721  * This is a vague reference to WxWindows license without
11722  * an exception reference.
11723  */
11724  else if (INFILE(_PHR_WXWINDOWS)) {
11725  INTERESTING("WxWindows");
11726  }
11727  else if (HASTEXT(_LT_u_boot_exception_20, REG_EXTENDED)) {
11728  INTERESTING("u-boot-exception-2.0");
11729  }
11730  else if (HASTEXT(_LT_GPL_EXCEPT_Trolltech, REG_EXTENDED)) {
11731  INTERESTING("trolltech-exception");
11732  }
11733  else if (INFILE(_LT_OpenSSL_exception_1) || INFILE(_LT_OpenSSL_exception_2)) {
11734  INTERESTING("OpenSSL-exception");
11735  }
11736  else if (INFILE(_LT_GPL_UPX_EXCEPT) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
11737  INTERESTING("UPX-exception");
11738  }
11739  else if (INFILE(_URL_mysql_floss_exception) || HASTEXT(_TITLE_mysql_floss_exception, 0)) {
11740  INTERESTING(lDebug ? "mysql-floss-exception(URL)" : "mysql-floss-exception");
11741  }
11742  else if (INFILE(_TITLE_Oracle_foss_exception) || INFILE(_LT_Oracle_foss_exception)) {
11743  INTERESTING("Oracle-foss-exception");
11744  }
11745  else if (INFILE(_LT_linking_exception_2) || (INFILE(_LT_linking_exception_3) && INFILE(_LT_GPL_EXCEPT_7))) {
11746  INTERESTING("linking-exception");
11747  }
11748  else if (HASTEXT(_TITLE_universal_foss_exception_10, 0)
11749  || URL_INFILE(_URL_universal_foss_exception_10)
11750  || INFILE(_LT_universal_foss_exception_10)) {
11751  INTERESTING("universal-foss-exception-1.0");
11752  }
11753  else if (INFILE(_LT_GPL_EXCEPT_1)) {
11754  INTERESTING(lDebug ? "GPL-except-1" : "GPL-exception");
11755  }
11756  else if (INFILE(_LT_GPL_EXCEPT_2)) {
11757  INTERESTING(lDebug ? "GPL-except-2" : "GPL-exception");
11758  }
11759  else if (INFILE(_LT_GPL_EXCEPT_3)) {
11760  INTERESTING(lDebug ? "GPL-except-3" : "GPL-exception");
11761  }
11762  else if (INFILE(_LT_GPL_EXCEPT_4)) {
11763  INTERESTING(lDebug ? "GPL-except-4" : "GPL-exception");
11764  }
11765  else if (INFILE(_LT_GPL_EXCEPT_7)) {
11766  INTERESTING("linking-exception");
11767  }
11768  else if (INFILE(_LT_GPL_SWI_PROLOG_EXCEPT)) {
11769  INTERESTING(lDebug ? "GPL-swi-prolog" : "GPL-exception");
11770  }
11771 
11772  return;
11773 }
11774 
11775 #ifdef LTSR_DEBUG
11776 #define LT_TARGET 1299 /* set to -1 OR the string# to track */
11777 void showLTCache(char *msg)
11778 {
11779  int i = 0;
11780  int nCached = 0;
11781  int nMatch = 0;
11782 
11783  printf("%s\n", msg);
11784  if (LT_TARGET >= 0) {
11785  printf("... tracking string #%d\n", LT_TARGET);
11786  }
11787  while (i < NFOOTPRINTS) {
11788  if (ltsr[i] < LTSR_SMASK) {
11789  printf(i == LT_TARGET ? "x" : ".");
11790  } else if (ltsr[i] == LTSR_YES) {
11791  printf("%%");
11792  nMatch++;
11793  nCached++;
11794  } else {
11795  printf(i == LT_TARGET ? "0" : ":");
11796  nCached++;
11797  }
11798  if ((++i % 75) == 0) {
11799  printf("|%04d\n", i);
11800  }
11801  }
11802  printf("\nLTSR-matches: %d, Cached: %d\n", nMatch, nCached);
11803  return;
11804 }
11805 #endif /* LTSR_DEBUG */
11806 
11807 #ifdef DOCTOR_DEBUG
11808 /*
11809  Debugging
11810  */
11811 void dumpMatch(char *text, char *label)
11812 {
11813  char *x = text + cur.regm.rm_so;
11814  char *cp = text + cur.regm.rm_eo;
11815 
11816  if (label) {
11817  printf("%s ", label);
11818  }
11819  printf("@ %d [", cur.regm.rm_so);
11820  for (; x < cp; x++) {
11821  if (!isEOL(*x)) {
11822  printf("%c", *x);
11823  }
11824  }
11825  printf("]\n");
11826  return;
11827 }
11828 
11829 #endif /* DOCTOR_DEBUG */
void doctorBuffer(char *buf, int isML, int isPS, int isCR)
Convert a buffer of multiple stuff to text-only, separated by spaces.
void listDump(list_t *l, int verbose)
print the passed in list
Definition: list.c:829
item_t * listGetItem(list_t *l, char *s)
get an item from the itemlist. If the item is not in the itemlist, then add it to the itemlist.
Definition: list.c:246
void listIterationReset(list_t *l)
Rest list ix to -1.
Definition: list.c:513
void listInit(list_t *l, int size, char *label)
intialize a list, if the list is not empty, empty it (initialize it to zero's).
Definition: list.c:54
item_t * listIterate(list_t *l)
return a pointer to listitem, returns a NULL_ITEM when no more items to return.
Definition: list.c:477
void listSort(list_t *l, int sortType)
Sort the list as per the sortType passed.
Definition: list.c:631
void listClear(list_t *l, int deallocFlag)
Destroy list_t.
Definition: list.c:106
if(!preg_match("/\s$projectGroup\s/", $groups) &&(posix_getgid() !=$gInfo[ 'gid']))
get monk license list of one specified uploadtree_id
Definition: migratetest.php:33
void printRegexMatch(int n, int cached)
CDB – Need to review this code, particularly for the use of an external file (Nomos....
Definition: util.c:986
char * getInstances(char *textp, int size, int nBefore, int nAfter, char *regex, int recordOffsets)
Get occurrence of a regex in a given string pointer.
Definition: util.c:630
char * copyString(char *s, char *label)
Create a copy of a string.
Definition: util.c:593
void Assert(int fatalFlag, const char *fmt,...)
Raise an assert.
Definition: util.c:1395
char * findEol(char *s)
Find first ROL in a string.
Definition: util.c:378
licText_t licText[]
Nomos header file.
#define NULL_ITEM
NULL item.
Definition: nomos.h:231
#define memFree(x, y)
Definition: nomos.h:531
#define NULL_STR
NULL string.
Definition: nomos.h:235
#define _SEED(x)
Definition: nomos.h:451
#define _REGEX(x)
Definition: nomos.h:447
#define isEOL(x)
Check if x points to a EOL character.
Definition: nomos.h:240
#define YES
Definition: nomos.h:175
#define LTSR_RMASK
Definition: nomos.h:196
#define LTSR_NO
Definition: nomos.h:199
#define NO
Definition: nomos.h:171
#define LTSR_SMASK
Definition: nomos.h:197
void Bail(int exitval)
Close connections and exit.
Definition: nomos_utils.c:533
#define FL_SAVEBASE
Definition: nomos.h:155
#define NULL_CHAR
NULL character.
Definition: nomos.h:234
#define LTSR_YES
Definition: nomos.h:198
#define OPTS_DEBUG
Definition: nomos.h:138
int optionIsSet(int val)
Check if an CLI option is set.
Definition: nomos_utils.c:560
int idxGrep_recordPosition(int index, char *data, int flags)
compile a regex, perform the search and record findings
Definition: nomos_regex.c:220
int idxGrep(int index, char *data, int flags)
compile a regex, and perform the search (on data?)
Definition: nomos_regex.c:205
int strGrep(char *regex, char *data, int flags)
General-purpose grep function, used for one-time-only searches.
Definition: nomos_regex.c:139
int idxGrep_recordPositionDoctored(int index, char *data, int flags)
compile a regex, perform the search and record findings
Definition: nomos_regex.c:241
int strNbuf(char *data, char *str)
Check if a string exists in buffer (case insensitive)
Definition: nomos_regex.c:528
void cleanLicenceBuffer()
Clean the license buffer.
Definition: nomos_utils.c:1006
FUNCTION void addLicence(GArray *theMatches, char *licenceName)
Add a license to the matches array.
Definition: nomos_utils.c:991
#define NY_INFILE(x)
Calls fileHasPatt() with qType 4.
Definition: parse.c:196
#define URL_INFILE(x)
Check in file with qType 0|1.
Definition: parse.c:202
char * aslVersion(char *, int, int, int)
Check for ASL Apache versions.
Definition: parse.c:7414
static char licStr[myBUFSIZ]
Definition: parse.c:164
#define RM_INFILE(x)
Calls fileHasPatt() with qType 1.
Definition: parse.c:193
void addRef(char *, int)
This function fills in a character-buffer for a license of a CURRENT file being evaluated,...
Definition: parse.c:9501
char * pythonVersion(char *, int, int, int)
Check for python versions.
Definition: parse.c:7765
char * gfdlVersion(char *, int, int, int)
Check for GFDL versions.
Definition: parse.c:8124
static int lDebug
Definition: parse.c:179
static int lDiags
Definition: parse.c:180
void checkCornerCases(char *, int, int, int, int, int, int, int)
If we call this function, we still don't know anything about a license.
Definition: parse.c:10170
#define HASREGEX(x, cp)
Calls idxGrep()
Definition: parse.c:199
#define PARSE_ARGS
Arguments to parse.
Definition: parse.c:188
#define SEEN(x)
Check LTSR_SMASK on lstr[x].
Definition: parse.c:190
char * cplVersion(char *, int, int, int)
Check for CPL versions.
Definition: parse.c:8478
#define NOT_INFILE(x)
Calls fileHasPatt()
Definition: parse.c:192
int findPhrase(int, char *, int, int, int, int)
Check for the presence of a phrase in a file by first searching for the search key provided.
Definition: parse.c:8678
char * parseLicenses(char *filetext, int size, scanres_t *scp, int isML, int isPS)
Parse a file to check all the possible licenses and add them to matches.
Definition: parse.c:359
static char * sisslVersion(char *, int, int, int)
Check for SISSL versions.
Definition: parse.c:7387
static char * gplVersion(char *, int, int, int)
Check for GPL versions.
Definition: parse.c:8299
char * lpplVersion(char *, int, int, int)
Check for LPPL versions.
Definition: parse.c:7940
#define HASTEXT(x, fl)
Calls idxGrep_recordIndex()
Definition: parse.c:201
char * oslVersion(char *, int, int, int)
Check for OSL versions.
Definition: parse.c:7860
void checkFileReferences(char *, int, int, int, int, int)
Generic license-phrases referring to other files or running commands.
Definition: parse.c:9836
static int dbgIdxGrep(int, char *, int)
Debugging call for idxGrep()
Definition: parse.c:316
static struct @1 kludge
void saveRegexLocation(int, int, int, int)
Save a regex in whereList.
Definition: parse.c:9449
#define INFILE(x)
Calls fileHasPatt()
Definition: parse.c:191
int checkUnclassified(char *, int, int, int, int, int)
This function is called when all the above license-checks don't turn up anything useful....
Definition: parse.c:9689
void locateRegex(char *, item_t *, int, int, int, int)
Locate a regex in a given file.
Definition: parse.c:9168
#define HASREGEX_RI(x, cp)
Calls idxGrep_recordIndex()
Definition: parse.c:200
char * cddlVersion(char *, int, int, int)
Check for CDDL versions.
Definition: parse.c:7900
int famOPENLDAP(char *, int, int, int)
Utility function to search for OpenLDAP licenses. So many different footprints are used by OpenLDAP,...
Definition: parse.c:9587
char * lgplVersion(char *, int, int, int)
Check for LGPL versions.
Definition: parse.c:8190
static int fileHasPatt(int licTextIdx, char *filetext, int size, int isML, int isPS, int qType)
Checks for a phrase in a file.
Definition: parse.c:248
static char ltsr[NFOOTPRINTS]
Definition: parse.c:166
char * aflVersion(char *, int, int, int)
Check for AFL versions.
Definition: parse.c:7820
void spdxReference(char *, int, int, int)
Definition: parse.c:10457
void copyleftExceptions(char *, int, int, int)
Definition: parse.c:11489
char * ccVersion(char *, int, int, int)
Check for CC_BY-X versions.
Definition: parse.c:8509
char * agplVersion(char *, int, int, int)
Check for AGPL versions.
Definition: parse.c:8046
char * mplNplVersion(char *, int, int, int)
Check for MPL|NPL versions.
Definition: parse.c:7598
#define PERL_INFILE(x)
Calls fileHasPatt() with qType 3.
Definition: parse.c:195
static char * realVersion(char *, int, int, int, int)
Check for RPSL versions.
Definition: parse.c:7715
#define GPL_INFILE(x)
Calls fileHasPatt() with qType 2.
Definition: parse.c:194
static int pd
Definition: parse.c:175
#define LVAL(x)
Check LTSR_RMASK on lstr[x].
Definition: parse.c:189
start($application)
start the application Assumes application is restartable via /etc/init.d/<script>....
Definition: pkgConfig.php:1214
GArray * theMatches
Definition: nomos.h:417
int uPsize
Size.
Definition: nomos.h:349
int flags
Flags.
Definition: nomos.h:348
char progName[64]
Program name.
Definition: nomos.h:346
searchString_t text
License text.
Definition: nomos.h:335
char * regex
License regex.
Definition: nomos.h:435
char * tseed
unencrypted license text
Definition: nomos.h:436
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:308
item_t * items
Definition: nomos.h:317
int used
Definition: nomos.h:310
tricky data structure used for a list of 'items'
Definition: nomos.h:274
void * buf
Definition: nomos.h:279
char * str
Definition: nomos.h:278
int score
License match score.
Definition: nomos.h:457
int csLen
String length.
Definition: nomos.h:325