LDAP : SambaMungedDial Syntax
Yohann Fourteau
yohann.fourteau at aitb.org
Wed Dec 8 16:03:37 GMT 2004
So for people who want to extract info from sambaMungedDial attribute, I ve done
a little script (in php) :
----------------------------------------------
<?
function hexbin($hex){
$bin='';
for($i=0;$i<strlen($hex);$i+=2)
$bin.=chr(hexdec(substr($hex,$i,2)));
return $bin;
}
$res=ldap_connect("localhost");
ldap_bind($res);
$dn="the dn";
$ret=ldap_read($res,$dn,"objectclass=*",array("sambamungeddial"));
$entries = ldap_get_entries($res, $ret);
$str=$entries[0]["sambamungeddial"][0];
ldap_close($res);
$string=base64_decode($str);
$len=strlen($string);
$noField=0;
$i=0;
while($i<$len)
{
if ($string[$i+6]=='C' && $string[$i+8]=='t' && $string[$i+10]=='x')
{
if ($noField==0)
$first=$i;
$fieldNameLen=ord($string[$i]);
$field[$noField]["name"]="";
$field[$noField]["value"]="";
for($j=$i+6;$j<$i+6+$fieldNameLen;$j+=2)
{
$field[$noField]["name"].=$string[$j];
}
$fieldValueLen=ord($string[$i+2]);
for($j=$i+6+$fieldNameLen;$j<$i+6+$fieldNameLen+$fieldValueLen;$j++)
{
$field[$noField]["value"].=$string[$j];
}
$noField++;
$i=$i+6+$fieldNameLen+$fieldValueLen;
}
else
$i++;
}
$stringFields=array("CtxMinEncryptionLevel","CtxWorkDirectory","CtxNWLogonServer","CtxWFHomeDir","CtxWFHomeDirDrive","CtxWFProfilePath","CtxInitialProgram","CtxCallbackNumber");
foreach($field as $index => $fi)
{
if (in_array($fi["name"],$stringFields))
{
$field[$index]["value"]=hexbin($fi["value"]);
}
}
var_dump($field);
// no idea what it is, the rest is space caracters.
echo ord($string[$first-4])."\n";
echo ord($string[$first-2])."\n";
?>
--------------------------------------------
I'm writing another script (in php) which integrate data into that attribute.
Yohann F.
Selon Roland Gruber <gruberr at in.tum.de>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> Yohann Fourteau schrieb:
> | I've done some test to try to decode (and recode) the sambaMungedDial
> Attribute
> | in LDAP.
> | [...]
> | You have the value of each TSE fields :
> | CtxCfgPresent
> | CtxCfgFlags
> | CtxCallback
> | CtxShadow
> | CtxMaxConnectionTime
> | CtxMaxDisconnectionTime
> | CtxMaxIdleTime
> | CtxKeyboardLayout
> | CtxMinEncryptionLevel
> | CtxWorkDirectory
> | CtxNWLogonServer
> | CtxWFHomeDir
> | CtxWFHomeDirDrive
> | CtxWFProfilePath
> | CtxInitialProgram
> | CtxCallbackNumber
>
> thanks, now I finally know what this attribute is all about.
>
> | Why not to try to decode and split that attribute in 16 other
> attributes in LDAP
>
> This would make it much easier to integrate this to LDAP Account
> Manager, too. Since I have no TSM I would be unable to test my code.
> On the other side it would double the Samba attributes.
>
>
> Greetings,
> Roland
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
>
> iD8DBQFBtxxLq/ywNCsrGZ4RArPyAJ9Cr8D4/6pCT5UQp3lNt5kFtmiPgQCdHmcL
> Lx5rwPB4cCY6pFcl7CcDs7g=
> =vVYr
> -----END PGP SIGNATURE-----
>
>
--
Yohann F.
More information about the samba-technical
mailing list