>From 557d59d0b8d5db9fc7f80ab037418625450efad3 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 1 Sep 2014 13:27:33 +0200 Subject: [PATCH] LDAP: Set umask before calling mkstemp Even though we only call mkstemp to generate a random filename, it's a good practice to set and re-set umask before and after calling mkstemp. Silences a warning from Coverity static analyzer. --- src/providers/ldap/ldap_child.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c index 6ef7bd204bb028b0dc1f0ccb8b6e52cdacf044f2..e5779b70906d90ab855677f04a154e179f2163c6 100644 --- a/src/providers/ldap/ldap_child.c +++ b/src/providers/ldap/ldap_child.c @@ -189,6 +189,7 @@ static krb5_error_code ldap_child_get_tgt_sync(TALLOC_CTX *memctx, TALLOC_CTX *tmp_ctx; char *ccname_file_dummy; char *ccname_file; + mode_t old_umask; krberr = krb5_init_context(&context); if (krberr) { @@ -303,7 +304,9 @@ static krb5_error_code ldap_child_get_tgt_sync(TALLOC_CTX *memctx, goto done; } + old_umask = umask(077); fd = mkstemp(ccname_file_dummy); + umask(old_umask); if (fd == -1) { ret = errno; goto done; -- 1.9.3