X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=send_common.c;h=ea494d9a7b23f5ee87186917d11e883631ec9cbc;hp=f7770a01394e9b0089ff4b5dc20b2befcf54e5bb;hb=62c0894fbb589dd45e69b7d9ef1fd152a9960d62;hpb=4fbe16430b4776814128d7110682c69d1b047c57 diff --git a/send_common.c b/send_common.c index f7770a01..ea494d9a 100644 --- a/send_common.c +++ b/send_common.c @@ -46,8 +46,10 @@ void shutdown_client(struct sender_client *sc, struct sender_status *ss) { PARA_INFO_LOG("shutting down %s on fd %d\n", sc->name, sc->fd); free(sc->name); - close(sc->fd); - del_close_on_fork_list(sc->fd); + if (!process_is_command_handler()) { + close(sc->fd); + del_close_on_fork_list(sc->fd); + } cq_destroy(sc->cq); list_del(&sc->node); free(sc->private_data); @@ -152,6 +154,25 @@ void init_sender_status(struct sender_status *ss, ss->default_deny = default_deny; } +/** + * Deallocate all resources allocated in \ref init_sender_status(). + * + * \param ss The structure whose components should be freed. + * + * This frees the dynamically allocated parts of the structure which was + * initialized by an earlier call to \ref init_sender_status(). It does *not* + * call free(ss), though. + */ +void free_sender_status(const struct sender_status *ss) +{ + int i; + + free(ss->listen_fds); + FOR_EACH_LISTEN_FD(i, ss) + free(ss->listen_addresses[i]); + free(ss->listen_addresses); +} + /** * Return a string containing the current status of a sender. * @@ -217,6 +238,22 @@ void generic_com_allow(struct sender_command_data *scd, acl_allow(scd->host, scd->netmask, &ss->acl, ss->default_deny); } +/** + * Empty the access control list of a sender. + * + * \param acl The access control list of the sender. + * + * This is called from the ->shutdown methods of the http and the dccp sender. + */ +void generic_acl_deplete(struct list_head *acl) +{ + /* + * Since default_deny is false, the ACL is considered a blacklist. A + * netmask of zero matches any IP address, so this call empties the ACL. + */ + acl_allow("0.0.0.0", 0 /* netmask */, acl, 0 /* default_deny */); +} + /** * Deny connections from the given range of IP addresses. *