Hi MCF community,

I have recently done a few modifications on 3 connectors to solve some clients issues, and I think that they might be useful for the community :

MCF JCIFS connector :
Some users may need to preserve the last access time of crawled files. This can be achieved thanks to a modification of the JCIFS lib that Google has already done :
https://github.com/googlegsa/filesystem.v3/tree/master/projects/jcifs
So I have modified the JCIFS connector to detect if the provided JCIFS Library implements the methods allowing to preserve the last access time of files and use them if the user wants to. Based on this, a new option has been added to the configuration UI to preserve or not the last access time (of course if the feature is not available, the option is disabled and prefixed by ‘[UNAVAILABLE]’)
Of course you can modify by your own any JCIFS release to add the required methods. You have to implement (along with the other involved modifications) the two methods ‘public long lastAccess()’ and ‘public void setLastAccess( long time )’ in the java class ‘jcifs.smb.SmbFile’ based on Google’s code : https://github.com/googlegsa/filesystem.v3/commit/3362a0e3802498ae98dab86753df663ef73a6c6c#diff-8be324616083b8a5d95af3b83ed62634
MCF Active Directory Authority Connector :
For debugging reasons or for people who work with ACL group names instead of SIDs (bad idea) or both, it might be useful that the Active Directory Authority Connector returns the group names. So I did some modifications to this connector to have the option in the configuration UI to return or not the group names in addition of the SIDs.
MCF JDBC Connector :
We recently had the bad surprise of a query serving to retrieve document’s data from an Oracle database, to fail after a certain amount of time when used with the JDBC connector. The reason was not obvious to find, but actually simple : The query was creating locks without ever releasing them, and when it was used massively in a single session, Oracle was raising an exception when the number of maximum locks was reached. Without any solution to release locks on query side, the only alternative was to re-init sessions on the JDBC connector side by closing and re-opening connections after each bunch of queries.
Again, I added the option in the configuration UI of the JDBC connector, to choose between keeping alive the connections in the connections pool or to close them and recreate new ones. Of course, when the last option is selected, the crawling performances are lowered so  it has to be wisely used.
   

You can find the 3 patches corresponding to these modifications as attachment pieces of this mail. They are based on the MCF 2.7-dev

Regards,
Julien Massiera
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus diff --git a/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java b/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
index cb570c2..9a97cb4 100644
--- a/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
+++ b/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
@@ -52,6 +52,7 @@ public class ActiveDirectoryAuthority extends org.apache.manifoldcf.authorities.
   private long responseLifetime = 60000L;
   private int LRUsize = 1000;
   private String ldapConnectionTimeout = null;
+  private boolean returnGroupsName = false;
 
   /** Session information for all DC's we talk with. */
   private Map<String,DCSessionInfo> sessionInfo = null;
@@ -146,6 +147,10 @@ public class ActiveDirectoryAuthority extends org.apache.manifoldcf.authorities.
     cacheLRUsize = params.getParameter(ActiveDirectoryConfig.PARAM_CACHELRUSIZE);
     if (cacheLRUsize == null)
       cacheLRUsize = "1000";    
+    
+    if(params.getParameter(ActiveDirectoryConfig.PARAM_ACLSGROUPSNAME) != null) {
+     returnGroupsName = params.getParameter(ActiveDirectoryConfig.PARAM_ACLSGROUPSNAME).equals("true");
+    }
   }
 
   protected static String deobfuscate(String input)
@@ -389,6 +394,10 @@ public class ActiveDirectoryAuthority extends org.apache.manifoldcf.authorities.
       //Specify the attributes to return
       String returnedAtts[]={"tokenGroups","objectSid"};
       searchCtls.setReturningAttributes(returnedAtts);
+      
+      // paceholder for an LDAP filter that will store SIDs of the groups the user belongs to
+      final StringBuffer groupsSearchFilter = new StringBuffer();
+      groupsSearchFilter.append("(|");
 
       //Search for tokens.  Since every user *must* have a SID, the "no user" detection should be safe.
       NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
@@ -407,14 +416,22 @@ public class ActiveDirectoryAuthority extends org.apache.manifoldcf.authorities.
         {
           try
           {
-            for (NamingEnumeration ae = attrs.getAll();ae.hasMore();)
-            {
-              Attribute attr = (Attribute)ae.next();
-              for (NamingEnumeration e = attr.getAll();e.hasMore();)
-              {
-                theGroups.add(sid2String((byte[])e.next()));
-              }
-            }
+          if (attrs.get("tokenGroups") != null) {
+ for (final NamingEnumeration ae = attrs.get("tokenGroups").getAll(); ae.hasMore();) {
+ final byte[] sid = (byte[]) ae.next();
+ theGroups.add(sid2String(sid));
+ if (returnGroupsName) {
+ groupsSearchFilter.append("(objectSid=" + sid2String(sid) + ")");
+ }
+ }
+ groupsSearchFilter.append(")");
+ }
+
+ if (attrs.get("objectSid") != null) {
+ for (final NamingEnumeration ae = attr
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB