summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2020-01-19 12:29:56 +0100
committerJeremy Allison <jra@samba.org>2020-01-19 18:29:39 +0000
commitb274bc698ed26c6897beee6051532244bc30d2ec (patch)
tree9d945740d1d896613b5d261429cd76c8f7d9926b /source4
parent229518ec01b495e0133d83d3560a432a08307c0b (diff)
downloadsamba-b274bc698ed26c6897beee6051532244bc30d2ec.tar.gz
dsdb: Use write_data() to write to the password check script
A simple write() might be interrupted or do short writes. Highly unlikely, but if it happens, it will be impossible to diagnose. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/common/util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 4050ace40c1..d88688a8ec1 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -47,6 +47,7 @@
#include "libds/common/flag_mapping.h"
#include "lib/util/access.h"
#include "lib/util/util_str_hex.h"
+#include "lib/util/sys_rw_data.h"
#include "libcli/util/ntstatus.h"
/*
@@ -2143,9 +2144,9 @@ enum samr_ValidationStatus samdb_check_password(TALLOC_CTX *mem_ctx,
cps_stdin = samba_runcmd_export_stdin(req);
- nwritten = write(cps_stdin, utf8_blob->data,
- utf8_blob->length);
- if (nwritten != utf8_blob->length) {
+ nwritten = write_data(
+ cps_stdin, utf8_blob->data, utf8_blob->length);
+ if (nwritten == -1) {
close(cps_stdin);
TALLOC_FREE(password_script);
TALLOC_FREE(event_ctx);