[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sat Dec 14 12:20:04 MST 2013


The branch, master has been updated
       via  0c7f36d s3:smbd: avoid calling fd_is_readable() without async echo handler
       via  fd72249 s3:lib: avoid talloc_zero_array() in poll_one_fd()
       via  952392a s3:smbd: use PATH_MAX for the buffer passed to full_path_tos()
      from  f3556bd tdb: Avoid reallocs for lockrecs

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


- Log -----------------------------------------------------------------
commit 0c7f36d299caa80785514939fd45be8377d8faf4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 11 15:02:27 2013 +0100

    s3:smbd: avoid calling fd_is_readable() without async echo handler
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Sat Dec 14 20:19:10 CET 2013 on sn-devel-104

commit fd722494e7b5add462af5163315d85344a775f1f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 4 23:31:10 2013 +0100

    s3:lib: avoid talloc_zero_array() in poll_one_fd()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 952392af38b5558f5dfb858251fce4d22c9a1ec2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Dec 14 10:45:42 2013 +0100

    s3:smbd: use PATH_MAX for the buffer passed to full_path_tos()
    
    We use this in other places too and it's better than a hardcoded value.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

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

Summary of changes:
 source3/lib/util_sock.c |   19 +++++--------------
 source3/smbd/files.c    |    2 +-
 source3/smbd/notify.c   |    2 +-
 source3/smbd/process.c  |   24 +++++++++++++-----------
 4 files changed, 20 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index a35ae97..12e4ccd 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1490,27 +1490,18 @@ int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res)
 
 int poll_one_fd(int fd, int events, int timeout, int *revents)
 {
-	struct pollfd *fds;
+	struct pollfd pfd;
 	int ret;
-	int saved_errno;
 
-	fds = talloc_zero_array(talloc_tos(), struct pollfd, 1);
-	if (fds == NULL) {
-		errno = ENOMEM;
-		return -1;
-	}
-	fds[0].fd = fd;
-	fds[0].events = events;
+	pfd.fd = fd;
+	pfd.events = events;
 
-	ret = poll(fds, 1, timeout);
+	ret = poll(&pfd, 1, timeout);
 
 	/*
 	 * Assign whatever poll did, even in the ret<=0 case.
 	 */
-	*revents = fds[0].revents;
-	saved_errno = errno;
-	TALLOC_FREE(fds);
-	errno = saved_errno;
+	*revents = pfd.revents;
 
 	return ret;
 }
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index ba24eda..5cf037e 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -734,7 +734,7 @@ ssize_t full_path_tos(const char *dir, const char *name,
 NTSTATUS file_name_hash(connection_struct *conn,
 			const char *name, uint32_t *p_name_hash)
 {
-	char tmpbuf[1024];
+	char tmpbuf[PATH_MAX];
 	char *fullpath, *to_free;
 	size_t len;
 
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c
index 078bc99..c19982a 100644
--- a/source3/smbd/notify.c
+++ b/source3/smbd/notify.c
@@ -419,7 +419,7 @@ void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
 {
 	struct notify_context *notify_ctx = conn->sconn->notify_ctx;
 	char *fullpath, *to_free;
-	char tmpbuf[1024];
+	char tmpbuf[PATH_MAX];
 	ssize_t len;
 
 	if (path[0] == '.' && path[1] == '/') {
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 7d9f767..8bd1c2e 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2383,21 +2383,23 @@ static void smbd_server_connection_read_handler(
 	NTSTATUS status;
 	uint32_t seqnum;
 
-	bool from_client;
+	bool async_echo = lp_async_smb_echo_handler();
+	bool from_client = false;
 
-	if (lp_async_smb_echo_handler()
-	    && fd_is_readable(sconn->smb1.echo_handler.trusted_fd)) {
-		/*
-		 * This is the super-ugly hack to prefer the packets
-		 * forwarded by the echo handler over the ones by the
-		 * client directly
-		 */
-		fd = sconn->smb1.echo_handler.trusted_fd;
+	if (async_echo) {
+		if (fd_is_readable(sconn->smb1.echo_handler.trusted_fd)) {
+			/*
+			 * This is the super-ugly hack to prefer the packets
+			 * forwarded by the echo handler over the ones by the
+			 * client directly
+			 */
+			fd = sconn->smb1.echo_handler.trusted_fd;
+		}
 	}
 
 	from_client = (sconn->sock == fd);
 
-	if (from_client) {
+	if (async_echo && from_client) {
 		smbd_lock_socket(sconn);
 
 		if (!fd_is_readable(fd)) {
@@ -2416,7 +2418,7 @@ static void smbd_server_connection_read_handler(
 				    &inbuf_len, &seqnum,
 				    !from_client /* trusted channel */);
 
-	if (from_client) {
+	if (async_echo && from_client) {
 		smbd_unlock_socket(sconn);
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list