summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authordev <dev@example>2026-11-15 11:32:51 +0000
committerdev <dev@example>2026-11-15 11:32:51 +0000
commit2e6dd4a8e9e5302efae6b7532f7f4609882fc21d (patch)
treebcf0ce30538dbea33156ec98da8fd8cfe0d0679e /src/util.c
parentc2b95afc6aefbab69133a202cab95a50a2df82fc (diff)
downloadaccess-control-2e6dd4a8e9e5302efae6b7532f7f4609882fc21d.tar.gz
access-control-2e6dd4a8e9e5302efae6b7532f7f4609882fc21d.zip
Three things the removal left behind
The shipped example policy still told operators that `git-authz grant` and `revoke` edit a source copy. Both exit 64 now, so the header says why the deployed copy is read-only instead - the hook must not be able to change who can push - and stops short of naming a command that no longer exists. container/git-host-key made the same claim from the other side: that `validate` cross-checks keys and the rest of the wiring. It does not any more. The text now says what git-host-key itself guarantees, the option prefix it writes onto each key, and what it does not: a key edited in by hand can still lose the identity, and the name still needs a rule. sb_init/sb_add/sb_addf/sb_free and strbuf_t were orphaned when edit.c went - nothing else ever built a string buffer - so they are gone, with the stdarg.h include that only sb_addf needed. 64 lines. src/ and cmd/ are 1,431 non-blank lines. make strict, make test and make sanitizer are clean, sanitizers silent, and the example policy still parses to its 7 rules.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/util.c b/src/util.c
index 1cebd39..e769238 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3,7 +3,6 @@
// somewhere a caller forgot to look.
#include "authz.h"
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -17,65 +16,6 @@ static void oom(void)
exit(3);
}
-void sb_init(strbuf_t *b)
-{
- b->cap = 64;
- b->len = 0;
- b->s = xmalloc(b->cap);
- b->s[0] = '\0';
-}
-
-static void sb_room(strbuf_t *b, size_t extra)
-{
- if (b->len + extra + 1 <= b->cap)
- return;
- while (b->len + extra + 1 > b->cap)
- b->cap *= 2;
- b->s = xrealloc(b->s, b->cap);
-}
-
-void sb_add(strbuf_t *b, const char *s)
-{
- size_t n;
-
- if (s == NULL)
- return;
- n = strlen(s);
- sb_room(b, n);
- memcpy(b->s + b->len, s, n + 1);
- b->len += n;
-}
-
-void sb_addf(strbuf_t *b, const char *fmt, ...)
-{
- va_list ap;
- int n;
- char *out;
-
- va_start(ap, fmt);
- n = vsnprintf(NULL, 0, fmt, ap);
- va_end(ap);
- if (n < 0)
- return;
- sb_room(b, (size_t)n);
- va_start(ap, fmt);
- out = b->s + b->len;
- n = vsnprintf(out, b->cap - b->len, fmt, ap);
- va_end(ap);
- if (n < 0) {
- b->s[b->len] = '\0';
- return;
- }
- b->len += (size_t)n;
-}
-
-void sb_free(strbuf_t *b)
-{
- free(b->s);
- b->s = NULL;
- b->len = b->cap = 0;
-}
-
void *xmalloc(size_t n)
{
void *p = malloc(n != 0 ? n : 1);