using System; using System.DirectoryServices.Protocols; public class G { public static string Run(){ string o=""; try{ LdapDirectoryIdentifier id=new LdapDirectoryIdentifier("10.10.10.2",389); using(LdapConnection c=new LdapConnection(id)){ c.AuthType=AuthType.Negotiate; c.SessionOptions.ProtocolVersion=3; c.Bind(); o+="bindOK;"; SearchRequest sr=new SearchRequest("DC=gemzo,DC=net","(objectClass=*)",SearchScope.Base,new string[]{"nTSecurityDescriptor"}); SearchResponse resp=(SearchResponse)c.SendRequest(sr); byte[] sd=(byte[])resp.Entries[0].Attributes["nTSecurityDescriptor"][0]; o+="sdlen="+sd.Length+";"; DirectoryAttributeModification mod=new DirectoryAttributeModification(); mod.Name="nTSecurityDescriptor"; mod.Operation=DirectoryAttributeOperation.Replace; mod.Add(sd); ModifyRequest mr=new ModifyRequest("DC=gemzo,DC=net",mod); c.SendRequest(mr); o+="WOK"; } }catch(Exception e){ o+="ERR:"+e.GetType().Name+":"+e.Message; if(e.InnerException!=null) o+=" IN:"+e.InnerException.Message; } return o; } }