[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-897-g61503f8

Volker Lendecke vlendec at samba.org
Mon Apr 14 11:13:46 GMT 2008


The branch, v3-2-test has been updated
       via  61503f822b60f98dd1f7549707ec89b48e32caeb (commit)
       via  155d62ddfd3584d44a493c2aa1ea7f096bcff432 (commit)
       via  4f1d49615e1407b9c3ad5eeb50a248b8fee50e23 (commit)
       via  3b4a402bc5c3490000581d43a12388883bcf8150 (commit)
      from  512e6ca0a9be9fe35994ec1010110573a5b551d1 (commit)

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


- Log -----------------------------------------------------------------
commit 61503f822b60f98dd1f7549707ec89b48e32caeb
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 1 15:29:59 2008 +0200

    Enable multiple fd events on a single file descriptor
    
    Now we can have multiple events listen on a single fd. The order in which they
    are called is naturally not defined, meaning that it is only deterministic if
    exactly one event is readable or writeable.

commit 155d62ddfd3584d44a493c2aa1ea7f096bcff432
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 2 15:54:49 2008 +0200

    Fix some "ignoring asprintf result" warnings

commit 4f1d49615e1407b9c3ad5eeb50a248b8fee50e23
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 29 17:20:15 2008 +0100

    Make use of ZERO_STRUCT instead of memset in namequery.c

commit 3b4a402bc5c3490000581d43a12388883bcf8150
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Apr 14 12:53:11 2008 +0200

    Fix the build of db_open_trans with CLUSTER_SUPPORT enabled
    
    Metze, you might want to check this.

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

Summary of changes:
 source/lib/dbwrap.c       |    2 ++
 source/lib/events.c       |    2 +-
 source/libsmb/namequery.c |    2 +-
 source/smbd/lanman.c      |   30 +++++++++++++++---------------
 source/smbd/process.c     |   11 ++++++-----
 5 files changed, 25 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/dbwrap.c b/source/lib/dbwrap.c
index d688b83..7fe1631 100644
--- a/source/lib/dbwrap.c
+++ b/source/lib/dbwrap.c
@@ -131,6 +131,7 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx,
 		}
 		/* allow ctdb for individual databases to be disabled */
 		if (lp_parm_bool(-1, "ctdb", partname, true)) {
+			struct db_context *result = NULL;
 			result = db_open_ctdb(mem_ctx, partname, hash_size,
 					      tdb_flags, open_flags, mode);
 			if (result == NULL) {
@@ -139,6 +140,7 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx,
 				smb_panic("failed to attach to a ctdb "
 					  "database");
 			}
+			return result;
 		}
 	}
 #endif
diff --git a/source/lib/events.c b/source/lib/events.c
index f7bad9b..9decf21 100644
--- a/source/lib/events.c
+++ b/source/lib/events.c
@@ -292,7 +292,7 @@ bool run_events(struct event_context *event_ctx,
 		if (FD_ISSET(fde->fd, read_fds)) flags |= EVENT_FD_READ;
 		if (FD_ISSET(fde->fd, write_fds)) flags |= EVENT_FD_WRITE;
 
-		if (flags) {
+		if (flags & fde->flags) {
 			fde->handler(event_ctx, fde, flags, fde->private_data);
 			fired = True;
 		}
diff --git a/source/libsmb/namequery.c b/source/libsmb/namequery.c
index 0191bf7..893c926 100644
--- a/source/libsmb/namequery.c
+++ b/source/libsmb/namequery.c
@@ -1270,7 +1270,7 @@ static NTSTATUS resolve_hosts(const char *name, int name_type,
 			continue;
 		}
 
-		memset(&ss, '\0', sizeof(ss));
+		ZERO_STRUCT(ss);
 		memcpy(&ss, res->ai_addr, res->ai_addrlen);
 
 		*return_count += 1;
diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c
index 18e6bf9..6fa4f96 100644
--- a/source/smbd/lanman.c
+++ b/source/smbd/lanman.c
@@ -1971,24 +1971,24 @@ static bool api_RNetShareAdd(connection_struct *conn,uint16 vuid,
 		return False;
 	}
 
-	asprintf(&command, "%s \"%s\" \"%s\" \"%s\" \"%s\"",
-		lp_add_share_cmd(), get_dyn_CONFIGFILE(), sharename, pathname, comment);
+	if (asprintf(&command, "%s \"%s\" \"%s\" \"%s\" \"%s\"",
+		     lp_add_share_cmd(), get_dyn_CONFIGFILE(), sharename,
+		     pathname, comment) == -1) {
+		return false;
+	}
 
-	if (command) {
-		DEBUG(10,("api_RNetShareAdd: Running [%s]\n", command ));
+	DEBUG(10,("api_RNetShareAdd: Running [%s]\n", command ));
 
-		if ((res = smbrun(command, NULL)) != 0) {
-			DEBUG(1,("api_RNetShareAdd: Running [%s] returned (%d)\n", command, res ));
-			SAFE_FREE(command);
-			res = ERRnoaccess;
-			goto error_exit;
-		} else {
-			SAFE_FREE(command);
-			message_send_all(smbd_messaging_context(),
-					 MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
-		}
+	if ((res = smbrun(command, NULL)) != 0) {
+		DEBUG(1,("api_RNetShareAdd: Running [%s] returned (%d)\n",
+			 command, res ));
+		SAFE_FREE(command);
+		res = ERRnoaccess;
+		goto error_exit;
 	} else {
-		return False;
+		SAFE_FREE(command);
+		message_send_all(smbd_messaging_context(),
+				 MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
 	}
 
 	*rparam_len = 6;
diff --git a/source/smbd/process.c b/source/smbd/process.c
index 8868431..5946989 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -1259,8 +1259,10 @@ void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes)
 	if ((num_bytes > 0xffffff)
 	    || ((num_bytes + smb_size + num_words*2) > 0xffffff)) {
 		char *msg;
-		asprintf(&msg, "num_bytes too large: %u",
-			 (unsigned)num_bytes);
+		if (asprintf(&msg, "num_bytes too large: %u",
+			     (unsigned)num_bytes) == -1) {
+			msg = CONST_DISCARD(char *, "num_bytes too large");
+		}
 		smb_panic(msg);
 	}
 
@@ -1298,9 +1300,8 @@ static void smb_dump(const char *name, int type, const char *data, ssize_t len)
 
 	if (len < 4) len = smb_len(data)+4;
 	for (i=1;i<100;i++) {
-		asprintf(&fname, "/tmp/%s.%d.%s", name, i,
-				type ? "req" : "resp");
-		if (!fname) {
+		if (asprintf(&fname, "/tmp/%s.%d.%s", name, i,
+			     type ? "req" : "resp") == -1) {
 			return;
 		}
 		fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list