sss_debuglevel.c revision f1828234a850dd28465425248a83a993f262918f
/*
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 "config.h"
#include "ldb.h"
#include "tools/tools_util.h"
#define MAX_PID_LENGTH 10
if (expr) { \
goto done; \
} \
} while(0);
struct debuglevel_tool_ctx {
struct confdb_ctx *confdb;
char **sections;
};
int debug_to_set, const char *config_file);
static errno_t send_sighup(void);
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) {
}
/* 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;
}
ret = send_sighup();
"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;
return ret;
}
return errno;
}
return EOK;
}
{
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 = 3;
return ENOMEM;
}
/* get domains */
domain_count++;
/* allocate output space */
("Could not allocate memory for sections\n"));
goto fail;
}
for (i = 0; i < known_services_count; i++) {
goto fail;
}
}
goto fail;
}
}
/* add NULL to the end */
return EOK;
fail:
return ret;
}
{
int ret;
*out_pid = 0;
errno = 0;
goto done;
}
/* eof not reached */
if (ret != 0) {
} else {
SSSD_PIDFILE));
}
goto done;
}
if (*out_pid == 0) {
("File \"%s\" contains invalid pid.\n", SSSD_PIDFILE));
return EINVAL;
}
done:
}
return ret;
}
{
long value;
char *endptr;
errno = 0;
return 0;
}
return value;
}
int parse_debug_level(const char *strlevel)
{
long value;
char *endptr;
errno = 0;
return SSSDBG_INVALID;
}
return debug_convert_old_level(value);
}