Bump versions.
[gsasl.git] / lib / src / xfinish.c
blobef12d8056cb769b21eca46c404f51b845622fc9b
1 /* xfinish.c --- Finish libgsasl session.
2 * Copyright (C) 2002, 2003, 2004, 2005, 2006 Simon Josefsson
4 * This file is part of GNU SASL Library.
6 * GNU SASL Library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * GNU SASL Library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License License along with GNU SASL Library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #include "internal.h"
25 /**
26 * gsasl_finish:
27 * @sctx: libgsasl session handle.
29 * Destroy a libgsasl client or server handle. The handle must not be
30 * used with other libgsasl functions after this call.
31 **/
32 void
33 gsasl_finish (Gsasl_session * sctx)
35 if (sctx->clientp)
37 if (sctx->mech && sctx->mech->client.finish)
38 sctx->mech->client.finish (sctx, sctx->mech_data);
40 else
42 if (sctx->mech && sctx->mech->server.finish)
43 sctx->mech->server.finish (sctx, sctx->mech_data);
46 if (sctx->anonymous_token)
47 free (sctx->anonymous_token);
49 if (sctx->authid)
50 free (sctx->authid);
52 if (sctx->authzid)
53 free (sctx->authzid);
55 if (sctx->password)
56 free (sctx->password);
58 if (sctx->passcode)
59 free (sctx->passcode);
61 if (sctx->pin)
62 free (sctx->pin);
64 if (sctx->suggestedpin)
65 free (sctx->suggestedpin);
67 if (sctx->service)
68 free (sctx->service);
70 if (sctx->hostname)
71 free (sctx->hostname);
73 if (sctx->gssapi_display_name)
74 free (sctx->gssapi_display_name);
76 if (sctx->realm)
77 free (sctx->realm);
79 free (sctx);