[dovecot-cvs] dovecot/src/pop3-login client-authenticate.c, 1.35,
1.36 client.c, 1.30, 1.31
cras at dovecot.org
cras at dovecot.org
Mon Oct 18 04:13:28 EEST 2004
Update of /var/lib/cvs/dovecot/src/pop3-login
In directory talvi:/tmp/cvs-serv24063/src/pop3-login
Modified Files:
client-authenticate.c client.c
Log Message:
Implemented support for LOGIN-REFERRALS using "referral" and "reason"
parameters from auth server.
Index: client-authenticate.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3-login/client-authenticate.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- client-authenticate.c 17 Oct 2004 23:08:40 -0000 1.35
+++ client-authenticate.c 18 Oct 2004 01:13:26 -0000 1.36
@@ -77,8 +77,42 @@
safe_memset(line, 0, strlen(line));
}
+static int client_handle_success_args(struct pop3_client *client,
+ const char *const *args)
+{
+ const char *reason = NULL;
+ string_t *reply;
+ int nologin = FALSE;
+
+ for (; *args != NULL; args++) {
+ if (strcmp(*args, "nologin") == 0)
+ nologin = TRUE;
+ else if (strncmp(*args, "reason=", 7) == 0)
+ reason = *args + 7;
+ }
+
+ if (!nologin)
+ return FALSE;
+
+ reply = t_str_new(128);
+ str_append(reply, "-ERR ");
+ if (reason != NULL)
+ str_append(reply, reason);
+ else
+ str_append(reply, "Login disabled.");
+
+ client_send_line(client, str_c(reply));
+
+ /* get back to normal client input. */
+ if (client->io != NULL)
+ io_remove(client->io);
+ client->io = io_add(client->common.fd, IO_READ,
+ client_input, client);
+ return TRUE;
+}
+
static void sasl_callback(struct client *_client, enum sasl_server_reply reply,
- const char *data)
+ const char *data, const char *const *args)
{
struct pop3_client *client = (struct pop3_client *)_client;
struct const_iovec iov[3];
@@ -87,6 +121,11 @@
switch (reply) {
case SASL_SERVER_REPLY_SUCCESS:
+ if (args != NULL) {
+ if (client_handle_success_args(client, args))
+ break;
+ }
+
client_send_line(client, "+OK Logged in.");
client_destroy(client, t_strconcat(
"Login: ", client->common.virtual_user, NULL));
Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3-login/client.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- client.c 17 Oct 2004 23:08:40 -0000 1.30
+++ client.c 18 Oct 2004 01:13:26 -0000 1.31
@@ -381,6 +381,7 @@
i_free(client->apop_challenge);
i_free(client->common.virtual_user);
+ i_free(client->common.auth_mech_name);
i_free(client);
main_unref();
More information about the dovecot-cvs
mailing list