diff --git a/pptp-client/CHANGELOG b/pptp-client/CHANGELOG index 2e2767bd3..59d22b651 100644 --- a/pptp-client/CHANGELOG +++ b/pptp-client/CHANGELOG @@ -2,3 +2,5 @@ Moved code for connecting a PPTP tunnel to a separate function, so it can be called by other modules. ---- Changes since 1.190 ---- A PPTP tunnel can now be configured to activate at boot time. +---- Changes since 1.390 ---- +When connecting a PPTP tunnel, an optional override password can be entered. This allows you to avoid storing the PPTP password in a configuration file. Thanks to Nicolas Ledoux for this patch. diff --git a/pptp-client/conn.cgi b/pptp-client/conn.cgi index b08d99cb4..684dc5123 100755 --- a/pptp-client/conn.cgi +++ b/pptp-client/conn.cgi @@ -25,7 +25,29 @@ $| = 1; print "",&text('conn_cmd', "$config{'pptp'} $tunnel->{'server'} ". "call $in{'tunnel'}"),"
\n"; -($ok, @status) = &connect_tunnel($tunnel); +# If a password is passed, use it to temprarily overwrite the one in +# the secrets file +if ($in{'cpass'}) { + $login = &find("name", $tunnel->{'opts'}); + $sn = $login ? $login->{'value'} : &get_system_hostname(1); + &lock_file($config{'pap_file'}); + @secs = &list_secrets(); + ($sec) = grep { $_->{'client'} eq $sn } @secs; + $oldsecret = $sec->{'secret'}; + $sec->{'secret'} = $in{'cpass'}; + &change_secret($sec); + &flush_file_lines(); + ($ok, @status) = &connect_tunnel($tunnel); + $sec->{'secret'} = $oldsecret; + &change_secret($sec); + &flush_file_lines(); + &unlock_file($config{'pap_file'}); + &lock_file($config{'pap_file'}); + } +else { + ($ok, @status) = &connect_tunnel($tunnel); + } + if ($ok) { # Worked! Tell user print "",&text('conn_ok', "$status[0]", diff --git a/pptp-client/index.cgi b/pptp-client/index.cgi index ea343ae3e..f827eb5d5 100755 --- a/pptp-client/index.cgi +++ b/pptp-client/index.cgi @@ -62,7 +62,9 @@ else { $config{'tunnel'} eq $t->{'name'} ? "selected" : "", $t->{'name'}; } - print "\n"; + print "\n"; + print $text{'index_pass'}," ",&ui_password("cpass", undef, 10); + print "\n"; print "