]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - nss_ldap/patches/nss_ldap-265-ent_internal.patch
Change file layout of the makefiles.
[people/amarx/ipfire-3.x.git] / nss_ldap / patches / nss_ldap-265-ent_internal.patch
1 Distinguish between contexts that are somewhat persistent and one-offs
2 which are used to fulfill part of a larger request. Proposed for #322.
3
4 diff -up nss_ldap-265/ldap-grp.c nss_ldap-265/ldap-grp.c
5 --- nss_ldap-265/ldap-grp.c 2010-01-08 17:38:38.000000000 -0500
6 +++ nss_ldap-265/ldap-grp.c 2010-01-08 17:38:38.000000000 -0500
7 @@ -859,7 +859,7 @@ ng_chase (const char *dn, ldap_initgroup
8 LA_STRING (a) = dn;
9 LA_TYPE (a) = LA_TYPE_STRING;
10
11 - if (_nss_ldap_ent_context_init_locked (&ctx) == NULL)
12 + if (_nss_ldap_ent_context_init_internal_locked (&ctx) == NULL)
13 {
14 return NSS_UNAVAIL;
15 }
16 @@ -931,7 +931,7 @@ ng_chase_backlink (const char ** members
17 LA_STRING_LIST (a) = filteredMembersOf;
18 LA_TYPE (a) = LA_TYPE_STRING_LIST_OR;
19
20 - if (_nss_ldap_ent_context_init_locked (&ctx) == NULL)
21 + if (_nss_ldap_ent_context_init_internal_locked (&ctx) == NULL)
22 {
23 free (filteredMembersOf);
24 return NSS_UNAVAIL;
25 diff -up nss_ldap-265/ldap-netgrp.c nss_ldap-265/ldap-netgrp.c
26 --- nss_ldap-265/ldap-netgrp.c 2009-11-06 05:28:08.000000000 -0500
27 +++ nss_ldap-265/ldap-netgrp.c 2010-01-08 17:38:38.000000000 -0500
28 @@ -691,7 +691,7 @@ do_innetgr_nested (ldap_innetgr_args_t *
29 LA_TYPE (a) = LA_TYPE_STRING;
30 LA_STRING (a) = nested; /* memberNisNetgroup */
31
32 - if (_nss_ldap_ent_context_init_locked (&ctx) == NULL)
33 + if (_nss_ldap_ent_context_init_internal_locked (&ctx) == NULL)
34 {
35 debug ("<== do_innetgr_nested: failed to initialize context");
36 return NSS_UNAVAIL;
37 diff -up nss_ldap-265/ldap-nss.c nss_ldap-265/ldap-nss.c
38 --- nss_ldap-265/ldap-nss.c 2010-01-08 17:38:38.000000000 -0500
39 +++ nss_ldap-265/ldap-nss.c 2010-01-08 17:40:37.000000000 -0500
40 @@ -2043,6 +2043,7 @@ _nss_ldap_ent_context_init_locked (ent_c
41 debug ("<== _nss_ldap_ent_context_init_locked");
42 return NULL;
43 }
44 + ctx->ec_internal = 0;
45 *pctx = ctx;
46 }
47 else
48 @@ -2104,7 +2105,8 @@ do_context_release (ent_context_t * ctx,
49
50 LS_INIT (ctx->ec_state);
51
52 - if (_nss_ldap_test_config_flag (NSS_LDAP_FLAGS_CONNECT_POLICY_ONESHOT))
53 + if (!ctx->ec_internal &&
54 + _nss_ldap_test_config_flag (NSS_LDAP_FLAGS_CONNECT_POLICY_ONESHOT))
55 {
56 do_close ();
57 }
58 @@ -2113,6 +2115,16 @@ do_context_release (ent_context_t * ctx,
59 free (ctx);
60 }
61
62 +ent_context_t *
63 +_nss_ldap_ent_context_init_internal_locked (ent_context_t ** pctx)
64 +{
65 + ent_context_t *ctx;
66 + ctx = _nss_ldap_ent_context_init_locked (pctx);
67 + if (ctx != NULL)
68 + ctx->ec_internal = 1;
69 + return ctx;
70 +}
71 +
72 /*
73 * Clears a given context; we require the caller
74 * to acquire the lock.
75 diff -up nss_ldap-265/ldap-nss.h nss_ldap-265/ldap-nss.h
76 --- nss_ldap-265/ldap-nss.h 2010-01-08 17:38:38.000000000 -0500
77 +++ nss_ldap-265/ldap-nss.h 2010-01-08 17:42:34.000000000 -0500
78 @@ -574,6 +574,8 @@ struct ent_context
79 ldap_state_t ec_state; /* eg. for services */
80 int ec_msgid; /* message ID */
81 LDAPMessage *ec_res; /* result chain */
82 + int ec_internal; /* this context is just a part of a larger
83 + * query for information */
84 ldap_service_search_descriptor_t *ec_sd; /* current sd */
85 struct berval *ec_cookie; /* cookie for paged searches */
86 int ec_eof; /* reached notional end of file */
87 @@ -769,6 +771,15 @@ ent_context_t *_nss_ldap_ent_context_ini
88 ent_context_t *_nss_ldap_ent_context_init_locked (ent_context_t **);
89
90 /*
91 + * _nss_ldap_ent_context_init_internal_locked() has the same
92 + * behaviour, except it marks the context as one that's being
93 + * used to fetch additional data used in answering a request, i.e.
94 + * that this isn't the "main" context
95 + */
96 +
97 +ent_context_t *_nss_ldap_ent_context_init_internal_locked (ent_context_t **);
98 +
99 +/*
100 * _nss_ldap_ent_context_release() is used to manually free a context
101 */
102 void _nss_ldap_ent_context_release (ent_context_t **);