When a user is deleted we need to cycle the active * connections in order to kill all the pending ones that * are authenticated with such user. */
| 296 | * connections in order to kill all the pending ones that |
| 297 | * are authenticated with such user. */ |
| 298 | void ACLFreeUserAndKillClients(user *u) { |
| 299 | listIter li; |
| 300 | listNode *ln; |
| 301 | listRewind(server.clients,&li); |
| 302 | while ((ln = listNext(&li)) != NULL) { |
| 303 | client *c = listNodeValue(ln); |
| 304 | if (c->user == u) { |
| 305 | /* We'll free the connection asynchronously, so |
| 306 | * in theory to set a different user is not needed. |
| 307 | * However if there are bugs in Redis, soon or later |
| 308 | * this may result in some security hole: it's much |
| 309 | * more defensive to set the default user and put |
| 310 | * it in non authenticated mode. */ |
| 311 | c->user = DefaultUser; |
| 312 | c->authenticated = 0; |
| 313 | /* We will write replies to this client later, so we can't |
| 314 | * close it directly even if async. */ |
| 315 | if (c == server.current_client) { |
| 316 | c->flags |= CLIENT_CLOSE_AFTER_COMMAND; |
| 317 | } else { |
| 318 | freeClientAsync(c); |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | ACLFreeUser(u); |
| 323 | } |
| 324 | |
| 325 | /* Copy the user ACL rules from the source user 'src' to the destination |
| 326 | * user 'dst' so that at the end of the process they'll have exactly the |
no test coverage detected