예제 #1
0
 internal SearchResultEntry(XmlNode node)
 {
     this.attributes  = new SearchResultAttributeCollection();
     this.dsmlNode    = node;
     this.dsmlNS      = NamespaceUtils.GetDsmlNamespaceManager();
     this.dsmlRequest = true;
 }
예제 #2
0
		internal SearchResultEntry(XmlNode node)
		{
			this.attributes = new SearchResultAttributeCollection();
			this.dsmlNode = node;
			this.dsmlNS = NamespaceUtils.GetDsmlNamespaceManager();
			this.dsmlRequest = true;
		}
 private SearchResultAttributeCollection AttributesHelper()
 {
     SearchResultAttributeCollection attributes = new SearchResultAttributeCollection();
     XmlNodeList list = this.dsmlNode.SelectNodes("dsml:attr", this.dsmlNS);
     if (list.Count != 0)
     {
         foreach (XmlNode node in list)
         {
             DirectoryAttribute attribute = new DirectoryAttribute((XmlElement) node);
             attributes.Add(attribute.Name, attribute);
         }
     }
     return attributes;
 }
예제 #4
0
        private SearchResultAttributeCollection AttributesHelper()
        {
            SearchResultAttributeCollection searchResultAttributeCollection = new SearchResultAttributeCollection();
            XmlNodeList xmlNodeLists = this.dsmlNode.SelectNodes("dsml:attr", this.dsmlNS);

            if (xmlNodeLists.Count != 0)
            {
                foreach (XmlNode xmlNodes in xmlNodeLists)
                {
                    DirectoryAttribute directoryAttribute = new DirectoryAttribute((XmlElement)xmlNodes);
                    searchResultAttributeCollection.Add(directoryAttribute.Name, directoryAttribute);
                }
            }
            return(searchResultAttributeCollection);
        }
예제 #5
0
        private SearchResultAttributeCollection AttributesHelper()
        {
            SearchResultAttributeCollection attributes = new SearchResultAttributeCollection();
            XmlNodeList list = this.dsmlNode.SelectNodes("dsml:attr", this.dsmlNS);

            if (list.Count != 0)
            {
                foreach (XmlNode node in list)
                {
                    DirectoryAttribute attribute = new DirectoryAttribute((XmlElement)node);
                    attributes.Add(attribute.Name, attribute);
                }
            }
            return(attributes);
        }
예제 #6
0
        public static long? GetAttributeFileTime(SearchResultAttributeCollection attributes, string attrName)
        {
            object[] obj = null;
            try
            {
                obj = attributes[attrName].GetValues(Type.GetType("System.String"));
            }
            catch
            {
                return null;
            }
            if (obj.Length > 1)
            {
                throw new Exception("Attribute has more than one entry.");
            }

            return Convert.ToInt64(obj[0]);
        }
예제 #7
0
        private SearchResultAttributeCollection AttributesHelper()
        {
            SearchResultAttributeCollection attributes = new SearchResultAttributeCollection();

            XmlNodeList nodeList = _dsmlNode.SelectNodes("dsml:attr", _dsmlNS);

            if (nodeList.Count != 0)
            {
                foreach (XmlNode node in nodeList)
                {
                    Debug.Assert(node is XmlElement);

                    DirectoryAttribute attribute = new DirectoryAttribute((XmlElement)node);
                    attributes.Add(attribute.Name, attribute);
                }
            }

            return(attributes);
        }
예제 #8
0
        public static ushort? GetAttributeUshort(SearchResultAttributeCollection attributes, string attrName)
        {
            object[] obj = null;
            try
            {
                obj = attributes[attrName].GetValues(Type.GetType("System.String"));
            }
            catch
            {
                //unable to get attrName attribute, value unset
                return null;
            }
            if (obj.Length > 1)
            {
                throw new Exception("Attribute has more than one entry.");
            }

            return Convert.ToUInt16(obj[0]);
        }
예제 #9
0
 internal SearchResultEntry(string dn, SearchResultAttributeCollection attrs)
 {
     _distinguishedName = dn;
     _attributes        = attrs;
 }
예제 #10
0
        public static string GetobjectSid(SearchResultAttributeCollection attributes)
        {
            object[] obj = null;
            try
            {
                obj = attributes["objectSid"].GetValues(Type.GetType("System.Byte[]"));
            }
            catch
            {
                //unable to get objectSid attribute, value unset
                return null;
            }
            if (obj.Length > 1)
            {
                throw new Exception("objectSid has more than one entry.");
            }

            SecurityIdentifier objectSid = new SecurityIdentifier((byte[])obj[0], 0);
            return objectSid.ToString();
        }
예제 #11
0
 public static uint GetGroupCount(SearchResultAttributeCollection attributes)
 {
     //There is one built-in group: Domain Users group
     return (uint)attributes["memberOf"].Count + 1;
 }
예제 #12
0
        public static uint[] GetGroupIds(SearchResultAttributeCollection attributes, string domainName, NetworkCredential cred)
        {
            LdapConnection connection = new LdapConnection(domainName);
            connection.Credential = cred;
            int groupCount = attributes["memberOf"].Count + 1;
            uint[] rid = new uint[groupCount];

            //Fix me
            //The built-in groupmembership Domain Users Rid = 513
            rid[0] = 513;
            for (int i = 1; i < groupCount; i++)
            {
                string dn = GetDomainDnFromDomainName(domainName);
                string targetOu = "cn=Users," + dn;
                string[] filter = attributes["memberOf"][i - 1].ToString().Split(',');
                SearchRequest searchRequest = new SearchRequest(targetOu, filter[0], SearchScope.Subtree, "objectSid");
                SearchResponse searchResponse = (SearchResponse)connection.SendRequest(searchRequest);
                if (searchResponse.Entries.Count > 1)
                {
                    throw new Exception("There are more than one entries with the same groupName.");
                }
                SearchResultAttributeCollection groupAttributes = searchResponse.Entries[0].Attributes;
                string[] tmp = GetobjectSid(groupAttributes).Split('-');
                rid[i] = Convert.ToUInt32(tmp[tmp.Length - 1]);
            }

            return rid;
        }
예제 #13
0
		internal SearchResultEntry (SearchResultAttributeCollection attributes, DirectoryControl [] controls, string distinguishedName)
		{
			Attributes = attributes;
			Controls = controls;
			DistinguishedName = distinguishedName;
		}
예제 #14
0
 internal SearchResultEntry(SearchResultAttributeCollection attributes, DirectoryControl [] controls, string distinguishedName)
 {
     Attributes        = attributes;
     Controls          = controls;
     DistinguishedName = distinguishedName;
 }
예제 #15
0
		internal SearchResultEntry(string dn)
		{
			this.attributes = new SearchResultAttributeCollection();
			this.distinguishedName = dn;
		}
예제 #16
0
 internal SearchResultEntry(string dn)
 {
     this.attributes        = new SearchResultAttributeCollection();
     this.distinguishedName = dn;
 }
예제 #17
0
		private SearchResultAttributeCollection AttributesHelper()
		{
			SearchResultAttributeCollection searchResultAttributeCollection = new SearchResultAttributeCollection();
			XmlNodeList xmlNodeLists = this.dsmlNode.SelectNodes("dsml:attr", this.dsmlNS);
			if (xmlNodeLists.Count != 0)
			{
				foreach (XmlNode xmlNodes in xmlNodeLists)
				{
					DirectoryAttribute directoryAttribute = new DirectoryAttribute((XmlElement)xmlNodes);
					searchResultAttributeCollection.Add(directoryAttribute.Name, directoryAttribute);
				}
			}
			return searchResultAttributeCollection;
		}
예제 #18
0
        private SearchResultAttributeCollection AttributesHelper()
        {
            SearchResultAttributeCollection attributes = new SearchResultAttributeCollection();

            XmlNodeList nodeList = _dsmlNode.SelectNodes("dsml:attr", _dsmlNS);

            if (nodeList.Count != 0)
            {
                foreach (XmlNode node in nodeList)
                {
                    Debug.Assert(node is XmlElement);

                    DirectoryAttribute attribute = new DirectoryAttribute((XmlElement)node);
                    attributes.Add(attribute.Name, attribute);
                }
            }

            return attributes;
        }
예제 #19
0
 internal SearchResultEntry(string dn, SearchResultAttributeCollection attrs)
 {
     _distinguishedName = dn;
     _attributes = attrs;
 }