From 866d588ae735d194fb69b1f9e8ced0e02aeb447b Mon Sep 17 00:00:00 2001 From: REIM THOMAS Date: Apr 29 2020 12:16:45 +0000 Subject: GPO: Close group policy file after copying The SMB protocol sequence for copying the content of group policy files should be: - smbc_getFunctionOpen() - smbc_getFunctionRead() - smbc_getFunctionClose(). Inform the AD server, that we do not need further access to a policy file after we have copied its content. Resolves: https://pagure.io/SSSD/sssd/issue/3324 Signed-off-by: REIM THOMAS Reviewed-by: Pawel Polawski Reviewed-by: Sumit Bose --- diff --git a/src/providers/ad/ad_gpo_child.c b/src/providers/ad/ad_gpo_child.c index 789b7fb..077d678 100644 --- a/src/providers/ad/ad_gpo_child.c +++ b/src/providers/ad/ad_gpo_child.c @@ -531,7 +531,7 @@ copy_smb_file_to_gpo_cache(SMBCCTX *smbc_ctx, { char *smb_uri = NULL; char *gpt_main_folder = NULL; - SMBCFILE *file; + SMBCFILE *file = NULL; int ret; uint8_t *buf = NULL; int buflen = 0; @@ -620,6 +620,10 @@ copy_smb_file_to_gpo_cache(SMBCCTX *smbc_ctx, } done: + if (file != NULL) { + smbc_getFunctionClose(smbc_ctx)(smbc_ctx, file); + } + talloc_free(tmp_ctx); return ret; }