48 |
* |
* |
49 |
* @file |
* @file |
50 |
*/ |
*/ |
51 |
int check_ldap3(Port_T p) { |
int check_ldap3(Socket_T s) { |
52 |
|
|
53 |
unsigned char buf[STRLEN]; |
unsigned char buf[STRLEN]; |
54 |
|
|
114 |
|
|
115 |
}; |
}; |
116 |
|
|
117 |
ASSERT(p); |
ASSERT(s); |
118 |
|
|
119 |
|
|
120 |
if(port_send(p, (unsigned char *)request, sizeof(request), 0) < 0) { |
if(socket_write(s, (unsigned char *)request, sizeof(request)) < 0) { |
121 |
log("LDAP: error sending data -- %s\n", STRERROR); |
log("LDAP: error sending data -- %s\n", STRERROR); |
122 |
return FALSE; |
return FALSE; |
123 |
} |
} |
124 |
|
|
125 |
if(port_recv(p, (unsigned char *)buf, sizeof(buf), 0) <= 0) { |
if(socket_read(s, (unsigned char *)buf, sizeof(buf)) <= 0) { |
126 |
log("LDAP: error receiving data -- %s\n", STRERROR); |
log("LDAP: error receiving data -- %s\n", STRERROR); |
127 |
return FALSE; |
return FALSE; |
128 |
} |
} |
129 |
|
|
130 |
if(strncmp((unsigned char *)buf, (unsigned char *)response, sizeof(response))) { |
if(strncmp((unsigned char *)buf, |
131 |
|
(unsigned char *)response, |
132 |
|
sizeof(response))) { |
133 |
log("LDAP: anonymous bind failed\n"); |
log("LDAP: anonymous bind failed\n"); |
134 |
return FALSE; |
return FALSE; |
135 |
} |
} |
136 |
|
|
137 |
if(port_send(p, (unsigned char *)unbind, sizeof(unbind), 0) < 0) { |
if(socket_write(s, (unsigned char *)unbind, sizeof(unbind)) < 0) { |
138 |
log("LDAP: error sending data -- %s\n", STRERROR); |
log("LDAP: error sending data -- %s\n", STRERROR); |
139 |
return FALSE; |
return FALSE; |
140 |
} |
} |
141 |
|
|
|
|
|
142 |
return TRUE; |
return TRUE; |
143 |
|
|
144 |
} |
} |