summaryrefslogtreecommitdiffstats
path: root/proxy.c
diff options
context:
space:
mode:
authorSimon Rettberg2017-04-21 15:05:31 +0200
committerSimon Rettberg2017-04-21 15:05:31 +0200
commitf2a9749f281f9460aae5c41e2aa1b2aa878a62b1 (patch)
tree8dc85e3b8371542d12bc6c5b6c8da266dc58c4e6 /proxy.c
parentclient.c: Shutdown SSL connection if peer requests so (diff)
downloadldadp-f2a9749f281f9460aae5c41e2aa1b2aa878a62b1.tar.gz
ldadp-f2a9749f281f9460aae5c41e2aa1b2aa878a62b1.tar.xz
ldadp-f2a9749f281f9460aae5c41e2aa1b2aa878a62b1.zip
proxy.c: Minor bug fixes
- Shutdown connection on UnbindRequest - Skip over SearchResultReference replies from server instead of aborting - Make use of lowercase homeAttr when matching attribute to get case insensitive matching
Diffstat (limited to 'proxy.c')
-rw-r--r--proxy.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/proxy.c b/proxy.c
index dc11d26..07c1b61 100644
--- a/proxy.c
+++ b/proxy.c
@@ -168,6 +168,12 @@ BOOL proxy_fromClient(epoll_client_t *client, const size_t maxLen)
case SearchRequest:
return proxy_clientSearchRequest(client, messageId, res, maxLen);
case UnbindRequest:
+ client->kill = TRUE;
+ if (client->ssl) {
+ SSL_shutdown(client->ssl);
+ } else {
+ shutdown(client->fd, SHUT_RDWR);
+ }
return TRUE;
}
return TRUE;
@@ -200,6 +206,19 @@ void proxy_removeServer(epoll_server_t * const server)
}
}
+//void hexdump(epoll_server_t *server, const size_t start, const size_t maxLen)
+//{
+// for (size_t i = start; i < maxLen; ++i) {
+// const uint8_t c = server->readBuffer[i];
+// if (c >= 32 && c <= 126) {
+// putchar(c);
+// } else {
+// printf("[%X]", (int)c);
+// }
+// }
+// putchar('\n');
+//}
+
BOOL proxy_fromServer(epoll_server_t *server, const size_t maxLen)
{
unsigned long messageId, op;
@@ -215,6 +234,10 @@ BOOL proxy_fromServer(epoll_server_t *server, const size_t maxLen)
case SearchResultEntry:
case SearchResultDone:
return proxy_serverSearchResult(server, messageId, op, res, maxLen);
+ case SearchResultReference:
+ // Just ignore these for now
+ //scan_ldapstring(server->readBuffer + res,const char* max,struct string* s);
+ return TRUE;
}
printf("Unsupported op: %lu\n", op);
return FALSE;
@@ -452,7 +475,7 @@ static BOOL request_replaceAttribute(server_t *server, struct string *attribute,
fixUnNumeric(value);
////// ###################
} else if (iequals(attribute, &s_homemount)) {
- if (server->homeAttr.s == NULL) {
+ if (server->homeAttrLower.s == NULL) {
*attribute = s_homeDirectory;
} else {
*attribute = server->homeAttr;
@@ -592,8 +615,8 @@ static void response_replacePal(server_t *server, struct PartialAttributeList **
elifDEL(mail);
elifDELATTR(cn, cn);
elifDEL(memberof);
- else if ( (server->homeAttr.s == NULL && iequals(&(*pal)->type, &s_homedirectory))
- || (server->homeAttr.s != NULL && iequals(&(*pal)->type, &server->homeAttr)) ) {
+ else if ( (server->homeAttrLower.s == NULL && iequals(&(*pal)->type, &s_homedirectory))
+ || (server->homeAttrLower.s != NULL && iequals(&(*pal)->type, &server->homeAttrLower)) ) {
// homeDirectory is set in AD - it can either be a local path (in which case it's useless)
// or a UNC path, which we can easily mount via mount.cifs
if (!response_filterHomeDir(*pal)) {