Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 912287 Details for
Bug 1071520
openldap does not re-register nss shutdown callbacks after nss_Shutdown is called
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Sample code to demonstrate the problem
ldapbug.c (text/plain), 3.80 KB, created by
Daniel Sands
on 2014-06-25 23:12:53 UTC
(
hide
)
Description:
Sample code to demonstrate the problem
Filename:
MIME Type:
Creator:
Daniel Sands
Created:
2014-06-25 23:12:53 UTC
Size:
3.80 KB
patch
obsolete
>#include <stdio.h> >#include <stdlib.h> >#include <ldap.h> >#include <sasl/sasl.h> > >#define LDAP_MECHANISM_EXTERNAL "EXTERNAL" > >static int lutil_sasl_interact( > LDAP *ld, > unsigned flags, > void *defaults, > void *in ) >{ > sasl_interact_t *interact = in; > > if( ld == NULL ) return LDAP_PARAM_ERROR; > > while( interact->id != SASL_CB_LIST_END ) { > const char *dflt = interact->defresult; > if( dflt && !*dflt ) dflt = NULL; > interact->result = (dflt && *dflt) ? dflt : ""; > interact->len = strlen( interact->result ); > > interact++; > } > > return LDAP_SUCCESS; >} > >int main(int argc, char *argv[]) >{ > int i; > const char *mech = LDAP_MECHANISM_EXTERNAL; > > for (i=0; i<10; i++) > { > LDAP *ld; > char *tmp; > int rc; > int idx; > > rc = ldap_initialize( &ld, argv[1]); > if ( ld == NULL) { > printf("ldap_initialize failed: %d\n", rc); > printf( "Loop: %d\n", i); > exit(1); > } > > rc = LDAP_VERSION3; > ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &rc); > > /* Using custom TLS settings seems to be an all or nothing proposition. > * So we'll start by copying all the settings from global and then > * any individual overrides can be done. > */ > static const int TLS_Constants[] = { > LDAP_OPT_X_TLS_CACERTDIR, > LDAP_OPT_X_TLS_CACERTFILE, > LDAP_OPT_X_TLS_CERTFILE, > LDAP_OPT_X_TLS_CIPHER_SUITE, > LDAP_OPT_X_TLS_CRLFILE, > LDAP_OPT_X_TLS_DHFILE, > LDAP_OPT_X_TLS_KEYFILE, > LDAP_OPT_X_TLS_RANDOM_FILE, > > LDAP_OPT_X_TLS_REQUIRE_CERT, > LDAP_OPT_X_TLS_PROTOCOL_MIN, > LDAP_OPT_X_TLS_CRLCHECK, > }; > > /* The first 8 settings are strings, so use memory management */ > for (idx=0; idx<8; idx++) > { > char *t; > if (ldap_get_option( NULL, TLS_Constants[idx], &t) == LDAP_OPT_SUCCESS) > { > ldap_set_option( ld, TLS_Constants[idx], t); > ldap_memfree( t); > } > } > /* The remaining settings are ints */ > for (; idx<11; idx++) > { > int t; > if (ldap_get_option( NULL, TLS_Constants[idx], &t) == LDAP_OPT_SUCCESS) > { > ldap_set_option( ld, TLS_Constants[idx], &t); > } > } > > tmp = getenv( "HPSS_LDAP_CA_DIR"); > if (tmp != NULL && tmp[0] != '\0') > { > ldap_set_option( ld, LDAP_OPT_X_TLS_CACERTDIR, tmp); > } > tmp = getenv( "HPSS_LDAP_CA_FILE"); > if (tmp != NULL && tmp[0] != '\0') > { > ldap_set_option( ld, LDAP_OPT_X_TLS_CACERTFILE, tmp); > } > tmp = getenv( "HPSS_LDAP_CERT"); > if (tmp != NULL && tmp[0] != '\0') > { > ldap_set_option( ld, LDAP_OPT_X_TLS_CERTFILE, tmp); > } > tmp = getenv( "HPSS_LDAP_KEY"); > if (tmp != NULL && tmp[0] != '\0') > { > ldap_set_option( ld, LDAP_OPT_X_TLS_KEYFILE, tmp); > } > > /* This option is a workaround to make the previous 3 actually take effect. > * It very well might be intended that this be used, but it seems to be a > * kludge. If no options needed to be changed, I would not need to > * tell TLS whether I'm a client or server, for one thing. In this call, I > * tell it I'm a client by setting the option integer to 0. Oh well > */ > rc = 0; > ldap_set_option( ld, LDAP_OPT_X_TLS_NEWCTX, &rc); > > rc = ldap_sasl_interactive_bind_s(ld, > NULL, > mech, > NULL, > NULL, > LDAP_SASL_QUIET, > lutil_sasl_interact, > NULL); > if (rc < 0) > { > printf( "Error in LDAP bind: %d\n", rc); > printf( "Loop: %d\n", i); > exit(1); > } > > ldap_unbind_ext_s(ld, NULL, NULL); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1071520
: 912287