*/
#include "includes.h"
+#include "system/filesys.h"
#include "krb5_samba.h"
#include "lib/util/asn1.h"
{
krb5_error_code code = 0;
krb5_creds my_creds;
+ mode_t mask;
#if defined(HAVE_KRB5_GET_INIT_CREDS_KEYBLOCK)
code = krb5_get_init_creds_keyblock(ctx, &my_creds, principal,
*(KRB5_KT_KEY(&entry)) = *keyblock;
memcpy(tmp_name, SMB_CREDS_KEYTAB, sizeof(SMB_CREDS_KEYTAB));
+ mask = umask(S_IRWXO | S_IRWXG);
mktemp(tmp_name);
+ umask(mask);
if (tmp_name[0] == 0) {
return KRB5_KT_BADNAME;
}
{
char *fname;
int fd;
+ mode_t mask;
if (!dir) {
dir = tmpdir();
errno = ENOMEM;
return -1;
}
+ mask = umask(S_IRWXO | S_IRWXG);
fd = mkstemp(fname);
+ umask(mask);
if (fd == -1) {
TALLOC_FREE(fname);
return -1;
NTSTATUS status;
size_t n = 0;
size_t converted_size;
+ mode_t mask;
if (!filename_out) {
return NT_STATUS_INVALID_PARAMETER;
goto out;
}
+ mask = umask(S_IRWXO | S_IRWXG);
tmp_fd = mkstemp(tmp_name);
+ umask(mask);
if (tmp_fd == -1) {
status = NT_STATUS_ACCESS_DENIED;
goto out;
const char *pager;
int fd;
int rc = 0;
+ mode_t mask;
rname = talloc_strdup(ctx, client_get_cur_dir());
if (!rname) {
if (!lname) {
return 1;
}
+ mask = umask(S_IRWXO | S_IRWXG);
fd = mkstemp(lname);
+ umask(mask);
if (fd == -1) {
d_printf("failed to create temporary file for more\n");
return 1;
*/
#include "includes.h"
+#include "system/filesys.h"
/* need to move this from here!! need some sleep ... */
struct current_user current_user;
int fd;
TALLOC_CTX *ctx = talloc_stackframe();
char *path = NULL;
+ mode_t mask;
path = talloc_asprintf(ctx,
"%s/smb.XXXXXX",
}
/* now create the file */
+ mask = umask(S_IRWXO | S_IRWXG);
fd = mkstemp(path);
+ umask(mask);
if (fd == -1) {
DEBUG(0,("setup_out_fd: Failed to create file %s. (%s)\n",
char *realm_upper = NULL;
bool result = false;
char *aes_enctypes = NULL;
+ mode_t mask;
if (!lp_create_krb5_conf()) {
return false;
flen = strlen(file_contents);
+ mask = umask(S_IRWXO | S_IRWXG);
fd = mkstemp(tmpname);
+ umask(mask);
if (fd == -1) {
DEBUG(0,("create_local_private_krb5_conf_for_domain: smb_mkstemp failed,"
" for file %s. Errno %s\n",
*/
#include "includes.h"
+#include "system/filesys.h"
#include "libnet/libnet_samsync.h"
#include "transfer_file.h"
#include "passdb.h"
const char *add_template = "/tmp/add.ldif.XXXXXX";
const char *mod_template = "/tmp/mod.ldif.XXXXXX";
const char *builtin_sid = "S-1-5-32";
+ mode_t mask;
+ int fd;
r = talloc_zero(mem_ctx, struct samsync_ldif_context);
NT_STATUS_HAVE_NO_MEMORY(r);
goto done;
}
+ mask = umask(S_IRWXO | S_IRWXG);
+ fd = mkstemp(r->add_name);
+ umask(mask);
+ if (fd < 0) {
+ DEBUG(1, ("Could not create %s\n", r->add_name));
+ status = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
/* Open the add and mod ldif files */
- if (!(r->add_file = fdopen(mkstemp(r->add_name),"w"))) {
+ r->add_file = fdopen(fd, "w");
+ if (r->add_file == NULL) {
DEBUG(1, ("Could not open %s\n", r->add_name));
+ close(fd);
status = NT_STATUS_UNSUCCESSFUL;
goto done;
}
- if (!(r->mod_file = fdopen(mkstemp(r->module_name),"w"))) {
+
+ mask = umask(S_IRWXO | S_IRWXG);
+ fd = mkstemp(r->module_name);
+ umask(mask);
+ if (fd < 0) {
+ DEBUG(1, ("Could not create %s\n", r->module_name));
+ status = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ r->mod_file = fdopen(fd, "w");
+ if (r->mod_file == NULL) {
DEBUG(1, ("Could not open %s\n", r->module_name));
+ close(fd);
status = NT_STATUS_UNSUCCESSFUL;
goto done;
}
SMB_STRUCT_STAT st;
const char *path;
int len;
+ mode_t mask;
/* if this file is within the printer path, it means that smbd
* is spooling it and will pass us control when it is finished.
slprintf(pjob->filename, sizeof(pjob->filename)-1,
"%s/%sXXXXXX", lp_pathname(talloc_tos(), snum),
PRINT_SPOOL_PREFIX);
+ mask = umask(S_IRWXO | S_IRWXG);
pjob->fd = mkstemp(pjob->filename);
+ umask(mask);
if (pjob->fd == -1) {
werr = map_werror_from_unix(errno);
*/
#include "includes.h"
+#include "system/filesys.h"
#include "printing.h"
#include "rpc_client/rpc_client.h"
#include "../librpc/gen_ndr/ndr_spoolss_c.h"
struct spoolss_DocumentInfo1 *info1;
int fd = -1;
WERROR werr;
+ mode_t mask;
tmp_ctx = talloc_new(fsp);
if (!tmp_ctx) {
goto done;
}
errno = 0;
+ mask = umask(S_IRWXO | S_IRWXG);
fd = mkstemp(pf->filename);
+ umask(mask);
if (fd == -1) {
if (errno == EACCES) {
/* Common setup error, force a report. */
#include "includes.h"
+#include "system/filesys.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "smbprofile.h"
ssize_t sz;
fstring alpha_buf;
char *s;
+ mode_t mask;
if (! (*lp_msg_command(frame))) {
DEBUG(1,("no messaging command specified\n"));
if (!name) {
goto done;
}
+ mask = umask(S_IRWXO | S_IRWXG);
fd = mkstemp(name);
+ umask(mask);
if (fd == -1) {
DEBUG(1, ("can't open message file %s: %s\n", name,
*/
#include "includes.h"
+#include "system/filesys.h"
#include "interact.h"
char buf[128];
char* ret = NULL;
FILE* file;
+ mode_t mask;
+ int fd;
- int fd = mkstemp(fname);
+ mask = umask(S_IRWXO | S_IRWXG);
+ fd = mkstemp(fname);
+ umask(mask);
if (fd == -1) {
DEBUG(0, ("failed to mkstemp %s: %s\n", fname,
strerror(errno)));
uid_t myeuid = geteuid();
bool guest_ok = false;
int num_usershares;
+ mode_t mask;
us_comment = "";
arg_acl = "S-1-1-0:R";
}
/* Create a temporary filename for this share. */
+ mask = umask(S_IRWXO | S_IRWXG);
tmpfd = mkstemp(full_path_tmp);
+ umask(mask);
if (tmpfd == -1) {
d_fprintf(stderr,
char *pager;
int fd;
int rc = 0;
+ mode_t mask;
lname = talloc_asprintf(ctx, "%s/smbmore.XXXXXX",tmpdir());
+ mask = umask(S_IRWXO | S_IRWXG);
fd = mkstemp(lname);
+ umask(mask);
if (fd == -1) {
d_printf("failed to create temporary file for more\n");
return 1;