Changes in / [88de0c9:560129a]
Legend:
- Unmodified
- Added
- Removed
-
otr.c
r88de0c9 r560129a 8 8 OTR support (cf. http://www.cypherpunks.ca/otr/) 9 9 10 (c) 2008-2010Sven Moritz Hallberg <pesco@khjk.org>11 (c) 2008funded by stonedcoder.org10 2008, Sven Moritz Hallberg <pesco@khjk.org> 11 (c) and 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_ smp_or_smpq(irc_t *irc, const char *nick, const char *question,160 void otr_initiate_smp(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_ smp_or_smpq(irc, args[1], NULL, args[2]); /* no question */740 otr_initiate_smp(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_ smp_or_smpq(irc, args[1], args[2], args[3]);745 otr_initiate_smp(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 1084 1076 tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1Q); 1085 1077 if (tlv) { … … 1090 1082 } else { 1091 1083 char *question = g_strndup((char *)tlv->data, tlv->len); 1092 irc_usermsg(irc, "smp: initiated by %s with question: \ x02\"%s\"\x02", u->nick,1084 irc_usermsg(irc, "smp: initiated by %s with question: \"%s\"", u->nick, 1093 1085 question); 1094 1086 irc_usermsg(irc, "smp: respond with \x02otr smp %s <answer>\x02", … … 1130 1122 } else { 1131 1123 /* SMP3 received, otrl_message_receiving will have sent SMP4 and set fp trust */ 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", 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", 1141 1127 u->nick); 1142 1128 } else { 1143 otrl_context_set_trust(context->active_fingerprint, ""); 1144 irc_usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1129 irc_usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1145 1130 u->nick); 1146 1131 } … … 1157 1142 } else { 1158 1143 /* SMP4 received, otrl_message_receiving will have set fp trust */ 1159 if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { 1160 irc_usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 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", 1161 1147 u->nick); 1162 1148 } else { 1163 irc_usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted",1149 irc_usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1164 1150 u->nick); 1165 1151 } … … 1177 1163 1178 1164 /* combined handler for the 'otr smp' and 'otr smpq' commands */ 1179 void otr_ smp_or_smpq(irc_t *irc, const char *nick, const char *question,1165 void otr_initiate_smp(irc_t *irc, const char *nick, const char *question, 1180 1166 const char *secret) 1181 1167 { … … 1208 1194 otrl_sm_state_free(ctx->smstate); 1209 1195 } 1210 1196 1211 1197 if(question) { 1212 1198 /* this was 'otr smpq', just initiate */
Note: See TracChangeset
for help on using the changeset viewer.