#include "str.h"
#include "strescape.h"
#include "time-util.h"
+#include "process-title.h"
#include "master-service-private.h"
#include "master-login.h"
#include "master-login-auth.h"
char *postlogin_socket_path;
unsigned int postlogin_timeout_secs;
+ bool update_proctitle:1;
bool stopping:1;
};
static void master_login_conn_close(struct master_login_connection *conn);
static void master_login_conn_unref(struct master_login_connection **_conn);
+static void login_server_proctitle_refresh(struct master_login *login)
+{
+ /* This function assumes that client_limit=1. With a higher limit
+ it just returns the first client's state, which isn't too bad
+ either. */
+ if (login->conns == NULL)
+ process_title_set("[idling]");
+ else if (login->conns->clients == NULL)
+ process_title_set("[waiting on client]");
+ else if (login->conns->clients->postlogin_client == NULL)
+ process_title_set("[auth lookup]");
+ else
+ process_title_set("[post-login script]");
+}
+
struct master_login *
master_login_init(struct master_service *service,
const struct master_login_settings *set)
set->request_auth_token);
login->postlogin_socket_path = i_strdup(set->postlogin_socket_path);
login->postlogin_timeout_secs = set->postlogin_timeout_secs;
+ login->update_proctitle = set->update_proctitle;
i_assert(service->login == NULL);
service->login = login;
int fd;
ssize_t ret;
+ if (login->update_proctitle)
+ process_title_set("[post-login script]");
+
fd = net_connect_unix_with_retries(socket_path, 1000);
if (fd == -1) {
conn_error(client->conn, "net_connect_unix(%s) failed: %m%s",
i_assert(client->postlogin_client == NULL);
client->postlogin_client = pl;
+
+ login_server_proctitle_refresh(login);
return 0;
}
memcpy(client->data, data+i, req.data_size);
conn->refcount++;
DLLIST_PREPEND(&conn->clients, client);
+ login_server_proctitle_refresh(login);
master_login_auth_request(login->auth, &req,
master_login_auth_callback, client);
o_stream_set_no_error_handling(conn->output, TRUE);
DLLIST_PREPEND(&login->conns, conn);
+ login_server_proctitle_refresh(login);
/* NOTE: currently there's a separate connection for each request. */
}
o_stream_unref(&conn->output);
DLLIST_REMOVE(&conn->login->conns, conn);
+ login_server_proctitle_refresh(conn->login);
if (!conn->login_success)
master_service_client_connection_destroyed(conn->login->service);