"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/doveadm/doveadm-auth.c" between
dovecot-2.3.16.tar.gz and dovecot-2.3.17.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

doveadm-auth.c  (dovecot-2.3.16):doveadm-auth.c  (dovecot-2.3.17)
skipping to change at line 49 skipping to change at line 49
struct auth_client_request *request; struct auth_client_request *request;
struct master_auth_request master_auth_req; struct master_auth_request master_auth_req;
unsigned int auth_id; unsigned int auth_id;
unsigned int auth_pid; unsigned int auth_pid;
const char *auth_cookie; const char *auth_cookie;
}; };
static void auth_cmd_help(doveadm_command_t *cmd); static void auth_cmd_help(struct doveadm_cmd_context *cctx);
static struct auth_master_connection * static struct auth_master_connection *
doveadm_get_auth_master_conn(const char *auth_socket_path) doveadm_get_auth_master_conn(const char *auth_socket_path)
{ {
enum auth_master_flags flags = 0; enum auth_master_flags flags = 0;
if (doveadm_debug) if (doveadm_debug)
flags |= AUTH_MASTER_FLAG_DEBUG; flags |= AUTH_MASTER_FLAG_DEBUG;
return auth_master_init(auth_socket_path, flags); return auth_master_init(auth_socket_path, flags);
} }
skipping to change at line 236 skipping to change at line 236
auth_client_connect(client); auth_client_connect(client);
auth_client_set_connect_notify(client, auth_connected, input); auth_client_set_connect_notify(client, auth_connected, input);
if (!auth_client_is_disconnected(client)) if (!auth_client_is_disconnected(client))
io_loop_run(current_ioloop); io_loop_run(current_ioloop);
auth_client_set_connect_notify(client, NULL, NULL); auth_client_set_connect_notify(client, NULL, NULL);
auth_client_deinit(&client); auth_client_deinit(&client);
} }
static void auth_user_info_parse(struct auth_user_info *info, const char *arg) static void
auth_user_info_parse_arg(struct auth_user_info *info, const char *arg)
{ {
if (str_begins(arg, "service=")) if (str_begins(arg, "service="))
info->service = arg + 8; info->service = arg + 8;
else if (str_begins(arg, "session=")) else if (str_begins(arg, "session="))
info->session_id = arg + 8; info->session_id = arg + 8;
else if (str_begins(arg, "local_name=")) else if (str_begins(arg, "local_name="))
info->local_name = arg + 11; info->local_name = arg + 11;
else if (str_begins(arg, "lip=")) { else if (str_begins(arg, "lip=")) {
if (net_addr2ip(arg + 4, &info->local_ip) < 0) if (net_addr2ip(arg + 4, &info->local_ip) < 0)
i_fatal("lip: Invalid ip"); i_fatal("lip: Invalid ip");
skipping to change at line 293 skipping to change at line 294
t_strdup_printf("%s\t%s=%s", info->forward_fields , key, value); t_strdup_printf("%s\t%s=%s", info->forward_fields , key, value);
} }
} else { } else {
if (!array_is_created(&info->extra_fields)) if (!array_is_created(&info->extra_fields))
t_array_init(&info->extra_fields, 4); t_array_init(&info->extra_fields, 4);
array_push_back(&info->extra_fields, &arg); array_push_back(&info->extra_fields, &arg);
} }
} }
static void static void
auth_user_info_parse(struct auth_user_info *info, const char *const *args)
{
for (unsigned int i = 0; args[i] != NULL; i++)
auth_user_info_parse_arg(info, args[i]);
}
static void
cmd_user_list(struct auth_master_connection *conn, cmd_user_list(struct auth_master_connection *conn,
const struct authtest_input *input, const struct authtest_input *input,
char *const *users) const char *const *users)
{ {
struct auth_master_user_list_ctx *ctx; struct auth_master_user_list_ctx *ctx;
const char *username, *user_mask = "*"; const char *username, *user_mask = "*";
unsigned int i; unsigned int i;
if (users[0] != NULL && users[1] == NULL) if (users[0] != NULL && users[1] == NULL)
user_mask = users[0]; user_mask = users[0];
ctx = auth_master_user_list_init(conn, user_mask, &input->info); ctx = auth_master_user_list_init(conn, user_mask, &input->info);
while ((username = auth_master_user_list_next(ctx)) != NULL) { while ((username = auth_master_user_list_next(ctx)) != NULL) {
skipping to change at line 317 skipping to change at line 325
if (wildcard_match_icase(username, users[i])) if (wildcard_match_icase(username, users[i]))
break; break;
} }
if (users[i] != NULL) if (users[i] != NULL)
printf("%s\n", username); printf("%s\n", username);
} }
if (auth_master_user_list_deinit(&ctx) < 0) if (auth_master_user_list_deinit(&ctx) < 0)
i_fatal("user listing failed"); i_fatal("user listing failed");
} }
static void cmd_auth_cache_flush(int argc, char *argv[]) static void cmd_auth_cache_flush(struct doveadm_cmd_context *cctx)
{ {
const char *master_socket_path = NULL; const char *master_socket_path;
struct auth_master_connection *conn; struct auth_master_connection *conn;
const char *const *users = NULL;
unsigned int count; unsigned int count;
int c;
while ((c = getopt(argc, argv, "a:")) > 0) { if (!doveadm_cmd_param_str(cctx, "socket-path", &master_socket_path)) {
switch (c) {
case 'a':
master_socket_path = optarg;
break;
default:
auth_cmd_help(cmd_auth_cache_flush);
}
}
argv += optind;
if (master_socket_path == NULL) {
master_socket_path = t_strconcat(doveadm_settings->base_dir, master_socket_path = t_strconcat(doveadm_settings->base_dir,
"/auth-master", NULL); "/auth-master", NULL);
} }
(void)doveadm_cmd_param_array(cctx, "user", &users);
conn = doveadm_get_auth_master_conn(master_socket_path); conn = doveadm_get_auth_master_conn(master_socket_path);
if (auth_master_cache_flush(conn, (void *)argv, &count) < 0) { if (auth_master_cache_flush(conn, users, &count) < 0) {
i_error("Cache flush failed"); i_error("Cache flush failed");
doveadm_exit_code = EX_TEMPFAIL; doveadm_exit_code = EX_TEMPFAIL;
} else { } else {
printf("%u cache entries flushed\n", count); printf("%u cache entries flushed\n", count);
} }
auth_master_deinit(&conn); auth_master_deinit(&conn);
} }
static void authtest_input_init(struct authtest_input *input) static void authtest_input_init(struct authtest_input *input)
{ {
i_zero(input); i_zero(input);
input->info.service = "doveadm"; input->info.service = "doveadm";
input->info.debug = doveadm_settings->auth_debug; input->info.debug = doveadm_settings->auth_debug;
} }
static void cmd_auth_test(int argc, char *argv[]) static void cmd_auth_test(struct doveadm_cmd_context *cctx)
{ {
const char *auth_socket_path = NULL; const char *auth_socket_path = NULL;
const char *const *auth_info;
struct authtest_input input; struct authtest_input input;
int c;
authtest_input_init(&input); authtest_input_init(&input);
while ((c = getopt(argc, argv, "a:M:x:")) > 0) { (void)doveadm_cmd_param_str(cctx, "socket-path", &auth_socket_path);
switch (c) { (void)doveadm_cmd_param_str(cctx, "master-user", &input.master_user);
case 'a': if (doveadm_cmd_param_array(cctx, "auth-info", &auth_info))
auth_socket_path = optarg; auth_user_info_parse(&input.info, auth_info);
break;
case 'M': if (!doveadm_cmd_param_str(cctx, "user", &input.username))
input.master_user = optarg; auth_cmd_help(cctx);
break; if (!doveadm_cmd_param_str(cctx, "password", &input.password))
case 'x': input.password = t_askpass("Password: ");
auth_user_info_parse(&input.info, optarg);
break;
default:
auth_cmd_help(cmd_auth_test);
}
}
if (optind == argc)
auth_cmd_help(cmd_auth_test);
input.username = argv[optind++];
input.password = argv[optind] != NULL ? argv[optind++] :
t_askpass("Password: ");
if (argv[optind] != NULL)
i_fatal("Unexpected parameter: %s", argv[optind]);
cmd_auth_input(auth_socket_path, &input); cmd_auth_input(auth_socket_path, &input);
if (!input.success) if (!input.success)
doveadm_exit_code = EX_NOPERM; doveadm_exit_code = EX_NOPERM;
} }
static void static void
master_auth_callback(const char *const *auth_args, master_auth_callback(const char *const *auth_args,
const char *errormsg, void *context) const char *errormsg, void *context)
{ {
struct authtest_input *input = context; struct authtest_input *input = context;
skipping to change at line 442 skipping to change at line 425
input->success = FALSE; input->success = FALSE;
master_auth = master_login_auth_init(auth_master_socket_path, FALSE); master_auth = master_login_auth_init(auth_master_socket_path, FALSE);
io_loop_set_running(current_ioloop); io_loop_set_running(current_ioloop);
master_login_auth_request(master_auth, &master_auth_req, master_login_auth_request(master_auth, &master_auth_req,
master_auth_callback, input); master_auth_callback, input);
if (io_loop_is_running(current_ioloop)) if (io_loop_is_running(current_ioloop))
io_loop_run(current_ioloop); io_loop_run(current_ioloop);
master_login_auth_deinit(&master_auth); master_login_auth_deinit(&master_auth);
} }
static void cmd_auth_login(int argc, char *argv[]) static void cmd_auth_login(struct doveadm_cmd_context *cctx)
{ {
const char *auth_login_socket_path, *auth_master_socket_path; const char *auth_login_socket_path, *auth_master_socket_path;
const char *const *auth_info;
struct auth_client *auth_client; struct auth_client *auth_client;
struct authtest_input input; struct authtest_input input;
int c;
authtest_input_init(&input); authtest_input_init(&input);
auth_login_socket_path = t_strconcat(doveadm_settings->base_dir, if (!doveadm_cmd_param_str(cctx, "auth-login-socket-path",
"/auth-login", NULL); &auth_login_socket_path)) {
auth_master_socket_path = t_strconcat(doveadm_settings->base_dir, auth_login_socket_path =
"/auth-master", NULL); t_strconcat(doveadm_settings->base_dir,
while ((c = getopt(argc, argv, "a:m:M:x:")) > 0) { "/auth-login", NULL);
switch (c) { }
case 'a': if (!doveadm_cmd_param_str(cctx, "auth-master-socket-path",
auth_login_socket_path = optarg; &auth_master_socket_path)) {
break; auth_master_socket_path =
case 'm': t_strconcat(doveadm_settings->base_dir,
auth_master_socket_path = optarg; "/auth-master", NULL);
break; }
case 'M': (void)doveadm_cmd_param_str(cctx, "master-user", &input.master_user);
input.master_user = optarg; if (doveadm_cmd_param_array(cctx, "auth-info", &auth_info))
break; auth_user_info_parse(&input.info, auth_info);
case 'x': if (!doveadm_cmd_param_str(cctx, "user", &input.username))
auth_user_info_parse(&input.info, optarg); auth_cmd_help(cctx);
break; if (!doveadm_cmd_param_str(cctx, "password", &input.password))
default: input.password = t_askpass("Password: ");
auth_cmd_help(cmd_auth_login);
}
}
if (optind == argc)
auth_cmd_help(cmd_auth_login);
input.pool = pool_alloconly_create("auth login", 256); input.pool = pool_alloconly_create("auth login", 256);
input.username = argv[optind++];
input.password = argv[optind] != NULL ? argv[optind++] :
t_askpass("Password: ");
if (argv[optind] != NULL)
i_fatal("Unexpected parameter: %s", argv[optind]);
/* authenticate */ /* authenticate */
auth_client = auth_client_init(auth_login_socket_path, getpid(), FALSE); auth_client = auth_client_init(auth_login_socket_path, getpid(), FALSE);
auth_client_connect(auth_client); auth_client_connect(auth_client);
auth_client_set_connect_notify(auth_client, auth_connected, &input); auth_client_set_connect_notify(auth_client, auth_connected, &input);
if (!auth_client_is_disconnected(auth_client)) if (!auth_client_is_disconnected(auth_client))
io_loop_run(current_ioloop); io_loop_run(current_ioloop);
auth_client_set_connect_notify(auth_client, NULL, NULL); auth_client_set_connect_notify(auth_client, NULL, NULL);
/* finish login with userdb lookup */ /* finish login with userdb lookup */
if (input.success) if (input.success)
cmd_auth_master_input(auth_master_socket_path, &input); cmd_auth_master_input(auth_master_socket_path, &input);
if (!input.success) if (!input.success)
doveadm_exit_code = EX_NOPERM; doveadm_exit_code = EX_NOPERM;
auth_client_deinit(&auth_client); auth_client_deinit(&auth_client);
pool_unref(&input.pool); pool_unref(&input.pool);
} }
static void cmd_auth_lookup(int argc, char *argv[]) static void cmd_auth_lookup(struct doveadm_cmd_context *cctx)
{ {
const char *auth_socket_path = doveadm_settings->auth_socket_path; const char *auth_socket_path;
struct auth_master_connection *conn; struct auth_master_connection *conn;
struct authtest_input input; struct authtest_input input;
const char *show_field = NULL; const char *show_field = NULL;
const char *const *auth_info, *const *users;
bool first = TRUE; bool first = TRUE;
int c, ret; int ret;
authtest_input_init(&input); authtest_input_init(&input);
while ((c = getopt(argc, argv, "a:f:x:")) > 0) { if (!doveadm_cmd_param_str(cctx, "socket-path", &auth_socket_path))
switch (c) { auth_socket_path = doveadm_settings->auth_socket_path;
case 'a': (void)doveadm_cmd_param_str(cctx, "field", &show_field);
auth_socket_path = optarg; if (doveadm_cmd_param_array(cctx, "auth-info", &auth_info))
break; auth_user_info_parse(&input.info, auth_info);
case 'f': if (!doveadm_cmd_param_array(cctx, "user", &users))
show_field = optarg; auth_cmd_help(cctx);
break;
case 'x':
auth_user_info_parse(&input.info, optarg);
break;
default:
auth_cmd_help(cmd_auth_lookup);
}
}
if (optind == argc)
auth_cmd_help(cmd_auth_lookup);
conn = doveadm_get_auth_master_conn(auth_socket_path); conn = doveadm_get_auth_master_conn(auth_socket_path);
while ((input.username = argv[optind++]) != NULL) { for (unsigned int i = 0; users[i] != NULL; i++) {
input.username = users[i];
if (first) if (first)
first = FALSE; first = FALSE;
else else
putchar('\n'); putchar('\n');
ret = cmd_user_input(conn, &input, show_field, FALSE); ret = cmd_user_input(conn, &input, show_field, FALSE);
switch (ret) { switch (ret) {
case -1: case -1:
doveadm_exit_code = EX_TEMPFAIL; doveadm_exit_code = EX_TEMPFAIL;
break; break;
skipping to change at line 653 skipping to change at line 616
printf("%s\n", str_c(str)); printf("%s\n", str_c(str));
} }
} }
mail_user_deinit(&user); mail_user_deinit(&user);
mail_storage_service_user_unref(&service_user); mail_storage_service_user_unref(&service_user);
pool_unref(&pool); pool_unref(&pool);
return 1; return 1;
} }
static void cmd_user(int argc, char *argv[]) static void cmd_user(struct doveadm_cmd_context *cctx)
{ {
const char *auth_socket_path = doveadm_settings->auth_socket_path; const char *auth_socket_path;
struct auth_master_connection *conn; struct auth_master_connection *conn;
struct authtest_input input; struct authtest_input input;
const char *show_field = NULL, *expand_field = NULL; const char *show_field = NULL, *expand_field = NULL;
const char *const *user_masks, *const *auth_info;
struct mail_storage_service_ctx *storage_service = NULL; struct mail_storage_service_ctx *storage_service = NULL;
unsigned int i; unsigned int i;
bool have_wildcards, userdb_only = FALSE, first = TRUE; bool have_wildcards, userdb_only = FALSE, first = TRUE;
int c, ret; int ret;
authtest_input_init(&input); authtest_input_init(&input);
while ((c = getopt(argc, argv, "a:e:f:ux:")) > 0) { if (!doveadm_cmd_param_str(cctx, "socket-path", &auth_socket_path))
switch (c) { auth_socket_path = doveadm_settings->auth_socket_path;
case 'a': (void)doveadm_cmd_param_str(cctx, "field", &show_field);
auth_socket_path = optarg; (void)doveadm_cmd_param_str(cctx, "expand-field", &expand_field);
break; (void)doveadm_cmd_param_bool(cctx, "userdb-only", &userdb_only);
case 'e': if (doveadm_cmd_param_array(cctx, "auth-info", &auth_info))
expand_field = optarg; auth_user_info_parse(&input.info, auth_info);
break; if (!doveadm_cmd_param_array(cctx, "user-mask", &user_masks))
case 'f': auth_cmd_help(cctx);
show_field = optarg;
break;
case 'u':
userdb_only = TRUE;
break;
case 'x':
auth_user_info_parse(&input.info, optarg);
break;
default:
auth_cmd_help(cmd_user);
}
}
if (expand_field != NULL && userdb_only) { if (expand_field != NULL && userdb_only) {
i_error("-e can't be used with -u"); i_error("-e can't be used with -u");
doveadm_exit_code = EX_USAGE; doveadm_exit_code = EX_USAGE;
return; return;
} }
if (expand_field != NULL && show_field != NULL) { if (expand_field != NULL && show_field != NULL) {
i_error("-e can't be used with -f"); i_error("-e can't be used with -f");
doveadm_exit_code = EX_USAGE; doveadm_exit_code = EX_USAGE;
return; return;
} }
if (optind == argc)
auth_cmd_help(cmd_user);
conn = doveadm_get_auth_master_conn(auth_socket_path); conn = doveadm_get_auth_master_conn(auth_socket_path);
have_wildcards = FALSE; have_wildcards = FALSE;
for (i = optind; argv[i] != NULL; i++) { for (i = 0; user_masks[i] != NULL; i++) {
if (strchr(argv[i], '*') != NULL || if (strchr(user_masks[i], '*') != NULL ||
strchr(argv[i], '?') != NULL) { strchr(user_masks[i], '?') != NULL) {
have_wildcards = TRUE; have_wildcards = TRUE;
break; break;
} }
} }
if (have_wildcards) { if (have_wildcards) {
cmd_user_list(conn, &input, argv + optind); cmd_user_list(conn, &input, user_masks);
auth_master_deinit(&conn); auth_master_deinit(&conn);
return; return;
} }
if (!userdb_only) { if (!userdb_only) {
storage_service = mail_storage_service_init(master_service, NULL, storage_service = mail_storage_service_init(master_service, NULL,
MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP | MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP |
MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR | MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR |
MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT | MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT |
MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS | MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS |
skipping to change at line 735 skipping to change at line 684
MAIL_STORAGE_SERVICE_FLAG_NO_RESTRICT_ACCESS); MAIL_STORAGE_SERVICE_FLAG_NO_RESTRICT_ACCESS);
mail_storage_service_set_auth_conn(storage_service, conn); mail_storage_service_set_auth_conn(storage_service, conn);
conn = NULL; conn = NULL;
if (show_field == NULL && expand_field == NULL) { if (show_field == NULL && expand_field == NULL) {
doveadm_print_init(DOVEADM_PRINT_TYPE_TAB); doveadm_print_init(DOVEADM_PRINT_TYPE_TAB);
doveadm_print_header_simple("field"); doveadm_print_header_simple("field");
doveadm_print_header_simple("value"); doveadm_print_header_simple("value");
} }
} }
while ((input.username = argv[optind++]) != NULL) { for (i = 0; user_masks[i] != NULL; i++) {
input.username = user_masks[i];
if (first) if (first)
first = FALSE; first = FALSE;
else else
putchar('\n'); putchar('\n');
ret = !userdb_only ? ret = !userdb_only ?
cmd_user_mail_input(storage_service, &input, show_field, expand_field) : cmd_user_mail_input(storage_service, &input, show_field, expand_field) :
cmd_user_input(conn, &input, show_field, TRUE); cmd_user_input(conn, &input, show_field, TRUE);
switch (ret) { switch (ret) {
case -1: case -1:
skipping to change at line 759 skipping to change at line 709
doveadm_exit_code = EX_NOUSER; doveadm_exit_code = EX_NOUSER;
break; break;
} }
} }
if (storage_service != NULL) if (storage_service != NULL)
mail_storage_service_deinit(&storage_service); mail_storage_service_deinit(&storage_service);
if (conn != NULL) if (conn != NULL)
auth_master_deinit(&conn); auth_master_deinit(&conn);
} }
struct doveadm_cmd doveadm_cmd_auth[] = { struct doveadm_cmd_ver2 doveadm_cmd_auth[] = {
{ cmd_auth_test, "auth test", {
"[-a <auth socket path>] [-x <auth info>] [-M <master user>] <user> [<p .cmd = cmd_auth_test,
assword>]" }, .name = "auth test",
{ cmd_auth_login, "auth login", .usage = "[-a <auth socket path>] [-x <auth info>] [-M <master user>] <us
"[-a <auth-login socket path>] [-m <auth-master socket path>] [-x <auth er> [<password>]",
info>] [-M <master user>] <user> [<password>]" }, DOVEADM_CMD_PARAMS_START
{ cmd_auth_lookup, "auth lookup", DOVEADM_CMD_PARAM('a', "socket-path", CMD_PARAM_STR, 0)
"[-a <userdb socket path>] [-x <auth info>] [-f field] <user> [...]" }, DOVEADM_CMD_PARAM('x', "auth-info", CMD_PARAM_ARRAY, 0)
{ cmd_auth_cache_flush, "auth cache flush", DOVEADM_CMD_PARAM('M', "master-user", CMD_PARAM_STR, 0)
"[-a <master socket path>] [<user> [...]]" }, DOVEADM_CMD_PARAM('\0', "user", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
{ cmd_user, "user", DOVEADM_CMD_PARAM('\0', "password", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
"[-a <userdb socket path>] [-x <auth info>] [-f field] [-e <value>] [-u DOVEADM_CMD_PARAMS_END
] <user mask> [...]" } },
{
.cmd = cmd_auth_login,
.name = "auth login",
.usage = "[-a <auth-login socket path>] [-m <auth-master socket path>] [-
x <auth info>] [-M <master user>] <user> [<password>]",
DOVEADM_CMD_PARAMS_START
DOVEADM_CMD_PARAM('a', "auth-login-socket-path", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('m', "auth-master-socket-path", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('x', "auth-info", CMD_PARAM_ARRAY, 0)
DOVEADM_CMD_PARAM('M', "master-user", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('\0', "user", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAM('\0', "password", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAMS_END
},
{
.cmd = cmd_auth_lookup,
.name = "auth lookup",
.usage = "[-a <userdb socket path>] [-x <auth info>] [-f field] <user> [<
user> [...]]",
DOVEADM_CMD_PARAMS_START
DOVEADM_CMD_PARAM('a', "socket-path", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('x', "auth-info", CMD_PARAM_ARRAY, 0)
DOVEADM_CMD_PARAM('f', "field", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('\0', "user", CMD_PARAM_ARRAY, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAMS_END
},
{
.cmd = cmd_auth_cache_flush,
.name = "auth cache flush",
.usage = "[-a <master socket path>] [<user> [...]]",
DOVEADM_CMD_PARAMS_START
DOVEADM_CMD_PARAM('a', "socket-path", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('\0', "user", CMD_PARAM_ARRAY, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAMS_END
},
{
.cmd = cmd_user,
.name = "user",
.usage = "[-a <userdb socket path>] [-x <auth info>] [-f field] [-e <valu
e>] [-u] <user mask> [<user mask> [...]]",
DOVEADM_CMD_PARAMS_START
DOVEADM_CMD_PARAM('a', "socket-path", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('x', "auth-info", CMD_PARAM_ARRAY, 0)
DOVEADM_CMD_PARAM('f', "field", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('e', "expand-field", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('u', "userdb-only", CMD_PARAM_BOOL, 0)
DOVEADM_CMD_PARAM('\0', "user-mask", CMD_PARAM_ARRAY, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAMS_END
}
}; };
static void auth_cmd_help(doveadm_command_t *cmd) static void auth_cmd_help(struct doveadm_cmd_context *cctx)
{ {
unsigned int i; unsigned int i;
for (i = 0; i < N_ELEMENTS(doveadm_cmd_auth); i++) { for (i = 0; i < N_ELEMENTS(doveadm_cmd_auth); i++) {
if (doveadm_cmd_auth[i].cmd == cmd) if (doveadm_cmd_auth[i].cmd == cctx->cmd->cmd)
help(&doveadm_cmd_auth[i]); help_ver2(&doveadm_cmd_auth[i]);
} }
i_unreached(); i_unreached();
} }
void doveadm_register_auth_commands(void) void doveadm_register_auth_commands(void)
{ {
unsigned int i; unsigned int i;
for (i = 0; i < N_ELEMENTS(doveadm_cmd_auth); i++) for (i = 0; i < N_ELEMENTS(doveadm_cmd_auth); i++)
doveadm_register_cmd(&doveadm_cmd_auth[i]); doveadm_cmd_register_ver2(&doveadm_cmd_auth[i]);
} }
 End of changes. 39 change blocks. 
149 lines changed or deleted 148 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)