[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [69] trunk
- Subject: SF.net SVN: ledger-smb: [69] trunk
- From: ..hidden..
- Date: Mon, 11 Sep 2006 18:25:37 -0700
Revision: 69
http://svn.sourceforge.net/ledger-smb/?rev=69&view=rev
Author: christopherm
Date: 2006-09-11 18:25:35 -0700 (Mon, 11 Sep 2006)
Log Message:
-----------
cleaning up login.pl, fixing serious traversal bug, whitelisting $form{path} to one of two options, same for $form{terminal}, removing references to HTTP_USER_AGENT
Modified Paths:
--------------
trunk/admin.pl
trunk/login.pl
Modified: trunk/admin.pl
===================================================================
--- trunk/admin.pl 2006-09-11 14:23:29 UTC (rev 68)
+++ trunk/admin.pl 2006-09-12 01:25:35 UTC (rev 69)
@@ -26,7 +26,6 @@
# Web: http://sourceforge.net/projects/ledger-smb/
#
# Contributors:
-# Portions Copyright (C) Dieter Simader 2001
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -63,17 +62,16 @@
eval { require "ledger-smb.conf"; };
-
if ($ENV{CONTENT_LENGTH}) {
- read(STDIN, $_, $ENV{CONTENT_LENGTH});
+ read(STDIN, $_, $ENV{CONTENT_LENGTH});
}
if ($ENV{QUERY_STRING}) {
- $_ = $ENV{QUERY_STRING};
+ $_ = $ENV{QUERY_STRING};
}
if ($ARGV[0]) {
- $_ = $ARGV[0];
+ $_ = $ARGV[0];
}
@@ -89,58 +87,33 @@
if (-e "$userspath/nologin" && $script ne 'admin.pl') {
- print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT};
- print "\nLogin disabled!\n";
- exit;
+ print "Content-Type: text/html\n\n<html><body><strong>";
+ print "\nLogin disabled!\n";
+ print "\n</strong></body></html>";
+ exit;
}
if ($form{path}) {
- $form{path} =~ s/%2f/\//gi;
- $form{path} =~ s/\.\.\///g;
- if ($form{path} !~ /^bin\//) {
- print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT};
- print "\nInvalid path!\n";
- exit;
- }
+ if ($form{path} ne 'bin/lynx'){ $form{path} = 'bin/mozilla';}
+ $ARGV[0] = "$_&script=$script";
+ require "$form{path}/$script";
- $ARGV[0] = "$_&script=$script";
- require "$form{path}/$script";
} else {
- if (!$form{terminal}) {
- if ($ENV{HTTP_USER_AGENT}) {
- # web browser
- $form{terminal} = "lynx";
- if ($ENV{HTTP_USER_AGENT} !~ /lynx/i) {
- $form{terminal} = "mozilla";
- }
- } else {
- if ($ENV{TERM} =~ /xterm/) {
- $form{terminal} = "xterm";
- }
- if ($ENV{TERM} =~ /(console|linux|vt.*)/i) {
- $form{terminal} = "console";
- }
- }
- }
+ $form{terminal} = "lynx";
+ if ($ENV{HTTP_USER_AGENT} !~ /lynx/i) {
+ $form{terminal} = "mozilla";
+ }
- if ($form{terminal}) {
+ $ARGV[0] = "path=bin/$form{terminal}&script=$script";
+ map { $ARGV[0] .= "&${_}=$form{$_}" } keys %form;
- $ARGV[0] = "path=bin/$form{terminal}&script=$script";
- map { $ARGV[0] .= "&${_}=$form{$_}" } keys %form;
+ require "bin/$form{terminal}/$script";
- require "bin/$form{terminal}/$script";
-
- } else {
-
- print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT};
- print qq|\nUnknown terminal\n|;
- }
-
}
# end of main
Modified: trunk/login.pl
===================================================================
--- trunk/login.pl 2006-09-11 14:23:29 UTC (rev 68)
+++ trunk/login.pl 2006-09-12 01:25:35 UTC (rev 69)
@@ -62,17 +62,16 @@
eval { require "ledger-smb.conf"; };
-
if ($ENV{CONTENT_LENGTH}) {
- read(STDIN, $_, $ENV{CONTENT_LENGTH});
+ read(STDIN, $_, $ENV{CONTENT_LENGTH});
}
if ($ENV{QUERY_STRING}) {
- $_ = $ENV{QUERY_STRING};
+ $_ = $ENV{QUERY_STRING};
}
if ($ARGV[0]) {
- $_ = $ARGV[0];
+ $_ = $ARGV[0];
}
@@ -88,61 +87,33 @@
if (-e "$userspath/nologin" && $script ne 'admin.pl') {
- print "Content-Type: text/html\n\n<html><body><strong>" if $ENV{HTTP_USER_AGENT};
- print "\nLogin disabled!\n";
- print "\n</strong></body></html>" if $ENV{HTTP_USER_AGENT};
- exit;
+ print "Content-Type: text/html\n\n<html><body><strong>";
+ print "\nLogin disabled!\n";
+ print "\n</strong></body></html>";
+ exit;
}
if ($form{path}) {
- $form{path} =~ s/%2f/\//gi;
- $form{path} =~ s/\.\.\///g;
- if ($form{path} !~ /^bin\//) {
- print "Content-Type: text/html\n\n<html><body><strong>" if $ENV{HTTP_USER_AGENT};
- print "\nInvalid path!\n";
- print "\n</strong></body></html>" if $ENV{HTTP_USER_AGENT};
- exit;
- }
+ if ($form{path} ne 'bin/lynx'){ $form{path} = 'bin/mozilla';}
+ $ARGV[0] = "$_&script=$script";
+ require "$form{path}/$script";
- $ARGV[0] = "$_&script=$script";
- require "$form{path}/$script";
} else {
- if (!$form{terminal}) {
- if ($ENV{HTTP_USER_AGENT}) {
- # web browser
- $form{terminal} = "lynx";
- if ($ENV{HTTP_USER_AGENT} !~ /lynx/i) {
- $form{terminal} = "mozilla";
- }
- } else {
- if ($ENV{TERM} =~ /xterm/) {
- $form{terminal} = "xterm";
- }
- if ($ENV{TERM} =~ /(console|linux|vt.*)/i) {
- $form{terminal} = "console";
- }
- }
- }
+ $form{terminal} = "lynx";
+ if ($ENV{HTTP_USER_AGENT} !~ /lynx/i) {
+ $form{terminal} = "mozilla";
+ }
- if ($form{terminal}) {
+ $ARGV[0] = "path=bin/$form{terminal}&script=$script";
+ map { $ARGV[0] .= "&${_}=$form{$_}" } keys %form;
- $ARGV[0] = "path=bin/$form{terminal}&script=$script";
- map { $ARGV[0] .= "&${_}=$form{$_}" } keys %form;
+ require "bin/$form{terminal}/$script";
- require "bin/$form{terminal}/$script";
-
- } else {
-
- print "Content-Type: text/html\n\n<html><body><strong>" if $ENV{HTTP_USER_AGENT};
- print qq|\nUnknown terminal\n|;
- print "\n</strong></body></html>" if $ENV{HTTP_USER_AGENT};
- }
-
}
# end of main
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.