J
junk1
I have got a propritry user directory based on DB2 which I am trying to
expose to LDAP - ie I want LDAP clients to be able to look up (simple)
user and group information directly from my DB2 tables.
I have got a simple test class which listens on the LDAP port and
displays the bytes that come in.(using ServerSocket ssock = new
ServerSocket(389) etc).
Inially what I got when I tried a dummy LDAP connection was garbage
until I read that I would need to use Apache commons to convert these
bytes to something meaningful. Unfortunatly what I now get out is
this...
[3, 0, 8, 4, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 1, 0, 1, 6, 0, 8, 4, 0,
0, 0, 0, 0, 0, 0, 7, 0, 2, 0, 1, 0, 3, 0, 4, 0, 0, 8, 0, 0, 0, 3, 0, 8,
4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 2, 0, 1, 0, 2, 4, 2, 0, 0]
....how do I get the input into something meaninful like the actual LDAP
query (ie (&(uid=dbevan) (o=jlp)))?
Heres the code so far...
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import org.apache.commons.codec.binary.Hex;
public class tcpserver
{
public static void main(String args[]) throws Exception
{
String message;
String messageout;
ServerSocket ssock = new ServerSocket(389);
while(true)
{
Socket connsock = ssock.accept();
InputStreamReader instr =
new InputStreamReader(connsock.getInputStream());
DataOutputStream outstr =
new DataOutputStream(connsock.getOutputStream());
BufferedReader innet = new BufferedReader(instr);
message = innet.readLine();
char charArray[] = Hex.encodeHex(message.getBytes());
messageout = message.toUpperCase() + "\n";
System.out.println("SERVER:- " + messageout);
outstr.writeBytes(messageout);
}
}
}
Thanks
David Bevan
http://www.davidbevan.co.uk
expose to LDAP - ie I want LDAP clients to be able to look up (simple)
user and group information directly from my DB2 tables.
I have got a simple test class which listens on the LDAP port and
displays the bytes that come in.(using ServerSocket ssock = new
ServerSocket(389) etc).
Inially what I got when I tried a dummy LDAP connection was garbage
until I read that I would need to use Apache commons to convert these
bytes to something meaningful. Unfortunatly what I now get out is
this...
[3, 0, 8, 4, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 1, 0, 1, 6, 0, 8, 4, 0,
0, 0, 0, 0, 0, 0, 7, 0, 2, 0, 1, 0, 3, 0, 4, 0, 0, 8, 0, 0, 0, 3, 0, 8,
4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 2, 0, 1, 0, 2, 4, 2, 0, 0]
....how do I get the input into something meaninful like the actual LDAP
query (ie (&(uid=dbevan) (o=jlp)))?
Heres the code so far...
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import org.apache.commons.codec.binary.Hex;
public class tcpserver
{
public static void main(String args[]) throws Exception
{
String message;
String messageout;
ServerSocket ssock = new ServerSocket(389);
while(true)
{
Socket connsock = ssock.accept();
InputStreamReader instr =
new InputStreamReader(connsock.getInputStream());
DataOutputStream outstr =
new DataOutputStream(connsock.getOutputStream());
BufferedReader innet = new BufferedReader(instr);
message = innet.readLine();
char charArray[] = Hex.encodeHex(message.getBytes());
messageout = message.toUpperCase() + "\n";
System.out.println("SERVER:- " + messageout);
outstr.writeBytes(messageout);
}
}
}
Thanks
David Bevan
http://www.davidbevan.co.uk