[OTR-dev] Username in query message (Enhancement #112)

mandragore mandragore at foss.ntua.gr
Thu Dec 10 08:12:33 EST 2015

Hello all,

While we were studying the libotr code and peeking through the project's
bugtracker we came across enhancement #112 [0].

With the attached patch we changed the correspnding code so that it will
optionally no longer contain any information about the senders username
in the query message.

The patch contains a change in the query message formatter, replacing
the username with "You have been requested to join". It also changes the
msg buffer's allocated size and removes the ourname variable from the
sprintf call. This changes apply if the ourname formal parameter is
passed a NULL value. Otherwise nothing changes and the original code is
executed unchanged.

Two formatters are now defined in the function
otrl_proto_default_query_msg, one for including the username and one for
omiting it. A pointer points to the appropriate formatter according to
the ourname value. Then memory for the msg buffer is allocated. If
ourname is not NULL nothing changes. If it is NULL then the memory
needed is the length of the formatter plus the version tag. We must
remove 2 bytes for the "%s" special symbol used in sprintf later and
then add 1 for the null character, which leaves a total of -1. After the
allocation of the needed memory we can simply call sprintf to actually
create the query message. Again by checking the if ourname has a valid
address we can decide if we should include it in the sprintf  call.

You can also find our patch in this github fork[1]

Kind regards,
Kostis Andrikopoulos
Dimitris Kolotouros

[0]: https://bugs.otr.im/issues/112
[1]: https://github.com/Mandragorian/libotr/tree/no_username
-------------- next part --------------
A non-text attachment was scrubbed...
Name: no_username.patch
Type: text/x-patch
Size: 2701 bytes
Desc: not available
URL: <http://lists.cypherpunks.ca/pipermail/otr-dev/attachments/20151210/ab107ecd/attachment.bin>

More information about the OTR-dev mailing list