* Added -U <user> command line to clixon_cli and clixon_netconf for NACM pseudo-user tests

This commit is contained in:
Olof hagsand 2018-06-07 21:34:52 +02:00
parent de69b253dc
commit 5cabc11bfb
15 changed files with 132 additions and 48 deletions

View file

@ -803,7 +803,7 @@ from_client_debug(clicon_handle h,
return retval;
}
/*! Match nacm access operations according to RFC8321 3.4.4.
/*! Match nacm access operations according to RFC8341 3.4.4.
* Incoming RPC Message Validation Step 7 (c)
* The rule's "access-operations" leaf has the "exec" bit set or
* has the special value "*".
@ -832,7 +832,7 @@ nacm_match_access(char *access_operations,
* @retval 0 Matching rule AND Not access and cbret set
* @retval 1 Matchung rule AND Access
* @retval 2 No matching rule Goto step 10
* From RFC8321 3.4.4. Incoming RPC Message Validation
* From RFC8341 3.4.4. Incoming RPC Message Validation
+---------+-----------------+---------------------+-----------------+
| Method | Resource class | NETCONF operation | Access |
| | | | operation |
@ -911,7 +911,7 @@ nacm_match_rule(clicon_handle h,
* @retval -1 Error
* @retval 0 Not access and cbret set
* @retval 1 Access
* From RFC8321 3.4.4. Incoming RPC Message Validation
* From RFC8341 3.4.4. Incoming RPC Message Validation
*/
static int
nacm_access(clicon_handle h,

View file

@ -117,7 +117,8 @@ backend_sig_term(int arg)
/*! usage
*/
static void
usage(char *argv0, clicon_handle h)
usage(clicon_handle h,
char *argv0)
{
char *plgdir = clicon_backend_dir(h);
char *confsock = clicon_sock(h);
@ -581,11 +582,11 @@ main(int argc,
break;
case 'D' : /* debug */
if (sscanf(optarg, "%d", &debug) != 1)
usage(argv[0], h);
usage(h, argv[0]);
break;
case 'f': /* config file */
if (!strlen(optarg))
usage(argv[0], h);
usage(h, argv[0]);
clicon_option_str_set(h, "CLICON_CONFIGFILE", optarg);
break;
}
@ -602,7 +603,7 @@ main(int argc,
/* Find and read configfile */
if (clicon_options_main(h) < 0){
if (help)
usage(argv[0], h);
usage(h, argv[0]);
return -1;
}
/* External NACM file? */
@ -621,12 +622,12 @@ main(int argc,
break; /* see above */
case 'd': /* Plugin directory */
if (!strlen(optarg))
usage(argv[0], h);
usage(h, argv[0]);
clicon_option_str_set(h, "CLICON_BACKEND_DIR", optarg);
break;
case 'b': /* XMLDB database directory */
if (!strlen(optarg))
usage(argv[0], h);
usage(h, argv[0]);
clicon_option_str_set(h, "CLICON_XMLDB_DIR", optarg);
break;
case 'F' : /* foreground */
@ -640,7 +641,7 @@ main(int argc,
break;
case 'u': /* config unix domain path / ip address */
if (!strlen(optarg))
usage(argv[0], h);
usage(h, argv[0]);
clicon_option_str_set(h, "CLICON_SOCK", optarg);
break;
case 'P': /* pidfile */
@ -650,7 +651,7 @@ main(int argc,
clicon_option_str_set(h, "CLICON_STARTUP_MODE", optarg);
if (clicon_startup_mode(h) < 0){
fprintf(stderr, "Invalid startup mode: %s\n", optarg);
usage(argv[0], h);
usage(h, argv[0]);
}
break;
case 'c': /* Load application config */
@ -668,7 +669,7 @@ main(int argc,
break;
}
default:
usage(argv[0], h);
usage(h, argv[0]);
break;
}
@ -677,7 +678,7 @@ main(int argc,
/* Defer: Wait to the last minute to print help message */
if (help)
usage(argv[0], h);
usage(h, argv[0]);
/* Check pid-file, if zap kil the old daemon, else return here */
if ((pidfile = clicon_backend_pidfile(h)) == NULL){

View file

@ -157,6 +157,8 @@ clixon_plugin_statedata(clicon_handle h,
if (reason){
while ((xc = xml_child_i(*xtop, 0)) != NULL)
xml_purge(xc);
clicon_log(LOG_NOTICE, "%s: Plugin '%s' state callback failed",
__FUNCTION__, cp->cp_name);
if (netconf_operation_failed_xml(xtop, "rpc", reason)< 0)
goto done;
goto ok;