|
|
|
@ -82,7 +82,7 @@ void MyMesh::putNeighbour(const mesh::Identity &id, uint32_t timestamp, float sn |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secret, uint32_t sender_timestamp, const uint8_t* data) { |
|
|
|
uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secret, uint32_t sender_timestamp, const uint8_t* data, bool is_flood) { |
|
|
|
ClientInfo* client = NULL; |
|
|
|
if (data[0] == 0) { // blank password, just check if sender is in ACL
|
|
|
|
client = acl.getClient(sender.pub_key, PUB_KEY_SIZE); |
|
|
|
@ -123,6 +123,10 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (is_flood) { |
|
|
|
client->out_path_len = -1; // need to rediscover out_path
|
|
|
|
} |
|
|
|
|
|
|
|
uint32_t now = getRTCClock()->getCurrentTimeUnique(); |
|
|
|
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
|
|
|
|
reply_data[4] = RESP_SERVER_LOGIN_OK; |
|
|
|
@ -438,7 +442,7 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m |
|
|
|
data[len] = 0; // ensure null terminator
|
|
|
|
uint8_t reply_len; |
|
|
|
if (data[4] == 0 || data[4] >= ' ') { // is password, ie. a login request
|
|
|
|
reply_len = handleLoginReq(sender, secret, timestamp, &data[4]); |
|
|
|
reply_len = handleLoginReq(sender, secret, timestamp, &data[4], packet->isRouteFlood()); |
|
|
|
//} else if (data[4] == ANON_REQ_TYPE_*) { // future type codes
|
|
|
|
// TODO
|
|
|
|
} else { |
|
|
|
|