diff options
| author | dev <dev@example> | 2026-11-14 11:16:29 +0000 |
|---|---|---|
| committer | dev <dev@example> | 2026-11-14 11:16:29 +0000 |
| commit | a2a702cb81eaf73a8989cc31c682592c8acb769a (patch) | |
| tree | d652ff6531c03176dd6280b5b8f77987a62da180 /Makefile | |
| parent | 312ddd4936f09ae27a180ca495cacf2c06faf33e (diff) | |
| download | access-control-a2a702cb81eaf73a8989cc31c682592c8acb769a.tar.gz access-control-a2a702cb81eaf73a8989cc31c682592c8acb769a.zip | |
Nine bugs the suite did not reach, and a test for each
Every one was found by reading a module against what the program promises, or by
driving the built binary with input the suite never sends. None of them was
visible from a green run: the run was already green.
Two are validate saying "ok" about a machine that is wide open:
ForceCommand none is how a Match block turns a forced command back off. It
is the same state as having none at all, which is the
state this check exists to catch.
sshd directives sshd keeps the first value it reads for a keyword, not the
last. "PermitUserEnvironment no" with a later "yes" read
as yes, and every push arrives anonymous.
One is a grant that grants more than was typed. A ref argument went into the
file verbatim, so
grant x team write 'refs/heads/a b'
landed as "x team write refs/heads/a b", which reads back as two patterns and
quietly grants refs/heads/b as well. A '#' argument was cut short at the comment
marker, and a newline argument wrote a file that no longer parses - which denies
every push there is. An argument that is not one field is refused now.
authorize did not accept the options its own usage text prints. The help says
"--user U" and "--ff auto|yes|no"; the parser took only --user=U, so the
documented spelling came back "unknown argument" while validate accepted both
forms. Both work now, and an option with no value says so.
Three are the boundary and status distinctions the exit codes are made of. A
rule with exactly MAX_FIELDS fields was refused as "too many", and a file that
does not parse denies every push. A directory passed as the policy read as a
policy that happens to be empty, so every push answered 1, person not allowed,
where the host is broken and the answer has to be 3. A gitconfig section name
was matched case-sensitively, so [CORE] reported a broken host that is not
broken; git folds section names without regard to case.
Two are smaller. "appended as line N" was printed when the pair's rule was the
last line and had been replaced rather than appended. And the Makefile tracked
no header dependencies, so editing src/authz.h rebuilt nothing and make test
passed against a binary that was not the code on disk.
Each fix went in as a failing test first, so the suite goes from 162 cases to
176 and no existing test was changed. Clean under -Werror and clean under
ASan/UBSan.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -11,15 +11,22 @@ CMD_OBJ = $(CMD_SRC:%=$(OBJ_DIR)/%.o) TST_SRC = $(wildcard $(TST_DIR)/*.c) TST_RUN = $(TST_SRC:$(TST_DIR)/%.c=$(OBJ_DIR)/test_runner/%) +TST_OBJ = $(TST_SRC:$(TST_DIR)/%.c=$(OBJ_DIR)/$(TST_DIR)/%.c.o) CC_SRC = $(wildcard $(SRC_DIR)/*.c) CC_OBJ = $(CC_SRC:%=$(OBJ_DIR)/%.o) +# -MMD writes a makefile of the headers each object actually includes. Without +# it, editing src/authz.h rebuilds nothing: the objects still match their .c +# files, so `make test' passes against a binary that is not the code on disk. CFLAGS = -std=c99 -Wall -Wextra -Wpedantic -I$(SRC_DIR) CFLAGS += -D_POSIX_C_SOURCE=200809L +CFLAGS += -MMD -MP CFLAGS += -g LDFLAGS = +DEPS = $(CC_OBJ:.o=.d) $(CMD_OBJ:.o=.d) $(TST_OBJ:.o=.d) + $(OBJ_DIR)/%.c.o: %.c @mkdir -p $(@D) $(CC) $(CFLAGS) -o $@ -c $< @@ -50,7 +57,7 @@ test: $(PROG) $(TST_RUN) .PHONY: sanitizer sanitizer: CFLAGS := -std=c99 -Wall -Wextra -Wpedantic -I$(SRC_DIR) \ -D_POSIX_C_SOURCE=200809L -O1 -g -fsanitize=address,undefined \ - -fno-omit-frame-pointer + -fno-omit-frame-pointer -MMD -MP sanitizer: LDFLAGS := -fsanitize=address,undefined sanitizer: test @@ -101,3 +108,7 @@ clean: @$(RM) -rf obj/ @$(RM) -rf $(TST_DIR)/tmp @$(RM) $(PROG) + +# Included last: the .d files only exist after something has been compiled, and +# a missing one is not an error. +-include $(DEPS) |
