diff options
author | Simon Rettberg | 2017-04-21 15:03:25 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-04-21 15:03:25 +0200 |
commit | c0124a9bc626734694ff320c3a94c7076ca26e0c (patch) | |
tree | 1c2fa526e7562a8092ffbda97cb33b2eeb493d8f | |
parent | Fix indentation (diff) | |
download | ldadp-c0124a9bc626734694ff320c3a94c7076ca26e0c.tar.gz ldadp-c0124a9bc626734694ff320c3a94c7076ca26e0c.tar.xz ldadp-c0124a9bc626734694ff320c3a94c7076ca26e0c.zip |
Introduce lowercase homeattr, update server last activity properly
-rw-r--r-- | server.c | 8 | ||||
-rw-r--r-- | types.h | 1 |
2 files changed, 7 insertions, 2 deletions
@@ -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) { @@ -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; |