define API option --api-groups
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
diff --git a/cgminer.c b/cgminer.c
index 69181b0..c946b6a 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -133,6 +133,7 @@ bool opt_autofan;
bool opt_autoengine;
bool opt_noadl;
char *opt_api_allow = NULL;
+char *opt_api_groups;
char *opt_api_description = PACKAGE_STRING;
int opt_api_port = 4028;
bool opt_api_listen;
@@ -682,6 +683,13 @@ static char *set_api_allow(const char *arg)
return NULL;
}
+static char *set_api_groups(const char *arg)
+{
+ opt_set_charp(arg, &opt_api_groups);
+
+ return NULL;
+}
+
static char *set_api_description(const char *arg)
{
opt_set_charp(arg, &opt_api_description);
@@ -732,10 +740,13 @@ static struct opt_table opt_config_table[] = {
#endif
OPT_WITH_ARG("--api-allow",
set_api_allow, NULL, NULL,
- "Allow API access only to the given list of IP[/Prefix] addresses[/subnets]"),
+ "Allow API access only to the given list of [G:]IP[/Prefix] addresses[/subnets]"),
OPT_WITH_ARG("--api-description",
set_api_description, NULL, NULL,
"Description placed in the API status header, default: cgminer version"),
+ OPT_WITH_ARG("--api-groups",
+ set_api_groups, NULL, NULL,
+ "API one letter groups G:cmd:cmd[,P:cmd:*...] defining the cmds a groups can use"),
OPT_WITHOUT_ARG("--api-listen",
opt_set_bool, &opt_api_listen,
"Enable API, default: disabled"),
@@ -2871,6 +2882,8 @@ void write_config(FILE *fcfg)
fprintf(fcfg, ",\n\"api-allow\" : \"%s\"", opt_api_allow);
if (strcmp(opt_api_description, PACKAGE_STRING) != 0)
fprintf(fcfg, ",\n\"api-description\" : \"%s\"", opt_api_description);
+ if (opt_api_groups)
+ fprintf(fcfg, ",\n\"api-groups\" : \"%s\"", opt_api_groups);
if (opt_icarus_timing)
fprintf(fcfg, ",\n\"icarus-timing\" : \"%s\"", opt_icarus_timing);
fputs("\n}", fcfg);
diff --git a/miner.h b/miner.h
index 5b44cee..bb56759 100644
--- a/miner.h
+++ b/miner.h
@@ -524,6 +524,7 @@ extern bool opt_autofan;
extern bool opt_autoengine;
extern bool use_curses;
extern char *opt_api_allow;
+extern char *opt_api_groups;
extern char *opt_api_description;
extern int opt_api_port;
extern bool opt_api_listen;