at 22.05-pre 104 lines 3.8 kB view raw
1https://bugzilla.redhat.com/show_bug.cgi?id=488857 2 3 4Distinguish between contexts that are somewhat persistent and one-offs 5which are used to fulfill part of a larger request. 6 7diff -up nss_ldap-253/ldap-grp.c nss_ldap-253/ldap-grp.c 8--- nss_ldap-253/ldap-grp.c 2009-05-08 13:30:43.000000000 -0400 9+++ nss_ldap-253/ldap-grp.c 2009-05-08 13:34:41.000000000 -0400 10@@ -857,7 +857,7 @@ ng_chase (const char *dn, ldap_initgroup 11 LA_STRING (a) = dn; 12 LA_TYPE (a) = LA_TYPE_STRING; 13 14- if (_nss_ldap_ent_context_init_locked (&ctx) == NULL) 15+ if (_nss_ldap_ent_context_init_internal_locked (&ctx) == NULL) 16 { 17 return NSS_UNAVAIL; 18 } 19@@ -930,7 +930,7 @@ ng_chase_backlink (const char ** members 20 LA_STRING_LIST (a) = filteredMembersOf; 21 LA_TYPE (a) = LA_TYPE_STRING_LIST_OR; 22 23- if (_nss_ldap_ent_context_init_locked (&ctx) == NULL) 24+ if (_nss_ldap_ent_context_init_internal_locked (&ctx) == NULL) 25 { 26 free (filteredMembersOf); 27 return NSS_UNAVAIL; 28diff -up nss_ldap-253/ldap-netgrp.c nss_ldap-253/ldap-netgrp.c 29--- nss_ldap-253/ldap-netgrp.c 2009-05-08 13:31:35.000000000 -0400 30+++ nss_ldap-253/ldap-netgrp.c 2009-05-08 13:33:14.000000000 -0400 31@@ -691,7 +691,7 @@ do_innetgr_nested (ldap_innetgr_args_t * 32 LA_TYPE (a) = LA_TYPE_STRING; 33 LA_STRING (a) = nested; /* memberNisNetgroup */ 34 35- if (_nss_ldap_ent_context_init_locked (&ctx) == NULL) 36+ if (_nss_ldap_ent_context_init_internal_locked (&ctx) == NULL) 37 { 38 debug ("<== do_innetgr_nested: failed to initialize context"); 39 return NSS_UNAVAIL; 40diff -up nss_ldap-253/ldap-nss.c nss_ldap-253/ldap-nss.c 41--- nss_ldap-253/ldap-nss.c 2009-05-08 13:27:17.000000000 -0400 42+++ nss_ldap-253/ldap-nss.c 2009-05-08 14:05:51.000000000 -0400 43@@ -1961,6 +1961,7 @@ _nss_ldap_ent_context_init_locked (ent_c 44 debug ("<== _nss_ldap_ent_context_init_locked"); 45 return NULL; 46 } 47+ ctx->ec_internal = 0; 48 *pctx = ctx; 49 } 50 else 51@@ -1990,6 +1991,15 @@ _nss_ldap_ent_context_init_locked (ent_c 52 53 return ctx; 54 } 55+ent_context_t * 56+_nss_ldap_ent_context_init_internal_locked (ent_context_t ** pctx) 57+{ 58+ ent_context_t *ctx; 59+ ctx = _nss_ldap_ent_context_init_locked (pctx); 60+ if (ctx != NULL) 61+ ctx->ec_internal = 1; 62+ return ctx; 63+} 64 65 /* 66 * Clears a given context; we require the caller 67@@ -2031,7 +2041,8 @@ _nss_ldap_ent_context_release (ent_conte 68 69 LS_INIT (ctx->ec_state); 70 71- if (_nss_ldap_test_config_flag (NSS_LDAP_FLAGS_CONNECT_POLICY_ONESHOT)) 72+ if (!ctx->ec_internal && 73+ _nss_ldap_test_config_flag (NSS_LDAP_FLAGS_CONNECT_POLICY_ONESHOT)) 74 { 75 do_close (); 76 } 77diff -up nss_ldap-253/ldap-nss.h nss_ldap-253/ldap-nss.h 78--- nss_ldap-253/ldap-nss.h 2009-05-08 13:35:47.000000000 -0400 79+++ nss_ldap-253/ldap-nss.h 2009-05-08 13:52:25.000000000 -0400 80@@ -560,6 +560,8 @@ struct ent_context 81 ldap_state_t ec_state; /* eg. for services */ 82 int ec_msgid; /* message ID */ 83 LDAPMessage *ec_res; /* result chain */ 84+ int ec_internal; /* this context is just a part of a larger 85+ * query for information */ 86 ldap_service_search_descriptor_t *ec_sd; /* current sd */ 87 struct berval *ec_cookie; /* cookie for paged searches */ 88 }; 89@@ -744,6 +746,15 @@ ent_context_t *_nss_ldap_ent_context_ini 90 ent_context_t *_nss_ldap_ent_context_init_locked (ent_context_t **); 91 92 /* 93+ * _nss_ldap_ent_context_init_internal_locked() has the same 94+ * behaviour, except it marks the context as one that's being 95+ * used to fetch additional data used in answering a request, i.e. 96+ * that this isn't the "main" context 97+ */ 98+ 99+ent_context_t *_nss_ldap_ent_context_init_internal_locked (ent_context_t **); 100+ 101+/* 102 * _nss_ldap_ent_context_release() is used to manually free a context 103 */ 104 void _nss_ldap_ent_context_release (ent_context_t *);