Imported Upstream version 2.6.4
This commit is contained in:
parent
fad6ced6f6
commit
fefe62b2bd
257 changed files with 6020 additions and 1394 deletions
|
|
@ -33,6 +33,7 @@ static void set_var(nut_ctype_t *client, const char *upsname, const char *var,
|
|||
upstype_t *ups;
|
||||
const char *val;
|
||||
const enum_t *etmp;
|
||||
const range_t *rtmp;
|
||||
char cmd[SMALLBUF], esc[SMALLBUF];
|
||||
|
||||
ups = get_ups_ptr(upsname);
|
||||
|
|
@ -108,6 +109,29 @@ static void set_var(nut_ctype_t *client, const char *upsname, const char *var,
|
|||
}
|
||||
}
|
||||
|
||||
/* or if it's within a range */
|
||||
|
||||
rtmp = sstate_getrangelist(ups, var);
|
||||
|
||||
if (rtmp) {
|
||||
int found = 0;
|
||||
int inewval = atoi(newval);
|
||||
|
||||
while (rtmp) {
|
||||
if ((inewval >= rtmp->min) && (inewval <= rtmp->max)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
rtmp = rtmp->next;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
send_err(client, NUT_ERR_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* must be OK now */
|
||||
|
||||
upslogx(LOG_INFO, "Set variable: %s@%s set %s on %s to %s",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue