1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

debug: add support for per debug-class logfiles

This adds support for per debug-class logfiles to the function parsing
the "log level" option.

The enhanced syntax is:

  log level = CLASS:LEVEL[@PATH] [CLASS:LEVEL[@PATH] ... ]

Eg

  log level = full_audit:1@/var/log/audit.logfile

While the option is already parsed and stored in in the dbgc_config[]
array, the feature is still effectively disabled, as
reopen_logs_internal() still doesn't open the per debug-class logfiles.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2018-12-12 13:11:26 +01:00 committed by Jeremy Allison
parent abfb3c6bbf
commit 249bdd9378

View File

@ -810,6 +810,7 @@ static void debug_dump_status(int level)
static bool debug_parse_param(char *param)
{
char *class_name;
char *class_file = NULL;
char *class_level;
char *saveptr = NULL;
int ndx;
@ -819,11 +820,13 @@ static bool debug_parse_param(char *param)
return false;
}
class_level = strtok_r(NULL, "\0", &saveptr);
class_level = strtok_r(NULL, "@\0", &saveptr);
if (class_level == NULL) {
return false;
}
class_file = strtok_r(NULL, "\0", &saveptr);
ndx = debug_lookup_classname(class_name);
if (ndx == -1) {
return false;
@ -831,6 +834,16 @@ static bool debug_parse_param(char *param)
dbgc_config[ndx].loglevel = atoi(class_level);
if (class_file == NULL) {
return true;
}
TALLOC_FREE(dbgc_config[ndx].logfile);
dbgc_config[ndx].logfile = talloc_strdup(NULL, class_file);
if (dbgc_config[ndx].logfile == NULL) {
return false;
}
return true;
}