[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1180-g4c32978

Jelmer Vernooij jelmer at samba.org
Mon Apr 20 21:59:36 GMT 2009


The branch, master has been updated
       via  4c32978d973093903a5372a6f358275184bbcab2 (commit)
      from  6fc40ce0d3b1bdfe9a138db4953896f47094424e (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4c32978d973093903a5372a6f358275184bbcab2
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Apr 20 23:58:26 2009 +0200

    Remove smb_mkstemp() - libreplace will now provide a secure mkstemp() if
    the system one is broken.

-----------------------------------------------------------------------

Summary of changes:
 source3/client/client.c              |    2 +-
 source3/lib/smbrun.c                 |    2 +-
 source3/lib/util.c                   |   18 ------------------
 source3/libads/kerberos.c            |    2 +-
 source3/libnet/libnet_samsync_ldif.c |    4 ++--
 source3/printing/printing.c          |    2 +-
 source3/smbd/message.c               |    2 +-
 source3/smbd/reply.c                 |    4 ++--
 source3/utils/net_usershare.c        |    2 +-
 9 files changed, 10 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/client.c b/source3/client/client.c
index a6f31bc..fcb9b27 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 fdccd9e..14e6a76 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 75fd827..c86f259 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 c476f59..e161863 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 dc3bc75..9311079 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 8524cfb..a661d3d 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 dbc833f..e6d5f45 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 e1364f2..d2e1f8b 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 7d3cb28..dadb883 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",


-- 
Samba Shared Repository


More information about the samba-cvs mailing list