title: Use ldapjs with promise
body: <p>I want to convert the following code to use promise. It is working and output a user's attributes within the active directory.</p>
  
  <pre><code>var client = ldap.createClient({
    url: ldap_url
  });
  
  client.bind(ldap_username, ldap_password, function (err) {
      client.search(ldap_dn_search, opts, function (err, search) {
          search.on('searchEntry', function (entry) {
            var user = entry.object;
            // It is working!!!. It outputs all user attributes.
            console.log(user);
          });
  
      });
  }); 
  </code></pre>
  
  <p>The following is my attempt, butit doesn't output anything.</p>
  
  <pre><code>var Promise = require('promise');
  var client_bind = Promise.denodeify(client.bind);
  var client_search = Promise.denodeify(client.search);
  
  client_bind(ldap_username, ldap_password)
  .then(function(err){
    client_search(ldap_dn_search, opts)
      .then(function(search){
        var search_on = Promise.denodeify(search.on);
        search_on('searchEntry')
          .then(function(entry){
            var user = entry.object;
  
            // It doesn't output anything !!!
            console.log(user);
          });
        });
  
      });
  </code></pre>