[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-303-gc15819b

Jeremy Allison jra at samba.org
Mon Nov 12 05:55:28 GMT 2007


The branch, v3-2-test has been updated
       via  c15819b75751a1e15cfed2ef94dae10ee72d769c (commit)
       via  c0412b5d13546f388b615a073e82e7730e01d731 (commit)
      from  c3a66b4ee97a902c5cf43c3bb145541849a029ed (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit c15819b75751a1e15cfed2ef94dae10ee72d769c
Author: Jeremy Allison <jra at samba.org>
Date:   Sun Nov 11 21:46:52 2007 -0800

    Three more pstring removals.
    Jeremy.

commit c0412b5d13546f388b615a073e82e7730e01d731
Author: Jeremy Allison <jra at samba.org>
Date:   Sun Nov 11 21:45:55 2007 -0800

    Remove a pstring.
    Jeremy.

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

Summary of changes:
 source/lib/util_sock.c  |   15 +++++++++++----
 source/smbd/chgpasswd.c |   10 +++++++---
 source/smbd/process.c   |   12 +++++++++---
 source/smbd/server.c    |    3 +--
 4 files changed, 28 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c
index 66da297..2815406 100644
--- a/source/lib/util_sock.c
+++ b/source/lib/util_sock.c
@@ -1895,7 +1895,7 @@ int create_pipe_sock(const char *socket_dir,
 	struct stat st;
 	int sock;
 	mode_t old_umask;
-	pstring path;
+	char *path = NULL;
 
 	old_umask = umask(0);
 
@@ -1935,11 +1935,15 @@ int create_pipe_sock(const char *socket_dir,
 	sock = socket(AF_UNIX, SOCK_STREAM, 0);
 
 	if (sock == -1) {
-		perror("socket");
-                goto out_umask;
+		DEBUG(0, ("create_pipe_sock: socket error %s\n",
+			strerror(errno) ));
+                goto out_close;
 	}
 
-	pstr_sprintf(path, "%s/%s", socket_dir, socket_name);
+	asprintf(&path, "%s/%s", socket_dir, socket_name);
+	if (!path) {
+                goto out_close;
+	}
 
 	unlink(path);
 	memset(&sunaddr, 0, sizeof(sunaddr));
@@ -1958,10 +1962,13 @@ int create_pipe_sock(const char *socket_dir,
 		goto out_close;
 	}
 
+	SAFE_FREE(path);
+
 	umask(old_umask);
 	return sock;
 
 out_close:
+	SAFE_FREE(path);
 	close(sock);
 
 out_umask:
diff --git a/source/smbd/chgpasswd.c b/source/smbd/chgpasswd.c
index d894421..6e7ef20 100644
--- a/source/smbd/chgpasswd.c
+++ b/source/smbd/chgpasswd.c
@@ -262,14 +262,18 @@ static int expect(int master, char *issue, char *expected)
 
 			{
 				/* Eat leading/trailing whitespace before match. */
-				pstring str;
-				pstrcpy( str, buffer);
-				trim_char( str, ' ', ' ');
+				char *str = SMB_STRDUP(buffer);
+				if (!str) {
+					DEBUG(2,("expect: ENOMEM\n"));
+					return False;
+				}
+				trim_char(str, ' ', ' ');
 
 				if ((match = unix_wild_match(expected, str)) == True) {
 					/* Now data has started to return, lower timeout. */
 					timeout = lp_passwd_chat_timeout() * 100;
 				}
+				SAFE_FREE(str);
 			}
 		}
 
diff --git a/source/smbd/process.c b/source/smbd/process.c
index 5601a7f..ffc9e10 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -1260,13 +1260,18 @@ void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes)
 static void smb_dump(const char *name, int type, const char *data, ssize_t len)
 {
 	int fd, i;
-	pstring fname;
-	if (DEBUGLEVEL < 50) return;
+	char *fname = NULL;
+	if (DEBUGLEVEL < 50) {
+		return;
+	}
 
 	if (len < 4) len = smb_len(data)+4;
 	for (i=1;i<100;i++) {
-		slprintf(fname,sizeof(fname)-1, "/tmp/%s.%d.%s", name, i,
+		asprintf(&fname, "/tmp/%s.%d.%s", name, i,
 				type ? "req" : "resp");
+		if (!fname) {
+			return;
+		}
 		fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644);
 		if (fd != -1 || errno != EEXIST) break;
 	}
@@ -1277,6 +1282,7 @@ static void smb_dump(const char *name, int type, const char *data, ssize_t len)
 		close(fd);
 		DEBUG(0,("created %s len %lu\n", fname, (unsigned long)len));
 	}
+	SAFE_FREE(fname);
 }
 
 /****************************************************************************
diff --git a/source/smbd/server.c b/source/smbd/server.c
index e89a945..028dacc 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -728,8 +728,7 @@ bool reload_services(bool test)
 	bool ret;
 	
 	if (lp_loaded()) {
-		pstring fname;
-		pstrcpy(fname,lp_configfile());
+		char *fname = lp_configfile();
 		if (file_exist(fname, NULL) &&
 		    !strcsequal(fname, dyn_CONFIGFILE)) {
 			pstrcpy(dyn_CONFIGFILE, fname);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list