mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Support non-ascii ParameterKey
This commit is contained in:
parent
7e86433c31
commit
5cb106186a
2 changed files with 21 additions and 1 deletions
|
|
@ -445,7 +445,12 @@ static int set_management_server_delay_reboot(char *refparam, struct dmctx *ctx,
|
|||
/*#Device.ManagementServer.ParameterKey!UCI:cwmp/acs,acs/ParameterKey*/
|
||||
static int get_management_server_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
char buf[1024] = {0};
|
||||
|
||||
dmuci_get_option_value_string("cwmp", "cpe", "ParameterKey", value);
|
||||
convert_hex_to_string(*value, buf, sizeof(buf));
|
||||
*value = dmstrdup(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
17
src/common.c
17
src/common.c
|
|
@ -363,9 +363,24 @@ size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
|||
return written;
|
||||
}
|
||||
|
||||
void convert_string_to_hex(const char *str, char *hex, size_t size)
|
||||
{
|
||||
int i, len = CWMP_STRLEN(str);
|
||||
unsigned pos = 0;
|
||||
|
||||
for (i = 0; i < len && pos < size - 2; i++) {
|
||||
pos += snprintf((char *)hex + pos, size - pos, "%02X", str[i]);
|
||||
}
|
||||
|
||||
hex[pos] = '\0';
|
||||
}
|
||||
|
||||
void set_rpc_parameter_key(char *param_key)
|
||||
{
|
||||
set_uci_path_value(NULL, "cwmp.cpe.ParameterKey", param_key ? param_key : "");
|
||||
char buf[1024] = {0};
|
||||
|
||||
convert_string_to_hex(param_key, buf, sizeof(buf));
|
||||
set_uci_path_value(NULL, "cwmp.cpe.ParameterKey", buf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue