Changes in / [e4fc493:191ac9d]
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
re4fc493 r191ac9d 28 28 yahoo=1 29 29 twitter=1 30 twitter=131 30 purple=0 32 31 -
otr.c
re4fc493 r191ac9d 185 185 /* find a private key by fingerprint prefix (given as any number of hex strings) */ 186 186 OtrlPrivKey *match_privkey(irc_t *irc, const char **args); 187 188 /* check whether a string is safe to use in a path component */ 189 int strsane(const char *s); 187 190 188 191 /* functions to be called for certain events */ … … 275 278 int kg=0; 276 279 277 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, irc->user->nick); 278 e = otrl_privkey_read(irc->otr->us, s); 279 if(e && e!=enoent) { 280 irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 281 } 282 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick); 283 e = otrl_privkey_read_fingerprints(irc->otr->us, s, NULL, NULL); 284 if(e && e!=enoent) { 285 irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 280 if(strsane(irc->user->nick)) { 281 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, irc->user->nick); 282 e = otrl_privkey_read(irc->otr->us, s); 283 if(e && e!=enoent) { 284 irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 285 } 286 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick); 287 e = otrl_privkey_read_fingerprints(irc->otr->us, s, NULL, NULL); 288 if(e && e!=enoent) { 289 irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 290 } 286 291 } 287 292 … … 306 311 gcry_error_t e; 307 312 308 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick); 309 e = otrl_privkey_write_fingerprints(irc->otr->us, s); 310 if(e) { 311 irc_rootmsg(irc, "otr save: %s: %s", s, gcry_strerror(e)); 312 } 313 chmod(s, 0600); 313 if(strsane(irc->user->nick)) { 314 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick); 315 e = otrl_privkey_write_fingerprints(irc->otr->us, s); 316 if(e) { 317 irc_rootmsg(irc, "otr save: %s: %s", s, gcry_strerror(e)); 318 } 319 chmod(s, 0600); 320 } 314 321 } 315 322 … … 318 325 char s[512]; 319 326 320 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, nick); 321 unlink(s); 322 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, nick); 323 unlink(s); 327 if(strsane(nick)) { 328 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, nick); 329 unlink(s); 330 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, nick); 331 unlink(s); 332 } 324 333 } 325 334 … … 328 337 char s[512], t[512]; 329 338 330 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, onick); 331 g_snprintf(t, 511, "%s%s.otr_keys", global.conf->configdir, nnick); 332 rename(s,t); 333 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, onick); 334 g_snprintf(t, 511, "%s%s.otr_fprints", global.conf->configdir, nnick); 335 rename(s,t); 339 if(strsane(nnick) && strsane(onick)) { 340 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, onick); 341 g_snprintf(t, 511, "%s%s.otr_keys", global.conf->configdir, nnick); 342 rename(s,t); 343 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, onick); 344 g_snprintf(t, 511, "%s%s.otr_fprints", global.conf->configdir, nnick); 345 rename(s,t); 346 } 336 347 } 337 348 … … 1777 1788 irc_rootmsg(irc, "%s", msg); 1778 1789 if(filename[0]) { 1779 char *kf = g_strdup_printf("%s%s.otr_keys", global.conf->configdir, irc->user->nick); 1780 char *tmp = g_strdup_printf("%s.new", kf); 1781 copyfile(filename, tmp); 1782 unlink(filename); 1783 rename(tmp,kf); 1784 otrl_privkey_read(irc->otr->us, kf); 1785 g_free(kf); 1786 g_free(tmp); 1790 if(strsane(irc->user->nick)) { 1791 char *kf = g_strdup_printf("%s%s.otr_keys", global.conf->configdir, irc->user->nick); 1792 char *tmp = g_strdup_printf("%s.new", kf); 1793 copyfile(filename, tmp); 1794 unlink(filename); 1795 rename(tmp,kf); 1796 otrl_privkey_read(irc->otr->us, kf); 1797 g_free(kf); 1798 g_free(tmp); 1799 } else { 1800 otrl_privkey_read(irc->otr->us, filename); 1801 unlink(filename); 1802 } 1787 1803 } 1788 1804 … … 1859 1875 } 1860 1876 1877 /* check whether a string is safe to use in a path component */ 1878 int strsane(const char *s) 1879 { 1880 return strpbrk(s, "/\\") == NULL; 1881 } 1882 1861 1883 /* vim: set noet ts=4 sw=4: */ -
protocols/msn/ns.c
re4fc493 r191ac9d 480 480 else 481 481 { 482 imcb_error( ic, "Session terminated by remote server (reason unknown)" ); 482 imcb_error( ic, "Session terminated by remote server (%s)", 483 cmd[1] ? cmd[1] : "reason unknown)" ); 483 484 } 484 485 -
protocols/msn/soap.c
re4fc493 r191ac9d 215 215 return; 216 216 217 if( ( s = strstr( headers, "\r\n\r\n" ) ) ) 218 st = write( 1, headers, s - headers + 4 ); 219 else 220 st = write( 1, headers, strlen( headers ) ); 217 if( headers ) 218 { 219 if( ( s = strstr( headers, "\r\n\r\n" ) ) ) 220 st = write( 1, headers, s - headers + 4 ); 221 else 222 st = write( 1, headers, strlen( headers ) ); 223 } 221 224 222 225 #ifdef DEBUG 226 if( payload ) 223 227 { 224 228 struct xt_node *xt = xt_from_string( payload );
Note: See TracChangeset
for help on using the changeset viewer.