/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 at bsnet
  • Date: 2011-12-24 23:07:17 UTC
  • Revision ID: teddy@fukt.bsnet.se-20111224230717-yd3c0532w0kaviuc
* plugins.d/mandos-client.c (fprintf_plus): Check format string.
  (run_network_hooks): Check for execl() failure.

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 © 2008-2012 Teddy Hogeborn
13
 
 * Copyright © 2008-2012 Björn Påhlsson
 
12
 * Copyright © 2008-2011 Teddy Hogeborn
 
13
 * Copyright © 2008-2011 Björn Påhlsson
14
14
 * 
15
15
 * This program is free software: you can redistribute it and/or
16
16
 * modify it under the terms of the GNU General Public License as
41
41
 
42
42
#include <stdio.h>              /* fprintf(), stderr, fwrite(),
43
43
                                   stdout, ferror(), remove() */
44
 
#include <stdint.h>             /* uint16_t, uint32_t, intptr_t */
 
44
#include <stdint.h>             /* uint16_t, uint32_t */
45
45
#include <stddef.h>             /* NULL, size_t, ssize_t */
46
46
#include <stdlib.h>             /* free(), EXIT_SUCCESS, srand(),
47
47
                                   strtof(), abort() */
170
170
 
171
171
/* Function to use when printing errors */
172
172
void perror_plus(const char *print_text){
173
 
  int e = errno;
174
173
  fprintf(stderr, "Mandos plugin %s: ",
175
174
          program_invocation_short_name);
176
 
  errno = e;
177
175
  perror(print_text);
178
176
}
179
177
 
821
819
    goto mandos_end;
822
820
  }
823
821
  
824
 
  /* This casting via intptr_t is to eliminate warning about casting
825
 
     an int to a pointer type.  This is exactly how the GnuTLS Guile
826
 
     function "set-session-transport-fd!" does it. */
827
 
  gnutls_transport_set_ptr(session,
828
 
                           (gnutls_transport_ptr_t)(intptr_t)tcp_sd);
 
822
  /* Spurious warning from -Wint-to-pointer-cast */
 
823
  gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t) tcp_sd);
829
824
  
830
825
  if(quit_now){
831
826
    errno = EINTR;
1453
1448
          perror_plus("setenv");
1454
1449
          _exit(EX_OSERR);
1455
1450
        }
1456
 
        ret = setenv("VERBOSITY", debug ? "1" : "0", 1);
 
1451
        ret = setenv("VERBOSE", debug ? "1" : "0", 1);
1457
1452
        if(ret == -1){
1458
1453
          perror_plus("setenv");
1459
1454
          _exit(EX_OSERR);
1476
1471
          _exit(EX_OSERR);
1477
1472
        }
1478
1473
        free(delaystring);
1479
 
        if(connect_to != NULL){
1480
 
          ret = setenv("CONNECT", connect_to, 1);
1481
 
          if(ret == -1){
1482
 
            perror_plus("setenv");
1483
 
            _exit(EX_OSERR);
1484
 
          }
1485
 
        }
1486
1474
        if(execl(fullname, direntry->d_name, mode, NULL) == -1){
1487
1475
          perror_plus("execl");
1488
1476
          _exit(EXIT_FAILURE);
1611
1599
        .group = 2 },
1612
1600
      { .name = "retry", .key = 132,
1613
1601
        .arg = "SECONDS",
1614
 
        .doc = "Retry interval used when denied by the Mandos server",
 
1602
        .doc = "Retry interval used when denied by the mandos server",
1615
1603
        .group = 2 },
1616
1604
      { .name = "network-hook-dir", .key = 133,
1617
1605
        .arg = "DIR",