Changeset d309eb3


Ignore:
Timestamp:
Oct 17, 2002, 3:00:57 PM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
e3869df
Parents:
aecf3e6
Message:
Fixed a memory bug in getsubs
Added receive support for zcrypt messages
Added the 'zcrypt' variable which controls whether or not zcrypt
    messages are decrypted
'reply' is disabled for zcrypt until sending zcrypt works
Started implementing zcrypt command
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    raecf3e6 rd309eb3  
    99        Added a workaround for a libzephyr bug that caused zwrites to fail
    1010          if zephyrs were sent just before and just after renewing tickets
     11        Fixed a memory bug in getsubs
     12        Added receive support for zcrypt messages
     13        Added the 'zcrypt' variable which controls whether or not zcrypt
     14          messages are decrypted
     15        'reply' is disabled for zcrypt until sending zcrypt works
     16        Started implementing zcrypt command
    1117       
    12181.2.6
  • Makefile.in

    r601a9e0 rd309eb3  
    1313     functions.o zwrite.o viewwin.o help.o filter.o regex.o history.o view.o \
    1414     dict.o variable.o varstubs.o filterelement.o \
    15      keypress.o keymap.o keybinding.o cmd.o context.o perlglue.o
     15     keypress.o keymap.o keybinding.o cmd.o context.o perlglue.o zcrypt.o
    1616
    1717AUTOGEN=owl_prototypes.h varstubs.c perlglue.c
     
    4242# Only move owl_prototypes.h into place if the new one is different
    4343owl_prototypes.h: codelist.pl varstubs.c $(OBJS:.o=.c)
    44         perl codelist.pl > owl_prototypes.h.new
     44        perl codelist.pl | grep -v ZWRITEOPTIONS > owl_prototypes.h.new
    4545        @cmp -s owl_prototypes.h.new owl_prototypes.h || echo 'Interfaces changed!'
    4646        @cmp -s owl_prototypes.h.new owl_prototypes.h || mv -f owl_prototypes.h.new owl_prototypes.h
  • commands.c

    r2527615 rd309eb3  
    100100              "-O opcode\n"
    101101              "      Send to the specified opcode\n"),
     102
     103  /*
     104  OWLCMD_ARGS("zcrypt", owl_command_zcrypt, OWL_CTX_INTERACTIVE,
     105              "send an encrypted zephyr",
     106              "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [-m <message...>]\n",
     107              "Behaves like zwrite but uses encryption.  Not for use with\n"
     108              "personal messages\n"),
     109  */
    102110 
    103111  OWLCMD_ARGS("reply", owl_command_reply,  OWL_CTX_INTERACTIVE,
     
    13021310  }
    13031311  return NULL;
     1312}
     1313
     1314char *owl_command_zcrypt(int argc, char **argv, char *buff) {
     1315  char *tmpbuff, *pos, *cmd, *msg;
     1316 
     1317  /* check for a zwrite -m */
     1318  for (pos = buff; *pos; pos = skiptokens(pos, 1)) {
     1319    if (!strncmp(pos, "-m ", 3)) {
     1320      cmd = owl_strdup(buff);
     1321      msg = cmd+(pos-buff);
     1322      *msg = '\0';
     1323      msg += 3;
     1324      owl_zwrite_create_and_send_from_line(cmd, msg);
     1325      owl_free(cmd);
     1326      return NULL;
     1327    }
     1328  }
     1329
     1330  if (argc < 2) {
     1331    owl_function_makemsg("Not enough arguments to the zcrypt command.");
     1332  } else {
     1333    tmpbuff = owl_strdup(buff);
     1334    owl_function_zwrite_setup(tmpbuff);
     1335    owl_global_set_buffercommand(&g, tmpbuff);
     1336    owl_free(tmpbuff);
     1337  }
     1338  return(NULL);
    13041339}
    13051340
  • functions.c

    r8fec514 rd309eb3  
    122122  if (ret) {
    123123    owl_function_makemsg("Error in zwrite arugments");
     124    owl_zwrite_free(&z);
     125    return;
     126  }
     127
     128  /* send a ping if necessary */
     129  if (owl_global_is_txping(&g)) {
     130    owl_zwrite_send_ping(&z);
     131  }
     132  owl_zwrite_free(&z);
     133
     134  /* create and setup the editwin */
     135  e=owl_global_get_typwin(&g);
     136  owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE, owl_global_get_msg_history(&g));
     137
     138  if (!owl_global_get_lockout_ctrld(&g)) {
     139    owl_function_makemsg("Type your zephyr below.  End with ^D or a dot on a line by itself.  ^C will quit.");
     140  } else {
     141    owl_function_makemsg("Type your zephyr below.  End with a dot on a line by itself.  ^C will quit.");
     142  }
     143
     144  owl_editwin_clear(e);
     145  owl_editwin_set_dotsend(e);
     146  strcpy(buff, "----> ");
     147  strcat(buff, line);
     148  strcat(buff, "\n");
     149  owl_editwin_set_locktext(e, buff);
     150
     151  /* make it active */
     152  owl_global_set_typwin_active(&g);
     153}
     154
     155void owl_function_zcrypt_setup(char *line) {
     156  owl_editwin *e;
     157  char buff[1024];
     158  owl_zwrite z;
     159  int ret;
     160
     161  /* check the arguments */
     162  ret=owl_zwrite_create_from_line(&z, line);
     163  if (ret) {
     164    owl_function_makemsg("Error in zwrite arugments");
     165    owl_zwrite_free(&z);
     166    return;
     167  }
     168
     169  if (owl_zwrite_get_numrecips(&z)>0) {
     170    owl_function_makemsg("You may not specifiy a recipient for a zcrypt message");
    124171    owl_zwrite_free(&z);
    125172    return;
     
    12951342
    12961343  buff=owl_malloc(num*500);
    1297   tmpbuff=owl_malloc(2048);
     1344  tmpbuff=owl_malloc(num*500);
    12981345  strcpy(buff, "");
    12991346  for (i=0; i<num; i++) {
     
    15121559        return;
    15131560      }
     1561    }
     1562
     1563    /* for now we disable replies to zcrypt messages, since we can't
     1564       support an encrypted reply */
     1565    if (!strcasecmp(owl_message_get_opcode(m), "crypt")) {
     1566      owl_function_makemsg("Replies to zcrypt messages are not enabled in this release");
     1567      return;
    15141568    }
    15151569
  • message.c

    ra3ba748 rd309eb3  
    401401  m->body[k]='\0';
    402402
     403  /* if zcrypt is enabled try to decrypt the message */
     404  if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) {
     405    char *out;
     406
     407    out=owl_malloc(strlen(m->body)*16+20);
     408    zcrypt_decrypt(out, m->body, m->class, m->inst);
     409    owl_free(m->body);
     410    m->body=out;
     411  }
     412
    403413  /* save the hostname */
    404414  owl_function_debugmsg("About to do gethostbyaddr");
     
    547557  char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
    548558  ZNotice_t *n;
    549   int len;
    550 
     559
     560  n=&(m->notice);
     561 
    551562  /* get the body */
    552   n=&(m->notice);
    553   ptr=(owl_zephyr_get_message(n, &len));
    554   body=owl_malloc(len+20);
    555   strncpy(body, ptr, len);
    556   body[len]='\0';
     563  body=owl_malloc(strlen(m->body)+30);
     564  strcpy(body, m->body);
    557565
    558566  /* add a newline if we need to */
     
    650658  char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
    651659  ZNotice_t *n;
    652   int len;
     660
     661  n=&(m->notice);
    653662
    654663  /* get the body */
    655   n=&(m->notice);
    656   ptr=(owl_zephyr_get_message(n, &len));
    657   body=owl_malloc(len+20);
    658   strncpy(body, ptr, len);
    659   body[len]='\0';
     664  body=owl_malloc(strlen(m->body)+30);
     665  strcpy(body, m->body);
    660666
    661667  /* add a newline if we need to */
  • variable.c

    r486688f rd309eb3  
    110110               "Note that only messages received after this variable\n"
    111111               "is set will be affected." ),
     112
     113  OWLVAR_BOOL( "zcrypt" /* %OwlVarStub */, 1,
     114               "Do automatic zcrypt processing",
     115               "" ),
    112116
    113117  OWLVAR_ENUM_FULL( "disable-ctrl-d" /* %OwlVarStub:lockout_ctrld */, 1,
Note: See TracChangeset for help on using the changeset viewer.