Changeset b9517cf


Ignore:
Timestamp:
Jul 25, 2011, 1:35:30 AM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.9
Children:
a74a044
Parents:
f271129
git-author:
David Benjamin <davidben@mit.edu> (07/25/11 01:24:06)
git-committer:
David Benjamin <davidben@mit.edu> (07/25/11 01:35:30)
Message:
Explicitly store whether an owl_message has a ZNotice_t

We should remove it altogether in perlmessages, but in the meantime, we
shouldn't be crashing on faked incoming zephyr messages. Also drop the
attempted fake ZNotice_t in owl_perlconfig_hashref2message. No one could
have relied on it safely today because any such message would crash on
delete.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    rf271129 rb9517cf  
    14231423    owl_fmtext_appendf_normal(&fm, "  Opcode    : %s\n", owl_message_get_opcode(m));
    14241424#ifdef HAVE_LIBZEPHYR
    1425     if (owl_message_is_direction_in(m)) {
     1425    n = owl_message_get_notice(m);
     1426    if (n != NULL) {
    14261427      char *tmpbuff, *tmpbuff2;
    14271428      int i, fields;
    1428 
    1429       n=owl_message_get_notice(m);
    14301429
    14311430      if (!owl_message_is_pseudo(m)) {
  • message.c

    rf271129 rb9517cf  
    3333  owl_message_set_direction_none(m);
    3434  m->delete=0;
     35
     36#ifdef HAVE_LIBZEPHYR
     37  m->has_notice = false;
     38#endif
    3539
    3640  owl_message_set_hostname(m, "");
     
    490494const ZNotice_t *owl_message_get_notice(const owl_message *m)
    491495{
    492   return(&(m->notice));
     496  return m->has_notice ? &m->notice : NULL;
    493497}
    494498#else
     
    781785  /* first save the full notice */
    782786  m->notice = *n;
     787  m->has_notice = true;
    783788
    784789  /* a little gross, we'll replace \r's with ' ' for now */
     
    9961001  owl_pair *p;
    9971002#ifdef HAVE_LIBZEPHYR   
    998   if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
     1003  if (m->has_notice) {
    9991004    ZFreeNotice(&(m->notice));
    10001005  }
  • owl.h

    rf271129 rb9517cf  
    356356  int direction;
    357357#ifdef HAVE_LIBZEPHYR
     358  bool has_notice;
    358359  ZNotice_t notice;
    359360#endif
  • perlconfig.c

    rf271129 rb9517cf  
    9191                                      owl_new_sv(owl_message_get_##field(m)), 0)
    9292
    93   if (owl_message_is_type_zephyr(m)
    94       && owl_message_is_direction_in(m)) {
     93  if (owl_message_get_notice(m)) {
    9594    /* Handle zephyr-specific fields... */
    9695    AV *av_zfields;
     
    173172   message2hashref and hashref2message. Currently we lose
    174173   zephyr-specific properties stored in the ZNotice_t
    175 
    176    This has been somewhat addressed, but is still not lossless.
    177174 */
    178175CALLER_OWN owl_message *owl_perlconfig_hashref2message(SV *msg)
     
    220217      owl_message_set_attribute(m, "adminheader", "");
    221218  }
    222 #ifdef HAVE_LIBZEPHYR
    223   if (owl_message_is_type_zephyr(m)) {
    224     ZNotice_t *n = &(m->notice);
    225     n->z_kind = ACKED;
    226     n->z_port = 0;
    227     n->z_auth = ZAUTH_NO;
    228     n->z_checked_auth = 0;
    229     n->z_class = zstr(owl_message_get_class(m));
    230     n->z_class_inst = zstr(owl_message_get_instance(m));
    231     n->z_opcode = zstr(owl_message_get_opcode(m));
    232     n->z_sender = zstr(owl_message_get_sender(m));
    233     n->z_recipient = zstr(owl_message_get_recipient(m));
    234     n->z_default_format = zstr("[zephyr created from perl]");
    235     n->z_multinotice = zstr("[zephyr created from perl]");
    236     n->z_num_other_fields = 0;
    237     n->z_message = g_strdup_printf("%s%c%s", owl_message_get_zsig(m), '\0', owl_message_get_body(m));
    238     n->z_message_len = strlen(owl_message_get_zsig(m)) + strlen(owl_message_get_body(m)) + 1;
    239   }
    240 #endif
    241219  return m;
    242220}
Note: See TracChangeset for help on using the changeset viewer.