From 93cab2448a03047d9ef815add62d471c9ff94f91 Mon Sep 17 00:00:00 2001 From: cajus Date: Tue, 26 Feb 2008 10:02:35 +0000 Subject: [PATCH] Corrected length calculation. Seems to break utf-8 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9122 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-bus | 6 ++++-- gosa-si/gosa-si-client | 6 ++++-- gosa-si/gosa-si-server | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gosa-si/gosa-si-bus b/gosa-si/gosa-si-bus index 8076db288..f1da0ba05 100755 --- a/gosa-si/gosa-si-bus +++ b/gosa-si/gosa-si-bus @@ -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 diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index bde1ce252..eef48fdfa 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -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 diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 848f237cc..7851f24ae 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -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 -- 2.30.2