Changes in / [560129a:88de0c9]
Legend:
- Unmodified
- Added
- Removed
-
otr.c
r560129a r88de0c9 8 8 OTR support (cf. http://www.cypherpunks.ca/otr/) 9 9 10 2008,Sven Moritz Hallberg <pesco@khjk.org>11 (c) andfunded by stonedcoder.org10 (c) 2008-2010 Sven Moritz Hallberg <pesco@khjk.org> 11 (c) 2008 funded by stonedcoder.org 12 12 13 13 files used to store OTR data: … … 158 158 159 159 /* combined handler for the 'otr smp' and 'otr smpq' commands */ 160 void otr_ initiate_smp(irc_t *irc, const char *nick, const char *question,160 void otr_smp_or_smpq(irc_t *irc, const char *nick, const char *question, 161 161 const char *secret); 162 162 … … 738 738 void cmd_otr_smp(irc_t *irc, char **args) 739 739 { 740 otr_ initiate_smp(irc, args[1], NULL, args[2]); /* no question */740 otr_smp_or_smpq(irc, args[1], NULL, args[2]); /* no question */ 741 741 } 742 742 743 743 void cmd_otr_smpq(irc_t *irc, char **args) 744 744 { 745 otr_ initiate_smp(irc, args[1], args[2], args[3]);745 otr_smp_or_smpq(irc, args[1], args[2], args[3]); 746 746 } 747 747 … … 1074 1074 nextMsg = context->smstate->nextExpected; 1075 1075 1076 if (context->smstate->sm_prog_state == OTRL_SMP_PROG_CHEATED) { 1077 irc_usermsg(irc, "smp %s: opponent violated protocol, aborting", 1078 u->nick); 1079 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1080 otrl_sm_state_free(context->smstate); 1081 return; 1082 } 1083 1076 1084 tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1Q); 1077 1085 if (tlv) { … … 1082 1090 } else { 1083 1091 char *question = g_strndup((char *)tlv->data, tlv->len); 1084 irc_usermsg(irc, "smp: initiated by %s with question: \ "%s\"", u->nick,1092 irc_usermsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick, 1085 1093 question); 1086 1094 irc_usermsg(irc, "smp: respond with \x02otr smp %s <answer>\x02", … … 1122 1130 } else { 1123 1131 /* SMP3 received, otrl_message_receiving will have sent SMP4 and set fp trust */ 1124 const char *trust = context->active_fingerprint->trust; 1125 if(!trust || trust[0]=='\0') { 1126 irc_usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1132 /* as noted above, fp trust SHOULD have been set by libotr. 1133 * however at least version 3.2.0 seems to forget it when 1134 * responding to an smp session that was initiated with SMP1Q 1135 * (question and answer); other cases appear to work fine. 1136 * as a workaround, we explicitly set it below. 1137 */ 1138 if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { 1139 otrl_context_set_trust(context->active_fingerprint, "smp"); 1140 irc_usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1127 1141 u->nick); 1128 1142 } else { 1129 irc_usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1143 otrl_context_set_trust(context->active_fingerprint, ""); 1144 irc_usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1130 1145 u->nick); 1131 1146 } … … 1142 1157 } else { 1143 1158 /* SMP4 received, otrl_message_receiving will have set fp trust */ 1144 const char *trust = context->active_fingerprint->trust; 1145 if(!trust || trust[0]=='\0') { 1146 irc_usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1159 if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { 1160 irc_usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1147 1161 u->nick); 1148 1162 } else { 1149 irc_usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted",1163 irc_usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1150 1164 u->nick); 1151 1165 } … … 1163 1177 1164 1178 /* combined handler for the 'otr smp' and 'otr smpq' commands */ 1165 void otr_ initiate_smp(irc_t *irc, const char *nick, const char *question,1179 void otr_smp_or_smpq(irc_t *irc, const char *nick, const char *question, 1166 1180 const char *secret) 1167 1181 { … … 1194 1208 otrl_sm_state_free(ctx->smstate); 1195 1209 } 1196 1210 1197 1211 if(question) { 1198 1212 /* this was 'otr smpq', just initiate */
Note: See TracChangeset
for help on using the changeset viewer.