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