diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/pathalias/files/patch-addlink.c | 127 | ||||
-rw-r--r-- | mail/pathalias/files/patch-addnode.c | 63 | ||||
-rw-r--r-- | mail/pathalias/files/patch-config.h | 11 | ||||
-rw-r--r-- | mail/pathalias/files/patch-def.h | 131 | ||||
-rw-r--r-- | mail/pathalias/files/patch-domain.c | 88 | ||||
-rw-r--r-- | mail/pathalias/files/patch-local.c | 25 | ||||
-rw-r--r-- | mail/pathalias/files/patch-main.c | 82 | ||||
-rw-r--r-- | mail/pathalias/files/patch-makedb.c | 10 | ||||
-rw-r--r-- | mail/pathalias/files/patch-mapaux.c | 105 | ||||
-rw-r--r-- | mail/pathalias/files/patch-mapit.c | 261 | ||||
-rw-r--r-- | mail/pathalias/files/patch-mem.c | 91 | ||||
-rw-r--r-- | mail/pathalias/files/patch-parse.y | 98 | ||||
-rw-r--r-- | mail/pathalias/files/patch-printit.c | 122 |
13 files changed, 1168 insertions, 46 deletions
diff --git a/mail/pathalias/files/patch-addlink.c b/mail/pathalias/files/patch-addlink.c new file mode 100644 index 000000000000..66820a9e9c85 --- /dev/null +++ b/mail/pathalias/files/patch-addlink.c @@ -0,0 +1,127 @@ +--- addlink.c.orig 1993-03-03 22:10:01.000000000 +0100 ++++ addlink.c 2013-06-16 17:03:10.000000000 +0200 +@@ -1,39 +1,35 @@ + /* pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)addlink.c 9.7 88/06/10"; ++static const char *sccsid = "@(#)addlink.c 9.7 88/06/10"; + #endif /* lint */ + + #include "def.h" ++#include <string.h> + + /* exports */ +-extern link *addlink(); +-extern void deadlink(), atrace(), freelink(); +-extern int tracelink(), maptrace(); +-char *Netchars = "!:@%"; /* sparse, but sufficient */ ++const char *Netchars = "!:@%"; /* sparse, but sufficient */ + long Lcount; /* how many edges? */ + + /* imports */ + extern int Tflag, Dflag; +-extern link *newlink(); +-extern node *addnode(); +-extern void yyerror(), die(); +-extern int strcmp(), strlen(); + + /* privates */ +-STATIC void netbits(), ltrace(), ltrprint(); +-static link *Trace[NTRACE]; ++STATIC void netbits(register palink *l, int netchar,int netdir); ++STATIC void ltrace(node *from, node *to, Cost cost, int netchar, int netdir, const char *message); ++STATIC void ltrprint(node *from, node *to, Cost cost, int netchar, int netdir, const char *message); ++static palink *Trace[NTRACE]; + static int Tracecount; + + #define EQ(n1, n2) (strcmp((n1)->n_name, (n2)->n_name) == 0) + #define LTRACE if (Tflag) ltrace + +-link * ++palink * + addlink(from, to, cost, netchar, netdir) + node *from; + register node *to; + Cost cost; + char netchar, netdir; +-{ register link *l, *prev = 0; ++{ register palink *l, *prev = 0; + + LTRACE(from, to, cost, netchar, netdir, ""); + /* +@@ -89,7 +85,7 @@ + void + deadlink(nleft, nright) + node *nleft, *nright; +-{ link *l, *lhold = 0, *lprev, *lnext; ++{ palink *l, *lhold = 0, *lprev, *lnext; + + /* DEAD host */ + if (nright == 0) { +@@ -132,7 +128,7 @@ + + STATIC void + netbits(l, netchar, netdir) +- register link *l; ++ register palink *l; + char netchar, netdir; + { + l->l_flag &= ~LDIR; +@@ -144,7 +140,7 @@ + tracelink(arg) + char *arg; + { char *bang; +- link *l; ++ palink *l; + + if (Tracecount >= NTRACE) + return -1; +@@ -170,8 +166,9 @@ + ltrace(from, to, cost, netchar, netdir, message) + node *from, *to; + Cost cost; +- char netchar, netdir, *message; +-{ link *l; ++ char netchar, netdir; ++ const char *message; ++{ palink *l; + int i; + + for (i = 0; i < Tracecount; i++) { +@@ -194,7 +191,8 @@ + ltrprint(from, to, cost, netchar, netdir, message) + node *from, *to; + Cost cost; +- char netchar, netdir, *message; ++ char netchar, netdir; ++ const char *message; + { char buf[256], *bptr = buf; + + strcpy(bptr, from->n_name); +@@ -213,7 +211,7 @@ + void + atrace(n1, n2) + node *n1, *n2; +-{ link *l; ++{ palink *l; + int i; + char buf[256]; + +@@ -230,7 +228,7 @@ + int + maptrace(from, to) + register node *from, *to; +-{ register link *l; ++{ register palink *l; + register int i; + + for (i = 0; i < Tracecount; i++) { +@@ -248,7 +246,7 @@ + deletelink(from, to) + node *from; + node *to; +-{ register link *l, *lnext; ++{ register palink *l, *lnext; + + l = from->n_link; + diff --git a/mail/pathalias/files/patch-addnode.c b/mail/pathalias/files/patch-addnode.c new file mode 100644 index 000000000000..86116f064086 --- /dev/null +++ b/mail/pathalias/files/patch-addnode.c @@ -0,0 +1,63 @@ +--- addnode.c.orig 1993-03-03 22:10:02.000000000 +0100 ++++ addnode.c 2013-06-16 17:10:09.000000000 +0200 +@@ -1,34 +1,30 @@ + /* pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)addnode.c 9.7 91/05/23"; ++static const char *sccsid = "@(#)addnode.c 9.7 91/05/23"; + #endif + + #include "def.h" ++#include <string.h> + + #define EQ(n, s) (*(n)->n_name == *(s) && strcmp((n)->n_name, (s)) == 0) + + /* exports */ +-node *addnode(), *addprivate(); +-void alias(), hashanalyze(), fixprivate(); + node **Table; /* hash table ^ priority queue */ + long Tabsize; /* size of Table */ + + /* imports */ +-extern link *addlink(); +-extern node *newnode(), **newtable(); +-extern char *strsave(); + extern int Iflag, Tflag, Vflag, InetFlag; + extern node **Table, *Home; + extern long Ncount, Tabsize; + extern char **Argv; +-extern void atrace(), die(), freetable(); +-extern int strcmp(); + + /* privates */ +-STATIC void crcinit(), rehash(), lowercase(); +-STATIC long fold(); +-STATIC long hash(); +-STATIC node *isprivate(); ++STATIC void crcinit(void); ++STATIC void rehash(void); ++STATIC void lowercase(register char *s); ++STATIC long fold(register char *s); ++STATIC long hash(char *name, int unique); ++STATIC node *isprivate(register char *name); + static node *Private; /* list of private nodes in current input file */ + /* + * these numbers are chosen because: +@@ -83,7 +79,7 @@ + alias(n1, n2) + node *n1, *n2; + { +- link *l; ++ palink *l; + + if (ISADOMAIN(n1) && ISADOMAIN(n2)) { + fprintf(stderr, "%s: domain alias %s = %s is illegal\n", Argv[0], n1->n_name, n2->n_name); +@@ -219,7 +215,7 @@ + Tabsize = Primes[++Tabindex]; + if (Tabsize == 0) + die("too many hosts"); /* need more prime numbers */ +- vprintf(stderr, "rehash into %d\n", Tabsize); ++ vprintf(stderr, "rehash into %ld\n", Tabsize); + Table = newtable(Tabsize); + Tab128 = (HIGHWATER * Tabsize * 128L)/100L; + diff --git a/mail/pathalias/files/patch-config.h b/mail/pathalias/files/patch-config.h new file mode 100644 index 000000000000..a5f5af24fbec --- /dev/null +++ b/mail/pathalias/files/patch-config.h @@ -0,0 +1,11 @@ +--- config.h.orig 1993-03-03 22:10:30.000000000 +0100 ++++ config.h 2013-06-16 15:49:18.000000000 +0200 +@@ -29,7 +29,7 @@ + + #ifdef MAIN + #ifndef lint +-static char *c_sccsid = "@(#)config.h 9.5 91/06/11"; ++static const char *c_sccsid = "@(#)config.h 9.5 91/06/11"; + #endif /*lint*/ + #endif /*MAIN*/ + diff --git a/mail/pathalias/files/patch-def.h b/mail/pathalias/files/patch-def.h new file mode 100644 index 000000000000..3d823bbbc793 --- /dev/null +++ b/mail/pathalias/files/patch-def.h @@ -0,0 +1,131 @@ +--- def.h.orig 1993-03-03 22:10:01.000000000 +0100 ++++ def.h 2013-06-16 17:11:21.000000000 +0200 +@@ -2,7 +2,7 @@ + + #ifndef lint + #ifdef MAIN +-static char *h_sccsid = "@(#)def.h 9.8 91/06/11"; ++static const char *h_sccsid = "@(#)def.h 9.8 91/06/11"; + #endif /*MAIN*/ + #endif /*lint*/ + +@@ -13,7 +13,7 @@ + + typedef long Cost; + typedef struct node node; +-typedef struct link link; ++typedef struct palink palink; + typedef struct dom dom; + + #ifdef lint +@@ -63,7 +63,7 @@ + /* WARNING: if > 2^16 nodes, type of n_tloc must change */ + struct node { + char *n_name; /* host name */ +- link *n_link; /* adjacency list */ ++ palink *n_link; /* adjacency list */ + Cost n_cost; /* cost to this host */ + union { + node *nu_net; /* others in this network (parsing) */ +@@ -114,11 +114,11 @@ + #define l_next un.lu_next + #define l_from un.lu_from + +-struct link { ++struct palink { + node *l_to; /* adjacent node */ + Cost l_cost; /* edge cost */ + union { +- link *lu_next; /* rest of adjacency list (not tracing) */ ++ palink *lu_next; /* rest of adjacency list (not tracing) */ + node *lu_from; /* source node (tracing) */ + } un; + short l_flag; /* right/left syntax, flags */ +@@ -133,7 +133,7 @@ + */ + struct node { + char *n_name; +- link *n_link; ++ palink *n_link; + Cost n_cost; + node *n_net; + node *n_root; +@@ -143,10 +143,10 @@ + unsigned short n_tloc; + unsigned short n_flag; + }; +-struct link { ++struct palink { + node *l_to; + Cost l_cost; +- link *l_next; ++ palink *l_next; + node *l_from; + short l_flag; + char l_netop; +@@ -159,3 +159,65 @@ + dom *prev; + char *name; + }; ++ ++/* prototypes addlink.c */ ++extern palink *addlink(node *from, register node *to, Cost cost, int netchar, int netdir); ++extern void deadlink(node *nleft, node *nright); ++extern void atrace(node *n1, node *n2); ++extern int tracelink(char *arg); ++extern void deletelink(node *from, node *to); ++extern int maptrace(register node *from, register node *to); ++ ++/* prototypes addnode.c */ ++extern node *addnode(register char *name); ++extern node *addprivate(register char *name); ++extern void alias(node *n1, node *n2); ++extern void hashanalyze(void); ++extern void fixprivate(void); ++extern node *addhidden(register char *name); ++ ++/* prototypes domain.c */ ++extern int ondomlist(dom **headp, char *domain); ++extern int nslookup(char *domain); ++extern void adddom(dom **headp, char *domain); ++extern void movetofront(dom **headp, dom *d); ++extern int isadomain(char *domain); ++ ++/* prototypes local.c */ ++extern char *local(void); ++ ++/* prototypes main.c */ ++extern void die(const char *s); ++ ++/* prototypes mapaux.c */ ++extern long pack(long low, long high); ++extern void resetnodes(void); ++extern void dumpgraph(void); ++extern void showlinks(void); ++extern int tiebreaker(node *n, register node *newp ); ++extern node *ncopy(register node *parent, register palink *l); ++ ++/* prototypes mapit.c */ ++void mapit(void); ++ ++/* prototypes mem.c */ ++extern void freelink(palink *l); ++extern void wasted(void); ++extern void freetable(node **t, long size); ++extern long allocation(void); ++extern palink *newlink(void); ++extern node *newnode(void); ++extern dom *newdom(void); ++extern char *strsave(const char *s); ++extern node **newtable(long size); ++#ifdef MYMALLOC ++extern char *mymalloc(register unsigned int n); ++#endif ++ ++/* prototypes parse.c */ ++extern void yyerror(const char *s); ++extern int yyparse(void); ++ ++/* prototypes printit.c */ ++extern void printit(void); ++ diff --git a/mail/pathalias/files/patch-domain.c b/mail/pathalias/files/patch-domain.c new file mode 100644 index 000000000000..0de65a642f44 --- /dev/null +++ b/mail/pathalias/files/patch-domain.c @@ -0,0 +1,88 @@ +--- domain.c.orig 1993-03-03 22:10:02.000000000 +0100 ++++ domain.c 2013-06-16 15:38:40.000000000 +0200 +@@ -1,9 +1,14 @@ + /* pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)domain.c 9.5 92/08/25"; ++static const char *sccsid = "@(#)domain.c 9.5 92/08/25"; + #endif /* lint */ + + #include "def.h" ++#include <string.h> ++#include <sys/types.h> ++#include <netinet/in.h> ++#include <arpa/nameser.h> ++#include <resolv.h> + + /* imports */ + extern dom *newdom(); +@@ -12,12 +17,14 @@ + + /* exports */ + ++ + /* privates */ + static dom *good, *bad; + + /* + * good and bad are passed by reference for move-to-front + */ ++int + isadomain(domain) + char *domain; + { +@@ -43,6 +50,7 @@ + } + } + ++int + ondomlist(headp, domain) + dom **headp; + char *domain; +@@ -60,6 +68,7 @@ + + + ++void + adddom(headp, domain) + dom **headp; + char *domain; +@@ -73,6 +82,7 @@ + *headp = d; + } + ++void + movetofront(headp, d) + dom **headp, *d; + { dom *head = *headp; +@@ -91,11 +101,12 @@ + #include <sys/types.h> + #include <arpa/nameser.h> + ++int + nslookup(domain) + char *domain; + { register HEADER *hp; + register int n; +- char q[PACKETSZ], a[PACKETSZ]; /* query, answer */ ++ unsigned char q[PACKETSZ], a[PACKETSZ]; /* query, answer */ + char buf[PACKETSZ+1]; + + if ((n = strlen(domain)) >= PACKETSZ) +@@ -105,7 +116,7 @@ + buf[n++] = '.'; + buf[n] = 0; + } +- if ((n = res_mkquery(QUERY, buf, C_IN, T_ANY, (char *) 0, 0, (struct rrec *) 0, q, sizeof(q))) < 0) ++ if ((n = res_mkquery(QUERY, buf, C_IN, T_ANY, (const unsigned char *) 0, 0, (const unsigned char *) 0, q, sizeof(q))) < 0) + die("impossible res_mkquery error"); + errno = 0; + if ((n = res_send(q, n, a, sizeof(a))) < 0) +@@ -117,6 +128,7 @@ + } + #else /*!RESOLVER*/ + /*ARGSUSED*/ ++int + nslookup(domain) + char *domain; + { diff --git a/mail/pathalias/files/patch-local.c b/mail/pathalias/files/patch-local.c new file mode 100644 index 000000000000..cc66431caef1 --- /dev/null +++ b/mail/pathalias/files/patch-local.c @@ -0,0 +1,25 @@ +--- local.c.orig 1993-03-03 22:10:02.000000000 +0100 ++++ local.c 2013-06-16 15:45:27.000000000 +0200 +@@ -1,11 +1,9 @@ + /* pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)local.c 9.3 91/06/11"; ++static const char *sccsid = "@(#)local.c 9.3 91/06/11"; + #endif /* lint */ + +-#include "config.h" +- +-#include STDIO_H ++#include "def.h" + + #ifdef UNAME + #include <sys/utsname.h> +@@ -29,7 +27,7 @@ + extern int gethostname(); + + (void) gethostname(lname, (int) sizeof(lname)); +- lname[sizeof(lname)] = 0; ++ lname[sizeof(lname) -1] = 0; + return(lname); + } + diff --git a/mail/pathalias/files/patch-main.c b/mail/pathalias/files/patch-main.c new file mode 100644 index 000000000000..d9e91c6c255a --- /dev/null +++ b/mail/pathalias/files/patch-main.c @@ -0,0 +1,82 @@ +--- main.c.orig 1993-03-03 22:10:02.000000000 +0100 ++++ main.c 2013-06-16 17:10:48.000000000 +0200 +@@ -1,6 +1,6 @@ +-/* pathalias -- by steve bellovin, as told to peter honeyman */ ++/*_pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)main.c 9.8 91/06/11"; ++static const char *sccsid = "@(#)main.c 9.8 91/06/11"; + #endif + + #ifndef VMS +@@ -9,10 +9,13 @@ + #define MAIN XXmain + #endif + ++#include <stdlib.h> ++#include <unistd.h> ++#include <string.h> + #include "def.h" + + /* exports */ +-char *Cfile; /* current input file */ ++const char *Cfile; /* current input file */ + char *Graphout; /* file for dumping edges (-g option) */ + char *Linkout; /* file for dumping shortest path tree */ + char **Argv; /* external copy of argv (for input files) */ +@@ -26,26 +29,20 @@ + int InetFlag; /* local host is w/in scope of DNS (-I flag) */ + int Lineno = 1; /* line number within current input file */ + int Argc; /* external copy of argc (for input files) */ +-extern void die(); +-extern int tracelink(); + + /* imports */ + extern char *optarg; + extern int optind; + extern long Lcount, Ncount; +-extern long allocation(); +-extern void wasted(), mapit(), hashanalyze(), deadlink(); +-extern char *local(); +-extern node *addnode(); +-extern int getopt(), yyparse(); +-extern void printit(); + + #define USAGE "usage: %s [-vciDfI] [-l localname] [-d deadlink] [-t tracelink] [-g edgeout] [-s treeout] [-a avoid] [files ...]\n" + ++int + MAIN(argc, argv) + register int argc; + register char **argv; +-{ char *locname = 0, *bang; ++{ const char *locname = 0; ++ char *bang; + register int c; + int errflg = 0; + +@@ -122,14 +119,14 @@ + Argv[0], locname); + } + +- Home = addnode(locname); /* add home node */ ++ Home = addnode(strsave(locname)); /* add home node */ + Home->n_cost = 0; /* doesn't cost to get here */ + + (void) yyparse(); /* read in link info */ + + if (Vflag > 1) + hashanalyze(); +- vprintf(stderr, "%d nodes, %d links, alloc %ldk\n", ++ vprintf(stderr, "%ld nodes, %ld links, alloc %ldk\n", + Ncount, Lcount, allocation()); + + Cfile = "[backlinks]"; /* for tracing back links */ +@@ -150,7 +147,7 @@ + + void + die(s) +- char *s; ++ const char *s; + { + #ifdef DEBUG + extern int abort(); diff --git a/mail/pathalias/files/patch-makedb.c b/mail/pathalias/files/patch-makedb.c new file mode 100644 index 000000000000..407e7d25b2f0 --- /dev/null +++ b/mail/pathalias/files/patch-makedb.c @@ -0,0 +1,10 @@ +--- makedb.c.orig 1993-03-03 22:10:04.000000000 +0100 ++++ makedb.c 2013-06-16 16:58:53.000000000 +0200 +@@ -4,6 +4,7 @@ + #endif /* lint */ + + #include <stdio.h> ++#include <unistd.h> + #include "config.h" + + typedef struct { diff --git a/mail/pathalias/files/patch-mapaux.c b/mail/pathalias/files/patch-mapaux.c new file mode 100644 index 000000000000..5faeb02c7e3b --- /dev/null +++ b/mail/pathalias/files/patch-mapaux.c @@ -0,0 +1,105 @@ +--- mapaux.c.orig 1993-03-03 22:10:03.000000000 +0100 ++++ mapaux.c 2013-06-16 17:14:02.000000000 +0200 +@@ -1,33 +1,26 @@ + /* pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)mapaux.c 9.8 91/06/23"; ++static const char *sccsid = "@(#)mapaux.c 9.8 91/06/23"; + #endif /* lint */ + + #include "def.h" ++#include <string.h> + + /* imports */ + extern long Nheap, Hashpart, Tabsize, NumNcopy, Nlink, NumLcopy; + extern node **Table, *Home; + extern char *Graphout, *Linkout, *Netchars, **Argv; + extern int Vflag; +-extern void freelink(), die(); +-extern long pack(); +-extern link *newlink(); +-extern node *newnode(); +-extern char *strsave(); +-extern int strcmp(), strlen(); + + /* exports */ +-extern long pack(); +-extern void resetnodes(), dumpgraph(), showlinks(), terminalnet(); +-extern int tiebreaker(); +-extern node *ncopy(); + + /* privates */ + static FILE *Gstream; /* for dumping graph */ +-STATIC void dumpnode(), untangle(), dfs(); +-STATIC int height(); +-STATIC link *lcopy(); ++STATIC void dumpnode(register node *from); ++STATIC void untangle(void); ++STATIC void dfs(register node *n); ++STATIC int height(register node *n); ++STATIC palink *lcopy(register node *parent, register node *n); + + /* + * slide everything from Table[low] to Table[high] +@@ -103,8 +96,8 @@ + dumpnode(from) + register node *from; + { register node *to; +- register link *l; +- link *lnet = 0, *ll, *lnext; ++ register palink *l; ++ palink *lnet = 0, *ll, *lnext; + + for (l = from->n_link ; l; l = l->l_next) { + to = l->l_to; +@@ -182,7 +175,7 @@ + STATIC void + dfs(n) + register node *n; +-{ register link *l; ++{ register palink *l; + register node *next; + + n->n_flag |= INDFS; +@@ -203,7 +196,7 @@ + + void + showlinks() +-{ register link *l; ++{ register palink *l; + register node *n; + register long i; + FILE *estream; +@@ -223,7 +216,7 @@ + fputs(l->l_to->n_name, estream); + if (NETDIR(l) == LLEFT) + putc(NETCHAR(l), estream); +- fprintf(estream, "(%d)\n", l->l_cost); ++ fprintf(estream, "(%ld)\n", l->l_cost); + } + } + (void) fclose(estream); +@@ -323,7 +316,7 @@ + node * + ncopy(parent, l) + register node *parent; +- register link *l; ++ register palink *l; + { register node *n, *ncp; + + #ifdef DEBUG +@@ -359,11 +352,11 @@ + * + * why copy any links other than aliases? hmmm ... + */ +-STATIC link * ++STATIC palink * + lcopy(parent, n) + register node *parent, *n; +-{ register link *l, *lcp; +- link *first = 0, *last = 0; ++{ register palink *l, *lcp; ++ palink *first = 0, *last = 0; + + for (l = n->n_link; l != 0; l = l->l_next) { + /* skip if dest is already mapped */ diff --git a/mail/pathalias/files/patch-mapit.c b/mail/pathalias/files/patch-mapit.c index f5273eb04826..e9c758d1851e 100644 --- a/mail/pathalias/files/patch-mapit.c +++ b/mail/pathalias/files/patch-mapit.c @@ -1,14 +1,247 @@ -*** ./mapit.c Sat Jun 9 12:32:18 1990 ---- ../../m/mapit.c Thu Feb 10 07:00:02 1994 -*************** -*** 298,303 **** ---- 298,306 ---- - || (NETDIR(l) == LRIGHT && (prev->n_flag & HASLEFT))) - cost += INF; /* mixed syntax */ - } -+ /* Dirk meyer 10.02.94 */ -+ if ( cost < 0 ) /* Overflow, more than 31 bit */ -+ cost = INF; /* Limit, to avoid recursive paths */ - - return cost; - } +--- mapit.c.orig 1993-03-03 22:10:02.000000000 +0100 ++++ mapit.c 2013-06-16 17:13:06.000000000 +0200 +@@ -1,6 +1,6 @@ + /* pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)mapit.c 9.16 92/08/25"; ++static const char *sccsid = "@(#)mapit.c 9.16 92/08/25"; + #endif + + #include "def.h" +@@ -17,43 +17,42 @@ + long Nheap; /* end of heap */ + long NumNcopy, Nlink, NumLcopy; + +-void mapit(); +- + /* imports */ + extern long Nheap, Hashpart, Tabsize, Tcount; + extern int Tflag, Vflag; + extern node **Table, *Home; + extern char *Linkout, *Graphout; + +-extern void freelink(), resetnodes(), printit(), dumpgraph(); +-extern void showlinks(), die(); +-extern long pack(), allocation(); +-extern link *newlink(), *addlink(); +-extern int maptrace(), tiebreaker(); +-extern node *ncopy(); +- +- + /* privates */ + static long Heaphighwater; +-static link **Heap; ++static palink **Heap; + +-STATIC void insert(), heapup(), heapdown(), heapswap(), backlinks(); +-STATIC void setheapbits(), mtracereport(), heapchildren(), otracereport(); +-STATIC link *min_node(); +-STATIC int dehash(), skiplink(), skipterminalalias(); +-STATIC Cost costof(); +-STATIC node *mappedcopy(); ++STATIC void insert(palink *l); ++STATIC void heapup(palink *l); ++STATIC void heapdown(palink *l); ++STATIC void heapswap(long i, long j); ++STATIC void backlinks(void); ++STATIC void setheapbits(register palink *l); ++STATIC void mtracereport(node *from, palink *l, const char *excuse); ++STATIC void heapchildren(register node *n); ++STATIC void otracereport(node *n); ++STATIC palink *min_node(void); ++STATIC int dehash(register node *n); ++STATIC int skiplink(palink *l, node *parent, register Cost cost, int trace); ++STATIC int skipterminalalias(node *n, node *next); ++STATIC Cost costof(register node *prev, register palink *l); ++STATIC node *mappedcopy(register node *n); + + /* transform the graph to a shortest-path tree by marking tree edges */ + void + mapit() + { register node *n; +- register link *l; ++ register palink *l; + + vprintf(stderr, "*** mapping\ttcount = %ld\n", Tcount); + Tflag = Tflag && Vflag; /* tracing here only if verbose */ + /* re-use the hash table space for the heap */ +- Heap = (link **) Table; ++ Heap = (palink **) Table; + Hashpart = pack(0L, Tabsize - 1); + + /* expunge penalties from -a option and make circular copy lists */ +@@ -84,7 +83,7 @@ + n->n_flag |= MAPPED; + heapchildren(n); /* add children to heap */ + } +- vprintf(stderr, "heap hiwat %d\nalloc %ldk, ncopy = %ld, nlink = %ld, lcopy = %ld\n", Heaphighwater, allocation(), NumNcopy, Nlink, NumLcopy); ++ vprintf(stderr, "heap hiwat %ld\nalloc %ldk, ncopy = %ld, nlink = %ld, lcopy = %ld\n", Heaphighwater, allocation(), NumNcopy, Nlink, NumLcopy); + + if (Nheap != 0) /* sanity check */ + die("null entry in heap"); +@@ -116,7 +115,7 @@ + STATIC void + heapchildren(n) + register node *n; +-{ register link *l; ++{ register palink *l; + register node *next; + register int mtrace; + register Cost cost; +@@ -132,11 +131,12 @@ + if (l->l_flag & LTERMINAL) + l->l_to = next = ncopy(n, l); + +- if ((n->n_flag & NTERMINAL) && (l->l_flag & LALIAS)) ++ if ((n->n_flag & NTERMINAL) && (l->l_flag & LALIAS)) { + if (skipterminalalias(n, next)) + continue; + else + l->l_to = next = ncopy(n, l); ++ } + + if (next->n_flag & MAPPED) { + if (mtrace) +@@ -208,12 +208,12 @@ + */ + STATIC int + skiplink(l, parent, cost, trace) +- link *l; /* new link to this node */ ++ palink *l; /* new link to this node */ + node *parent; /* (potential) new parent of this node */ + register Cost cost; /* new cost to this node */ + int trace; /* trace this link? */ + { register node *n; /* this node */ +- register link *lheap; /* old link to this node */ ++ register palink *lheap; /* old link to this node */ + + n = l->l_to; + +@@ -263,7 +263,7 @@ + STATIC Cost + costof(prev, l) + register node *prev; +- register link *l; ++ register palink *l; + { register node *next; + register Cost cost; + +@@ -296,6 +296,9 @@ + || (NETDIR(l) == LRIGHT && (prev->n_flag & HASLEFT))) + cost += INF; /* mixed syntax */ + } ++ /* Dirk meyer 10.02.94 */ ++ if ( cost < 0 ) /* Overflow, more than 31 bit */ ++ cost = INF; /* Limit, to avoid recursive paths */ + + return cost; + } +@@ -303,7 +306,7 @@ + /* binary heap implementation of priority queue */ + STATIC void + insert(l) +- link *l; ++ palink *l; + { register node *n; + + n = l->l_to; +@@ -336,7 +339,7 @@ + */ + STATIC void + heapup(l) +- link *l; ++ palink *l; + { register long cindx, pindx; /* child, parent indices */ + register Cost cost; + register node *child, *parent; +@@ -366,10 +369,10 @@ + } + + /* extract min (== Heap[1]) from heap */ +-STATIC link * ++STATIC palink * + min_node() +-{ link *rval, *lastlink; +- register link **rheap; ++{ palink *rval, *lastlink; ++ register palink **rheap; + + if (Nheap == 0) + return 0; +@@ -399,9 +402,9 @@ + + STATIC void + heapdown(l) +- link *l; ++ palink *l; + { register long pindx, cindx; +- register link **rheap = Heap; /* in register -- heavily used */ ++ register palink **rheap = Heap; /* in register -- heavily used */ + node *child, *rchild, *parent; + + pindx = l->l_to->n_tloc; +@@ -450,7 +453,7 @@ + STATIC void + heapswap(i, j) + long i, j; +-{ register link *temp, **rheap; ++{ register palink *temp, **rheap; + + rheap = Heap; /* heavily used -- put in register */ + temp = rheap[i]; +@@ -489,7 +492,7 @@ + */ + STATIC void + backlinks() +-{ register link *l; ++{ register palink *l; + register node *n, *child; + node *nomap; + long i; +@@ -539,7 +542,7 @@ + if (Vflag > 1) + fprintf(stderr, "backlink: %s <- %s\n", nomap->n_name, child->n_name); + } +- vprintf(stderr, "%d backlinks\n", Nheap); ++ vprintf(stderr, "%ld backlinks\n", Nheap); + } + + /* find a mapped copy of n if it exists */ +@@ -562,7 +565,7 @@ + */ + STATIC void + setheapbits(l) +- register link *l; ++ register palink *l; + { register node *n; + register node *parent; + +@@ -588,8 +591,8 @@ + STATIC void + mtracereport(from, l, excuse) + node *from; +- link *l; +- char *excuse; ++ palink *l; ++ const char *excuse; + { node *to = l->l_to; + + fprintf(stderr, "%-16s ", excuse); +@@ -638,7 +641,7 @@ + #if 00 + /* this hasn't been used for years */ + for (i = 1; i < Nheap; i++) { +- link *l; ++ palink *l; + + vprintf(stderr, "%5d %-16s", i, Heap[i]->l_to->n_name); + if ((l = Heap[i]->l_to->n_link) != 0) do { +@@ -647,7 +650,7 @@ + vprintf(stderr, "\n"); + } + for (i = Hashpart; i < Tabsize; i++) { +- link *l; ++ palink *l; + node *n; + + vprintf(stderr, "%5d %-16s", i, Table[i]->n_name); diff --git a/mail/pathalias/files/patch-mem.c b/mail/pathalias/files/patch-mem.c index 7bfab9e2c864..94615fa30d8a 100644 --- a/mail/pathalias/files/patch-mem.c +++ b/mail/pathalias/files/patch-mem.c @@ -1,17 +1,78 @@ ---- mem.c.orig Wed Mar 3 22:11:23 1993 -+++ mem.c Sat Oct 7 20:16:25 2006 -@@ -19,6 +19,10 @@ - extern char *sbrk(); +--- mem.c.orig 1993-03-03 22:11:23.000000000 +0100 ++++ mem.c 2013-06-16 17:14:35.000000000 +0200 +@@ -1,38 +1,40 @@ + /* pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)mem.c 9.6 92/08/25"; ++static const char *sccsid = "@(#)mem.c 9.6 92/08/25"; #endif -+#ifdef MYMALLOC -+STATIC void addtoheap(); ++#include <stdlib.h> + #include "def.h" ++#include <string.h> + + /* exports */ + long Ncount; +-extern void freelink(), wasted(), freetable(); +-extern long allocation(); + + /* imports */ + extern char *Netchars; + extern int Vflag; +-extern void die(); +-extern int strlen(); + #ifdef DEBUG +-extern char *sbrk(); ++#include <unistd.h> +#endif + ++#ifdef MYMALLOC ++STATIC void addtoheap(char *p, long size); + #endif + /* privates */ - STATIC void nomem(); - static link *Lcache; -@@ -105,8 +109,6 @@ +-STATIC void nomem(); +-static link *Lcache; +-static unsigned int Memwaste; ++STATIC void nomem(void); ++static palink *Lcache; ++static unsigned long Memwaste; + +-link * ++palink * + newlink() +-{ register link *rval; ++{ register palink *rval; + + if (Lcache) { + rval = Lcache; + Lcache = Lcache->l_next; +- strclear((char *) rval, sizeof(link)); +- } else if ((rval = (link * ) calloc(1, sizeof(link))) == 0) ++ strclear((char *) rval, sizeof(palink)); ++ } else if ((rval = (palink * ) calloc(1, sizeof(palink))) == 0) + nomem(); + return rval; + } +@@ -40,7 +42,7 @@ + /* caution: this destroys the contents of l_next */ + void + freelink(l) +- link *l; ++ palink *l; + { + l->l_next = Lcache; + Lcache = l; +@@ -69,7 +71,7 @@ + + char * + strsave(s) +- char *s; ++ const char *s; + { register char *r; + + if ((r = malloc((unsigned) strlen(s) + 1)) == 0) +@@ -105,8 +107,6 @@ long size; { #ifdef MYMALLOC @@ -20,3 +81,15 @@ addtoheap((char *) t, size * sizeof(node *)); #else free((char *) t); +@@ -163,10 +163,9 @@ + #undef calloc + + /* imports */ +-extern char *malloc(), *calloc(); + + /* private */ +-STATIC int align(); ++STATIC int align(char *n); + + /* allocate in MBUFSIZ chunks. 4k works ok (less 16 for malloc quirks). */ + #define MBUFSIZ (4 * 1024 - 16) diff --git a/mail/pathalias/files/patch-parse.y b/mail/pathalias/files/patch-parse.y new file mode 100644 index 000000000000..60834bf97a98 --- /dev/null +++ b/mail/pathalias/files/patch-parse.y @@ -0,0 +1,98 @@ +--- parse.y.orig 1993-03-03 22:10:03.000000000 +0100 ++++ parse.y 2013-06-16 17:16:43.000000000 +0200 +@@ -1,10 +1,11 @@ + %{ + /* pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)parse.y 9.11 91/06/01"; ++static const char *sccsid = "@(#)parse.y 9.11 91/06/01"; + #endif /* lint */ + + #include "def.h" ++#include <string.h> + + /* scanner states (yylex, parse) */ + #define OTHER 0 +@@ -14,14 +15,8 @@ + + /* exports */ + long Tcount; +-extern void yyerror(); + + /* imports */ +-extern node *addnode(), *addprivate(); +-extern void fixprivate(), alias(), deadlink(), deletelink(); +-extern link *addlink(); +-extern int strcmp(); +-extern char *strsave(); + extern int optind; + extern char *Cfile, *Netchars, **Argv; + extern int Lineno, Argc; +@@ -78,7 +73,7 @@ + ; + + links : host site cost { +- struct link *l; ++ struct palink *l; + + l = addlink($1, $2.ys_node, $3, $2.ys_net, $2.ys_dir); + if (GATEWAYED($2.ys_node)) +@@ -87,7 +82,7 @@ + l->l_flag |= LTERMINAL; + } + | links ',' site cost { +- struct link *l; ++ struct palink *l; + + l = addlink($1, $3.ys_node, $4, $3.ys_net, $3.ys_dir); + if (GATEWAYED($3.ys_node)) +@@ -238,18 +233,18 @@ + %% + + void +-#ifdef YYDEBUG ++#if YYDEBUG + /*VARARGS1*/ + yyerror(fmt, arg) +- char *fmt, *arg; ++ const char *fmt, *arg; + #else + yyerror(s) +- char *s; ++ const char *s; + #endif + { + /* a concession to bsd error(1) */ + fprintf(stderr, "\"%s\", ", Cfile); +-#ifdef YYDEBUG ++#if YYDEBUG + fprintf(stderr, "line %d: ", Lineno); + fprintf(stderr, fmt, arg); + putc('\n', stderr); +@@ -279,7 +274,7 @@ + Cost cost; + char netchar, netdir; + { register node *member, *nextnet; +- link *l; ++ palink *l; + static int netanon = 0; + char anon[25]; + +@@ -314,7 +309,7 @@ + #define NLRETURN() {Scanstate = NEWLINE; return EOL;} + + static struct ctable { +- char *cname; ++ const char *cname; + Cost cval; + } ctable[] = { + /* ordered by frequency of appearance in a "typical" dataset */ +@@ -524,7 +519,7 @@ + adjust(n, cost) + node *n; + Cost cost; +-{ link *l; ++{ palink *l; + + n->n_cost += cost; /* cumulative */ + diff --git a/mail/pathalias/files/patch-printit.c b/mail/pathalias/files/patch-printit.c index a531d8e4c164..6d073d697060 100644 --- a/mail/pathalias/files/patch-printit.c +++ b/mail/pathalias/files/patch-printit.c @@ -1,23 +1,99 @@ -diff -c ./printit.c ../../m/printit.c -*** ./printit.c Sat Jun 9 12:32:26 1990 ---- ../../m/printit.c Thu Feb 10 07:08:42 1994 -*************** -*** 27,33 **** - STATIC int printable(); - - /* in practice, even the longest paths are < 100 bytes */ -! #define PATHSIZE 512 - - void - printit() ---- 27,36 ---- - STATIC int printable(); - - /* in practice, even the longest paths are < 100 bytes */ -! /* Dirk meyer 10.02.94 */ -! /* in reality we have reached paths up to 200 bytes */ -! /* the path must fit two times in the buffer */ -! #define PATHSIZE 4096 - - void - printit() +--- printit.c.orig 1993-03-03 22:10:03.000000000 +0100 ++++ printit.c 2013-06-16 17:17:32.000000000 +0200 +@@ -1,9 +1,10 @@ + /* pathalias -- by steve bellovin, as told to peter honeyman */ + #ifndef lint +-static char *sccsid = "@(#)printit.c 9.4 89/02/07"; ++static const char *sccsid = "@(#)printit.c 9.4 89/02/07"; + #endif + + #include "def.h" ++#include <string.h> + + /* + * print the routes by traversing the shortest path tree in preorder. +@@ -11,27 +12,28 @@ + */ + + /* exports */ +-extern void printit(); ++extern void printit(void); + + /* imports */ + extern int Cflag, Vflag, Dflag, Fflag; + extern node *Home; + extern char *Netchars; +-extern void die(); +-extern int strlen(); + + /* privates */ +-static link *Ancestor; /* for -f option */ ++static palink *Ancestor; /* for -f option */ + STATIC void preorder(), setpath(), printhost(), printdomain(); + STATIC char *hostpath(); + STATIC int printable(); + + /* in practice, even the longest paths are < 100 bytes */ +-#define PATHSIZE 512 ++/* Dirk meyer 10.02.94 */ ++/* in reality we have reached paths up to 200 bytes */ ++/* the path must fit two times in the buffer */ ++#define PATHSIZE 4096 + + void + printit() +-{ link *l; ++{ palink *l; + char pbuf[PATHSIZE]; + + /* print home */ +@@ -57,7 +59,7 @@ + */ + STATIC void + preorder(l, ppath) +- register link *l; ++ register palink *l; + char *ppath; + { register node *n; + node *ncp; /* circular copy list */ +@@ -105,7 +107,7 @@ + printable(n) + register node *n; + { node *ncp; +- link *l; ++ palink *l; + + if (n->n_flag & PRINTED) + return 0; +@@ -156,7 +158,7 @@ + + STATIC void + setpath(l, ppath, npath) +- link *l; ++ palink *l; + register char *ppath, *npath; + { register node *next, *parent; + char netchar; +@@ -192,11 +194,12 @@ + return; + } + +- if (netchar == '@') ++ if (netchar == '@') { + if (next->n_flag & ATSIGN) + netchar = '%'; /* shazam? shaman? */ + else + next->n_flag |= ATSIGN; ++ } + + /* remainder should be a sprintf -- foo on '%' as an operator */ + for ( ; (*npath = *ppath) != 0; ppath++) { +@@ -224,7 +227,7 @@ + STATIC char * + hostpath(path, l, netchar) + register char *path; +- register link *l; ++ register palink *l; + char netchar; + { register node *prev; + |