X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_sambaMungedDial.inc;h=03a5b8c30f4528e4b334c824bcde186664d7c30e;hb=0188b38526443763ee3d1d88c9fdb39bd9fd52e4;hp=0f387658196c4e705b6c7cdc5d1b21625ae31a3f;hpb=5e0f73da483ce30326698e07ef9adf9ec866f81b;p=gosa.git diff --git a/include/class_sambaMungedDial.inc b/include/class_sambaMungedDial.inc index 0f3876581..03a5b8c30 100644 --- a/include/class_sambaMungedDial.inc +++ b/include/class_sambaMungedDial.inc @@ -28,6 +28,15 @@ define ("FILEHEADER", "20002000200020002000200020002000". "20002000200020002000200020002000". "5000"); +/* This is the old header, it is needed to automatically convert old mungedDials to new ones */ +define ("FILEHEADER_OLD", + "6d000800200020002000200020002000". + "20002000200020002000200020002000". + "20002000200020002000200064000100". + "20002000200020002000200020002000". + "20002000200020002000200020002000". + "20002000200020002000200020002000". + "50001000"); class sambaMungedDial { @@ -66,6 +75,7 @@ class sambaMungedDial /* These parameters are treated as time values and get converted */ var $timeParams= array("CtxMaxConnectionTime", "CtxMaxDisconnectionTime", "CtxMaxIdleTime"); + var $old_behavior= false; function strhex($string) { @@ -221,9 +231,18 @@ class sambaMungedDial /* * Remove base64 encoding and skip FILEHEADER. * The '4' is added, because the FILEHEADER has been stripped by 4 chars. - * These is the number of attributes follow - we don't need this now - only when writing. + * This is the number of attributes following - we don't need this at read time, only when writing. */ - $ctxField= substr(base64_decode($munge), (strlen(FILEHEADER)+4) / 2); + if(substr(base64_decode($munge),0,2)=="6d") { + $this->old_behavior=true; + } + + $ctxField=""; + if($this->old_behavior==true) { + $ctxField= substr(base64_decode($munge), (strlen(FILEHEADER_OLD)) / 2); + } else { + $ctxField= substr(base64_decode($munge), (strlen(FILEHEADER)+4) / 2); + } /* Decode parameters */ while ($ctxField!=""){ @@ -422,7 +441,11 @@ class sambaMungedDial */ function getShadow () { - $result= substr($this->ctx['CtxShadow'], 1, 1); + if($this->old_behavior==true) { + $result= substr($this->ctx['CtxCfgFlags1'], 1, 1); + } else { + $result= substr($this->ctx['CtxShadow'], 1, 1); + } return $result; } @@ -430,6 +453,10 @@ class sambaMungedDial function setShadow ($checked, $value) { if ($checked) { + if($this->old_behavior==true) { + // We need to reset the old setting + $this->ctx['CtxCfgFlags1'][1]= sprintf('%1X', $value); + } $this->ctx['CtxShadow'][1]= sprintf('%1x', $value); } }