From: Guus Sliepen Date: Sun, 9 Jul 2017 14:12:55 +0000 (+0200) Subject: Store the invitation data after a succesful join. X-Git-Tag: release-1.1pre15~11 X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=acefa66dbd97617d86dee270b2b95ecdb763434b Store the invitation data after a succesful join. This can be used by the invitee to examine the file after a join, and process it in different ways than the tinc CLI does. --- diff --git a/doc/tinc.conf.5.in b/doc/tinc.conf.5.in index 22b01d20..8b67527a 100644 --- a/doc/tinc.conf.5.in +++ b/doc/tinc.conf.5.in @@ -781,6 +781,10 @@ It can be used to set up the corresponding network interface. If an executable file with this name exists, it will be executed right before the tinc daemon is going to close its connection to the virtual network device. +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /invitations/ +This directory contains outstanding invitations. +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /invitation-data +After a succesful join, this file contains a copy of the invitation data received. .El .Sh SEE ALSO .Xr tincd 8 , diff --git a/src/invitation.c b/src/invitation.c index ac410b81..b10151f0 100644 --- a/src/invitation.c +++ b/src/invitation.c @@ -607,6 +607,15 @@ make_names: return false; } + snprintf(filename, sizeof filename, "%s" SLASH "invitation-data", confbase); + FILE *finv = fopen(filename, "w"); + if(!finv || fwrite(data, datalen, 1, finv) != 1) { + fprintf(stderr, "Could not create file %s: %s\n", filename, strerror(errno)); + fclose(finv); + return false; + } + fclose(finv); + snprintf(filename, sizeof filename, "%s" SLASH "tinc-up.invitation", confbase); FILE *fup = fopen(filename, "w"); if(!fup) {