~ubuntu-branches/ubuntu/jaunty/stunnel4/jaunty

« back to all changes in this revision

Viewing changes to src/stunnel3.in

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lemoine
  • Date: 2005-04-20 21:07:50 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050420210750-0vk5fj5vh75o4d00
Tags: 2:4.090-1
* New upstream release
* include better stunnel3 compability script from upstream, options 
  like -cd can now be use instead of -c -d ...
  (closes: #305259)
* Added depends on perl-modules to allow use of stunnel3 compatibilty script

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
#
 
3
# stunnel3      Perl wrapper to use stunnel 3.x syntax in stunnel >=4.05
 
4
# Copyright (c) 2004-2005 Michal Trojnara <Michal.Trojnara@mirt.net>
 
5
#               All Rights Reserved
 
6
#
 
7
# Version:      2.00
 
8
# Date:         2005.04.20
 
9
# Author:       Michal Trojnara  <Michal.Trojnara@mirt.net>
 
10
#
 
11
# This program is free software; you can redistribute it and/or modify
 
12
# it under the terms of the GNU General Public License as published by
 
13
# the Free Software Foundation; either version 2 of the License, or
 
14
# (at your option) any later version.
 
15
#
 
16
# This program is distributed in the hope that it will be useful,
 
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
# GNU General Public License for more details.
 
20
#
 
21
# You should have received a copy of the GNU General Public License
 
22
# along with this program; if not, write to the Free Software
 
23
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
24
#
 
25
 
 
26
use POSIX;
 
27
use Getopt::Std;
 
28
 
 
29
# Configuration - path to stunnel (version >=4.05)
 
30
$stunnel_bin='@prefix@/sbin/stunnel4';
 
31
 
 
32
# stunnel3 script body begins here
 
33
($read_fd, $write_fd)=POSIX::pipe();
 
34
$pid=fork;
 
35
die "Can't fork" unless defined $pid;
 
36
if($pid) { # parent
 
37
    POSIX::close($write_fd);
 
38
    exec "$stunnel_bin -fd $read_fd";
 
39
    die "$stunnel_bin exec failed";
 
40
}
 
41
# child
 
42
POSIX::close($read_fd);
 
43
open(STUNNEL, ">&$write_fd");
 
44
# comment out the next line to see the config file
 
45
select(STUNNEL);
 
46
 
 
47
getopts('cTWfD:O:o:C:p:v:a:A:t:N:u:n:E:R:B:I:d:s:g:P:r:L:l:');
 
48
 
 
49
print("client = yes\n") if defined $opt_c;
 
50
print("transparent = yes\n") if defined $opt_T;
 
51
print("RNDoverwrite = yes\n") if defined $opt_W;
 
52
print("foreground = yes\n") if defined $opt_f;
 
53
print("debug = $opt_D\n") if defined $opt_D;
 
54
print("socket = $opt_O\n") if defined $opt_O;
 
55
print("output = $opt_o\n") if defined $opt_o;
 
56
print("ciphers = $opt_C\n") if defined $opt_C;
 
57
print("cert = $opt_p\n") if defined $opt_p;
 
58
print("verify = $opt_v\n") if defined $opt_v;
 
59
print("CApath = $opt_a\n") if defined $opt_a;
 
60
print("CAfile = $opt_A\n") if defined $opt_A;
 
61
print("session = $opt_t\n") if defined $opt_t;
 
62
print("service = $opt_N\n") if defined $opt_N;
 
63
print("ident = $opt_u\n") if defined $opt_u;
 
64
print("protocol = $opt_n\n") if defined $opt_n;
 
65
print("EGD = $opt_E\n") if defined $opt_E;
 
66
print("RNDfile = $opt_R\n") if defined $opt_R;
 
67
print("RNDbytes = $opt_B\n") if defined $opt_B;
 
68
print("local = $opt_I\n") if defined $opt_I;
 
69
print("accept = $opt_d\n") if defined $opt_d;
 
70
print("setuid = $opt_s\n") if defined $opt_s;
 
71
print("setgid = $opt_g\n") if defined $opt_g;
 
72
print("pid = $opt_P\n") if defined $opt_P;
 
73
print("connect = $opt_r\n") if defined $opt_r;
 
74
print("pty = yes\n"), $opt_l=$opt_L if defined $opt_L;
 
75
print("exec = $opt_l\n") if defined $opt_l;
 
76
print("execargs = " . join(' ', @ARGV) . "\n") if @ARGV;
 
77
print("[stunnel3]\n") if defined $opt_d;
 
78
 
 
79
close(STUNNEL);
 
80
 
 
81
# stunnel3 script body ends here