Log if restconf started w/o configuration

This commit is contained in:
Philip Prindeville 2023-08-24 16:45:31 -06:00 committed by Olof Hagsand
parent 4a3fef4946
commit 6e314dd96f
2 changed files with 6 additions and 21 deletions

View file

@ -301,23 +301,10 @@ restconf_verify_certs(int preverify_ok,
static int static int
alpn_proto_dump(const char *label, alpn_proto_dump(const char *label,
const char *inp, const char *inp,
int len) unsigned len)
{ {
clicon_debug(1, "%s %.*s", label, (int)len, inp);
int retval = -1; return 0;
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;
} }
/*! Application-layer Protocol Negotiation (alpn) callback /*! Application-layer Protocol Negotiation (alpn) callback
@ -533,7 +520,6 @@ restconf_checkcert_file(cxobj *xrestconf,
static int static int
restconf_accept_client(int fd, restconf_accept_client(int fd,
void *arg) void *arg)
{ {
int retval = -1; int retval = -1;
restconf_socket *rsock; restconf_socket *rsock;
@ -1315,7 +1301,7 @@ main(int argc,
if ((ret = restconf_clixon_init(h, inline_config, &xrestconf)) < 0) if ((ret = restconf_clixon_init(h, inline_config, &xrestconf)) < 0)
goto done; goto done;
if (ret == 0){ /* restconf disabled */ 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; retval = 0;
goto done; goto done;
} }

View file

@ -374,8 +374,7 @@ plugin_load_one(clicon_handle h,
if ((p=strrchr(name, '.')) != NULL) if ((p=strrchr(name, '.')) != NULL)
*p = '\0'; *p = '\0';
/* Copy name to struct */ /* Copy name to struct */
snprintf(cp->cp_name, sizeof(cp->cp_name), "%*s", snprintf(cp->cp_name, sizeof(cp->cp_name), "%s", name);
(int)strlen(name), name);
cp->cp_api = *api; cp->cp_api = *api;
if (cp){ if (cp){
*cpp = cp; *cpp = cp;
@ -481,7 +480,7 @@ clixon_pseudo_plugin(clicon_handle h,
goto done; goto done;
} }
memset(cp, 0, sizeof(struct clixon_plugin)); 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); ADDQ(cp, ms->ms_plugin_list);
*cpp = cp; *cpp = cp;
cp = NULL; cp = NULL;