Changeset d564c3d
- Timestamp:
- Mar 17, 2010, 11:15:36 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 2b7ef0a
- Parents:
- dfe94f9
- git-author:
- Nelson Elhage <nelhage@ksplice.com> (03/17/10 22:55:20)
- git-committer:
- Nelson Elhage <nelhage@ksplice.com> (03/17/10 23:15:36)
- Files:
-
- 2 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r10557e6 rd564c3d 9 9 barnowl_bin_SOURCES = $(BASE_SRCS) \ 10 10 owl.h owl_perl.h config.h \ 11 owl.c \11 owl.c filterproc.c \ 12 12 $(GEN_C) $(GEN_H) 13 13 … … 38 38 perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \ 39 39 regex.c history.c view.c dict.c variable.c filterelement.c pair.c \ 40 keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c\40 keypress.c keymap.c keybinding.c cmd.c context.c \ 41 41 aim.c buddy.c buddylist.c style.c errqueue.c \ 42 42 zbuddylist.c popexec.c obarray.c select.c wcwidth.c \ -
commands.c
rf449096 rd564c3d 1962 1962 char *owl_command_zcrypt(int argc, const char *const *argv, const char *buff) 1963 1963 { 1964 #ifdef OWL_ENABLE_ZCRYPT1965 1964 owl_zwrite z; 1966 1965 … … 1984 1983 } 1985 1984 return(NULL); 1986 #else1987 owl_function_makemsg("This Owl does not support zcrypt");1988 return NULL;1989 #endif1990 1985 } 1991 1986 -
functions.c
rdfe94f9 rd564c3d 12 12 #include <signal.h> 13 13 #include "owl.h" 14 #include "filterproc.h" 14 15 15 16 char *owl_function_command(const char *cmdbuff) … … 402 403 char *cryptmsg; 403 404 owl_message *m; 405 const char *argv[7]; 406 int rv, status; 404 407 405 408 /* create the zwrite and send the message */ … … 411 414 412 415 mymsg=owl_zwrite_get_message(&z); 413 #ifdef OWL_ENABLE_ZCRYPT 414 cryptmsg = owl_zcrypt_encrypt(mymsg, owl_zwrite_get_class(&z), owl_zwrite_get_instance(&z)); 415 if (!cryptmsg) { 416 417 argv[0] = "zcrypt"; 418 argv[1] = "-E"; 419 argv[2] = "-c"; argv[3] = owl_zwrite_get_class(&z); 420 argv[4] = "-i"; argv[5] = owl_zwrite_get_instance(&z); 421 argv[6] = NULL; 422 423 rv = call_filter("zcrypt", argv, mymsg, &cryptmsg, &status); 424 425 if (rv || status) { 426 if(cryptmsg) owl_free(cryptmsg); 416 427 owl_function_error("Error in zcrypt, possibly no key found. Message not sent."); 417 428 owl_function_beep(); … … 419 430 return; 420 431 } 421 #else422 cryptmsg=owl_strdup(mymsg);423 #endif424 432 425 433 owl_zwrite_set_message(&z, cryptmsg); -
message.c
r66a8cd6 rd564c3d 10 10 #include <time.h> 11 11 #include "owl.h" 12 #include "filterproc.h" 12 13 13 14 static owl_fmtext_cache fmtext_cache[OWL_FMTEXT_CACHE_SIZE]; … … 838 839 owl_free(tmp); 839 840 840 #ifdef OWL_ENABLE_ZCRYPT841 841 /* if zcrypt is enabled try to decrypt the message */ 842 842 if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) { 843 char *out = owl_zcrypt_decrypt(owl_message_get_body(m), owl_message_get_class(m), owl_message_get_instance(m)); 844 if (out) { 843 const char *argv[] = { 844 "zcrypt", 845 "-D", 846 "-c", owl_message_get_class(m), 847 "-i", owl_message_get_instance(m), 848 NULL 849 }; 850 char *out; 851 int rv; 852 int status; 853 854 rv = call_filter("zcrypt", argv, owl_message_get_body(m), &out, &status); 855 856 if(!rv && !status) { 857 int len = strlen(out); 858 if(len >= 8 && !strcmp(out + len - 8, "**END**\n")) { 859 out[len - 8] = 0; 860 } 845 861 owl_message_set_body(m, out); 846 862 owl_free(out); 863 } else if(out) { 864 owl_free(out); 847 865 } 848 866 } 849 #endif850 867 } 851 868 #else -
tester.c
r30bb10a rd564c3d 13 13 int owl_obarray_regtest(void); 14 14 int owl_editwin_regtest(void); 15 #ifdef OWL_ENABLE_ZCRYPT16 int owl_zcrypt_regtest(void);17 #endif18 15 19 16 int main(int argc, char **argv, char **env) … … 36 33 numfailures += owl_obarray_regtest(); 37 34 numfailures += owl_editwin_regtest(); 38 #ifdef OWL_ENABLE_ZCRYPT39 numfailures += owl_zcrypt_regtest();40 #endif41 35 if (numfailures) { 42 36 fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures); … … 367 361 return numfailed; 368 362 } 369 370 #ifdef OWL_ENABLE_ZCRYPT371 int owl_zcrypt_regtest(void)372 {373 int numfailed = 0;374 char *encrypted, *decrypted;375 376 printf("# BEGIN testing owl_zcrypt\n");377 378 encrypted = owl_zcrypt_encrypt_with_key("Hello, world!", "seekritkey");379 FAIL_UNLESS("zcrypt encrypt", strcmp(encrypted, "TLJMKQSIGKSJRIJRSIIPIJFFULKRJSPK") == 0);380 decrypted = owl_zcrypt_decrypt_with_key(encrypted, "seekritkey");381 FAIL_UNLESS("zcrypt decrypt", strcmp(decrypted, "Hello, world!") == 0);382 owl_free(decrypted);383 owl_free(encrypted);384 385 printf("# END testing owl_zcrypt (%d failures)\n", numfailed);386 387 return numfailed;388 }389 #endif
Note: See TracChangeset
for help on using the changeset viewer.