/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: 2016-10-05 20:03:48 UTC
  • mfrom: (877 trunk)
  • mto: This revision was merged to the branch mainline in revision 878.
  • Revision ID: teddy@recompile.se-20161005200348-7vio421w006duism
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
                                   strtof(), abort() */
48
48
#include <stdbool.h>            /* bool, false, true */
49
49
#include <string.h>             /* strcmp(), strlen(), strerror(),
50
 
                                   asprintf(), strncpy() */
 
50
                                   asprintf(), strncpy(), strsignal()
 
51
                                */
51
52
#include <sys/ioctl.h>          /* ioctl */
52
53
#include <sys/types.h>          /* socket(), inet_pton(), sockaddr,
53
54
                                   sockaddr_in6, PF_INET6,
625
626
                     safer_gnutls_strerror(ret));
626
627
        dhparamsfilename = NULL;
627
628
      }
 
629
      free(params.data);
628
630
    } while(false);
629
631
  }
630
632
  if(dhparamsfilename == NULL){
1237
1239
           with an explicit route added with the server's address.
1238
1240
           
1239
1241
           Avahi bug reference:
1240
 
           http://lists.freedesktop.org/archives/avahi/2010-February/001833.html
 
1242
           https://lists.freedesktop.org/archives/avahi/2010-February/001833.html
1241
1243
           https://bugs.debian.org/587961
1242
1244
        */
1243
1245
        if(debug){
1423
1425
                                               &decrypted_buffer, mc);
1424
1426
    if(decrypted_buffer_size >= 0){
1425
1427
      
 
1428
      clearerr(stdout);
1426
1429
      written = 0;
1427
1430
      while(written < (size_t) decrypted_buffer_size){
1428
1431
        if(quit_now){
1444
1447
        }
1445
1448
        written += (size_t)ret;
1446
1449
      }
 
1450
      ret = fflush(stdout);
 
1451
      if(ret != 0){
 
1452
        int e = errno;
 
1453
        if(debug){
 
1454
          fprintf_plus(stderr, "Error writing encrypted data: %s\n",
 
1455
                       strerror(errno));
 
1456
        }
 
1457
        errno = e;
 
1458
        goto mandos_end;
 
1459
      }
1447
1460
      retval = 0;
1448
1461
    }
1449
1462
  }
2485
2498
  
2486
2499
  {
2487
2500
    /* Work around Debian bug #633582:
2488
 
       <http://bugs.debian.org/633582> */
 
2501
       <https://bugs.debian.org/633582> */
2489
2502
    
2490
2503
    /* Re-raise privileges */
2491
2504
    ret = raise_privileges();
2946
2959
 end:
2947
2960
  
2948
2961
  if(debug){
2949
 
    fprintf_plus(stderr, "%s exiting\n", argv[0]);
 
2962
    if(signal_received){
 
2963
      fprintf_plus(stderr, "%s exiting due to signal %d: %s\n",
 
2964
                   argv[0], signal_received,
 
2965
                   strsignal(signal_received));
 
2966
    } else {
 
2967
      fprintf_plus(stderr, "%s exiting\n", argv[0]);
 
2968
    }
2950
2969
  }
2951
2970
  
2952
2971
  /* Cleanup things */