* 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

@ -71,7 +71,7 @@
#include "netconf_rpc.h"
/* Command line options to be passed to getopt(3) */
#define NETCONF_OPTS "hDqf:d:Sy:"
#define NETCONF_OPTS "hDqf:d:Sy:U:"
/*! Process incoming packet
* @param[in] h Clicon handle
@ -292,7 +292,8 @@ usage(clicon_handle h,
"\t-f <file>\tConfiguration file (mandatory)\n"
"\t-d <dir>\tSpecify netconf plugin directory dir (default: %s)\n"
"\t-S\t\tLog on syslog\n"
"\t-y <file>\tOverride yang spec file (dont include .yang suffix)\n",
"\t-y <file>\tOverride yang spec file (dont include .yang suffix)\n"
"\t-U <user>\tOver-ride unix user with a pseudo user for NACM.\n",
argv0,
clicon_netconf_dir(h)
);
@ -379,6 +380,12 @@ main(int argc,
clicon_option_str_set(h, "CLICON_YANG_MODULE_MAIN", optarg);
break;
}
case 'U': /* Clixon 'pseudo' user */
if (!strlen(optarg))
usage(h, argv[0]);
if (clicon_username_set(h, optarg) < 0)
goto done;
break;
default:
usage(h, argv[0]);
break;