/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: 2014-07-14 21:41:08 UTC
  • Revision ID: teddy@recompile.se-20140714214108-awg7u6gaiy7d40dz
mandos-monitor: New "verbose" mode to see less important log messages.

* mandos-monitor (MandosClientWidget.__init__): Log client creation.
  (MandosClientWidget.checker_completed): Log a successful checker.
  (MandosClientWidget.checker_started): Log starting of a checker.
  (UserInterface.__init__): New optional "log_level" argument.
  (UserInterface.log_message, UserInterface.log_message_raw): Take
                                                              optional
                                                              "level"
                                                              arg.
  (UserInterface.toggle_log_display): Log visibility change.
  (UserInterface.change_log_display): Log wrap mode change.
  (UserInterface.process_input): Show new "v" key in help message and
                                 process "v" key if pressed.
* mandos-monitor.xml (KEYS): Document new "v" key.

Show diffs side-by-side

added added

removed removed

Lines of Context:
240
240
  ret = clock_gettime(CLOCK_MONOTONIC, &(new_server->last_seen));
241
241
  if(ret == -1){
242
242
    perror_plus("clock_gettime");
243
 
#ifdef __GNUC__
244
 
#pragma GCC diagnostic push
245
 
#pragma GCC diagnostic ignored "-Wcast-qual"
246
 
#endif
247
 
    free((char *)(new_server->ip));
248
 
#ifdef __GNUC__
249
 
#pragma GCC diagnostic pop
250
 
#endif
 
243
    free(new_server->ip);
251
244
    free(new_server);
252
245
    return false;
253
246
  }
1076
1069
     timed out */
1077
1070
  
1078
1071
  if(quit_now){
1079
 
    avahi_s_service_resolver_free(r);
1080
1072
    return;
1081
1073
  }
1082
1074
  
1650
1642
        _exit(EXIT_FAILURE);
1651
1643
      }
1652
1644
    } else {
1653
 
      if(hook_pid == -1){
1654
 
        perror_plus("fork");
1655
 
        free(direntry);
1656
 
        continue;
1657
 
      }
1658
1645
      int status;
1659
1646
      if(TEMP_FAILURE_RETRY(waitpid(hook_pid, &status, 0)) == -1){
1660
1647
        perror_plus("waitpid");
1661
 
        free(direntry);
1662
1648
        continue;
1663
1649
      }
1664
1650
      if(WIFEXITED(status)){
1666
1652
          fprintf_plus(stderr, "Warning: network hook \"%s\" exited"
1667
1653
                       " with status %d\n", direntry->d_name,
1668
1654
                       WEXITSTATUS(status));
1669
 
          free(direntry);
1670
1655
          continue;
1671
1656
        }
1672
1657
      } else if(WIFSIGNALED(status)){
1673
1658
        fprintf_plus(stderr, "Warning: network hook \"%s\" died by"
1674
1659
                     " signal %d\n", direntry->d_name,
1675
1660
                     WTERMSIG(status));
1676
 
        free(direntry);
1677
1661
        continue;
1678
1662
      } else {
1679
1663
        fprintf_plus(stderr, "Warning: network hook \"%s\""
1680
1664
                     " crashed\n", direntry->d_name);
1681
 
        free(direntry);
1682
1665
        continue;
1683
1666
      }
1684
1667
    }
1686
1669
      fprintf_plus(stderr, "Network hook \"%s\" ran successfully\n",
1687
1670
                   direntry->d_name);
1688
1671
    }
1689
 
    free(direntry);
1690
1672
  }
1691
1673
  free(direntries);
1692
1674
  if((int)TEMP_FAILURE_RETRY(close(hookdir_fd)) == -1){
1902
1884
int main(int argc, char *argv[]){
1903
1885
  mandos_context mc = { .server = NULL, .dh_bits = 1024,
1904
1886
                        .priority = "SECURE256:!CTYPE-X.509:"
1905
 
                        "+CTYPE-OPENPGP:!RSA", .current_server = NULL,
 
1887
                        "+CTYPE-OPENPGP", .current_server = NULL,
1906
1888
                        .interfaces = NULL, .interfaces_size = 0 };
1907
1889
  AvahiSServiceBrowser *sb = NULL;
1908
1890
  error_t ret_errno;
2286
2268
        if(ret_errno != 0){
2287
2269
          errno = ret_errno;
2288
2270
          perror_plus("argz_add");
2289
 
          free(direntries[i]);
2290
2271
          continue;
2291
2272
        }
2292
2273
        if(debug){
2293
2274
          fprintf_plus(stderr, "Will use interface \"%s\"\n",
2294
2275
                       direntries[i]->d_name);
2295
2276
        }
2296
 
        free(direntries[i]);
2297
2277
      }
2298
2278
      free(direntries);
2299
2279
    } else {
2569
2549
    mc.current_server->prev->next = NULL;
2570
2550
    while(mc.current_server != NULL){
2571
2551
      server *next = mc.current_server->next;
2572
 
#ifdef __GNUC__
2573
 
#pragma GCC diagnostic push
2574
 
#pragma GCC diagnostic ignored "-Wcast-qual"
2575
 
#endif
2576
 
      free((char *)(mc.current_server->ip));
2577
 
#ifdef __GNUC__
2578
 
#pragma GCC diagnostic pop
2579
 
#endif
2580
2552
      free(mc.current_server);
2581
2553
      mc.current_server = next;
2582
2554
    }
2651
2623
                         " \"%s\", 0): %s\n", tempdir,
2652
2624
                         direntries[i]->d_name, strerror(errno));
2653
2625
          }
2654
 
          free(direntries[i]);
2655
2626
        }
2656
2627
        
2657
2628
        /* need to clean even if 0 because man page doesn't specify */