dovecot-2.2: login-common: Code cleanup
dovecot at dovecot.org
dovecot at dovecot.org
Sat Feb 25 03:46:15 EET 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/ce1fd6eefeff
changeset: 14153:ce1fd6eefeff
user: Timo Sirainen <tss at iki.fi>
date: Sat Feb 25 03:46:10 2012 +0200
description:
login-common: Code cleanup
diffstat:
src/login-common/client-common.c | 46 ++++++++++++++++++++--------------------
src/login-common/client-common.h | 1 -
2 files changed, 23 insertions(+), 24 deletions(-)
diffs (74 lines):
diff -r eb1aecd05cea -r ce1fd6eefeff src/login-common/client-common.c
--- a/src/login-common/client-common.c Sat Feb 25 03:45:13 2012 +0200
+++ b/src/login-common/client-common.c Sat Feb 25 03:46:10 2012 +0200
@@ -45,6 +45,29 @@
}
}
+static bool client_is_trusted(struct client *client)
+{
+ const char *const *net;
+ struct ip_addr net_ip;
+ unsigned int bits;
+
+ if (client->set->login_trusted_networks == NULL)
+ return FALSE;
+
+ net = t_strsplit_spaces(client->set->login_trusted_networks, ", ");
+ for (; *net != NULL; net++) {
+ if (net_parse_range(*net, &net_ip, &bits) < 0) {
+ i_error("login_trusted_networks: "
+ "Invalid network '%s'", *net);
+ break;
+ }
+
+ if (net_is_in_network(&client->ip, &net_ip, bits))
+ return TRUE;
+ }
+ return FALSE;
+}
+
struct client *
client_create(int fd, bool ssl, pool_t pool,
const struct login_settings *set, void **other_sets,
@@ -493,29 +516,6 @@
} T_END;
}
-bool client_is_trusted(struct client *client)
-{
- const char *const *net;
- struct ip_addr net_ip;
- unsigned int bits;
-
- if (client->set->login_trusted_networks == NULL)
- return FALSE;
-
- net = t_strsplit_spaces(client->set->login_trusted_networks, ", ");
- for (; *net != NULL; net++) {
- if (net_parse_range(*net, &net_ip, &bits) < 0) {
- i_error("login_trusted_networks: "
- "Invalid network '%s'", *net);
- break;
- }
-
- if (net_is_in_network(&client->ip, &net_ip, bits))
- return TRUE;
- }
- return FALSE;
-}
-
const char *client_get_extra_disconnect_reason(struct client *client)
{
unsigned int auth_secs = client->auth_first_started == 0 ? 0 :
diff -r eb1aecd05cea -r ce1fd6eefeff src/login-common/client-common.h
--- a/src/login-common/client-common.h Sat Feb 25 03:45:13 2012 +0200
+++ b/src/login-common/client-common.h Sat Feb 25 03:46:10 2012 +0200
@@ -176,7 +176,6 @@
void client_log_err(struct client *client, const char *msg);
void client_log_warn(struct client *client, const char *msg);
const char *client_get_extra_disconnect_reason(struct client *client);
-bool client_is_trusted(struct client *client);
void client_auth_respond(struct client *client, const char *response);
void client_auth_abort(struct client *client);
More information about the dovecot-cvs
mailing list