00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021
00022 #include <stdio.h>
00023 #include <errno.h>
00024
00025 #ifdef HAVE_STRING_H
00026 #include <string.h>
00027 #endif
00028
00029 #include "protocol.h"
00030
00051 int check_ldap3(Port_T p) {
00052
00053 unsigned char buf[STRLEN];
00054
00055 unsigned char request[14] = {
00056 0x30,
00057 0x0c,
00059 0x02,
00060 0x01,
00061 0x00,
00063 0x60,
00064 0x07,
00066 0x02,
00067 0x01,
00068 0x03,
00070 0x04,
00071 0x00,
00072
00074 0x80,
00075 0x00
00076
00077 };
00078
00079 unsigned char response[14] = {
00080 0x30,
00081 0x0c,
00083 0x02,
00084 0x01,
00085 0x00,
00087 0x61,
00088 0x07,
00090 0x0a,
00091 0x01,
00092 0x00,
00094 0x04,
00095 0x00,
00096
00098 0x04,
00099 0x00
00100
00101 };
00102
00103 ASSERT(p);
00104
00105
00106 if(port_send(p, (unsigned char *)request, sizeof(request), 0) < 0) {
00107 log("LDAP: error sending data -- %s\n", STRERROR);
00108 return FALSE;
00109 }
00110
00111 if(port_recv(p, (unsigned char *)buf, sizeof(buf), 0) <= 0) {
00112 log("LDAP: error receiving data -- %s\n", STRERROR);
00113 return FALSE;
00114 }
00115
00116 if(strncmp((unsigned char *)buf, (unsigned char *)response, sizeof(response))) {
00117 log("LDAP: anonymous bind failed\n");
00118 return FALSE;
00119 }
00120
00121
00122 return TRUE;
00123
00124 }
00125