Commit beb78229 beb782295ca386a70beb0f4374a890e7abfa9216 by Sergey Poznyakoff

Improve debugging in the category "auth".

* libmailutils/auth/mu_auth.c: Fix mu_debug calls. Use different levels.

Remove --debug-auth option.  Users should use --debug-level=auth instead.

* libmu_argp/auth.c: Remove.
* libmu_argp/Makefile.am (libmu_argp_a_SOURCES): Remove auth.c
* include/mailutils/libargp.h (mu_auth_cmdline): Remove.
* libmu_argp/cmdline.c (all_cmdline_capa): Remove mu_auth_cmdline.
1 parent c5f1126f
......@@ -60,7 +60,6 @@ extern struct mu_cmdline_capa mu_tls_cmdline;
extern struct mu_cmdline_capa mu_radius_cmdline;
extern struct mu_cmdline_capa mu_sql_cmdline;
extern struct mu_cmdline_capa mu_virtdomain_cmdline;
extern struct mu_cmdline_capa mu_auth_cmdline;
extern void mu_libargp_init (void);
......
......@@ -55,7 +55,7 @@
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE, \
("source=%s, name=%s, passwd=%s, uid=%lu, gid=%lu, " \
"gecos=%s, dir=%s, shell=%s, mailbox=%s, quota=%lu, " \
"change_uid=%d\n", \
"change_uid=%d", \
S ((a)->source), \
S ((a)->name), \
S ((a)->passwd), \
......@@ -191,11 +191,11 @@ mu_auth_runlist (mu_list_t flist, struct mu_auth_data **return_data,
mu_iterator_next (itr))
{
mu_iterator_current (itr, (void **)&ep);
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE,
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE2,
("Trying %s...", ep->name));
rc = ep->fun (return_data, key, ep->func_data, data);
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE,
("result: %d=%s\n", rc, mu_strerror (rc)));
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE2,
("%s yields %d=%s", ep->name, rc, mu_strerror (rc)));
if (rc == 0)
{
if (return_data)
......@@ -244,13 +244,13 @@ mu_get_auth (struct mu_auth_data **auth, enum mu_auth_key_type type,
switch (type)
{
case mu_auth_key_name:
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE,
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE1,
("Getting auth info for user %s", (char*) key));
list = mu_auth_by_name_list;
break;
case mu_auth_key_uid:
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE,
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE1,
("Getting auth info for UID %lu",
(unsigned long) *(uid_t*) key));
list = mu_auth_by_uid_list;
......@@ -289,8 +289,8 @@ mu_authenticate (struct mu_auth_data *auth_data, const char *pass)
{
if (!auth_data)
return EINVAL;
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE,
("mu_authenticate, user %s, source %s\n",
mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE1,
("mu_authenticate, user %s, source %s",
auth_data->name, auth_data->source));
if (!mu_authenticate_list)
mu_auth_begin_setup ();
......
......@@ -25,7 +25,6 @@ AM_CPPFLAGS = \
lib_LIBRARIES = libmu_argp.a
libmu_argp_a_SOURCES =\
auth.c\
cmdline.c\
cmdline.h\
common.c\
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library. If not, see
<http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/mu_auth.h"
/* ************************************************************************* */
/* Traditional configuration */
/* ************************************************************************* */
enum {
OPT_DEBUG_AUTH=256
};
static error_t mu_auth_argp_parser (int key, char *arg,
struct argp_state *state);
/* Options used by programs that use extended authentication mechanisms. */
static struct argp_option mu_auth_argp_option[] = {
{ "debug-auth", OPT_DEBUG_AUTH, NULL, 0,
N_("debug authentication functions") },
{ NULL, 0, NULL, 0, NULL, 0 }
};
static struct argp mu_auth_argp = {
mu_auth_argp_option,
mu_auth_argp_parser,
};
static struct argp_child mu_auth_argp_child = {
&mu_auth_argp,
0,
NULL,
0
};
static error_t
mu_auth_argp_parser (int key, char *arg, struct argp_state *state)
{
static mu_list_t lst;
switch (key)
{
case ARGP_KEY_INIT:
mu_argp_node_list_init (&lst);
break;
case ARGP_KEY_FINI:
mu_argp_node_list_finish (lst, "auth", NULL);
break;
case OPT_DEBUG_AUTH:
mu_debug_set_category_level (MU_DEBCAT_AUTH,
MU_DEBUG_LEVEL_UPTO (MU_DEBUG_TRACE7));
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
}
struct mu_cmdline_capa mu_auth_cmdline = {
"auth", &mu_auth_argp_child
};
......@@ -27,7 +27,6 @@ static struct mu_cmdline_capa *all_cmdline_capa[] = {
&mu_mailer_cmdline,
&mu_debug_cmdline,
&mu_tls_cmdline,
&mu_auth_cmdline,
&mu_sieve_cmdline,
NULL
};
......