[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Wed Dec 14 05:35:01 MST 2011


The branch, master has been updated
       via  ffa996e s3:smb2_lock: use talloc_get_type_abort() as private_data can't be NULL
       via  324e66f s3:smbd/oplock: make process_oplock_async_level2_break_message() static
       via  dabc2cb s3:smbd/oplock: use talloc_get_type_abort() as private_data can't be NULL
       via  940f21e s3:smbd/open: use talloc_get_type_abort() as private_data can't be NULL
       via  e3e56e2 s3:smbd/conn_msg: use talloc_get_type_abort() as private_data can't be NULL
       via  95384d1 s3:smbd/close: use talloc_get_type_abort() as private_data can't be NULL
       via  500d703 s3:smbd/blocking: use talloc_get_type_abort() as private_data can't be NULL
       via  ef45279 s3:web/swat: use short term event and message contexts
       via  2e0bc74 s3:smbd: remove brl_register_msgs()
      from  c51da25 s3:smbd/server: avoid msg_ctx_to_sconn() in smbd_accept_connection()

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


- Log -----------------------------------------------------------------
commit ffa996e4797af1a38c484894fc03528f6fa73496
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 14 09:50:24 2011 +0100

    s3:smb2_lock: use talloc_get_type_abort() as private_data can't be NULL
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Wed Dec 14 13:34:25 CET 2011 on sn-devel-104

commit 324e66fd45747b64b1abc85f2ac2fb1e5ed31232
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 14 09:54:42 2011 +0100

    s3:smbd/oplock: make process_oplock_async_level2_break_message() static
    
    metze

commit dabc2cb9cb10c05e44144bf048277bc8ac62bf77
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 14 09:50:24 2011 +0100

    s3:smbd/oplock: use talloc_get_type_abort() as private_data can't be NULL
    
    metze

commit 940f21e5c694cf441d6ab19fff87745f2c3a9172
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 14 09:50:24 2011 +0100

    s3:smbd/open: use talloc_get_type_abort() as private_data can't be NULL
    
    metze

commit e3e56e209fdb878d540c3f7041837a96fd5743f6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 14 09:50:24 2011 +0100

    s3:smbd/conn_msg: use talloc_get_type_abort() as private_data can't be NULL
    
    metze

commit 95384d11a3640e67712dd29939eceace80473203
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 14 09:50:24 2011 +0100

    s3:smbd/close: use talloc_get_type_abort() as private_data can't be NULL
    
    metze

commit 500d703977ab7ec2f617ca0f88ed979a7115be36
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 14 09:50:24 2011 +0100

    s3:smbd/blocking: use talloc_get_type_abort() as private_data can't be NULL
    
    metze

commit ef45279f5e2e78e448c96ae63b9c35302132306f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 14 09:11:44 2011 +0100

    s3:web/swat: use short term event and message contexts
    
    swat doesn't have a central event loop.
    
    metze

commit 2e0bc74a6e88a2689e281e2767627c8773b380e4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 09:24:31 2011 +0100

    s3:smbd: remove brl_register_msgs()
    
    metze

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

Summary of changes:
 source3/locking/brlock.c |   16 +++++-----------
 source3/locking/proto.h  |    6 +++++-
 source3/smbd/blocking.c  |   12 ++----------
 source3/smbd/close.c     |    6 +-----
 source3/smbd/conn_msg.c  |    6 +-----
 source3/smbd/open.c      |    6 +-----
 source3/smbd/oplock.c    |   32 ++++++--------------------------
 source3/smbd/proto.h     |    5 -----
 source3/smbd/server.c    |    3 ++-
 source3/smbd/smb2_lock.c |    6 +-----
 source3/web/swat.c       |   39 +++++++++++++++++++++++++++++++++++----
 11 files changed, 59 insertions(+), 78 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index efc58c3..33c9243 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1926,11 +1926,11 @@ static int compare_procids(const void *p1, const void *p2)
  * array, then qsort that array and only send to non-dupes.
  */
 
-static void brl_revalidate(struct messaging_context *msg_ctx,
-			   void *private_data,
-			   uint32_t msg_type,
-			   struct server_id server_id,
-			   DATA_BLOB *data)
+void brl_revalidate(struct messaging_context *msg_ctx,
+		    void *private_data,
+		    uint32_t msg_type,
+		    struct server_id server_id,
+		    DATA_BLOB *data)
 {
 	struct brl_revalidate_state *state;
 	uint32 i;
@@ -1973,9 +1973,3 @@ static void brl_revalidate(struct messaging_context *msg_ctx,
 	TALLOC_FREE(state);
 	return;
 }
-
-void brl_register_msgs(struct messaging_context *msg_ctx)
-{
-	messaging_register(msg_ctx, NULL, MSG_SMB_BRL_VALIDATE,
-			   brl_revalidate);
-}
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 5be8acc..2c01634 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -90,7 +90,11 @@ int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
 struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
 					files_struct *fsp);
 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
-void brl_register_msgs(struct messaging_context *msg_ctx);
+void brl_revalidate(struct messaging_context *msg_ctx,
+		    void *private_data,
+		    uint32_t msg_type,
+		    struct server_id server_id,
+		    DATA_BLOB *data);
 
 /* The following definitions come from locking/locking.c  */
 
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index ad1bbe3..cd6967e 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -703,13 +703,9 @@ static void received_unlock_msg(struct messaging_context *msg,
 				DATA_BLOB *data)
 {
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	DEBUG(10,("received_unlock_msg\n"));
 	process_blocking_lock_queue(sconn);
 }
@@ -832,13 +828,9 @@ static void process_blocking_lock_cancel_message(struct messaging_context *ctx,
 	const char *msg = (const char *)data->data;
 	struct blocking_lock_record *blr;
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	if (data->data == NULL) {
 		smb_panic("process_blocking_lock_cancel_message: null msg");
 	}
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 09d8905..9eedaf9 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -1137,13 +1137,9 @@ void msg_close_file(struct messaging_context *msg_ctx,
 	files_struct *fsp = NULL;
 	struct share_mode_entry e;
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	message_to_share_mode_entry(&e, (char *)data->data);
 
 	if(DEBUGLVL(10)) {
diff --git a/source3/smbd/conn_msg.c b/source3/smbd/conn_msg.c
index 96171e2..46161cc 100644
--- a/source3/smbd/conn_msg.c
+++ b/source3/smbd/conn_msg.c
@@ -38,12 +38,8 @@ void msg_force_tdis(struct messaging_context *msg,
 {
 	const char *sharename = (const char *)data->data;
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	conn_force_tdis(sconn, sharename);
 }
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index ee0ba08..265de27 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -3002,13 +3002,9 @@ void msg_file_was_renamed(struct messaging_context *msg,
 	size_t sp_len, bn_len;
 	NTSTATUS status;
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	if (data->data == NULL
 	    || data->length < MSG_FILE_RENAMED_MIN_SIZE + 2) {
                 DEBUG(0, ("msg_file_was_renamed: Got invalid msg len %d\n",
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index a414b72..7a810d9 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -430,7 +430,7 @@ void break_level2_to_none_async(files_struct *fsp)
  the client for LEVEL2.
 *******************************************************************/
 
-void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
+static void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
 						      void *private_data,
 						      uint32_t msg_type,
 						      struct server_id src,
@@ -439,13 +439,9 @@ void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx
 	struct share_mode_entry msg;
 	files_struct *fsp;
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	if (data->data == NULL) {
 		DEBUG(0, ("Got NULL buffer\n"));
 		return;
@@ -491,13 +487,9 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
 	files_struct *fsp;
 	bool break_to_level2 = False;
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	if (data->data == NULL) {
 		DEBUG(0, ("Got NULL buffer\n"));
 		return;
@@ -598,13 +590,9 @@ static void process_kernel_oplock_break(struct messaging_context *msg_ctx,
 	unsigned long file_id;
 	files_struct *fsp;
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	if (data->data == NULL) {
 		DEBUG(0, ("Got NULL buffer\n"));
 		return;
@@ -692,13 +680,9 @@ static void process_oplock_break_response(struct messaging_context *msg_ctx,
 {
 	struct share_mode_entry msg;
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	if (data->data == NULL) {
 		DEBUG(0, ("Got NULL buffer\n"));
 		return;
@@ -730,13 +714,9 @@ static void process_open_retry_message(struct messaging_context *msg_ctx,
 {
 	struct share_mode_entry msg;
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	if (data->data == NULL) {
 		DEBUG(0, ("Got NULL buffer\n"));
 		return;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 64cf944..0123e7d 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -654,11 +654,6 @@ bool downgrade_oplock(files_struct *fsp);
 bool should_notify_deferred_opens(void);
 void break_level2_to_none_async(files_struct *fsp);
 void reply_to_oplock_break_requests(files_struct *fsp);
-void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
-						      void *private_data,
-						      uint32_t msg_type,
-						      struct server_id src,
-						      DATA_BLOB *data);
 void contend_level2_oplocks_begin(files_struct *fsp,
 				  enum level2_contention_type type);
 void contend_level2_oplocks_end(files_struct *fsp,
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index f351b99..07d2b3e 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -765,7 +765,8 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 	messaging_register(msg_ctx, NULL, MSG_DEBUG, smbd_msg_debug);
 	messaging_register(msg_ctx, ev_ctx, MSG_PRINTER_PCAP,
 			   smb_pcap_updated);
-	brl_register_msgs(msg_ctx);
+	messaging_register(msg_ctx, NULL, MSG_SMB_BRL_VALIDATE,
+			   brl_revalidate);
 
 	msg_idmap_register_msg(msg_ctx);
 
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index 57bcbe6..10b35df 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -451,13 +451,9 @@ static void received_unlock_msg(struct messaging_context *msg,
 				DATA_BLOB *data)
 {
 	struct smbd_server_connection *sconn =
-		talloc_get_type(private_data,
+		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	if (sconn == NULL) {
-		return;
-	}
-
 	DEBUG(10,("received_unlock_msg (SMB2)\n"));
 
 	process_blocking_lock_queue_smb2(sconn, timeval_current());
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 1ecaa57..3d6aaf4 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -37,6 +37,7 @@
 #include "intl/lang_tdb.h"
 #include "../lib/crypto/md5.h"
 #include "lib/param/loadparm.h"
+#include "messages.h"
 
 static int demo_mode = False;
 static int passwd_only = False;
@@ -588,8 +589,23 @@ static int save_reload(int snum)
         }
 	iNumNonAutoPrintServices = lp_numservices();
 	if (pcap_cache_loaded()) {
-		load_printers(server_event_context(),
-			      server_messaging_context());
+		struct tevent_context *ev_ctx;
+		struct messaging_context *msg_ctx;
+
+		ev_ctx = s3_tevent_context_init(NULL);
+		if (ev_ctx == NULL) {
+			printf("s3_tevent_context_init() failed\n");
+			return 0;
+		}
+		msg_ctx = messaging_init(ev_ctx, ev_ctx);
+		if (msg_ctx == NULL) {
+			printf("messaging_init() failed\n");
+			return 0;
+		}
+
+		load_printers(ev_ctx, msg_ctx);
+
+		talloc_free(ev_ctx);
 	}
 
 	return 1;
@@ -1574,8 +1590,23 @@ const char *lang_msg_rotate(TALLOC_CTX *ctx, const char *msgid)
 	load_interfaces();
 	iNumNonAutoPrintServices = lp_numservices();
 	if (pcap_cache_loaded()) {
-		load_printers(server_event_context(),
-			      server_messaging_context());
+		struct tevent_context *ev_ctx;
+		struct messaging_context *msg_ctx;
+
+		ev_ctx = s3_tevent_context_init(NULL);
+		if (ev_ctx == NULL) {
+			printf("s3_tevent_context_init() failed\n");
+			return 0;
+		}
+		msg_ctx = messaging_init(ev_ctx, ev_ctx);
+		if (msg_ctx == NULL) {
+			printf("messaging_init() failed\n");
+			return 0;
+		}
+
+		load_printers(ev_ctx, msg_ctx);
+
+		talloc_free(ev_ctx);
 	}
 
 	cgi_setup(get_dyn_SWATDIR(), !demo_mode);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list