~ubuntu-branches/ubuntu/saucy/sudo/saucy

« back to all changes in this revision

Viewing changes to plugins/sudoers/defaults.c

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2012-11-16 09:31:32 UTC
  • mfrom: (1.4.13)
  • Revision ID: package-import@ubuntu.com-20121116093132-ptext55adlzbrq6y
Tags: 1.8.6p3-0ubuntu1
* New upstream release (1.8.6p3).
* Add patch to fix building with sssd when ldap is disabled.
* Drop sudo.manpages and sudo-ldap.manpages as the upstream build system
  now does the right thing here.
* Build the main sudo package with support for sssd, this doesn't add any
  additional build time or runtime dependency. sudo will dynamically load
  the sssd library if 'sss' is listed for the 'sudoers' nss service.

Show diffs side-by-side

added added

removed removed

Lines of Context:
485
485
 * Update the defaults based on what was set by sudoers.
486
486
 * Pass in an OR'd list of which default types to update.
487
487
 */
488
 
int
 
488
bool
489
489
update_defaults(int what)
490
490
{
491
491
    struct defaults *def;
507
507
                break;
508
508
            case DEFAULTS_RUNAS:
509
509
                if (ISSET(what, SETDEF_RUNAS) &&
510
 
                    runaslist_matches(&def->binding, NULL) == ALLOW &&
 
510
                    runaslist_matches(&def->binding, NULL, NULL, NULL) == ALLOW &&
511
511
                    !set_default(def->var, def->val, def->op))
512
512
                    rc = false;
513
513
                break;
528
528
    debug_return_bool(rc);
529
529
}
530
530
 
 
531
/*
 
532
 * Check the defaults entries without actually setting them.
 
533
 * Pass in an OR'd list of which default types to check.
 
534
 */
 
535
bool
 
536
check_defaults(int what, bool quiet)
 
537
{
 
538
    struct sudo_defs_types *cur;
 
539
    struct defaults *def;
 
540
    bool rc = true;
 
541
    debug_decl(check_defaults, SUDO_DEBUG_DEFAULTS)
 
542
 
 
543
    tq_foreach_fwd(&defaults, def) {
 
544
        switch (def->type) {
 
545
            case DEFAULTS:
 
546
                if (!ISSET(what, SETDEF_GENERIC))
 
547
                    continue;
 
548
                break;
 
549
            case DEFAULTS_USER:
 
550
                if (!ISSET(what, SETDEF_USER))
 
551
                    continue;
 
552
                break;
 
553
            case DEFAULTS_RUNAS:
 
554
                if (!ISSET(what, SETDEF_RUNAS))
 
555
                    continue;
 
556
                break;
 
557
            case DEFAULTS_HOST:
 
558
                if (!ISSET(what, SETDEF_HOST))
 
559
                    continue;
 
560
                break;
 
561
            case DEFAULTS_CMND:
 
562
                if (!ISSET(what, SETDEF_CMND))
 
563
                    continue;
 
564
                break;
 
565
        }
 
566
        for (cur = sudo_defs_table; cur->name != NULL; cur++) {
 
567
            if (strcmp(def->var, cur->name) == 0)
 
568
                break;
 
569
        }
 
570
        if (cur->name == NULL) {
 
571
            if (!quiet)
 
572
                warningx(_("unknown defaults entry `%s'"), def->var);
 
573
            rc = false;
 
574
        }
 
575
    }
 
576
    debug_return_bool(rc);
 
577
}
 
578
 
531
579
static bool
532
580
store_int(char *val, struct sudo_defs_types *def, int op)
533
581
{