~ubuntu-branches/ubuntu/wily/389-ds-base/wily-proposed

« back to all changes in this revision

Viewing changes to ldap/servers/plugins/chainingdb/cb_bind.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2014-07-08 15:50:11 UTC
  • mfrom: (0.2.2)
  • Revision ID: package-import@ubuntu.com-20140708155011-r66lvtioamqwaype
Tags: 1.3.2.19-1
* New upstream release.
* admin_scripts.diff: Updated to fix more bashisms.
* watch: Update the url.
* Install failedbinds.py and logregex.py scripts.
* init: Use status from init-functions.
* control: Update my email.

Show diffs side-by-side

added added

removed removed

Lines of Context:
230
230
int
231
231
chainingdb_bind( Slapi_PBlock *pb )
232
232
{
233
 
 
234
 
        int                     status=LDAP_SUCCESS;
235
 
        int                     allocated_errmsg;
236
 
        int                     rc=LDAP_SUCCESS;
237
 
        cb_backend_instance     *cb;
238
 
        Slapi_Backend           *be;
239
 
        const char      *dn = NULL;
240
 
        Slapi_DN        *sdn = NULL;
241
 
        Slapi_DN        *mysdn = NULL;
242
 
        int                     method;
243
 
        struct berval           *creds, **urls;
244
 
        char                    *matcheddn,*errmsg;
245
 
        LDAPControl             **reqctrls, **resctrls, **ctrls;
246
 
        char                    * mechanism;
247
 
        int                     freectrls=1;
248
 
        int                     bind_retry;
 
233
        cb_backend_instance *cb;
 
234
        Slapi_Backend *be;
 
235
        struct berval *creds = NULL, **urls = NULL;
 
236
        const char *dn = NULL;
 
237
        Slapi_DN *sdn = NULL;
 
238
        Slapi_DN *mysdn = NULL;
 
239
        char *matcheddn = NULL, *errmsg = NULL;
 
240
        LDAPControl **reqctrls = NULL, **resctrls = NULL, **ctrls = NULL;
 
241
        char *mechanism = NULL;
 
242
        int status=LDAP_SUCCESS;
 
243
        int allocated_errmsg = 0;
 
244
        int rc = LDAP_SUCCESS;
 
245
        int freectrls = 1;
 
246
        int bind_retry;
 
247
        int method;
249
248
        
250
249
        if ( LDAP_SUCCESS != (rc = cb_forward_operation(pb) )) {
251
250
                cb_send_ldap_result( pb, rc, NULL, "Chaining forbidden", 0, NULL );
252
251
                return SLAPI_BIND_FAIL;
253
252
        }
254
253
 
255
 
        ctrls=NULL;
256
254
        /* don't add proxy auth control. use this call to check for supported   */
257
255
        /* controls only.                                                       */
258
256
        if ( LDAP_SUCCESS != ( rc = cb_update_controls( pb, NULL, &ctrls, 0 )) ) {
285
283
 
286
284
        cb_update_monitor_info(pb,cb,SLAPI_OPERATION_BIND);
287
285
 
288
 
        matcheddn=errmsg=NULL;
289
 
        allocated_errmsg = 0;
290
 
        resctrls=NULL;
291
 
        urls=NULL;
292
 
 
293
286
        /* Check wether the chaining BE is available or not */
294
287
        if ( cb_check_availability( cb, pb ) == FARMSERVER_UNAVAILABLE ){
295
288
                slapi_sdn_free(&mysdn);
307
300
                rc = status;
308
301
                allocated_errmsg = 1;
309
302
        } else if ( LDAP_USER_CANCELLED != rc ) {
 
303
                slapi_ch_free_string(&errmsg);
310
304
                errmsg = ldap_err2string( rc );
311
305
                if (rc == LDAP_TIMEOUT) {
312
306
                        cb_ping_farm(cb,NULL,0);
313
307
                }
314
308
                rc = LDAP_OPERATIONS_ERROR;
 
309
        } else {
 
310
                allocated_errmsg = 1;
315
311
        }
316
312
 
317
313
        if ( rc != LDAP_USER_CANCELLED ) {  /* not abandoned */
318
314
                if ( resctrls != NULL ) {
319
315
                        slapi_pblock_set( pb, SLAPI_RESCONTROLS, resctrls );
320
 
                        freectrls=0;
 
316
                        freectrls = 0;
321
317
                }
322
318
 
323
319
                if ( rc != LDAP_SUCCESS ) {
331
327
        if ( freectrls && ( resctrls != NULL )) {
332
328
                ldap_controls_free( resctrls );
333
329
        }
334
 
        slapi_ch_free((void **)& matcheddn );
335
 
        if ( allocated_errmsg && errmsg != NULL ) {
336
 
                slapi_ch_free((void **)& errmsg );
 
330
        slapi_ch_free_string(&matcheddn);
 
331
        if ( allocated_errmsg ) {
 
332
                slapi_ch_free_string(&errmsg);
337
333
        }
338
334
 
339
335
        slapi_sdn_free(&mysdn);