/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: 2015-12-03 21:06:34 UTC
  • Revision ID: teddy@recompile.se-20151203210634-5dcyccalld40cygn
* debian/rules (override_dh_fixperms): Split into
                                       "override_dh_fixperms-arch" and
                                       "override_dh_fixperms-indep".
                                       Fixes Debian bug #806073.

Show diffs side-by-side

added added

removed removed

Lines of Context:
305
305
      return false;
306
306
    }
307
307
    
308
 
    ret = (int)TEMP_FAILURE_RETRY(close(fd));
 
308
    ret = close(fd);
309
309
    if(ret == -1){
310
310
      perror_plus("close");
311
311
    }
931
931
      perror_plus("dup2(devnull, STDIN_FILENO)");
932
932
      _exit(EX_OSERR);
933
933
    }
934
 
    ret = (int)TEMP_FAILURE_RETRY(close(devnull));
 
934
    ret = close(devnull);
935
935
    if(ret == -1){
936
936
      perror_plus("close");
937
937
      _exit(EX_OSERR);
954
954
                                                   helper, O_RDONLY));
955
955
    if(helper_fd == -1){
956
956
      perror_plus("openat");
 
957
      close(helperdir_fd);
957
958
      _exit(EX_UNAVAILABLE);
958
959
    }
959
 
    TEMP_FAILURE_RETRY(close(helperdir_fd));
 
960
    close(helperdir_fd);
960
961
#ifdef __GNUC__
961
962
#pragma GCC diagnostic push
962
963
#pragma GCC diagnostic ignored "-Wcast-qual"
1222
1223
                    sizeof(struct sockaddr_in));
1223
1224
    }
1224
1225
    if(ret < 0){
1225
 
      if(errno == ENETUNREACH
 
1226
      if(((errno == ENETUNREACH) or (errno == EHOSTUNREACH))
1226
1227
         and if_index != AVAHI_IF_UNSPEC
1227
1228
         and connect_to == NULL
1228
1229
         and not route_added and
1466
1467
    free(decrypted_buffer);
1467
1468
    free(buffer);
1468
1469
    if(tcp_sd >= 0){
1469
 
      ret = (int)TEMP_FAILURE_RETRY(close(tcp_sd));
 
1470
      ret = close(tcp_sd);
1470
1471
    }
1471
1472
    if(ret == -1){
1472
1473
      if(e == 0){
2011
2012
        perror_plus("openat");
2012
2013
        _exit(EXIT_FAILURE);
2013
2014
      }
2014
 
      if((int)TEMP_FAILURE_RETRY(close(hookdir_fd)) == -1){
 
2015
      if(close(hookdir_fd) == -1){
2015
2016
        perror_plus("close");
2016
2017
        _exit(EXIT_FAILURE);
2017
2018
      }
2020
2021
        perror_plus("dup2(devnull, STDIN_FILENO)");
2021
2022
        _exit(EX_OSERR);
2022
2023
      }
2023
 
      ret = (int)TEMP_FAILURE_RETRY(close(devnull));
 
2024
      ret = close(devnull);
2024
2025
      if(ret == -1){
2025
2026
        perror_plus("close");
2026
2027
        _exit(EX_OSERR);
2075
2076
    free(direntry);
2076
2077
  }
2077
2078
  free(direntries);
2078
 
  if((int)TEMP_FAILURE_RETRY(close(hookdir_fd)) == -1){
 
2079
  if(close(hookdir_fd) == -1){
2079
2080
    perror_plus("close");
2080
2081
  } else {
2081
2082
    hookdir_fd = -1;
2121
2122
    }
2122
2123
    
2123
2124
    if(quit_now){
2124
 
      ret = (int)TEMP_FAILURE_RETRY(close(sd));
 
2125
      ret = close(sd);
2125
2126
      if(ret == -1){
2126
2127
        perror_plus("close");
2127
2128
      }
2177
2178
    }
2178
2179
    
2179
2180
    /* Close the socket */
2180
 
    ret = (int)TEMP_FAILURE_RETRY(close(sd));
 
2181
    ret = close(sd);
2181
2182
    if(ret == -1){
2182
2183
      perror_plus("close");
2183
2184
    }
2265
2266
    }
2266
2267
    
2267
2268
    /* Close the socket */
2268
 
    int ret = (int)TEMP_FAILURE_RETRY(close(sd));
 
2269
    int ret = close(sd);
2269
2270
    if(ret == -1){
2270
2271
      perror_plus("close");
2271
2272
    }
2287
2288
 
2288
2289
int main(int argc, char *argv[]){
2289
2290
  mandos_context mc = { .server = NULL, .dh_bits = 0,
2290
 
                        .priority = "SECURE256:!CTYPE-X.509:"
2291
 
                        "+CTYPE-OPENPGP:!RSA", .current_server = NULL,
2292
 
                        .interfaces = NULL, .interfaces_size = 0 };
 
2291
                        .priority = "SECURE256:!CTYPE-X.509"
 
2292
                        ":+CTYPE-OPENPGP:!RSA:+SIGN-DSA-SHA256",
 
2293
                        .current_server = NULL, .interfaces = NULL,
 
2294
                        .interfaces_size = 0 };
2293
2295
  AvahiSServiceBrowser *sb = NULL;
2294
2296
  error_t ret_errno;
2295
2297
  int ret;
2522
2524
              }
2523
2525
            }
2524
2526
          }
2525
 
          TEMP_FAILURE_RETRY(close(seckey_fd));
 
2527
          close(seckey_fd);
2526
2528
        }
2527
2529
      }
2528
2530
      
2543
2545
              }
2544
2546
            }
2545
2547
          }
2546
 
          TEMP_FAILURE_RETRY(close(pubkey_fd));
 
2548
          close(pubkey_fd);
2547
2549
        }
2548
2550
      }
2549
2551
      
2550
 
      if(strcmp(dh_params_file, PATHDIR "/dhparams.pem" ) == 0){
 
2552
      if(dh_params_file != NULL
 
2553
         and strcmp(dh_params_file, PATHDIR "/dhparams.pem" ) == 0){
2551
2554
        int dhparams_fd = open(dh_params_file, O_RDONLY);
2552
2555
        if(dhparams_fd == -1){
2553
2556
          perror_plus("open");
2564
2567
              }
2565
2568
            }
2566
2569
          }
2567
 
          TEMP_FAILURE_RETRY(close(dhparams_fd));
 
2570
          close(dhparams_fd);
2568
2571
        }
2569
2572
      }
2570
2573
      
3083
3086
          perror_plus("rmdir");
3084
3087
        }
3085
3088
      }
3086
 
      TEMP_FAILURE_RETRY(close(tempdir_fd));
 
3089
      close(tempdir_fd);
3087
3090
    }
3088
3091
  }
3089
3092