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

« back to all changes in this revision

Viewing changes to plugins/sudoers/visudo.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:
188
188
                (void) printf(_("%s grammar version %d\n"), getprogname(), SUDOERS_GRAMMAR_VERSION);
189
189
                goto done;
190
190
            case 'c':
191
 
                checkonly++;            /* check mode */
 
191
                checkonly = true;       /* check mode */
192
192
                break;
193
193
            case 'f':
194
194
                sudoers_path = optarg;  /* sudoers file path */
198
198
                help();
199
199
                break;
200
200
            case 's':
201
 
                strict++;               /* strict mode */
 
201
                strict = true;          /* strict mode */
202
202
                break;
203
203
            case 'q':
204
 
                quiet++;                /* quiet mode */
 
204
                quiet = false;          /* quiet mode */
205
205
                break;
206
206
            default:
207
207
                usage(1);
235
235
    if ((yyin = open_sudoers(sudoers_path, true, NULL)) == NULL) {
236
236
        error(1, "%s", sudoers_path);
237
237
    }
238
 
    init_parser(sudoers_path, 0);
 
238
    init_parser(sudoers_path, false);
239
239
    yyparse();
240
240
    (void) update_defaults(SETDEF_GENERIC|SETDEF_HOST|SETDEF_USER);
241
241
 
472
472
    int ch;
473
473
    debug_decl(reparse_sudoers, SUDO_DEBUG_UTIL)
474
474
 
 
475
    if (tq_empty(&sudoerslist))
 
476
        debug_return;
 
477
 
475
478
    /*
476
479
     * Parse the edited sudoers files and do sanity checking
477
480
     */
497
500
        }
498
501
        fclose(yyin);
499
502
        if (!parse_error) {
500
 
            if (!update_defaults(SETDEF_GENERIC|SETDEF_HOST|SETDEF_USER) ||
 
503
            if (!check_defaults(SETDEF_ALL, quiet) ||
501
504
                check_aliases(strict, quiet) != 0) {
502
505
                parse_error = true;
503
 
                errorfile = sp->path;
 
506
                errorfile = NULL;
504
507
            }
505
508
        }
506
509
 
524
527
            tq_foreach_fwd(&sudoerslist, sp) {
525
528
                if (errorfile == NULL || strcmp(sp->path, errorfile) == 0) {
526
529
                    edit_sudoers(sp, editor, args, errorlineno);
527
 
                    break;
 
530
                    if (errorfile != NULL)
 
531
                        break;
528
532
                }
529
533
            }
530
 
            if (sp == NULL) {
 
534
            if (errorfile != NULL && sp == NULL) {
531
535
                errorx(1, _("internal error, unable to find %s in list!"),
532
536
                    sudoers);
533
537
            }
822
826
        parse_error = true;
823
827
        errorfile = sudoers_path;
824
828
    }
825
 
    if (!parse_error && check_aliases(strict, quiet) != 0) {
826
 
        parse_error = true;
827
 
        errorfile = sudoers_path;
 
829
    if (!parse_error) {
 
830
        if (!check_defaults(SETDEF_ALL, quiet) ||
 
831
            check_aliases(strict, quiet) != 0) {
 
832
            parse_error = true;
 
833
            errorfile = NULL;
 
834
        }
828
835
    }
829
836
    ok = !parse_error;
830
837