mirror of
https://github.com/eclipse/mosquitto.git
synced 2025-05-09 01:01:11 +08:00
dynsec: Consistent behaviour when setting clientid.
This commit is contained in:
parent
047c09bd32
commit
d8775b7d9c
@ -697,12 +697,16 @@ int dynsec_clients__process_modify(cJSON *j_responses, struct mosquitto *context
|
||||
}
|
||||
|
||||
if(json_get_string(command, "clientid", &clientid, false) == MOSQ_ERR_SUCCESS){
|
||||
str = mosquitto_strdup(clientid);
|
||||
if(str == NULL){
|
||||
dynsec__command_reply(j_responses, context, "modifyClient", "Internal error", correlation_data);
|
||||
return MOSQ_ERR_NOMEM;
|
||||
if(clientid && strlen(clientid) > 0){
|
||||
str = mosquitto_strdup(clientid);
|
||||
if(str == NULL){
|
||||
dynsec__command_reply(j_responses, context, "modifyClient", "Internal error", correlation_data);
|
||||
return MOSQ_ERR_NOMEM;
|
||||
}
|
||||
mosquitto_free(client->clientid);
|
||||
}else{
|
||||
str = NULL;
|
||||
}
|
||||
mosquitto_free(client->clientid);
|
||||
client->clientid = str;
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,9 @@ list_clients_verbose_response = {'responses':[{"command": "listClients", "data":
|
||||
|
||||
|
||||
get_client_command = { "commands": [{
|
||||
"command": "getClient", "username": "user_one"}]}
|
||||
"command": "getClient", "username": "user_one", "correlationData": "42"}]}
|
||||
get_client_response = {'responses':[{'command': 'getClient', 'data': {'client': {'username': 'user_one', 'clientid': 'cid',
|
||||
'textname': 'Name', 'textdescription': 'Description', 'groups': [], 'roles': []}}}]}
|
||||
'textname': 'Name', 'textdescription': 'Description', 'groups': [], 'roles': []}}, "correlationData":"42"}]}
|
||||
|
||||
set_client_password_command = {"commands": [{
|
||||
"command": "setClientPassword", "username": "user_one", "password": "password"}]}
|
||||
|
@ -80,6 +80,7 @@ create_roles_response = {'responses': [
|
||||
modify_client_command1 = { "commands": [{
|
||||
"command": "modifyClient", "username": "user_one",
|
||||
"textname": "Modified name", "textdescription": "Modified description",
|
||||
"clientid": "",
|
||||
"roles":[
|
||||
{'rolename':'role_one', 'priority':2},
|
||||
{'rolename':'role_two'},
|
||||
@ -112,7 +113,7 @@ get_client_response1 = {'responses':[{'command': 'getClient', 'data': {'client':
|
||||
|
||||
get_client_command2 = { "commands": [{
|
||||
"command": "getClient", "username": "user_one"}]}
|
||||
get_client_response2 = {'responses':[{'command': 'getClient', 'data': {'client': {'username': 'user_one', 'clientid': 'cid',
|
||||
get_client_response2 = {'responses':[{'command': 'getClient', 'data': {'client': {'username': 'user_one',
|
||||
'textname': 'Modified name', 'textdescription': 'Modified description',
|
||||
'roles': [
|
||||
{'rolename':'role_three', 'priority':10},
|
||||
@ -126,7 +127,7 @@ get_client_response2 = {'responses':[{'command': 'getClient', 'data': {'client':
|
||||
|
||||
get_client_command3 = { "commands": [{
|
||||
"command": "getClient", "username": "user_one"}]}
|
||||
get_client_response3 = {'responses':[{'command': 'getClient', 'data': {'client': {'username': 'user_one', 'clientid': 'cid',
|
||||
get_client_response3 = {'responses':[{'command': 'getClient', 'data': {'client': {'username': 'user_one',
|
||||
'textname': 'Modified name', 'textdescription': 'Modified description',
|
||||
'groups': [],
|
||||
'roles': [
|
||||
|
Loading…
x
Reference in New Issue
Block a user