/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/password-request.c

  • Committer: Björn Påhlsson
  • Date: 2008-08-08 01:31:58 UTC
  • mto: (237.7.1 mandos) (24.1.154 mandos)
  • mto: This revision was merged to the branch mainline in revision 50.
  • Revision ID: belorn@braxen-20080808013158-weqgqkxni7du1ke5
Added manual pages for:
      clients.conf
      mandos.conf
      mandos
      mandos-client
      password-prompt
      password-request

Show diffs side-by-side

added added

removed removed

Lines of Context:
319
319
      != GNUTLS_E_SUCCESS) {
320
320
    fprintf (stderr, "GnuTLS memory error: %s\n",
321
321
             safer_gnutls_strerror(ret));
 
322
    gnutls_global_deinit ();
322
323
    return -1;
323
324
  }
324
325
  
336
337
            " '%s')\n", ret, pubkeyfile, seckeyfile);
337
338
    fprintf(stdout, "The GnuTLS error is: %s\n",
338
339
            safer_gnutls_strerror(ret));
339
 
    return -1;
 
340
    goto globalfail;
340
341
  }
341
342
  
342
343
  /* GnuTLS server initialization */
344
345
  if (ret != GNUTLS_E_SUCCESS) {
345
346
    fprintf (stderr, "Error in GnuTLS DH parameter initialization:"
346
347
             " %s\n", safer_gnutls_strerror(ret));
347
 
    return -1;
 
348
    goto globalfail;
348
349
  }
349
350
  ret = gnutls_dh_params_generate2(mc->dh_params, mc->dh_bits);
350
351
  if (ret != GNUTLS_E_SUCCESS) {
351
352
    fprintf (stderr, "Error in GnuTLS prime generation: %s\n",
352
353
             safer_gnutls_strerror(ret));
353
 
    return -1;
 
354
    goto globalfail;
354
355
  }
355
356
  
356
357
  gnutls_certificate_set_dh_params(mc->cred, mc->dh_params);
357
358
 
358
359
  return 0;
 
360
 
 
361
 globalfail:
 
362
 
 
363
  gnutls_certificate_free_credentials (mc->cred);
 
364
  gnutls_global_deinit ();
 
365
  return -1;
 
366
 
359
367
}
360
368
 
361
369
static int init_gnutls_session(mandos_context *mc,
375
383
      fprintf(stderr, "Syntax error at: %s\n", err);
376
384
      fprintf(stderr, "GnuTLS error: %s\n",
377
385
              safer_gnutls_strerror(ret));
 
386
      gnutls_deinit (*session);
378
387
      return -1;
379
388
    }
380
389
  }
384
393
  if (ret != GNUTLS_E_SUCCESS) {
385
394
    fprintf(stderr, "Error setting GnuTLS credentials: %s\n",
386
395
            safer_gnutls_strerror(ret));
 
396
    gnutls_deinit (*session);
387
397
    return -1;
388
398
  }
389
399
  
603
613
  free(buffer);
604
614
  close(tcp_sd);
605
615
  gnutls_deinit (session);
606
 
  gnutls_certificate_free_credentials (mc->cred);
607
 
  gnutls_global_deinit ();
608
616
  return retval;
609
617
}
610
618
 
741
749
    const char *seckeyfile = "seckey.txt";
742
750
    mandos_context mc = { .simple_poll = NULL, .server = NULL,
743
751
                          .dh_bits = 1024, .priority = "SECURE256"};
 
752
    bool gnutls_initalized = false;
744
753
    
745
754
    {
746
755
      struct argp_option options[] = {
846
855
    if (ret == -1){
847
856
      fprintf(stderr, "init_gnutls_global\n");
848
857
      goto end;
 
858
    } else {
 
859
      gnutls_initalized = true;
849
860
    }
850
861
 
851
862
    uid = getuid();
1000
1011
        avahi_simple_poll_free(mc.simple_poll);
1001
1012
    free(pubkeyfile);
1002
1013
    free(seckeyfile);
 
1014
 
 
1015
    if (gnutls_initalized){
 
1016
      gnutls_certificate_free_credentials (mc.cred);
 
1017
      gnutls_global_deinit ();
 
1018
    }
1003
1019
    
1004
1020
    return exitcode;
1005
1021
}