kcm: parse_bytes() returns ssize_t

This commit is contained in:
Nicolas Williams
2021-12-17 14:39:35 -06:00
committed by Luke Howard
parent f91b171f04
commit 50e08b4bc5

View File

@@ -118,6 +118,10 @@ static struct getargs args[] = {
"renewable-life", 'r', arg_string, &renew_life, "renewable-life", 'r', arg_string, &renew_life,
"renewable lifetime of system tickets", "time" "renewable lifetime of system tickets", "time"
}, },
{
"max-request", 'r', arg_integer, &max_request_str,
"max request size", "bytes"
},
{ {
"socket-path", 's', arg_string, &socket_path, "socket-path", 's', arg_string, &socket_path,
"path to kcm domain socket", "path" "path to kcm domain socket", "path"
@@ -350,8 +354,15 @@ kcm_configure(int argc, char **argv)
krb5_err(kcm_context, 1, ret, "reading configuration files"); krb5_err(kcm_context, 1, ret, "reading configuration files");
} }
if(max_request_str) if (max_request_str) {
max_request = parse_bytes(max_request_str, NULL); ssize_t bytes;
if ((bytes = parse_bytes(max_request_str, NULL)) < 0)
krb5_errx(kcm_context, 1,
"--max-request size must be non-negative");
max_request = bytes;
}
if(max_request == 0){ if(max_request == 0){
p = krb5_config_get_string (kcm_context, p = krb5_config_get_string (kcm_context,
@@ -359,8 +370,14 @@ kcm_configure(int argc, char **argv)
"kcm", "kcm",
"max-request", "max-request",
NULL); NULL);
if(p) if (p) {
max_request = parse_bytes(p, NULL); ssize_t bytes;
if ((bytes = parse_bytes(max_request_str, NULL)) < 0)
krb5_errx(kcm_context, 1,
"[kcm] max-request size must be non-negative");
max_request = bytes;
}
} }
if (system_principal == NULL) { if (system_principal == NULL) {