doveadm-auth.c revision 3b22894b8805b186c73d8b754001e8d7e944be85
/* Copyright (c) 2009-2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "array.h"
#include "askpass.h"
#include "base64.h"
#include "str.h"
#include "auth-client.h"
#include "auth-master.h"
#include "auth-server-connection.h"
#include "doveadm.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
struct authtest_input {
const char *username;
const char *password;
struct auth_user_info info;
};
static int
{
struct auth_master_connection *conn;
int ret;
if (auth_socket_path == NULL)
if (ret < 0) {
else {
i_fatal("userdb lookup failed for %s: %s",
}
} else if (ret == 0) {
printf("userdb lookup: user %s doesn't exist\n",
} else {
if (p == NULL)
else {
printf(" %-10s: %s\n",
}
}
}
return ret == 0 ? 1 : 0;
}
static void
enum auth_request_status status,
const char *data_base64 ATTR_UNUSED,
{
if (!io_loop_is_running(current_ioloop))
return;
if (status == 0)
i_fatal("passdb expects SASL continuation");
if (status < 0)
else
printf("extra fields:\n");
}
}
{
struct auth_request_info info;
if (!connected)
i_fatal("Couldn't connect to auth socket");
}
static int
{
struct auth_client *client;
if (auth_socket_path == NULL)
return 0;
}
{
i_fatal("lip: Invalid ip");
i_fatal("rip: Invalid ip");
} else {
}
}
static void
{
const char *auth_socket_path = NULL;
struct authtest_input input;
int c;
switch (c) {
case 'a':
break;
case 'x':
break;
default:
}
}
if (cmd == &doveadm_cmd_auth) {
t_askpass("Password: ");
exit(1);
} else {
if (first)
else
putchar('\n');
exit(1);
}
}
}
{
}
{
}
struct doveadm_cmd doveadm_cmd_auth = {
cmd_auth, "auth",
"[-a <auth socket path>] [-x <auth info>] <user> [<password>]", NULL
};
struct doveadm_cmd doveadm_cmd_user = {
cmd_user, "user",
"[-a <auth socket path>] [-x <auth info>] <user> [<user> ...]", NULL
};