]> tinc-vpn.org Git - tinc/commitdiff
Store the invitation data after a succesful join.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 9 Jul 2017 14:12:55 +0000 (16:12 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 9 Jul 2017 14:12:55 +0000 (16:12 +0200)
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.

doc/tinc.conf.5.in
src/invitation.c

index 22b01d20cab4fcf11d5122cecffe6f74ebc73922..8b67527a185aaa12baf19efcf1f6f52934391270 100644 (file)
@@ -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 ,
index ac410b8143f3eee66bf6303e047f4de9752fad74..b10151f0479faf46233f3fb4dc529e3fabf042cd 100644 (file)
@@ -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) {