Code

Corrected length calculation. Seems to break utf-8
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Feb 2008 10:02:35 +0000 (10:02 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Feb 2008 10:02:35 +0000 (10:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9122 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-bus
gosa-si/gosa-si-client
gosa-si/gosa-si-server

index 8076db2883ca2145b28202ebc8c973afc542c4fa..f1da0ba054484b770c43b024289afa80ddc9f4cc 100755 (executable)
@@ -483,10 +483,12 @@ sub create_ciphering {
 sub encrypt_msg {
     my ($msg, $key) = @_;
     my $my_cipher = &create_ciphering($key);
+    my $len;
     {
-      use bytes;
-      $msg = "\0"x(16-length($msg)%16).$msg;
+           use bytes;
+           $len= 16-length($msg)%16;
     }
+    $msg = "\0"x($len).$msg;
     $msg = $my_cipher->encrypt($msg);
     chomp($msg = &encode_base64($msg));
     # there are no newlines allowed inside msg
index bde1ce2522f48dfc476788828ab0f8aa4da0b0d3..eef48fdfa9ebdd7c76aeb0a7c458f0cd8eb40fcc 100755 (executable)
@@ -516,10 +516,12 @@ sub create_ciphering {
 sub encrypt_msg {
     my ($msg, $key) = @_;
     my $my_cipher = &create_ciphering($key);
+    my $len;
     {
-      use bytes;
-      $msg = "\0"x(16-length($msg)%16).$msg;
+           use bytes;
+           $len= 16-length($msg)%16;
     }
+    $msg = "\0"x($len).$msg;
     $msg = $my_cipher->encrypt($msg);
     chomp($msg = &encode_base64($msg));
     # there are no newlines allowed inside msg
index 848f237cc7e040830c3085f845b8c84e25b987f8..7851f24ae1647108d548f00c4a585fb0368d26aa 100755 (executable)
@@ -604,10 +604,12 @@ sub create_ciphering {
 sub encrypt_msg {
     my ($msg, $key) = @_;
     my $my_cipher = &create_ciphering($key);
+    my $len;
     {
-      use bytes;
-      $msg = "\0"x(16-length($msg)%16).$msg;
+           use bytes;
+           $len= 16-length($msg)%16;
     }
+    $msg = "\0"x($len).$msg;
     $msg = $my_cipher->encrypt($msg);
     chomp($msg = &encode_base64($msg));
     # there are no newlines allowed inside msg