corrected makefile
[gnutls.git] / tests / setcredcrash.c
bloba18e5729f3c50891d563f1b25a41fbfc40042462
1 /*
2 * Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 * Author: Simon Josefsson
6 * This file is part of GnuTLS.
8 * GnuTLS is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * GnuTLS is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with GnuTLS; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <gnutls/gnutls.h>
32 int
33 main (int argc, char *argv[])
35 gnutls_anon_client_credentials_t c_anoncred;
36 gnutls_session_t client;
38 gnutls_global_init ();
40 gnutls_anon_allocate_client_credentials (&c_anoncred);
41 gnutls_init (&client, GNUTLS_CLIENT);
42 gnutls_set_default_priority (client);
44 /* Test setting the same credential type twice. Earlier GnuTLS had
45 a bug that crashed when this happened. */
46 gnutls_credentials_set (client, GNUTLS_CRD_ANON, c_anoncred);
47 gnutls_credentials_set (client, GNUTLS_CRD_ANON, c_anoncred);
49 gnutls_deinit (client);
50 gnutls_anon_free_client_credentials (c_anoncred);
52 gnutls_global_deinit ();
54 return 0;