I have a legacy .NET library doing the following:
const int adsOptionPasswordMethod = 7;
const int adsPasswordEncodeClear = 0;
user.Invoke ("SetOption", new object[] { adsOptionPasswordMethod, adsPasswordEncodeClear });
I am using System.DirectoryServices.Protocols in .NET 7 now, and I want to do something like this:
const int adsOptionPasswordMethod = 7;
const int adsPasswordEncodeClear = 0;
var setOptionsAccountControl = new DirectoryAttributeModification
{
Operation = DirectoryAttributeOperation.Replace,
Name = "SetOption",
};
modifyUserAccountControl.Add(adsOptionPasswordMethod);
modifyUserAccountControl.Add(adsPasswordEncodeClear);
But the above seems wrong.
According to the documentation, the value of
ADS_PASSWORD_ENCODE_CLEARis1, but the old code is using0, which is the value forADS_PASSWORD_ENCODE_REQUIRE_SSL, which requires the use of SSL.So if the old code was working, then it must have already been connecting via SSL (port 636).
The documentation for the
unicodePwdattribute (the real attribute for the password, althoughuserPasswordcan work too) says that:If it's already using SSL, then that's all that's needed to be able to set the password. Setting those options isn't necessary.