From: Guus Sliepen Date: Tue, 3 Jul 2018 18:21:40 +0000 (+0200) Subject: Pass appname in the ID string. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=2bd4182c4d960596b54793027a0f42e991eb12dd;p=meshlink Pass appname in the ID string. This is completely ignored by MeshLink itself at the moment, but is just a hint to any proxy/relay. --- diff --git a/src/meshlink.c b/src/meshlink.c index 9a0e914a..fd9b8827 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -1048,6 +1048,12 @@ meshlink_handle_t *meshlink_open(const char *confbase, const char *name, const c return NULL; } + if(strchr(appname, ' ')) { + logger(NULL, MESHLINK_ERROR, "Invalid appname given!\n"); + meshlink_errno = MESHLINK_EINVAL; + return NULL; + } + if(!name || !*name) { logger(NULL, MESHLINK_ERROR, "No name given!\n"); //return NULL; diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 4ba3ebe4..b43003e3 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -151,7 +151,7 @@ bool send_id(meshlink_handle_t *mesh, connection_t *c) { return false; } - return send_request(mesh, c, "%d %s %d.%d", ID, mesh->self->connection->name, mesh->self->connection->protocol_major, minor); + return send_request(mesh, c, "%d %s %d.%d %s", ID, mesh->self->connection->name, mesh->self->connection->protocol_major, minor, mesh->appname); } static bool finalize_invitation(meshlink_handle_t *mesh, connection_t *c, const void *data, uint16_t len) {