Index: src/main/java/com/xpn/xwiki/plugin/ldap/XWikiLDAPUtils.java
===================================================================
--- src/main/java/com/xpn/xwiki/plugin/ldap/XWikiLDAPUtils.java (revision 9836)
+++ src/main/java/com/xpn/xwiki/plugin/ldap/XWikiLDAPUtils.java (working copy)
@@ -21,6 +21,7 @@

 package com.xpn.xwiki.plugin.ldap;

+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -68,6 +69,11 @@
     private static final String LDAP_OBJECTCLASS = "objectClass";

     /**
+     * LDAP dn parameter.
+     */
+    private static final String LDAP_DN = "dn";
+
+    /**
      * The name of the LDAP groups cache.
      */
     private static final String CACHE_NAME_GROUPS = "groups";
@@ -93,6 +99,7 @@
     private String uidAttributeName = LDAP_DEFAULT_UID;

     static {
+        LDAP_GROUP_CLASS.add("posixGroup".toLowerCase());
         LDAP_GROUP_CLASS.add("group".toLowerCase());
         LDAP_GROUP_CLASS.add("groupOfNames".toLowerCase());
         LDAP_GROUP_CLASS.add("groupOfUniqueNames".toLowerCase());
@@ -100,6 +107,7 @@
         LDAP_GROUP_CLASS.add("dynamicGroupAux".toLowerCase());
         LDAP_GROUP_CLASS.add("groupWiseDistributionList".toLowerCase());

+        LDAP_GROUP_MEMBER.add("memberUid".toLowerCase());
         LDAP_GROUP_MEMBER.add("member".toLowerCase());
         LDAP_GROUP_MEMBER.add("uniqueMember".toLowerCase());
     }
@@ -279,6 +287,46 @@
     }

     /**
+     * Get dn from user id.
+     *
+     * @param userId the short user id
+     * @param context the XWiki context.
+     * @return the user dn, null if not found
+     */
+    public String getUserDN(String userId, XWikiContext context)
+    {
+        XWikiLDAPConfig config = XWikiLDAPConfig.getInstance();
+
+        // search for the user in LDAP
+        String query =
+            MessageFormat.format("({0}={1})",
+                new Object[] {getUidAttributeName(), userId});
+
+        String baseDN = config.getLDAPParam("ldap_base_DN", "", context);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Searching for the user in LDAP: user:" + userId
+                + " base:" + baseDN + " query:" + query + " uid:" + getUidAttributeName());
+        }
+
+        String[] attributeNameTable = {LDAP_DN};
+
+        List searchAttributes = null;
+
+        searchAttributes = getConnection().searchLDAP(baseDN, query, attributeNameTable,
+            LDAPConnection.SCOPE_SUB);
+
+        for (Iterator it = searchAttributes.iterator(); it.hasNext();) {
+            XWikiLDAPSearchAttribute searchAttribute = (XWikiLDAPSearchAttribute) it.next();
+
+            if (LDAP_DN.equals(searchAttribute.name)) {
+                return searchAttribute.value;
+            }
+        }
+        return null;
+    }
+
+    /**
      * Get all members of a given group based on the groupDN. If the group contains subgroups get
      * these members as well. Retrieve an identifier for each member.
      *
@@ -300,6 +348,28 @@

         List searchAttributeList = searchGroupsMembers(groupDN);

+        // Convert short userId in full dn
+        // There should be a config option to enable this code
+        // It is useful when your ldap groups doesn't contain full dn
+        for (Iterator searchAttributeIt = searchAttributeList.iterator(); searchAttributeIt
+            .hasNext();) {
+            XWikiLDAPSearchAttribute searchAttribute =
+                (XWikiLDAPSearchAttribute) searchAttributeIt.next();
+
+            String key = searchAttribute.name;
+            if (LDAP_GROUP_MEMBER.contains(key.toLowerCase())) {
+
+                String userId = searchAttribute.value;
+
+                // Replace the userid by the dn
+                searchAttribute.value = getUserDN(userId, context);
+
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Found user id : " + userId + " in dn : " + searchAttribute.value);
+                }
+            }
+        }
+
         if (searchAttributeList != null) {
             isGroup =
                 getGroupMembers(groupDN, memberMap, subgroups, searchAttributeList, context);
