Changeset 987cf3f for zwrite.c


Ignore:
Timestamp:
Jul 4, 2010, 12:15:12 PM (11 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
efc460e
Parents:
aeadc74
git-author:
Nelson Elhage <nelhage@mit.edu> (06/20/10 16:47:23)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/04/10 12:15:12)
Message:
Pass around owl_zwrite objects, instead of continually re-parsing them.

In addition to be cleaner and shorter, this fixes a bug where ': zcrypt' ended
in an unencrypted zwrite.

Reported-by: Tony Valderrama <tvald@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zwrite.c

    rc230bc1 r987cf3f  
    55#include "owl.h"
    66
     7owl_zwrite *owl_zwrite_new(const char *line)
     8{
     9  owl_zwrite *z = owl_malloc(sizeof *z);
     10  if (owl_zwrite_create_from_line(z, line) < 0) {
     11    owl_zwrite_delete(z);
     12    return NULL;
     13  }
     14  return z;
     15}
     16
    717int owl_zwrite_create_from_line(owl_zwrite *z, const char *line)
    818{
     
    1525 
    1626  /* start with null entries */
     27  z->cmd=NULL;
    1728  z->realm=NULL;
    1829  z->class=NULL;
     
    3546  myargc=argc;
    3647  if (myargc && *(myargv[0])!='-') {
     48    z->cmd=owl_strdup(myargv[0]);
    3749    myargc--;
    3850    myargv++;
     
    350362}
    351363
     364void owl_zwrite_delete(owl_zwrite *z)
     365{
     366  owl_zwrite_cleanup(z);
     367  owl_free(z);
     368}
     369
    352370void owl_zwrite_cleanup(owl_zwrite *z)
    353371{
Note: See TracChangeset for help on using the changeset viewer.