commit ecf5ec81c7523d0ea634926b0221655d71bb3a05360b5aa0b9006b654131557e from: Stefan Sperling date: Wed Jun 25 11:45:14 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 - fd41efeccc49d9c612dc34323c9dea4b7f5e9db836c4cadd34ba0b6e87d9181b commit + ecf5ec81c7523d0ea634926b0221655d71bb3a05360b5aa0b9006b654131557e blob - e7232210572c4caad54020799385ee0ebe4716926a2b98a2e6a7dd98146ca68b blob + 688a72529e245db278fc98faaa2362b5eedfbac365c7f98dcc4609d5cc319061 --- 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);