diff options
author | Rich Megginson <rmeggins@redhat.com> | 2007-10-10 01:55:36 +0000 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2007-10-10 01:55:36 +0000 |
commit | 95094b83959c600871a7153b29f939795669ee13 (patch) | |
tree | 4b559bbffc39af1265aba55f60193a8f7066b75b /ldap | |
parent | 1291ed2618b5b2a111e82c193c195e03370ef2ba (diff) | |
download | ds-95094b83959c600871a7153b29f939795669ee13.tar.gz ds-95094b83959c600871a7153b29f939795669ee13.tar.xz ds-95094b83959c600871a7153b29f939795669ee13.zip |
Resolves: bug 244475
Bug Description: crash at startup with new ldap sdk on 64-bit platform
Reviewed by: nkinder (Thanks!)
Fix Description: I went ahead and cleaned up or removed the incorrect ber code. We do not need to use LBER_SOCKBUF_OPT_DESC or LBER_SOCKBUF_OPT_READ_FN or LBER_SOCKBUF_OPT_WRITE_FN. I removed an unnecessary malloc/free and just used the stack as we do everywhere else in the code. It looks as though the start_tls cleanup code is almost never used - the code assumes that when you do a start_tls, that stays in force throughout the lifetime of the connection. Removing this code now should insulate us from future ldap c sdk changes.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
Diffstat (limited to 'ldap')
-rw-r--r-- | ldap/servers/slapd/daemon.c | 19 | ||||
-rw-r--r-- | ldap/servers/slapd/start_tls_extop.c | 32 |
2 files changed, 9 insertions, 42 deletions
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c index 8d4f2f60..38c4e236 100644 --- a/ldap/servers/slapd/daemon.c +++ b/ldap/servers/slapd/daemon.c @@ -2242,13 +2242,9 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i } PR_Lock( conn->c_mutex ); -#if !defined( XP_WIN32 ) - ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&pr_clonefd); -#else +#if defined( XP_WIN32 ) if( !secure ) ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&ns); - else - ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&pr_clonefd); #endif conn->c_sd = ns; @@ -2288,13 +2284,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i func_pointers.lbextiofn_socket_arg = (struct lextiof_socket_private *) pr_clonefd; ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers); - - /* changed here by Cheston - ber_sockbuf_set_option( conn->c_sb, - LBER_SOCKBUF_OPT_READ_FN, (void *)secure_read_function ); - ber_sockbuf_set_option( conn->c_sb, - LBER_SOCKBUF_OPT_WRITE_FN, (void *)secure_write_function ); - */ } else { struct lber_x_ext_io_fns func_pointers; memset(&func_pointers, 0, sizeof(func_pointers)); @@ -2309,12 +2298,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i #endif ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers); - /* - ber_sockbuf_set_option( conn->c_sb, - LBER_SOCKBUF_OPT_READ_FN, (void *)read_function ); - ber_sockbuf_set_option( conn->c_sb, - LBER_SOCKBUF_OPT_WRITE_FN, (void *)write_function ); - */ } if( secure && config_get_SSLclientAuth() != SLAPD_SSLCLIENTAUTH_OFF ) { diff --git a/ldap/servers/slapd/start_tls_extop.c b/ldap/servers/slapd/start_tls_extop.c index 3b4fadcb..d5e2b98b 100644 --- a/ldap/servers/slapd/start_tls_extop.c +++ b/ldap/servers/slapd/start_tls_extop.c @@ -277,24 +277,17 @@ start_tls( Slapi_PBlock *pb ) secure = 1; ns = configure_pr_socket( &newsocket, secure, 0 /*never local*/ ); - - /* - ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_DESC, &newsocket ); - ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_READ_FN, (void *)secure_read_function ); - ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_WRITE_FN, (void *)secure_write_function ); - */ - /*changed to */ { - struct lber_x_ext_io_fns *func_pointers = malloc(LBER_X_EXTIO_FNS_SIZE); - func_pointers->lbextiofn_size = LBER_X_EXTIO_FNS_SIZE; - func_pointers->lbextiofn_read = secure_read_function; - func_pointers->lbextiofn_write = secure_write_function; - func_pointers->lbextiofn_writev = NULL; - func_pointers->lbextiofn_socket_arg = (struct lextiof_socket_private *) newsocket; + struct lber_x_ext_io_fns func_pointers; + memset(&func_pointers, 0, sizeof(func_pointers)); + func_pointers.lbextiofn_size = LBER_X_EXTIO_FNS_SIZE; + func_pointers.lbextiofn_read = secure_read_function; + func_pointers.lbextiofn_write = secure_write_function; + func_pointers.lbextiofn_writev = NULL; + func_pointers.lbextiofn_socket_arg = (struct lextiof_socket_private *) newsocket; ber_sockbuf_set_option( conn->c_sb, - LBER_SOCKBUF_OPT_EXT_IO_FNS, func_pointers); - free(func_pointers); + LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers); } conn->c_flags |= CONN_FLAG_SSL; conn->c_flags |= CONN_FLAG_START_TLS; @@ -420,26 +413,17 @@ start_tls_graceful_closure( Connection *c, Slapi_PBlock * pb, int is_initiator ) secure = 0; ns = configure_pr_socket( &(c->c_prfd), secure, 0 /*never local*/ ); - ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_DESC, &(c->c_prfd) ); - #else ns = PR_FileDesc2NativeHandle( c->c_prfd ); c->c_prfd = NULL; configure_ns_socket( &ns ); - - ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_DESC, &ns ); - #endif c->c_sd = ns; c->c_flags &= ~CONN_FLAG_SSL; c->c_flags &= ~CONN_FLAG_START_TLS; - ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_READ_FN, (void *)read_function ); - ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_WRITE_FN, (void *)write_function ); - - /* authentication & authorization credentials must be set to "anonymous". */ bind_credentials_clear( c, PR_FALSE, PR_TRUE ); |