sss_debuglevel.c revision 877b92e80bde510d5cd9f03dbf01e2bcf73ab072
/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2011 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <talloc.h>
#include <popt.h>
#include <dirent.h>
#include <ctype.h>
#include <signal.h>
#include <utime.h>
#include <ldb.h>
#include "config.h"
#include "tools/tools_util.h"
if (expr) { \
goto done; \
} \
} while(0)
struct debuglevel_tool_ctx {
struct confdb_ctx *confdb;
char **sections;
};
int debug_to_set, const char *config_file);
char ***output_sections);
static int parse_debug_level(const char *strlevel);
{
int ret;
int pc_debug = SSSDBG_DEFAULT;
int debug_to_set = SSSDBG_INVALID;
const char *debug_as_string = NULL;
const char *config_file = NULL;
const char *pc_config_file = NULL;
struct poptOption long_options[] = {
0, _("The debug level to run with"), NULL },
0, _("Specify a non-default config file"), NULL},
};
debug_prg_name = argv[0];
/* parse parameters */
switch(ret) {
default:
ret = EXIT_FAILURE;
goto fini;
}
}
/* get debug level */
if (debug_as_string == NULL) {
}
/* No more arguments expected. If something follows it is an error. */
if (poptGetArg(pc)) {
}
/* get config file */
if (pc_config_file) {
} else {
}
if (config_file == NULL) {
goto fini;
}
/* free pc_config_file? */
/* free debug_as_string? */
/* allocate context */
"Could not allocate memory for tools context\n");
goto fini;
}
"Could not force sssd processes to reload configuration. "
"Is sssd running?");
fini:
return ret;
}
int debug_to_set, const char *config_file)
{
int ret;
int err;
const char *values[2];
return ENOMEM;
}
/* convert debug_to_set to string */
"debug_to_set to string conversion\n");
goto done;
}
/* write to confdb */
goto done;
}
}
/*
* Change atime and mtime of sssd.conf,
* so the configuration can be restored on next start.
*/
errno = 0;
}
done:
return ret;
}
{
int ret;
char* confdb_path = NULL;
if (confdb_path == NULL) {
"Could not allocate memory for confdb path\n");
return ENOMEM;
}
"Could not initialize connection to the confdb\n");
}
return ret;
}
char ***output_sections)
{
int ret;
int domain_count = 0;
int i = 0;
char **sections;
const char *known_services[] = {
};
static const int known_services_count = sizeof(known_services)
/ sizeof(*known_services);
return ENOMEM;
}
/* get domains */
for (domain = domain_list;
domain_count++;
}
/* allocate output space */
"Could not allocate memory for sections\n");
goto fail;
}
for (i = 0; i < known_services_count; i++) {
goto fail;
}
}
for (domain = domain_list;
goto fail;
}
}
/* add NULL to the end */
return EOK;
fail:
return ret;
}
int parse_debug_level(const char *strlevel)
{
long value;
char *endptr;
errno = 0;
return SSSDBG_INVALID;
}
return debug_convert_old_level(value);
}