summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-04-20 23:58:26 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-04-20 23:58:26 +0200
commit4c32978d973093903a5372a6f358275184bbcab2 (patch)
treeb7f0331f4909d125215c1ffe042cdec4d0e63172
parent6fc40ce0d3b1bdfe9a138db4953896f47094424e (diff)
downloadsamba-4c32978d973093903a5372a6f358275184bbcab2.tar.gz
samba-4c32978d973093903a5372a6f358275184bbcab2.tar.bz2
samba-4c32978d973093903a5372a6f358275184bbcab2.zip
Remove smb_mkstemp() - libreplace will now provide a secure mkstemp() if
the system one is broken.
-rw-r--r--source3/client/client.c2
-rw-r--r--source3/lib/smbrun.c2
-rw-r--r--source3/lib/util.c18
-rw-r--r--source3/libads/kerberos.c2
-rw-r--r--source3/libnet/libnet_samsync_ldif.c4
-rw-r--r--source3/printing/printing.c2
-rw-r--r--source3/smbd/message.c2
-rw-r--r--source3/smbd/reply.c4
-rw-r--r--source3/utils/net_usershare.c2
9 files changed, 10 insertions, 28 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index a6f31bcf17..fcb9b27f1f 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -1281,7 +1281,7 @@ static int cmd_more(void)
if (!lname) {
return 1;
}
- fd = smb_mkstemp(lname);
+ fd = mkstemp(lname);
if (fd == -1) {
d_printf("failed to create temporary file for more\n");
return 1;
diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c
index fdccd9ec97..14e6a7690c 100644
--- a/source3/lib/smbrun.c
+++ b/source3/lib/smbrun.c
@@ -42,7 +42,7 @@ static int setup_out_fd(void)
}
/* now create the file */
- fd = smb_mkstemp(path);
+ fd = mkstemp(path);
if (fd == -1) {
DEBUG(0,("setup_out_fd: Failed to create file %s. (%s)\n",
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 75fd82709a..c86f259ce3 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2114,24 +2114,6 @@ int set_maxfiles(int requested_max)
}
/*****************************************************************
- Possibly replace mkstemp if it is broken.
-*****************************************************************/
-
-int smb_mkstemp(char *name_template)
-{
-#if HAVE_SECURE_MKSTEMP
- return mkstemp(name_template);
-#else
- /* have a reasonable go at emulating it. Hope that
- the system mktemp() isn't completly hopeless */
- char *p = mktemp(name_template);
- if (!p)
- return -1;
- return open(p, O_CREAT|O_EXCL|O_RDWR, 0600);
-#endif
-}
-
-/*****************************************************************
malloc that aborts with smb_panic on fail or zero size.
*****************************************************************/
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index c476f59ff5..e1618636e1 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -874,7 +874,7 @@ bool create_local_private_krb5_conf_for_domain(const char *realm,
flen = strlen(file_contents);
- fd = smb_mkstemp(tmpname);
+ fd = mkstemp(tmpname);
if (fd == -1) {
DEBUG(0,("create_local_private_krb5_conf_for_domain: smb_mkstemp failed,"
" for file %s. Errno %s\n",
diff --git a/source3/libnet/libnet_samsync_ldif.c b/source3/libnet/libnet_samsync_ldif.c
index dc3bc75541..931107946e 100644
--- a/source3/libnet/libnet_samsync_ldif.c
+++ b/source3/libnet/libnet_samsync_ldif.c
@@ -948,12 +948,12 @@ static NTSTATUS ldif_init_context(TALLOC_CTX *mem_ctx,
}
/* Open the add and mod ldif files */
- if (!(r->add_file = fdopen(smb_mkstemp(r->add_name),"w"))) {
+ if (!(r->add_file = fdopen(mkstemp(r->add_name),"w"))) {
DEBUG(1, ("Could not open %s\n", r->add_name));
status = NT_STATUS_UNSUCCESSFUL;
goto done;
}
- if (!(r->mod_file = fdopen(smb_mkstemp(r->mod_name),"w"))) {
+ if (!(r->mod_file = fdopen(mkstemp(r->mod_name),"w"))) {
DEBUG(1, ("Could not open %s\n", r->mod_name));
status = NT_STATUS_UNSUCCESSFUL;
goto done;
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 8524cfb2bd..a661d3dbdc 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -2476,7 +2476,7 @@ uint32 print_job_start(struct auth_serversupplied_info *server_info, int snum,
/* we have a job entry - now create the spool file */
slprintf(pjob.filename, sizeof(pjob.filename)-1, "%s/%s%.8u.XXXXXX",
path, PRINT_SPOOL_PREFIX, (unsigned int)jobid);
- pjob.fd = smb_mkstemp(pjob.filename);
+ pjob.fd = mkstemp(pjob.filename);
if (pjob.fd == -1) {
if (errno == EACCES) {
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index dbc833f091..e6d5f451cd 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -59,7 +59,7 @@ static void msg_deliver(struct msg_state *state)
if (!name) {
goto done;
}
- fd = smb_mkstemp(name);
+ fd = mkstemp(name);
if (fd == -1) {
DEBUG(1, ("can't open message file %s: %s\n", name,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index e1364f2462..d2e1f8be5f 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2214,7 +2214,7 @@ void reply_ctemp(struct smb_request *req)
return;
}
- tmpfd = smb_mkstemp(fname);
+ tmpfd = mkstemp(fname);
if (tmpfd == -1) {
reply_unixerror(req, ERRDOS, ERRnoaccess);
END_PROFILE(SMBctemp);
@@ -2244,7 +2244,7 @@ void reply_ctemp(struct smb_request *req)
NULL, /* pinfo */
&sbuf); /* psbuf */
- /* close fd from smb_mkstemp() */
+ /* close fd from mkstemp() */
close(tmpfd);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c
index 7d3cb287a8..dadb88303b 100644
--- a/source3/utils/net_usershare.c
+++ b/source3/utils/net_usershare.c
@@ -859,7 +859,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
}
/* Create a temporary filename for this share. */
- tmpfd = smb_mkstemp(full_path_tmp);
+ tmpfd = mkstemp(full_path_tmp);
if (tmpfd == -1) {
d_fprintf(stderr, "net usershare add: cannot create tmp file %s\n",