~ubuntu-branches/ubuntu/precise/krb5/precise-updates

« back to all changes in this revision

Viewing changes to src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c

  • Committer: Package Import Robot
  • Author(s): Sam Hartman
  • Date: 2011-12-01 19:34:41 UTC
  • mfrom: (28.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20111201193441-9tipg3aru1jsidyv
Tags: 1.10+dfsg~alpha1-6
* Fix segfault with unknown hostnames in krb5_sname_to_principal,
  Closes: #650671
* Indicate that this library breaks libsmbclient versions that depend on
  krb5_locate_kdc, Closes: #650603, #650611

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
 
2
/* plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c */
2
3
/*
3
 
 * lib/kdb/kdb_ldap/kdb_ldap.c
4
 
 *
5
4
 * Copyright (c) 2004-2005, Novell, Inc.
6
5
 * All rights reserved.
7
6
 *
109
108
 
110
109
    SETUP_CONTEXT();
111
110
    if ((retval=krb5_ldap_read_krbcontainer_params(context, &(ldap_context->krbcontainer)))) {
112
 
        prepend_err_str (context, "Unable to read Kerberos container", retval, retval);
 
111
        prepend_err_str(context, _("Unable to read Kerberos container"),
 
112
                        retval, retval);
113
113
        goto cleanup;
114
114
    }
115
115
 
116
116
    if ((retval=krb5_ldap_read_realm_params(context, context->default_realm, &(ldap_context->lrparams), &mask))) {
117
 
        prepend_err_str (context, "Unable to read Realm", retval, retval);
 
117
        prepend_err_str(context, _("Unable to read Realm"), retval, retval);
118
118
        goto cleanup;
119
119
    }
120
120
 
240
240
    return ret;
241
241
}
242
242
 
243
 
#define ERR_MSG1 "Unable to check if SASL EXTERNAL mechanism is supported by LDAP server. Proceeding anyway ..."
244
 
#define ERR_MSG2 "SASL EXTERNAL mechanism not supported by LDAP server. Can't perform certificate-based bind."
 
243
#define ERR_MSG1 _("Unable to check if SASL EXTERNAL mechanism is supported by LDAP server. Proceeding anyway ...")
 
244
#define ERR_MSG2 _("SASL EXTERNAL mechanism not supported by LDAP server. Can't perform certificate-based bind.")
245
245
 
246
246
/* Function to check if a LDAP server supports the SASL external mechanism
247
247
 *Return values:
323
323
                free (opt);
324
324
                free (val);
325
325
                status = EINVAL;
326
 
                krb5_set_error_message (context, status, "'binddn' missing");
 
326
                krb5_set_error_message(context, status, _("'binddn' missing"));
327
327
                goto clean_n_exit;
328
328
            }
329
329
            if (val == NULL) {
330
330
                status = EINVAL;
331
 
                krb5_set_error_message (context, status, "'binddn' value missing");
 
331
                krb5_set_error_message(context, status,
 
332
                                       _("'binddn' value missing"));
332
333
                free(opt);
333
334
                goto clean_n_exit;
334
335
            }
344
345
                free (opt);
345
346
                free (val);
346
347
                status = EINVAL;
347
 
                krb5_set_error_message (context, status, "'nconns' missing");
 
348
                krb5_set_error_message(context, status, _("'nconns' missing"));
348
349
                goto clean_n_exit;
349
350
            }
350
351
            if (val == NULL) {
351
352
                status = EINVAL;
352
 
                krb5_set_error_message (context, status, "'nconns' value missing");
 
353
                krb5_set_error_message(context, status,
 
354
                                       _("'nconns' value missing"));
353
355
                free(opt);
354
356
                goto clean_n_exit;
355
357
            }
359
361
                free (opt);
360
362
                free (val);
361
363
                status = EINVAL;
362
 
                krb5_set_error_message (context, status, "'bindpwd' missing");
 
364
                krb5_set_error_message(context, status,
 
365
                                       _("'bindpwd' missing"));
363
366
                goto clean_n_exit;
364
367
            }
365
368
            if (val == NULL) {
366
369
                status = EINVAL;
367
 
                krb5_set_error_message (context, status, "'bindpwd' value missing");
 
370
                krb5_set_error_message(context, status,
 
371
                                       _("'bindpwd' value missing"));
368
372
                free(opt);
369
373
                goto clean_n_exit;
370
374
            }
378
382
        } else if (opt && !strcmp(opt, "host")) {
379
383
            if (val == NULL) {
380
384
                status = EINVAL;
381
 
                krb5_set_error_message (context, status, "'host' value missing");
 
385
                krb5_set_error_message(context, status,
 
386
                                       _("'host' value missing"));
382
387
                free(opt);
383
388
                goto clean_n_exit;
384
389
            }
415
420
        } else if (opt && !strcmp(opt, "cert")) {
416
421
            if (val == NULL) {
417
422
                status = EINVAL;
418
 
                krb5_set_error_message (context, status, "'cert' value missing");
 
423
                krb5_set_error_message(context, status,
 
424
                                       _("'cert' value missing"));
419
425
                free(opt);
420
426
                goto clean_n_exit;
421
427
            }
450
456
                 * temporary is passed in when kdb5_util load without -update is done.
451
457
                 * This is unsupported by the LDAP plugin.
452
458
                 */
 
459
                krb5_set_error_message(context, status,
 
460
                                       _("open of LDAP directory aborted, "
 
461
                                         "plugin requires -update argument"));
 
462
            } else {
453
463
                krb5_set_error_message (context, status,
454
 
                                        "open of LDAP directory aborted, plugin requires -update argument");
455
 
            } else {
456
 
                krb5_set_error_message (context, status, "unknown option \'%s\'",
 
464
                                        _("unknown option \'%s\'"),
457
465
                                        opt?opt:val);
458
466
            }
459
467
            free(opt);
474
482
            krb5_ldap_free_ldap_context(ldap_context);
475
483
        ldap_context = NULL;
476
484
        dal_handle->db_context = NULL;
477
 
        prepend_err_str (context, "Error reading LDAP server params: ", status, status);
 
485
        prepend_err_str(context, _("Error reading LDAP server params: "),
 
486
                        status, status);
478
487
        goto clean_n_exit;
479
488
    }
480
489
    if ((status=krb5_ldap_db_init(context, ldap_context)) != 0) {
532
541
krb5_ldap_check_policy_as(krb5_context kcontext, krb5_kdc_req *request,
533
542
                          krb5_db_entry *client, krb5_db_entry *server,
534
543
                          krb5_timestamp kdc_time, const char **status,
535
 
                          krb5_data *e_data)
 
544
                          krb5_pa_data ***e_data)
536
545
{
537
546
    krb5_error_code retval;
538
547