/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-13 04:45:33 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090113044533-de691yv0fa5w6quw
* plugins.d/mandos-client.c: Only comment changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
#include <fcntl.h>              /* open() */
58
58
#include <dirent.h>             /* opendir(), struct dirent, readdir()
59
59
                                 */
60
 
#include <inttypes.h>           /* PRIu16, intmax_t, SCNdMAX */
 
60
#include <inttypes.h>           /* PRIu16, SCNu16 */
61
61
#include <assert.h>             /* assert() */
62
62
#include <errno.h>              /* perror(), errno */
63
63
#include <time.h>               /* time() */
754
754
      avahi_address_snprint(ip, sizeof(ip), address);
755
755
      if(debug){
756
756
        fprintf(stderr, "Mandos server \"%s\" found on %s (%s, %"
757
 
                PRIdMAX ") on port %" PRIu16 "\n", name, host_name,
758
 
                ip, (intmax_t)interface, port);
 
757
                PRIu16 ") on port %d\n", name, host_name, ip,
 
758
                interface, port);
759
759
      }
760
760
      int ret = start_mandos_communication(ip, port, interface, mc);
761
761
      if(ret == 0){
821
821
    AvahiSServiceBrowser *sb = NULL;
822
822
    int error;
823
823
    int ret;
824
 
    intmax_t tmpmax;
825
 
    int numchars;
826
824
    int exitcode = EXIT_SUCCESS;
827
825
    const char *interface = "eth0";
828
826
    struct ifreq network;
893
891
          pubkey = arg;
894
892
          break;
895
893
        case 129:               /* --dh-bits */
896
 
          ret = sscanf(arg, "%" SCNdMAX "%n", &tmpmax, &numchars);
897
 
          if(ret < 1 or tmpmax != (typeof(mc.dh_bits))tmpmax
898
 
             or arg[numchars] != '\0'){
 
894
          ret = sscanf(arg, "%u", &mc.dh_bits);
 
895
          if(ret != 1){
899
896
            fprintf(stderr, "Bad number of DH bits\n");
900
897
            exit(EXIT_FAILURE);
901
898
          }
902
 
          mc.dh_bits = (typeof(mc.dh_bits))tmpmax;
903
899
          break;
904
900
        case 130:               /* --priority */
905
901
          mc.priority = arg;
1008
1004
        goto end;
1009
1005
      }
1010
1006
      uint16_t port;
1011
 
      ret = sscanf(address+1, "%" SCNdMAX "%n", &tmpmax, &numchars);
1012
 
      if(ret < 1 or tmpmax != (uint16_t)tmpmax
1013
 
         or address[numchars+1] != '\0'){
 
1007
      ret = sscanf(address+1, "%" SCNu16, &port);
 
1008
      if(ret != 1){
1014
1009
        fprintf(stderr, "Bad port number\n");
1015
1010
        exitcode = EXIT_FAILURE;
1016
1011
        goto end;
1017
1012
      }
1018
 
      port = (uint16_t)tmpmax;
1019
1013
      *address = '\0';
1020
1014
      address = connect_to;
1021
1015
      ret = start_mandos_communication(address, port, if_index, &mc);