mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
LDAP: dump BER content on error
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1624 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
35acd60fcc
commit
9efe8160a5
@ -30,9 +30,7 @@ import davmail.exchange.ExchangeSessionFactory;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.*;
|
||||
@ -471,8 +469,8 @@ public class LdapConnection extends AbstractConnection {
|
||||
}
|
||||
|
||||
DavGatewayTray.switchIcon();
|
||||
//Ber.dumpBER(System.out, "request\n", inbuf, 0, offset);
|
||||
handleRequest(new BerDecoder(inbuf, 0, offset));
|
||||
|
||||
handleRequest(inbuf, offset);
|
||||
}
|
||||
|
||||
} catch (SocketException e) {
|
||||
@ -492,7 +490,8 @@ public class LdapConnection extends AbstractConnection {
|
||||
DavGatewayTray.resetIcon();
|
||||
}
|
||||
|
||||
protected void handleRequest(BerDecoder reqBer) throws IOException {
|
||||
protected void handleRequest(byte[] inbuf, int offset) throws IOException {
|
||||
BerDecoder reqBer = new BerDecoder(inbuf, 0, offset);
|
||||
int currentMessageId = 0;
|
||||
try {
|
||||
reqBer.parseSeq(null);
|
||||
@ -577,6 +576,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
sendClient(currentMessageId, LDAP_REP_RESULT, LDAP_OTHER, "Unsupported operation");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
dumpBer(inbuf, offset);
|
||||
try {
|
||||
sendErr(currentMessageId, LDAP_REP_RESULT, e);
|
||||
} catch (IOException e2) {
|
||||
@ -586,6 +586,17 @@ public class LdapConnection extends AbstractConnection {
|
||||
}
|
||||
}
|
||||
|
||||
protected void dumpBer(byte[] inbuf, int offset) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
Ber.dumpBER(baos, "LDAP request buffer\n", inbuf, 0, offset);
|
||||
try {
|
||||
LOGGER.debug(new String(baos.toByteArray(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// should not happen
|
||||
LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected LdapFilter parseFilter(BerDecoder reqBer) throws IOException {
|
||||
LdapFilter ldapFilter;
|
||||
if (reqBer.peekByte() == LDAP_FILTER_PRESENT) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user