anchor.diff:  	    logger:log(error, "LDAP client: Unknown result from ldapsearch_unsafe (handle ~p, query ~p ~p) :~n~p",
   		       [Handle, Type, In, Unknown]),
   	    error
  -    end.
  +    end;
  +exec_ldapsearch(Mode, Handle, [Type, In, Attribute]) ->
  +    logger:log(error, "LDAP client: Returning 'error' on query ~p ~p because handle '~p' is not valid", [Type, In, Handle]),
  +    error.
   
   get_valuelist([], Attribute) ->
       [];
  
positive.code: 		H when record(H, ldaphandle) ->
  		    logger:log(debug, "LDAP client: Opened new connection to server ~s", [Server]),
  		    {noreply, State#state{handle=H, querycount=0}, ?TIMEOUT};
  		{'EXIT', E} ->
  		    logger:log(error, "LDAP client: Could not reconnect to LDAP server ~p : ~p", [Server, E]),
  		    %% Keep using old handle in hope that it is still working.
  		    {noreply, State, ?TIMEOUT};
  		Unknown ->
  		    logger:log(error, "LDAP client: Could not reconnect to LDAP server ~p, unknown " ++
  			       "result from ldap_connect :~n~p", [Server, Unknown]),
  		    %% Keep using old handle in hope that it is still working.
  		    {noreply, State, ?TIMEOUT}
  	    end;
  
negative.code:     case exec_ldapsearch(Mode, Handle, Args) of
  	error ->
  	    logger:log(error, "LDAP client: Error returned from exec_ldapsearch (~p), " ++
  		       "closing LDAP handle '~p', opening new handle and retrying query", [Mode, Handle]),
  	    ldap_close(Handle),
  	    case catch ldap_connect(Server) of
  		NewHandle when record(NewHandle, ldaphandle) ->
  		    logger:log(debug, "LDAP client: Retrying query using new LDAP handle ~p", [NewHandle]),
  		    %% New handle returned, retry query and return new handle plus result of retry
  		    Res = exec_ldapsearch(Mode, NewHandle, Args),
  		    {NewHandle, Res};
  		Unknown ->
  		    logger:log(error, "LDAP client: Could not connect to LDAP server ~p, ldap_connect() returned ~p",
  			       [Server, Unknown]),
  		    %% This is bad. We have closed our old handle and could not get a new one...
  		    {error, error}
  	    end;
  	Res ->
  	    {Handle, Res}
  