Exemplo n.º 1
0
        public void Stuff()
        {
            string myLDAPPath = "ldap://ldap.toshok.org";

            try {
                Mono.Directory.LDAP.LDAP ld = new Mono.Directory.LDAP.LDAP(myLDAPPath);
                LDAPMessage res, entry;
                string[]    attrs = { "+", null };

                /* don't bind, we do this anonymously */

                ld.Search("" /* root dse */,
                          SearchScope.Base,
                          "(objectclass=*)",
                          attrs, false,
                          TimeSpan.FromSeconds(10), 0 /* no size limit */,
                          out res);

                if (res == null)
                {
                    Console.WriteLine("the search failed");
                }

                Console.WriteLine("There are {0} entries", res.CountEntries());

                entry = res.FirstEntry();
                if (entry == null)
                {
                    Console.WriteLine("null returned from res.FirstEntry");
                }

                string[] extensions = entry.GetValues("supportedExtension");

                if (extensions != null)
                {
                    foreach (String e in extensions)
                    {
                        Console.WriteLine("Supported Extension: {0}\n", e);
                    }
                }
                else
                {
                    Console.WriteLine("null returned from entry.GetValues\n");
                }
            }
            catch (Exception e) {
                Console.WriteLine("The '" + myLDAPPath + "' path not found.");
                Console.WriteLine("Exception : " + e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }
Exemplo n.º 2
0
		public void Stuff() 
		{
			string myLDAPPath = "ldap://ldap.toshok.org";
			string username = "******", passwd = "evotest";
			try {
				Mono.Directory.LDAP.LDAP ld = new Mono.Directory.LDAP.LDAP (myLDAPPath);

				ld.BindSimple (username, passwd);

				Console.WriteLine("Successfully bound {0} at {1}", username, myLDAPPath);
			}
			catch(Exception e) {
				Console.WriteLine("The '" + myLDAPPath + "' path not found.");
				Console.WriteLine("Exception : " + e.Message);
			}
		}
Exemplo n.º 3
0
        public void Stuff()
        {
            string myLDAPPath = "ldap://ldap.toshok.org";
            string username = "******", passwd = "evotest";

            try {
                Mono.Directory.LDAP.LDAP ld = new Mono.Directory.LDAP.LDAP(myLDAPPath);

                ld.BindSimple(username, passwd);

                Console.WriteLine("Successfully bound {0} at {1}", username, myLDAPPath);
            }
            catch (Exception e) {
                Console.WriteLine("The '" + myLDAPPath + "' path not found.");
                Console.WriteLine("Exception : " + e.Message);
            }
        }
Exemplo n.º 4
0
		public void Stuff() 
		{
			string myLDAPPath = "ldap://ldap.toshok.org";
			try {
				Mono.Directory.LDAP.LDAP ld = new Mono.Directory.LDAP.LDAP (myLDAPPath);
				LDAPMessage res, entry;
				string[] attrs = { "+", null };

				/* don't bind, we do this anonymously */

				ld.Search ("" /* root dse */,
					   SearchScope.Base,
					   "(objectclass=*)",
					   attrs, false,
					   TimeSpan.FromSeconds(10), 0 /* no size limit */,
					   out res);

				if (res == null) {
				  Console.WriteLine ("the search failed");
				}

				Console.WriteLine ("There are {0} entries", res.CountEntries());

				entry = res.FirstEntry();
				if (entry == null)
				  Console.WriteLine ("null returned from res.FirstEntry");

				string[] extensions = entry.GetValues ("supportedExtension");

				if (extensions != null) {
				  foreach( String e in extensions )
				    Console.WriteLine ("Supported Extension: {0}\n", e);
				}
				else {
					Console.WriteLine ("null returned from entry.GetValues\n");
				}
			}
			catch(Exception e) {
				Console.WriteLine("The '" + myLDAPPath + "' path not found.");
				Console.WriteLine("Exception : " + e.Message);
				Console.WriteLine(e.StackTrace);
			}
		}
Exemplo n.º 5
0
	  	internal LDAPMessage(LDAP ld, IntPtr ldm) {
			this.ld = ld;
			this.ldm = ldm;
		}
Exemplo n.º 6
0
 internal LDAPMessage(LDAP ld, IntPtr ldm)
 {
     this.ld  = ld;
     this.ldm = ldm;
 }