commit a474b672ce9285ba515ade45d6e91fe4a1648d2a from: Stefan Sperling via: Thomas Adam date: Fri Jun 27 06:52:35 2025 UTC fix creation of gotd.conf deny rules in gotsys-write-conf Deny rules do not contain the rw/ro authorization mode string. Do not fail if that string is missing. Corresponding tests will be added soon. commit - 3039b005314e94c1558771544b2064a1a10507fd commit + a474b672ce9285ba515ade45d6e91fe4a1648d2a blob - fbc17257cbb8ceb3f87916183d64f1660a16d0f7 blob + be28e070e622a6bb2ad28de4120884dfffc27dfc --- gotsysd/libexec/gotsys-write-conf/gotsys-write-conf.c +++ gotsysd/libexec/gotsys-write-conf/gotsys-write-conf.c @@ -106,10 +106,10 @@ write_access_rules(struct gotsys_access_rule_list *rul switch (rule->access) { case GOTSYS_ACCESS_DENIED: - access = "deny"; + access = "deny "; break; case GOTSYS_ACCESS_PERMITTED: - access = "permit"; + access = "permit "; break; default: return got_error_fmt(GOT_ERR_PARSE_CONFIG, @@ -118,20 +118,18 @@ write_access_rules(struct gotsys_access_rule_list *rul } if (rule->authorization & GOTSYS_AUTH_WRITE) - authorization = "rw"; + authorization = "rw "; else if (rule->authorization & GOTSYS_AUTH_READ) - authorization = "ro"; + authorization = "ro "; else - return got_error_fmt(GOT_ERR_PARSE_CONFIG, - "unknown access rule authorization flags 0x%x", - rule->authorization); + authorization = ""; - ret = dprintf(gotd_conf_tmpfd, "\t%s %s %s\n", + ret = dprintf(gotd_conf_tmpfd, "\t%s%s%s\n", access, authorization, rule->identifier); if (ret == -1) return got_error_from_errno2("dprintf", gotd_conf_tmppath); - if (ret != 3 + strlen(access) + strlen(authorization) + + if (ret != 1 + strlen(access) + strlen(authorization) + strlen(rule->identifier) + 1) { return got_error_fmt(GOT_ERR_IO, "short write to %s", gotd_conf_tmppath);