/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugins.d/mandos-client.c

merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
309
309
        }
310
310
        gpgme_recipient_t recipient;
311
311
        recipient = result->recipients;
312
 
        while(recipient != NULL){
313
 
          fprintf(stderr, "Public key algorithm: %s\n",
314
 
                  gpgme_pubkey_algo_name(recipient->pubkey_algo));
315
 
          fprintf(stderr, "Key ID: %s\n", recipient->keyid);
316
 
          fprintf(stderr, "Secret key available: %s\n",
317
 
                  recipient->status == GPG_ERR_NO_SECKEY
318
 
                  ? "No" : "Yes");
319
 
          recipient = recipient->next;
 
312
        if(recipient){
 
313
          while(recipient != NULL){
 
314
            fprintf(stderr, "Public key algorithm: %s\n",
 
315
                    gpgme_pubkey_algo_name(recipient->pubkey_algo));
 
316
            fprintf(stderr, "Key ID: %s\n", recipient->keyid);
 
317
            fprintf(stderr, "Secret key available: %s\n",
 
318
                    recipient->status == GPG_ERR_NO_SECKEY
 
319
                    ? "No" : "Yes");
 
320
            recipient = recipient->next;
 
321
          }
320
322
        }
321
323
      }
322
324
    }
899
901
  int exitcode = EXIT_SUCCESS;
900
902
  const char *interface = "eth0";
901
903
  struct ifreq network;
902
 
  int sd = -1;
903
 
  bool interface_taken_up = false;
 
904
  int sd;
904
905
  uid_t uid;
905
906
  gid_t gid;
906
907
  char *connect_to = NULL;
1114
1115
#endif  /* __linux__ */
1115
1116
        goto end;
1116
1117
      }
1117
 
      interface_taken_up = true;
1118
1118
    }
1119
1119
    /* sleep checking until interface is running */
1120
1120
    for(int i=0; i < delay * 4; i++){
1130
1130
        perror("nanosleep");
1131
1131
      }
1132
1132
    }
1133
 
    if(not interface_taken_up){
1134
 
      ret = (int)TEMP_FAILURE_RETRY(close(sd));
1135
 
      if(ret == -1){
1136
 
        perror("close");
1137
 
      }
 
1133
    ret = (int)TEMP_FAILURE_RETRY(close(sd));
 
1134
    if(ret == -1){
 
1135
      perror("close");
1138
1136
    }
1139
1137
#ifdef __linux__
1140
1138
    if(restore_loglevel){
1301
1299
    gpgme_release(mc.ctx);
1302
1300
  }
1303
1301
  
1304
 
  /* Take down the network interface */
1305
 
  if(interface_taken_up){
1306
 
    ret = ioctl(sd, SIOCGIFFLAGS, &network);
1307
 
    if(ret == -1){
1308
 
      perror("ioctl SIOCGIFFLAGS");
1309
 
    } else if(network.ifr_flags & IFF_UP) {
1310
 
      network.ifr_flags &= ~IFF_UP; /* clear flag */
1311
 
      ret = ioctl(sd, SIOCSIFFLAGS, &network);
1312
 
      if(ret == -1){
1313
 
        perror("ioctl SIOCSIFFLAGS");
1314
 
      }
1315
 
    }
1316
 
    ret = (int)TEMP_FAILURE_RETRY(close(sd));
1317
 
    if(ret == -1){
1318
 
      perror("close");
1319
 
    }
1320
 
  }
1321
 
  
1322
1302
  /* Removes the temp directory used by GPGME */
1323
1303
  if(tempdir_created){
1324
1304
    DIR *d;