Changeset d564c3d for message.c


Ignore:
Timestamp:
Mar 17, 2010, 11:15:36 PM (11 years ago)
Author:
Nelson Elhage <nelhage@ksplice.com>
Branches:
master, 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)
Message:
Replace the built-in zcrypt with shelling out to the zcrypt binary.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    r66a8cd6 rd564c3d  
    1010#include <time.h>
    1111#include "owl.h"
     12#include "filterproc.h"
    1213
    1314static owl_fmtext_cache fmtext_cache[OWL_FMTEXT_CACHE_SIZE];
     
    838839  owl_free(tmp);
    839840
    840 #ifdef OWL_ENABLE_ZCRYPT
    841841  /* if zcrypt is enabled try to decrypt the message */
    842842  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      }
    845861      owl_message_set_body(m, out);
    846862      owl_free(out);
     863    } else if(out) {
     864      owl_free(out);
    847865    }
    848866  }
    849 #endif 
    850867}
    851868#else
Note: See TracChangeset for help on using the changeset viewer.