Skip to content

Commit

Permalink
Log if restconf started w/o configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Prindeville authored and olofhagsand committed Oct 21, 2023
1 parent 4a3fef4 commit 6e314dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
22 changes: 4 additions & 18 deletions apps/restconf/restconf_main_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,23 +301,10 @@ restconf_verify_certs(int preverify_ok,
static int
alpn_proto_dump(const char *label,
const char *inp,
int len)
unsigned len)
{

int retval = -1;
char *str = NULL;

if ((str = malloc(len+1)) == NULL){
clicon_err(OE_UNIX, errno, "malloc");
goto done;
}
strncpy(str, inp, len);
str[len] = '\0';
clicon_debug(1, "%s %s", label, str);
retval = 0;
done:
free(str);
return retval;
clicon_debug(1, "%s %.*s", label, (int)len, inp);
return 0;
}

/*! Application-layer Protocol Negotiation (alpn) callback
Expand Down Expand Up @@ -533,7 +520,6 @@ restconf_checkcert_file(cxobj *xrestconf,
static int
restconf_accept_client(int fd,
void *arg)

{
int retval = -1;
restconf_socket *rsock;
Expand Down Expand Up @@ -1315,7 +1301,7 @@ main(int argc,
if ((ret = restconf_clixon_init(h, inline_config, &xrestconf)) < 0)
goto done;
if (ret == 0){ /* restconf disabled */
clicon_debug(1, "restconf configuration not found or disabled");
clicon_log(LOG_INFO, "restconf configuration not found or disabled");
retval = 0;
goto done;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/src/clixon_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,7 @@ plugin_load_one(clicon_handle h,
if ((p=strrchr(name, '.')) != NULL)
*p = '\0';
/* Copy name to struct */
snprintf(cp->cp_name, sizeof(cp->cp_name), "%*s",
(int)strlen(name), name);
snprintf(cp->cp_name, sizeof(cp->cp_name), "%s", name);
cp->cp_api = *api;
if (cp){
*cpp = cp;
Expand Down Expand Up @@ -481,7 +480,7 @@ clixon_pseudo_plugin(clicon_handle h,
goto done;
}
memset(cp, 0, sizeof(struct clixon_plugin));
snprintf(cp->cp_name, sizeof(cp->cp_name), "%*s", (int)strlen(name), name);
snprintf(cp->cp_name, sizeof(cp->cp_name), "%s", name);
ADDQ(cp, ms->ms_plugin_list);
*cpp = cp;
cp = NULL;
Expand Down

0 comments on commit 6e314dd

Please sign in to comment.