From: ian Date: Wed, 31 May 2000 01:16:11 +0000 (+0000) Subject: Update copyright notices. X-Git-Tag: userv-utils-0-1-finger-mergeup-1~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=userv-utils.git;a=commitdiff_plain;h=f0e54a9987423f0f5939b961fa10ab4ca7a2c406 Update copyright notices. --- diff --git a/ipif/.cvsignore b/ipif/.cvsignore index db26654..8272b90 100644 --- a/ipif/.cvsignore +++ b/ipif/.cvsignore @@ -1,3 +1,4 @@ service automech.[ch] udptunnel-forwarder +blowfishtest diff --git a/ipif/Makefile b/ipif/Makefile index c2e3a7f..f1e63a4 100644 --- a/ipif/Makefile +++ b/ipif/Makefile @@ -1,4 +1,6 @@ -# Copyright (C) 1999 Ian Jackson +# Makefile for ipif/udptunnel stuff + +# Copyright (C) 1999-2000 Ian Jackson # # This is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -30,7 +32,8 @@ libuserv= $(libdir)/userv etcuserv= $(etcdir)/userv services= $(etcuserv)/services.d -TARGETS= service udptunnel-forwarder blowfishtest +PROGRAMS= udptunnel udptunnel-forwarder +TARGETS= service blowfishtest $(PROGRAMS) MECHFILES= null pkcs5 timestamp sequence blowfish MECHOBJS= $(foreach m, $(MECHFILES), mech-$m.o) @@ -44,7 +47,7 @@ install: all mkdir -p $(libuserv) $(services) cp -b service $(libuserv)/ipif cp ipif $(services)/ipif:new - cp -b udptunnel $(bindir)/. + cp -b $(PROGRAMS) $(bindir)/. set -e; cd $(services); test -f ipif || mv ipif:new ipif udptunnel-forwarder: $(OBJS_FORWARD) diff --git a/ipif/automechgen.sh b/ipif/automechgen.sh index a712a73..d89189a 100755 --- a/ipif/automechgen.sh +++ b/ipif/automechgen.sh @@ -1,4 +1,22 @@ #!/bin/sh +# generates automech.h and automech.c + +# Copyright (C) 2000 Ian Jackson +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with userv-utils; if not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + exec >automech.c.new exec 3>automech.h.new diff --git a/ipif/blowfish.c b/ipif/blowfish.c index fd7f631..6731c8e 100644 --- a/ipif/blowfish.c +++ b/ipif/blowfish.c @@ -4,7 +4,23 @@ * Algorithm by Bruce Schneier 1995 * This implementation adapted from a public domain version by Bruce * Schneier (1995) by Ian Jackson in 1997. - * Copyright (C)1997 Ian Jackson. + */ +/* + * Copyright (C) 1997,2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* TODO: test with zero length key */ diff --git a/ipif/blowfish.h b/ipif/blowfish.h index af02c07..70cce7f 100644 --- a/ipif/blowfish.h +++ b/ipif/blowfish.h @@ -1,4 +1,20 @@ -/**/ +/* + * Copyright (C) 1997,2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #ifndef BLOWFISH__H_INCLUDED #define BLOWFISH__H_INCLUDED diff --git a/ipif/blowfishspeed.c b/ipif/blowfishspeed.c index aaaf622..ece4e7d 100644 --- a/ipif/blowfishspeed.c +++ b/ipif/blowfishspeed.c @@ -1,4 +1,20 @@ -/**/ +/* + * Copyright (C) 1997,2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #include #include diff --git a/ipif/blowfishtest.c b/ipif/blowfishtest.c index 5b2fe57..c4c8252 100644 --- a/ipif/blowfishtest.c +++ b/ipif/blowfishtest.c @@ -1,4 +1,23 @@ -/**/ +/* + * test program for blowfish; very hard to use (sorry!) + */ +/* + * Copyright (C) 1997,2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ #include #include diff --git a/ipif/forwarder.c b/ipif/forwarder.c index d3a0f0f..f901f78 100644 --- a/ipif/forwarder.c +++ b/ipif/forwarder.c @@ -1,6 +1,7 @@ /* * Encrypting tunnel for userv-ipif tunnels, actual implementation - * + */ +/* * usage: * udptunnel-forwarder * @@ -33,6 +34,23 @@ * 12 usage error * 16 bad trouble */ +/* + * Copyright (C) 2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #include #include @@ -191,7 +209,9 @@ static void inbound(void) { for (i=n_mechs-1; i>=0; i--) { emsg= mechs[i]->decode(md_in[i],&buf_in); if (emsg) { - fprintf(stderr, "%s: bad packet: %s: %s\n", programid, mechs[i]->name, emsg); + if (*emsg) + fprintf(stderr, "%s: bad packet: %s: %s\n", + programid, mechs[i]->name, emsg); return; } cdebugbuf(i, "decode", &buf_in, 3,0); diff --git a/ipif/forwarder.h b/ipif/forwarder.h index 08eee56..a9b88b6 100644 --- a/ipif/forwarder.h +++ b/ipif/forwarder.h @@ -1,4 +1,22 @@ /* + * Encrypting tunnel for userv-ipif tunnels, header file + */ +/* + * Copyright (C) 2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef MECHS_H @@ -39,7 +57,8 @@ extern const struct mechanism *const mechanismlists[]; * * setup_in function may increase maxprefix and maxsuffix * code functions modify buffer in place - * decode function returns message to print + * decode function returns 0 meaning packet decoded ok, + * "" meaning discard it quietly, or message to print for verbose discard */ const char *getarg_string(void); diff --git a/ipif/hex.c b/ipif/hex.c index dc0c749..37cb75b 100644 --- a/ipif/hex.c +++ b/ipif/hex.c @@ -1,4 +1,20 @@ -/**/ +/* + * Copyright (C) 1997,2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #include #include diff --git a/ipif/hex.h b/ipif/hex.h index 5bce442..236fafa 100644 --- a/ipif/hex.h +++ b/ipif/hex.h @@ -1,4 +1,20 @@ -/**/ +/* + * Copyright (C) 1997,2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #ifndef HEX__H_INCLUDED #define HEX__H_INCLUDED diff --git a/ipif/mech-blowfish.c b/ipif/mech-blowfish.c index 65e3311..b1cb192 100644 --- a/ipif/mech-blowfish.c +++ b/ipif/mech-blowfish.c @@ -1,5 +1,5 @@ /* - * Blowfish + * Blowfish mechanism for udp tunnel * * arguments: key size in bits (must be multiple of 8) * @@ -8,6 +8,23 @@ * encoding: do CBC encryption overwriting message * encoding for MAC: do CBC and prepend last ciphertext block */ +/* + * Copyright (C) 2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #include "forwarder.h" #include "blowfish.h" diff --git a/ipif/mech-null.c b/ipif/mech-null.c index 8ff117c..fccb7d7 100644 --- a/ipif/mech-null.c +++ b/ipif/mech-null.c @@ -1,4 +1,22 @@ /* + * Null mechanism for udp tunnel (for testing purposes only) + */ +/* + * Copyright (C) 2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "forwarder.h" diff --git a/ipif/mech-pkcs5.c b/ipif/mech-pkcs5.c index df4d918..f03787b 100644 --- a/ipif/mech-pkcs5.c +++ b/ipif/mech-pkcs5.c @@ -1,11 +1,28 @@ /* - * PKCS#5 padding + * PKCS#5 padding mechanism for udp tunnel * * arguments: block size to pad to, must be power of 2 * * encoding: append between 1 and n bytes, all of the same value being * the number of bytes appended */ +/* + * Copyright (C) 2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #include "forwarder.h" diff --git a/ipif/mech-sequence.c b/ipif/mech-sequence.c index 2090b37..76c8c83 100644 --- a/ipif/mech-sequence.c +++ b/ipif/mech-sequence.c @@ -1,11 +1,28 @@ /* - * Sequence number / nonce mechanism + * Sequence number / nonce mechanism for udp tunnel * * arguments: none * * encoding: prepend 4 bytes of sequence arithmetic serial number * decoding: check increasingness, or ignore */ +/* + * Copyright (C) 2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #include diff --git a/ipif/mech-timestamp.c b/ipif/mech-timestamp.c index 226f23f..93d30e6 100644 --- a/ipif/mech-timestamp.c +++ b/ipif/mech-timestamp.c @@ -1,5 +1,5 @@ /* - * Timestamp mechanism + * Timestamp mechanism for udp tunnel * * arguments: * @@ -10,14 +10,34 @@ * accept a packet (or 0 for any future age). * */ +/* + * Copyright (C) 2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #include #include #include "forwarder.h" +#define WARN_EVERY 30 + struct mechdata { time_t max_skew, max_age; + time_t next_warn; }; static void mds_timestamp(struct mechdata **md_r) { @@ -27,6 +47,7 @@ static void mds_timestamp(struct mechdata **md_r) { md->max_skew= getarg_ulong(); md->max_age= getarg_ulong(); + md->next_warn= now(); *md_r= md; } @@ -42,27 +63,27 @@ static void menc_timestamp(struct mechdata *md, struct buffer *buf) { static const char *mdec_timestamp(struct mechdata *md, struct buffer *buf) { static char cbuf[40]; - uint32_t *tp, timestamp, tnow; + uint32_t *tp, timestamp; + time_t tnow; long age; BUF_UNPREPEND(tp,buf,4); timestamp= ntohl(*tp); tnow= now(); - age= timestamp - tnow; + age= timestamp - (uint32_t)tnow; if (age > 0) { - if (md->max_age && age > md->max_age) { - sprintf(cbuf,"packet too old (%lds)",age); - return cbuf; - } + if (!md->max_age || age <= md->max_age) return 0; + sprintf(cbuf,"packet too old (%lds)",age); } else if (age < 0) { - if (md->max_skew && age < -md->max_skew) { - sprintf(cbuf,"too much skew (%lds)",-age); - return cbuf; - } + if (!md->max_skew || age >= -md->max_skew) return 0; + sprintf(cbuf,"too much skew (%lds)",-age); } - return 0; + if (tnow < md->next_warn) return ""; + + md->next_warn= tnow+WARN_EVERY; + return cbuf; } STANDARD_MECHANISMLIST("timestamp",timestamp); diff --git a/ipif/utils.c b/ipif/utils.c index 97ff430..dadee70 100644 --- a/ipif/utils.c +++ b/ipif/utils.c @@ -1,4 +1,22 @@ /* + * General utility functions for udp tunnel + */ +/* + * Copyright (C) 2000 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include