[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2938] trunk



Revision: 2938
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2938&view=rev
Author:   einhverfr
Date:     2010-03-01 20:21:44 +0000 (Mon, 01 Mar 2010)

Log Message:
-----------
Committing Alexey's patch for Safari and authentication

Modified Paths:
--------------
    trunk/LedgerSMB/Auth/DB.pm
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB.pm

Modified: trunk/LedgerSMB/Auth/DB.pm
===================================================================
--- trunk/LedgerSMB/Auth/DB.pm	2010-03-01 19:57:34 UTC (rev 2937)
+++ trunk/LedgerSMB/Auth/DB.pm	2010-03-01 20:21:44 UTC (rev 2938)
@@ -292,6 +292,8 @@
 sub get_credentials {
     # Handling of HTTP Basic Auth headers
     my $auth = $ENV{'HTTP_AUTHORIZATION'};
+	# Send HTTP 401 if the authorization header is missing
+	credential_prompt unless ($auth);
     $auth =~ s/Basic //i; # strip out basic authentication preface
     $auth = MIME::Base64::decode($auth);
     my $return_value = {};

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2010-03-01 19:57:34 UTC (rev 2937)
+++ trunk/LedgerSMB/Form.pm	2010-03-01 20:21:44 UTC (rev 2938)
@@ -60,6 +60,7 @@
 
 use Math::BigFloat lib => 'GMP';
 use LedgerSMB::Sysconfig;
+use LedgerSMB::Auth;
 use List::Util qw(first);
 use Time::Local;
 use Cwd;
@@ -1199,7 +1200,9 @@
 
     # Handling of HTTP Basic Auth headers
     my $auth = $ENV{'HTTP_AUTHORIZATION'};
-    $auth =~ s/Basic //i; # strip out basic authentication preface
+	# Send HTTP 401 if the authorization header is missing
+    LedgerSMB::Auth::credential_prompt unless ($auth);
+	$auth =~ s/Basic //i; # strip out basic authentication preface
     $auth = MIME::Base64::decode($auth);
     my ($login, $password) = split(/:/, $auth);
     $self->{login} = $login;

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2010-03-01 19:57:34 UTC (rev 2937)
+++ trunk/LedgerSMB.pm	2010-03-01 20:21:44 UTC (rev 2938)
@@ -912,7 +912,7 @@
     my $index = ( $args{index} ) ? $args{index} : 'runningnumber';
 
     my @rows;
-    my $i;    # incriment counter use only
+    my $i;    # increment counter use only
     for $i ( 1 .. $count ) {
         my $temphash = { _inc => $i };
         for my $fld (@flds) {
@@ -921,7 +921,7 @@
         push @rows, $temphash;
     }
     $i = 1;
-    for my $row ( sort { $a->{index} <=> $b->{index} } @rows ) {
+    for my $row ( sort { $a->{$index} <=> $b->{$index} } @rows ) {
         for my $fld (@flds) {
             $self->{ "$fld" . "_$i" } = $row->{$fld};
         }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.