aboutsummaryrefslogtreecommitdiffstats
path: root/net/pipsecd
diff options
context:
space:
mode:
authorcy <cy@FreeBSD.org>2006-08-04 10:48:55 +0800
committercy <cy@FreeBSD.org>2006-08-04 10:48:55 +0800
commit337aed36e634fee85d1034253108293d670a7c40 (patch)
treeafaf90ca9735858cc220964ab8dc9c3f414beae9 /net/pipsecd
parent709e0ce9c74dbfae47ce3b8faba4d047d03c7bfd (diff)
downloadfreebsd-ports-gnome-337aed36e634fee85d1034253108293d670a7c40.tar.gz
freebsd-ports-gnome-337aed36e634fee85d1034253108293d670a7c40.tar.zst
freebsd-ports-gnome-337aed36e634fee85d1034253108293d670a7c40.zip
Add capability to specify configuration files on the command line.
Diffstat (limited to 'net/pipsecd')
-rw-r--r--net/pipsecd/Makefile2
-rw-r--r--net/pipsecd/files/patch-ab89
2 files changed, 80 insertions, 11 deletions
diff --git a/net/pipsecd/Makefile b/net/pipsecd/Makefile
index bcb0c5e76d54..f94d8012939b 100644
--- a/net/pipsecd/Makefile
+++ b/net/pipsecd/Makefile
@@ -7,7 +7,7 @@
PORTNAME= pipsecd
PORTVERSION= 19991014
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net security
MASTER_SITES= http://www.enst.fr/~beyssac/pipsec/ \
http://www.mindstep.com/pipsec/
diff --git a/net/pipsecd/files/patch-ab b/net/pipsecd/files/patch-ab
index adb8f1726fc3..20ef653effce 100644
--- a/net/pipsecd/files/patch-ab
+++ b/net/pipsecd/files/patch-ab
@@ -1,5 +1,5 @@
---- tunip.c.orig0 Tue Sep 21 15:20:40 1999
-+++ tunip.c Sat Feb 23 17:32:45 2002
+--- tunip.c.orig Tue Sep 21 15:20:40 1999
++++ tunip.c Thu Jul 20 04:26:39 2006
@@ -35,6 +35,8 @@
#include <unistd.h>
#include <fcntl.h>
@@ -26,7 +26,15 @@
#define _PATH_DEV_RANDOM "/dev/random"
#ifdef USE_ETHERTAP
-@@ -131,7 +135,9 @@
+@@ -100,6 +104,7 @@
+ #endif
+
+ unsigned char buf[MAX_HEADER+MAX_PACKET];
++char *cmd;
+
+ typedef union {
+ MD5_CTX md5;
+@@ -131,7 +136,9 @@
des_key_schedule k3;
} des3;
CAST_KEY cast;
@@ -36,7 +44,7 @@
} crypt_key;
typedef struct crypt_method {
-@@ -304,12 +310,14 @@
+@@ -304,12 +311,14 @@
void cast_cbc_decrypt(unsigned char *iv, crypt_key *dk,
unsigned char *ct, unsigned int len);
int cast_setkey(unsigned char *b, unsigned int len, crypt_key *k);
@@ -51,7 +59,7 @@
void my_des_cbc_encrypt(unsigned char *iv, crypt_key *ek,
unsigned char *t, unsigned int len);
void my_des_cbc_decrypt(unsigned char *iv, crypt_key *dk,
-@@ -379,14 +387,20 @@
+@@ -379,14 +388,20 @@
hash_method_t *hash_list = &hash_ripemd160;
@@ -72,7 +80,7 @@
"cast_cbc", 8, 8,
cast_cbc_encrypt, cast_cbc_decrypt,
cast_setkey, cast_setkey
-@@ -704,13 +718,22 @@
+@@ -704,13 +719,22 @@
*/
int tun_send_ip(struct tun_method *this, struct encap_method *encap, int fd)
{
@@ -96,7 +104,7 @@
sent = write(fd, encap->buf, encap->buflen);
if (sent != encap->buflen)
syslog(LOG_ERR, "truncated in: %d -> %d\n", encap->buflen, sent);
-@@ -1120,6 +1143,7 @@
+@@ -1120,6 +1144,7 @@
}
} else if (strcmp(arg, "if") == 0) {
int fd;
@@ -104,7 +112,7 @@
struct sa_desc *local_sa, *remote_sa;
struct peer_desc *peer;
-@@ -1128,6 +1152,7 @@
+@@ -1128,6 +1153,7 @@
perror(arg);
continue;
}
@@ -112,7 +120,7 @@
local_sa = NULL;
remote_sa = NULL;
-@@ -1974,6 +1999,7 @@
+@@ -1974,6 +2000,7 @@
return 0;
}
@@ -120,7 +128,7 @@
void my_idea_cbc_encrypt(unsigned char *iv, crypt_key *ek,
unsigned char *t, unsigned int len)
{
-@@ -2002,6 +2028,7 @@
+@@ -2002,6 +2029,7 @@
idea_set_decrypt_key(&k->idea, &k->idea);
return 0;
}
@@ -128,3 +136,64 @@
void my_des_cbc_encrypt(unsigned char *iv, crypt_key *ek,
unsigned char *t, unsigned int len)
+@@ -2081,6 +2109,11 @@
+ return 0;
+ }
+
++void usage()
++{
++ fprintf(stderr, "%s: usage: [ -c CONFIG ] [ -s SCRIPT ]\n", cmd);
++ exit(1);
++}
+ int main(int argc, char **argv)
+ {
+ time_t t;
+@@ -2088,9 +2121,14 @@
+ int pack, i;
+ struct sockaddr_in from;
+ struct stat sb;
++ int ch;
++ char *path_conf = _PATH_CONF;
++ char *path_startup = _PATH_STARTUP;
+
+ FILE *f;
+
++ cmd=argv[0];
++
+ openlog ("pipsecd", LOG_PID, LOG_DAEMON);
+ syslog (LOG_NOTICE, "pipsecd starting");
+
+@@ -2113,7 +2151,21 @@
+ if (encap_icmp_new(&encap_meth[ENCAP_ICMP], IPPROTO_ICMP) == -1)
+ exit(1);
+
+- f = fopen(_PATH_CONF, "r");
++ while ((ch = getopt(argc, argv, "c:s:")) != -1) {
++ switch (ch) {
++ case 'c':
++ path_conf = optarg;
++ break;
++ case 's':
++ path_startup = optarg;
++ break;
++ case '?':
++ default:
++ usage();
++ }
++ }
++
++ f = fopen(path_conf, "r");
+ if (f == NULL) {
+ perror("configuration file");
+ exit(1);
+@@ -2123,8 +2175,8 @@
+ fclose(f);
+
+ /* Execute startup script, if any */
+- if (stat(_PATH_STARTUP, &sb) == 0 && (sb.st_mode & 0400))
+- system(_PATH_STARTUP);
++ if (stat(path_startup, &sb) == 0 && (sb.st_mode & 0400))
++ system(path_startup);
+
+ /* Send a probe to every peer on startup */
+ for (i = 0; i < peer_num; i++)