summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2017-04-21 15:03:25 +0200
committerSimon Rettberg2017-04-21 15:03:25 +0200
commitc0124a9bc626734694ff320c3a94c7076ca26e0c (patch)
tree1c2fa526e7562a8092ffbda97cb33b2eeb493d8f
parentFix indentation (diff)
downloadldadp-c0124a9bc626734694ff320c3a94c7076ca26e0c.tar.gz
ldadp-c0124a9bc626734694ff320c3a94c7076ca26e0c.tar.xz
ldadp-c0124a9bc626734694ff320c3a94c7076ca26e0c.zip
Introduce lowercase homeattr, update server last activity properly
-rw-r--r--server.c8
-rw-r--r--types.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/server.c b/server.c
index 13d72c8..22f6085 100644
--- a/server.c
+++ b/server.c
@@ -127,12 +127,15 @@ void server_setHomeAttribute(const char *server, const char *homeattribute)
server_t *entry = server_create(server);
if (entry == NULL || entry->sslContext != NULL) return;
free((void*)entry->homeAttr.s);
+ free((void*)entry->homeAttrLower.s);
entry->homeAttr.l = strlen(homeattribute);
+ entry->homeAttrLower.l = entry->homeAttr.l;
+ entry->homeAttr.s = strdup(homeattribute);
char *tmp = strdup(homeattribute);
- for (size_t i = 0; i < entry->homeAttr.l; ++i) {
+ for (size_t i = 0; i < entry->homeAttrLower.l; ++i) {
tmp[i] = tolower(tmp[i]);
}
- entry->homeAttr.s = tmp;
+ entry->homeAttrLower.s = tmp;
}
void server_setFingerprint(const char *server, const char *fingerprint)
@@ -440,6 +443,7 @@ BOOL server_send(epoll_server_t *server, const char *buffer, size_t len, const B
server->kill = TRUE;
return FALSE;
}
+ server->lastActive = time(NULL);
if (ret == (int)len) return TRUE;
// Couldn't send everything, continue with buffering logic below
if (ret > 0) {
diff --git a/types.h b/types.h
index 16cf964..57f790f 100644
--- a/types.h
+++ b/types.h
@@ -106,6 +106,7 @@ struct _server_t_ {
char sid[SIDLEN];
char homeTemplate[MOUNTLEN];
struct string homeAttr;
+ struct string homeAttrLower;
unsigned char fingerprint[FINGERPRINTLEN];
char cabundle[MAXPATH];
BOOL plainLdap;