/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugins.d/mandos-client.c

  • Committer: Björn Påhlsson
  • Date: 2009-02-08 01:50:24 UTC
  • mto: (237.7.1 mandos) (24.1.154 mandos)
  • mto: This revision was merged to the branch mainline in revision 250.
  • Revision ID: belorn@braxen-20090208015024-jewaulcqtxvbopq6
Fixed a bug in fallback handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
} mandos_context;
131
131
 
132
132
/*
133
 
 * Make room in "buffer" for at least BUFFER_SIZE additional bytes.
134
 
 * "buffer_capacity" is how much is currently allocated,
135
 
 * "buffer_length" is how much is already used.
 
133
 * Make additional room in "buffer" for at least BUFFER_SIZE
 
134
 * additional bytes. "buffer_capacity" is how much is currently
 
135
 * allocated, "buffer_length" is how much is already used.
136
136
 */
137
 
size_t adjustbuffer(char **buffer, size_t buffer_length,
 
137
size_t incbuffer(char **buffer, size_t buffer_length,
138
138
                  size_t buffer_capacity){
139
139
  if(buffer_length + BUFFER_SIZE > buffer_capacity){
140
140
    *buffer = realloc(*buffer, buffer_capacity + BUFFER_SIZE);
326
326
  
327
327
  *plaintext = NULL;
328
328
  while(true){
329
 
    plaintext_capacity = adjustbuffer(plaintext,
 
329
    plaintext_capacity = incbuffer(plaintext,
330
330
                                      (size_t)plaintext_length,
331
331
                                      plaintext_capacity);
332
332
    if(plaintext_capacity == 0){
333
 
        perror("adjustbuffer");
 
333
        perror("incbuffer");
334
334
        plaintext_length = -1;
335
335
        goto decrypt_end;
336
336
    }
637
637
  }
638
638
  
639
639
  while(true){
640
 
    buffer_capacity = adjustbuffer(&buffer, buffer_length,
 
640
    buffer_capacity = incbuffer(&buffer, buffer_length,
641
641
                                   buffer_capacity);
642
642
    if(buffer_capacity == 0){
643
 
      perror("adjustbuffer");
 
643
      perror("incbuffer");
644
644
      retval = -1;
645
645
      goto mandos_end;
646
646
    }