mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
occtl: propagate error codes on error conditions.
This commit is contained in:
@@ -651,7 +651,6 @@ int common_info_cmd(UserListRep * args)
|
||||
if (print_list_entries(out, "\tiRoutes:", args->user[i]->iroutes, args->user[i]->n_iroutes) < 0)
|
||||
goto error_parse;
|
||||
|
||||
|
||||
at_least_one = 1;
|
||||
}
|
||||
|
||||
@@ -662,8 +661,10 @@ int common_info_cmd(UserListRep * args)
|
||||
fprintf(stderr, "%s: message parsing error\n", __func__);
|
||||
goto cleanup;
|
||||
cleanup:
|
||||
if (at_least_one == 0)
|
||||
if (at_least_one == 0) {
|
||||
fprintf(out, "user or ID not found\n");
|
||||
ret = 2;
|
||||
}
|
||||
pager_stop(out);
|
||||
|
||||
return ret;
|
||||
@@ -701,7 +702,6 @@ int handle_show_user_cmd(struct unix_ctx *ctx, const char *arg)
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
|
||||
error:
|
||||
@@ -751,7 +751,6 @@ int handle_show_id_cmd(struct unix_ctx *ctx, const char *arg)
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
|
||||
error:
|
||||
|
||||
@@ -280,8 +280,15 @@ unsigned check_cmd(const char *cmd, const char *input,
|
||||
while (whitespace(*p))
|
||||
p++;
|
||||
|
||||
if (need_preconn == 0 || conn_prehandle(conn) >= 0)
|
||||
if (need_preconn != 0) {
|
||||
if (conn_prehandle(conn) < 0) {
|
||||
*status = 1;
|
||||
} else {
|
||||
*status = func(conn, p);
|
||||
}
|
||||
} else {
|
||||
*status = func(conn, p);
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user