|
|
|
1 |
From 00942d17ab9c32e7366f70f91d7e4eea31e3f2ed Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?J=C3=BCrn=20Brodersen?= <brodersen@univention.de> |
3 |
Date: Thu, 18 Feb 2021 18:34:15 +0100 |
4 |
Subject: [PATCH] foooo |
5 |
Organization: Univention GmbH, Bremen, Germany |
6 |
|
7 |
--- |
8 |
cy2_saml.c | 7 ++++--- |
9 |
pam_saml.c | 7 +++++-- |
10 |
2 files changed, 9 insertions(+), 5 deletions(-) |
11 |
|
12 |
diff --git a/cy2_saml.c b/cy2_saml.c |
13 |
index 398715c..5e8824c 100644 |
14 |
--- a/cy2_saml.c |
15 |
+++ b/cy2_saml.c |
16 |
@@ -58,6 +58,7 @@ __RCSID("$Id: cy2_saml.c,v 1.12 2017/05/24 22:47:15 manu Exp $"); |
17 |
|
18 |
#include "plugin_common.h" |
19 |
|
20 |
+static int lasso_is_initialized = 0; |
21 |
|
22 |
typedef struct { |
23 |
char *out; |
24 |
@@ -348,8 +349,6 @@ saml_server_mech_free(glob_context, utils) |
25 |
gctx->lasso_server = NULL; |
26 |
} |
27 |
|
28 |
- lasso_shutdown(); |
29 |
- |
30 |
/* |
31 |
* Do not free (saml_glob_context_t *)glob_context, it is static! |
32 |
*/ |
33 |
@@ -401,9 +400,11 @@ sasl_server_plug_init(utils, maxvers, outvers, pluglist, plugcount) |
34 |
*pluglist = &saml_server_plugin; |
35 |
*plugcount = 1; |
36 |
|
37 |
- if (lasso_init() != 0) { |
38 |
+ if (!lasso_is_initialized && lasso_init() != 0) { |
39 |
utils->seterror(utils->conn, 0, "lasso_init() failed"); |
40 |
return SASL_FAIL; |
41 |
+ } else { |
42 |
+ lasso_is_initialized = 1; |
43 |
} |
44 |
|
45 |
gctx = (saml_glob_context_t *)saml_server_plugin.glob_context; |
46 |
diff --git a/pam_saml.c b/pam_saml.c |
47 |
index a9f99cc..eea7036 100644 |
48 |
--- a/pam_saml.c |
49 |
+++ b/pam_saml.c |
50 |
@@ -62,6 +62,8 @@ __RCSID("$Id: pam_saml.c,v 1.14 2017/08/13 14:29:00 manu Exp $"); |
51 |
|
52 |
#define GCTX_DATA "CRUDESAML-GCTX" |
53 |
|
54 |
+static int lasso_is_initialized = 0; |
55 |
+ |
56 |
void |
57 |
saml_log(const void *utils, int pri, const char *fmt, ...) |
58 |
{ |
59 |
@@ -153,7 +155,6 @@ gctx_cleanup(pamh, data, error) |
60 |
gctx->lasso_server = NULL; |
61 |
} |
62 |
|
63 |
- lasso_shutdown(); |
64 |
free(gctx); |
65 |
gctx = NULL; |
66 |
} |
67 |
@@ -182,9 +183,11 @@ pam_global_context_init(pamh, ac, av) |
68 |
/* |
69 |
* Initialize lasso |
70 |
*/ |
71 |
- if (lasso_init() != 0) { |
72 |
+ if (!lasso_is_initialized && lasso_init() != 0) { |
73 |
syslog(LOG_ERR, "lasso_init() failed"); |
74 |
return NULL; |
75 |
+ } else { |
76 |
+ lasso_is_initialized = 1; |
77 |
} |
78 |
|
79 |
if ((gctx = malloc(sizeof(*gctx))) == NULL) { |
80 |
-- |
81 |
2.27.0 |
82 |
|