/mandos/trunk

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

« back to all changes in this revision

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

  • Committer: Teddy Hogeborn
  • Date: 2009-01-10 02:39:56 UTC
  • mfrom: (257.1.2 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20090110023956-o7f5r8af28fmgahw
Fixed warnings on AMD64, thanks to Mooie <mooie@cow.se> for the patch.

* plugins.d/askpass-fifo.c (main): Cast value from TEMP_FAILURE_RETRY
                                   to int, the value the inner
                                   function returns.
* plugins.d/mandos-client.c (init_gpgme): - '' -
  (start_mandos_communication): New variable "ssize_t sret"; used to
                                store return value from
                                "gnutls_record_recv".  Also cast value
                                from TEMP_FAILURE_RETRY as above.
* plugins.d/usplash.c (usplash_write): New variable "ssize_t sret";
                                       used to store return value from
                                       "write".

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 * "browse_callback", and parts of "main".
10
10
 * 
11
11
 * Everything else is
12
 
 * Copyright © 2007-2008 Teddy Hogeborn & Björn Påhlsson
 
12
 * Copyright © 2008,2009 Teddy Hogeborn
 
13
 * Copyright © 2008,2009 Björn Påhlsson
13
14
 * 
14
15
 * This program is free software: you can redistribute it and/or
15
16
 * modify it under the terms of the GNU General Public License as
101
102
 
102
103
#define BUFFER_SIZE 256
103
104
 
104
 
/*
105
 
  #define PATHDIR "/conf/conf.d/mandos"
106
 
*/
107
 
 
108
105
#define PATHDIR "/conf/conf.d/mandos"
109
106
#define SECKEY "seckey.txt"
110
107
#define PUBKEY "pubkey.txt"
111
108
 
112
109
bool debug = false;
113
110
static const char mandos_protocol_version[] = "1";
114
 
const char *argp_program_version = "mandos-client 1.0";
 
111
const char *argp_program_version = "mandos-client " VERSION;
115
112
const char *argp_program_bug_address = "<mandos@fukt.bsnet.se>";
116
113
 
117
114
/* Used for passing in values through the Avahi callback functions */
159
156
    int fd;
160
157
    gpgme_data_t pgp_data;
161
158
    
162
 
    fd = TEMP_FAILURE_RETRY(open(filename, O_RDONLY));
 
159
    fd = (int)TEMP_FAILURE_RETRY(open(filename, O_RDONLY));
163
160
    if(fd == -1){
164
161
      perror("open");
165
162
      return false;
179
176
      return false;
180
177
    }
181
178
    
182
 
    ret = TEMP_FAILURE_RETRY(close(fd));
 
179
    ret = (int)TEMP_FAILURE_RETRY(close(fd));
183
180
    if(ret == -1){
184
181
      perror("close");
185
182
    }
504
501
                                      AvahiIfIndex if_index,
505
502
                                      mandos_context *mc){
506
503
  int ret, tcp_sd;
 
504
  ssize_t sret;
507
505
  union { struct sockaddr in; struct sockaddr_in6 in6; } to;
508
506
  char *buffer = NULL;
509
507
  char *decrypted_buffer;
580
578
  written = 0;
581
579
  while (true){
582
580
    size_t out_size = strlen(out);
583
 
    ret = TEMP_FAILURE_RETRY(write(tcp_sd, out + written,
 
581
    ret = (int)TEMP_FAILURE_RETRY(write(tcp_sd, out + written,
584
582
                                   out_size - written));
585
583
    if (ret == -1){
586
584
      perror("write");
635
633
      goto mandos_end;
636
634
    }
637
635
    
638
 
    ret = gnutls_record_recv(session, buffer+buffer_length,
639
 
                             BUFFER_SIZE);
640
 
    if (ret == 0){
 
636
    sret = gnutls_record_recv(session, buffer+buffer_length,
 
637
                              BUFFER_SIZE);
 
638
    if (sret == 0){
641
639
      break;
642
640
    }
643
 
    if (ret < 0){
644
 
      switch(ret){
 
641
    if (sret < 0){
 
642
      switch(sret){
645
643
      case GNUTLS_E_INTERRUPTED:
646
644
      case GNUTLS_E_AGAIN:
647
645
        break;
664
662
        goto mandos_end;
665
663
      }
666
664
    } else {
667
 
      buffer_length += (size_t) ret;
 
665
      buffer_length += (size_t) sret;
668
666
    }
669
667
  }
670
668
  
706
704
  
707
705
 mandos_end:
708
706
  free(buffer);
709
 
  ret = TEMP_FAILURE_RETRY(close(tcp_sd));
 
707
  ret = (int)TEMP_FAILURE_RETRY(close(tcp_sd));
710
708
  if(ret == -1){
711
709
    perror("close");
712
710
  }
943
941
          goto end;
944
942
        }
945
943
      }
946
 
      ret = TEMP_FAILURE_RETRY(close(sd));
 
944
      ret = (int)TEMP_FAILURE_RETRY(close(sd));
947
945
      if(ret == -1){
948
946
        perror("close");
949
947
      }