1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

s3-libnetapi: add libnetapi_set_logfile()

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
Günther Deschner
2021-02-15 17:33:46 +01:00
parent 927390bae5
commit 1c62cac7f2
3 changed files with 28 additions and 0 deletions

View File

@ -218,6 +218,25 @@ NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx,
/**************************************************************** /****************************************************************
****************************************************************/ ****************************************************************/
NET_API_STATUS libnetapi_set_logfile(struct libnetapi_ctx *ctx,
const char *logfile)
{
TALLOC_CTX *frame = talloc_stackframe();
ctx->logfile = talloc_strdup(ctx, logfile);
if (!lp_set_cmdline("log file", logfile)) {
TALLOC_FREE(frame);
return W_ERROR_V(WERR_GEN_FAILURE);
}
debug_set_logfile(logfile);
setup_logging("libnetapi", DEBUG_FILE);
TALLOC_FREE(frame);
return NET_API_STATUS_SUCCESS;
}
/****************************************************************
****************************************************************/
NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx,
char **debuglevel) char **debuglevel)
{ {

View File

@ -1429,6 +1429,12 @@ NET_API_STATUS libnetapi_get_use_kerberos(struct libnetapi_ctx *ctx,
/**************************************************************** /****************************************************************
****************************************************************/ ****************************************************************/
NET_API_STATUS libnetapi_set_logfile(struct libnetapi_ctx *ctx,
const char *logfile);
/****************************************************************
****************************************************************/
NET_API_STATUS libnetapi_set_use_ccache(struct libnetapi_ctx *ctx); NET_API_STATUS libnetapi_set_use_ccache(struct libnetapi_ctx *ctx);
/**************************************************************** /****************************************************************

View File

@ -56,6 +56,7 @@ struct libnetapi_private_ctx {
struct libnetapi_ctx { struct libnetapi_ctx {
char *debuglevel; char *debuglevel;
char *logfile;
char *error_string; char *error_string;
int disable_policy_handle_cache; int disable_policy_handle_cache;
@ -69,6 +70,8 @@ NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx,
const char *format, ...) const char *format, ...)
PRINTF_ATTRIBUTE(2,3); PRINTF_ATTRIBUTE(2,3);
NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel); NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
NET_API_STATUS libnetapi_set_logfile(struct libnetapi_ctx *ctx,
const char *logfile);
WERROR libnetapi_shutdown_cm(struct libnetapi_ctx *ctx); WERROR libnetapi_shutdown_cm(struct libnetapi_ctx *ctx);
WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx, WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,