[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Wed Mar 3 01:24:10 MST 2010


The branch, master has been updated
       via  e0726d4... s4-build: fix SMB_LIBRARY and change its name so it didn't collide with s3 one
       via  92785f9... s3: Fix build file due to file move. Use the new path of iniparser
       via  b953c4c... s3: Move source3/iniparser to lib/iniparser to allow sharing between s3/s4
       via  1af5a6d... s3: Allow pam_winbind.c to build without localedir.c
       via  db67818... nsswitch: libpam remove depedance on locale.h use directly LOCALEDIR
       via  3f94624... s4-winrepl: Migrated the wins replication server to tsocket.
      from  27ae935... s3:net: add a command "net registry setsd_sdd"

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


- Log -----------------------------------------------------------------
commit e0726d4d661cfc508e8e8fd210a2cfba7ed53682
Author: Matthieu Patou <mat at matws.net>
Date:   Sun Feb 28 23:02:00 2010 +0300

    s4-build: fix SMB_LIBRARY and change its name so it didn't collide with s3 one
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 92785f9af6a124097fcc653375984499b441676d
Author: Matthieu Patou <mat at matws.net>
Date:   Mon Mar 1 00:21:09 2010 +0300

    s3: Fix build file due to file move. Use the new path of iniparser
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit b953c4c67cfc6f0de38526e97eb5fc6031d61c81
Author: Matthieu Patou <mat at matws.net>
Date:   Sun Feb 28 22:48:16 2010 +0300

    s3: Move source3/iniparser to lib/iniparser to allow sharing between s3/s4
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 1af5a6d35966ddb5435214a6d1f8ba34be697001
Author: Matthieu Patou <mat at matws.net>
Date:   Mon Mar 1 00:21:09 2010 +0300

    s3: Allow pam_winbind.c to build without localedir.c
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit db6781833ddae85190a270f481cc2432ff8dc702
Author: Matthieu Patou <mat at matws.net>
Date:   Sun Feb 28 22:53:04 2010 +0300

    nsswitch: libpam remove depedance on locale.h use directly LOCALEDIR
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 3f946240fa892f79c83f9c00f1b16ea73c2ad237
Author: Andreas Schneider <asn at redhat.com>
Date:   Wed Jan 20 14:21:47 2010 +0100

    s4-winrepl: Migrated the wins replication server to tsocket.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 {source3 => lib}/iniparser/AUTHORS                 |    0 
 {source3 => lib}/iniparser/INSTALL                 |    0 
 {source3 => lib}/iniparser/LICENSE                 |    0 
 {source3 => lib}/iniparser/Makefile                |    0 
 {source3 => lib}/iniparser/README                  |    0 
 {source3 => lib}/iniparser/html/doxygen.css        |    0 
 {source3 => lib}/iniparser/html/doxygen.png        |  Bin 1281 -> 1281 bytes
 {source3 => lib}/iniparser/html/globals_func.html  |    0 
 {source3 => lib}/iniparser/html/index.html         |    0 
 {source3 => lib}/iniparser/html/iniparser_8h.html  |    0 
 .../iniparser/html/iniparser_8main.html            |    0 
 {source3 => lib}/iniparser/html/tab_b.gif          |  Bin 35 -> 35 bytes
 {source3 => lib}/iniparser/html/tab_l.gif          |  Bin 706 -> 706 bytes
 {source3 => lib}/iniparser/html/tab_r.gif          |  Bin 2585 -> 2585 bytes
 {source3 => lib}/iniparser/html/tabs.css           |    0 
 {source3 => lib}/iniparser/src/dictionary.c        |    0 
 {source3 => lib}/iniparser/src/dictionary.h        |    0 
 {source3 => lib}/iniparser/src/iniparser.c         |    0 
 {source3 => lib}/iniparser/src/iniparser.h         |    0 
 {source3 => lib}/iniparser/src/strlib.c            |    0 
 {source3 => lib}/iniparser/src/strlib.h            |    0 
 {source3 => lib}/iniparser/test/Makefile           |    0 
 {source3 => lib}/iniparser/test/iniexample.c       |    0 
 lib/iniparser_build/dictionary.c                   |    7 +
 lib/iniparser_build/iniparser.c                    |    7 +
 lib/iniparser_build/strlib.c                       |    7 +
 nsswitch/config.m4                                 |    2 +-
 nsswitch/pam_winbind.c                             |    2 +-
 nsswitch/pam_winbind.h                             |    1 -
 source3/Makefile.in                                |   13 +-
 source3/configure.in                               |    2 +-
 source3/iniparser_build/dictionary.c               |    7 -
 source3/iniparser_build/iniparser.c                |    7 -
 source3/iniparser_build/strlib.c                   |    7 -
 source4/build/m4/public.m4                         |    8 +-
 source4/wrepl_server/wrepl_in_call.c               |   31 +-
 source4/wrepl_server/wrepl_in_connection.c         |  389 ++++++++++++++------
 source4/wrepl_server/wrepl_out_helpers.c           |   26 +-
 source4/wrepl_server/wrepl_server.h                |    9 +-
 39 files changed, 352 insertions(+), 173 deletions(-)
 rename {source3 => lib}/iniparser/AUTHORS (100%)
 rename {source3 => lib}/iniparser/INSTALL (100%)
 rename {source3 => lib}/iniparser/LICENSE (100%)
 rename {source3 => lib}/iniparser/Makefile (100%)
 rename {source3 => lib}/iniparser/README (100%)
 rename {source3 => lib}/iniparser/html/doxygen.css (100%)
 rename {source3 => lib}/iniparser/html/doxygen.png (100%)
 rename {source3 => lib}/iniparser/html/globals_func.html (100%)
 rename {source3 => lib}/iniparser/html/index.html (100%)
 rename {source3 => lib}/iniparser/html/iniparser_8h.html (100%)
 rename {source3 => lib}/iniparser/html/iniparser_8main.html (100%)
 rename {source3 => lib}/iniparser/html/tab_b.gif (100%)
 rename {source3 => lib}/iniparser/html/tab_l.gif (100%)
 rename {source3 => lib}/iniparser/html/tab_r.gif (100%)
 rename {source3 => lib}/iniparser/html/tabs.css (100%)
 rename {source3 => lib}/iniparser/src/dictionary.c (100%)
 rename {source3 => lib}/iniparser/src/dictionary.h (100%)
 rename {source3 => lib}/iniparser/src/iniparser.c (100%)
 rename {source3 => lib}/iniparser/src/iniparser.h (100%)
 rename {source3 => lib}/iniparser/src/strlib.c (100%)
 rename {source3 => lib}/iniparser/src/strlib.h (100%)
 rename {source3 => lib}/iniparser/test/Makefile (100%)
 rename {source3 => lib}/iniparser/test/iniexample.c (100%)
 create mode 100644 lib/iniparser_build/dictionary.c
 create mode 100644 lib/iniparser_build/iniparser.c
 create mode 100644 lib/iniparser_build/strlib.c
 delete mode 100644 source3/iniparser_build/dictionary.c
 delete mode 100644 source3/iniparser_build/iniparser.c
 delete mode 100644 source3/iniparser_build/strlib.c


Changeset truncated at 500 lines:

diff --git a/source3/iniparser/AUTHORS b/lib/iniparser/AUTHORS
similarity index 100%
rename from source3/iniparser/AUTHORS
rename to lib/iniparser/AUTHORS
diff --git a/source3/iniparser/INSTALL b/lib/iniparser/INSTALL
similarity index 100%
rename from source3/iniparser/INSTALL
rename to lib/iniparser/INSTALL
diff --git a/source3/iniparser/LICENSE b/lib/iniparser/LICENSE
similarity index 100%
rename from source3/iniparser/LICENSE
rename to lib/iniparser/LICENSE
diff --git a/source3/iniparser/Makefile b/lib/iniparser/Makefile
similarity index 100%
rename from source3/iniparser/Makefile
rename to lib/iniparser/Makefile
diff --git a/source3/iniparser/README b/lib/iniparser/README
similarity index 100%
rename from source3/iniparser/README
rename to lib/iniparser/README
diff --git a/source3/iniparser/html/doxygen.css b/lib/iniparser/html/doxygen.css
similarity index 100%
rename from source3/iniparser/html/doxygen.css
rename to lib/iniparser/html/doxygen.css
diff --git a/source3/iniparser/html/doxygen.png b/lib/iniparser/html/doxygen.png
similarity index 100%
rename from source3/iniparser/html/doxygen.png
rename to lib/iniparser/html/doxygen.png
diff --git a/source3/iniparser/html/globals_func.html b/lib/iniparser/html/globals_func.html
similarity index 100%
rename from source3/iniparser/html/globals_func.html
rename to lib/iniparser/html/globals_func.html
diff --git a/source3/iniparser/html/index.html b/lib/iniparser/html/index.html
similarity index 100%
rename from source3/iniparser/html/index.html
rename to lib/iniparser/html/index.html
diff --git a/source3/iniparser/html/iniparser_8h.html b/lib/iniparser/html/iniparser_8h.html
similarity index 100%
rename from source3/iniparser/html/iniparser_8h.html
rename to lib/iniparser/html/iniparser_8h.html
diff --git a/source3/iniparser/html/iniparser_8main.html b/lib/iniparser/html/iniparser_8main.html
similarity index 100%
rename from source3/iniparser/html/iniparser_8main.html
rename to lib/iniparser/html/iniparser_8main.html
diff --git a/source3/iniparser/html/tab_b.gif b/lib/iniparser/html/tab_b.gif
similarity index 100%
rename from source3/iniparser/html/tab_b.gif
rename to lib/iniparser/html/tab_b.gif
diff --git a/source3/iniparser/html/tab_l.gif b/lib/iniparser/html/tab_l.gif
similarity index 100%
rename from source3/iniparser/html/tab_l.gif
rename to lib/iniparser/html/tab_l.gif
diff --git a/source3/iniparser/html/tab_r.gif b/lib/iniparser/html/tab_r.gif
similarity index 100%
rename from source3/iniparser/html/tab_r.gif
rename to lib/iniparser/html/tab_r.gif
diff --git a/source3/iniparser/html/tabs.css b/lib/iniparser/html/tabs.css
similarity index 100%
rename from source3/iniparser/html/tabs.css
rename to lib/iniparser/html/tabs.css
diff --git a/source3/iniparser/src/dictionary.c b/lib/iniparser/src/dictionary.c
similarity index 100%
rename from source3/iniparser/src/dictionary.c
rename to lib/iniparser/src/dictionary.c
diff --git a/source3/iniparser/src/dictionary.h b/lib/iniparser/src/dictionary.h
similarity index 100%
rename from source3/iniparser/src/dictionary.h
rename to lib/iniparser/src/dictionary.h
diff --git a/source3/iniparser/src/iniparser.c b/lib/iniparser/src/iniparser.c
similarity index 100%
rename from source3/iniparser/src/iniparser.c
rename to lib/iniparser/src/iniparser.c
diff --git a/source3/iniparser/src/iniparser.h b/lib/iniparser/src/iniparser.h
similarity index 100%
rename from source3/iniparser/src/iniparser.h
rename to lib/iniparser/src/iniparser.h
diff --git a/source3/iniparser/src/strlib.c b/lib/iniparser/src/strlib.c
similarity index 100%
rename from source3/iniparser/src/strlib.c
rename to lib/iniparser/src/strlib.c
diff --git a/source3/iniparser/src/strlib.h b/lib/iniparser/src/strlib.h
similarity index 100%
rename from source3/iniparser/src/strlib.h
rename to lib/iniparser/src/strlib.h
diff --git a/source3/iniparser/test/Makefile b/lib/iniparser/test/Makefile
similarity index 100%
rename from source3/iniparser/test/Makefile
rename to lib/iniparser/test/Makefile
diff --git a/source3/iniparser/test/iniexample.c b/lib/iniparser/test/iniexample.c
similarity index 100%
rename from source3/iniparser/test/iniexample.c
rename to lib/iniparser/test/iniexample.c
diff --git a/lib/iniparser_build/dictionary.c b/lib/iniparser_build/dictionary.c
new file mode 100644
index 0000000..a6b2a12
--- /dev/null
+++ b/lib/iniparser_build/dictionary.c
@@ -0,0 +1,7 @@
+/*
+ for someplatforms it's needed to inject replace.h into
+ the iniparser source code
+ --metze
+*/
+#include "../replace/replace.h"
+#include "../iniparser/src/dictionary.c"
diff --git a/lib/iniparser_build/iniparser.c b/lib/iniparser_build/iniparser.c
new file mode 100644
index 0000000..e203699
--- /dev/null
+++ b/lib/iniparser_build/iniparser.c
@@ -0,0 +1,7 @@
+/*
+ for someplatforms it's needed to inject replace.h into
+ the iniparser source code
+ --metze
+*/
+#include "../replace/replace.h"
+#include "../iniparser/src/iniparser.c"
diff --git a/lib/iniparser_build/strlib.c b/lib/iniparser_build/strlib.c
new file mode 100644
index 0000000..12ef233
--- /dev/null
+++ b/lib/iniparser_build/strlib.c
@@ -0,0 +1,7 @@
+/*
+ for someplatforms it's needed to inject replace.h into
+ the iniparser source code
+ --metze
+*/
+#include "../replace/replace.h"
+#include "../iniparser/src/strlib.c"
diff --git a/nsswitch/config.m4 b/nsswitch/config.m4
index 2c8fa17..680ee5d 100644
--- a/nsswitch/config.m4
+++ b/nsswitch/config.m4
@@ -2,7 +2,7 @@ AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h )
 
 case "$host_os" in
 	*linux*)
-		SMB_LIBRARY(nss_winbind,
+		SMB_BUILD_LIBRARY(nss_winbind,
 			    [../nsswitch/winbind_nss_linux.o],
 			    [LIBWINBIND-CLIENT])
 	;;
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 82c8c4d..2689390 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -156,7 +156,7 @@ static inline void textdomain_init(void);
 static inline void textdomain_init(void)
 {
 	if (!initialized) {
-		bindtextdomain(MODULE_NAME, dyn_LOCALEDIR);
+		bindtextdomain(MODULE_NAME, LOCALEDIR);
 		initialized = 1;
 	}
 	return;
diff --git a/nsswitch/pam_winbind.h b/nsswitch/pam_winbind.h
index 25d673e..ed92479 100644
--- a/nsswitch/pam_winbind.h
+++ b/nsswitch/pam_winbind.h
@@ -9,7 +9,6 @@
 #include "system/time.h"
 #include <talloc.h>
 #include "libwbclient/wbclient.h"
-#include "localedir.h"
 
 #define MODULE_NAME "pam_winbind"
 #define PAM_SM_AUTH
diff --git a/source3/Makefile.in b/source3/Makefile.in
index ead1d31..de70c27 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -921,7 +921,7 @@ RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
 	     $(LIBADS_OBJ) $(POPT_LIB_OBJ) \
 	     $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(LDB_OBJ) 
 
-PAM_WINBIND_OBJ = ../nsswitch/pam_winbind.o localedir.o $(WBCOMMON_OBJ) \
+PAM_WINBIND_OBJ = ../nsswitch/pam_winbind.o $(WBCOMMON_OBJ) \
 		  $(LIBREPLACE_OBJ) @BUILD_INIPARSER@
 
 LIBSMBCLIENT_THREAD_OBJ = \
@@ -1293,8 +1293,8 @@ WINBIND_KRB5_LOCATOR_OBJ = $(WINBIND_KRB5_LOCATOR_OBJ1) $(LIBREPLACE_OBJ)
 POPT_OBJ=../lib/popt/findme.o ../lib/popt/popt.o ../lib/popt/poptconfig.o \
           ../lib/popt/popthelp.o ../lib/popt/poptparse.o
 
-INIPARSER_OBJ = iniparser_build/iniparser.o iniparser_build/dictionary.o \
-		iniparser_build/strlib.o
+INIPARSER_OBJ = ../lib/iniparser_build/iniparser.o ../lib/iniparser_build/dictionary.o \
+		../lib/iniparser_build/strlib.o
 
 TDBBACKUP_OBJ = @tdbdir@/tools/tdbbackup.o $(LIBREPLACE_OBJ) \
 	$(SOCKET_WRAPPER_OBJ)
@@ -1522,6 +1522,13 @@ dynconfig.o: dynconfig.c Makefile
 		echo "$(COMPILE_CC_PATH)" 1>&2;\
 		$(COMPILE_CC_PATH) >/dev/null 2>&1
 
+../nsswitch/pam_winbind.o: ../nsswitch/pam_winbind.c Makefile
+	@echo Compiling $*.c
+	@$(COMPILE_CC_PATH) && exit 0;\
+		echo "The following command failed:" 1>&2;\
+		echo "$(COMPILE_CC_PATH)" 1>&2;\
+		$(COMPILE_CC_PATH) >/dev/null 2>&1
+
 localedir.o: localedir.c Makefile
 	@echo Compiling $*.c
 	@$(COMPILE_CC_PATH) && exit 0;\
diff --git a/source3/configure.in b/source3/configure.in
index 45d2563..7ba72bf 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -6447,7 +6447,7 @@ if test x"$INCLUDED_INIPARSER" = x"yes"; then
     AC_MSG_RESULT(yes)
     BUILD_INIPARSER='$(INIPARSER_OBJ)'
 	INIPARSERLIBS=""
-    FLAGS1="$FLAGS1 -I\$(srcdir)/iniparser/src"
+    FLAGS1="$FLAGS1 -I\$(srcdir)/../lib/iniparser/src"
 else
     AC_MSG_RESULT(no)
 	BUILD_INIPARSER=""
diff --git a/source3/iniparser_build/dictionary.c b/source3/iniparser_build/dictionary.c
deleted file mode 100644
index 3147361..0000000
--- a/source3/iniparser_build/dictionary.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- for someplatforms it's needed to inject replace.h into
- the iniparser source code
- --metze
-*/
-#include "../replace/replace.h"
-#include "iniparser/src/dictionary.c"
diff --git a/source3/iniparser_build/iniparser.c b/source3/iniparser_build/iniparser.c
deleted file mode 100644
index 3f4a1aa..0000000
--- a/source3/iniparser_build/iniparser.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- for someplatforms it's needed to inject replace.h into
- the iniparser source code
- --metze
-*/
-#include "../replace/replace.h"
-#include "iniparser/src/iniparser.c"
diff --git a/source3/iniparser_build/strlib.c b/source3/iniparser_build/strlib.c
deleted file mode 100644
index 4ea95b7..0000000
--- a/source3/iniparser_build/strlib.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- for someplatforms it's needed to inject replace.h into
- the iniparser source code
- --metze
-*/
-#include "../replace/replace.h"
-#include "iniparser/src/strlib.c"
diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4
index 704811b..5fadcfb 100644
--- a/source4/build/m4/public.m4
+++ b/source4/build/m4/public.m4
@@ -43,12 +43,12 @@ ENABLE = YES
 "
 ])
 
-dnl SMB_LIBRARY(name,obj_files,required_subsystems,cflags,ldflags)
-AC_DEFUN([SMB_LIBRARY],
+dnl SMB_BUILD_LIBRARY(name,obj_files,required_subsystems,cflags,ldflags)
+AC_DEFUN([SMB_BUILD_LIBRARY],
 [
 MAKE_SETTINGS="$MAKE_SETTINGS
-$1_CFLAGS = $6
-$1_LDFLAGS = $7
+$1_CFLAGS = $4
+$1_LDFLAGS = $5
 n1_ENABLE = YES
 $1_OBJ_FILES = $2
 "
diff --git a/source4/wrepl_server/wrepl_in_call.c b/source4/wrepl_server/wrepl_in_call.c
index fd09bba..6737d6f 100644
--- a/source4/wrepl_server/wrepl_in_call.c
+++ b/source4/wrepl_server/wrepl_in_call.c
@@ -31,6 +31,7 @@
 #include "lib/ldb/include/ldb_errors.h"
 #include "system/time.h"
 #include "lib/util/tsort.h"
+#include "lib/stream/packet.h" /* FIXME */
 
 static NTSTATUS wreplsrv_in_start_association(struct wreplsrv_in_call *call)
 {
@@ -341,23 +342,31 @@ static NTSTATUS wreplsrv_in_update(struct wreplsrv_in_call *call)
 	struct wreplsrv_out_connection *wrepl_out;
 	struct wrepl_table *update_in = &call->req_packet.message.replication.info.table;
 	struct wreplsrv_in_update_state *update_state;
-	uint16_t fde_flags;
+	struct packet_context *packet;
 
 	DEBUG(2,("WREPL_REPL_UPDATE: partner[%s] initiator[%s] num_owners[%u]\n",
 		call->wreplconn->partner->address,
 		update_in->initiator, update_in->partner_count));
 
-	/* 
-	 * we need to flip the connection into a client connection
+	update_state = talloc(wrepl_in, struct wreplsrv_in_update_state);
+	NT_STATUS_HAVE_NO_MEMORY(update_state);
+
+	/*
+	 * We need to flip the connection into a client connection
 	 * and do a WREPL_REPL_SEND_REQUEST's on the that connection
-	 * and then stop this connection
+	 * and then stop this connection.
 	 */
-	fde_flags = event_get_fd_flags(wrepl_in->conn->event.fde);
-	talloc_free(wrepl_in->conn->event.fde);
-	wrepl_in->conn->event.fde = NULL;
+	packet = packet_init(wrepl_in);
+	if (packet == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
 
-	update_state = talloc(wrepl_in, struct wreplsrv_in_update_state);
-	NT_STATUS_HAVE_NO_MEMORY(update_state);
+	/*
+	 * TODO We can free the tstream here as we don't use it in the client
+	 * yet.
+	 */
+	TALLOC_FREE(wrepl_in->send_queue);
+	TALLOC_FREE(wrepl_in->tstream);
 
 	wrepl_out = talloc(update_state, struct wreplsrv_out_connection);
 	NT_STATUS_HAVE_NO_MEMORY(wrepl_out);
@@ -368,11 +377,9 @@ static NTSTATUS wreplsrv_in_update(struct wreplsrv_in_call *call)
 	wrepl_out->sock			= wrepl_socket_merge(wrepl_out,
 							     wrepl_in->conn->event.ctx,
 							     wrepl_in->conn->socket,
-							     wrepl_in->packet);
+							     packet);
 	NT_STATUS_HAVE_NO_MEMORY(wrepl_out->sock);
 
-	event_set_fd_flags(wrepl_out->sock->event.fde, fde_flags);
-
 	update_state->wrepl_in			= wrepl_in;
 	update_state->wrepl_out			= wrepl_out;
 	update_state->cycle_io.in.partner	= wrepl_out->partner;
diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c
index 7c9c2b7..6b60dd1 100644
--- a/source4/wrepl_server/wrepl_in_connection.c
+++ b/source4/wrepl_server/wrepl_in_connection.c
@@ -31,6 +31,8 @@
 #include "smbd/process_model.h"
 #include "system/network.h"
 #include "lib/socket/netif.h"
+#include "lib/tsocket/tsocket.h"
+#include "libcli/util/tstream.h"
 #include "param/param.h"
 
 void wreplsrv_terminate_in_connection(struct wreplsrv_in_connection *wreplconn, const char *reason)
@@ -38,35 +40,19 @@ void wreplsrv_terminate_in_connection(struct wreplsrv_in_connection *wreplconn,
 	stream_terminate_connection(wreplconn->conn, reason);
 }
 
-static int terminate_after_send_destructor(struct wreplsrv_in_connection **tas)
-{
-	wreplsrv_terminate_in_connection(*tas, "wreplsrv_in_connection: terminate_after_send");
-	return 0;
-}
-
 /*
   receive some data on a WREPL connection
 */
-static NTSTATUS wreplsrv_recv_request(void *private_data, DATA_BLOB blob)
+static NTSTATUS wreplsrv_process(struct wreplsrv_in_connection *wrepl_conn,
+				 struct wreplsrv_in_call **_call)
 {
-	struct wreplsrv_in_connection *wreplconn = talloc_get_type(private_data, struct wreplsrv_in_connection);
-	struct wreplsrv_in_call *call;
-	DATA_BLOB packet_in_blob;
-	DATA_BLOB packet_out_blob;
 	struct wrepl_wrap packet_out_wrap;
 	NTSTATUS status;
 	enum ndr_err_code ndr_err;
+	struct wreplsrv_in_call *call = *_call;
 
-	call = talloc_zero(wreplconn, struct wreplsrv_in_call);
-	NT_STATUS_HAVE_NO_MEMORY(call);
-	call->wreplconn = wreplconn;
-	talloc_steal(call, blob.data);
-
-	packet_in_blob.data = blob.data + 4;
-	packet_in_blob.length = blob.length - 4;
-
-	ndr_err = ndr_pull_struct_blob(&packet_in_blob, call, 
-				       lp_iconv_convenience(wreplconn->service->task->lp_ctx),
+	ndr_err = ndr_pull_struct_blob(&call->in, call,
+				       lp_iconv_convenience(wrepl_conn->service->task->lp_ctx),
 				       &call->req_packet,
 				       (ndr_pull_flags_fn_t)ndr_pull_wrepl_packet);
 	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -74,8 +60,8 @@ static NTSTATUS wreplsrv_recv_request(void *private_data, DATA_BLOB blob)
 	}
 
 	if (DEBUGLVL(10)) {
-		DEBUG(10,("Received WINS-Replication packet of length %u\n", 
-			  (unsigned)packet_in_blob.length + 4));
+		DEBUG(10,("Received WINS-Replication packet of length %u\n",
+			  (unsigned int) call->in.length + 4));
 		NDR_PRINT_DEBUG(wrepl_packet, &call->req_packet);
 	}
 
@@ -84,70 +70,31 @@ static NTSTATUS wreplsrv_recv_request(void *private_data, DATA_BLOB blob)
 	if (!NT_STATUS_IS_OK(status)) {
 		/* w2k just ignores invalid packets, so we do */
 		DEBUG(10,("Received WINS-Replication packet was invalid, we just ignore it\n"));
-		talloc_free(call);
+		TALLOC_FREE(call);
+		*_call = NULL;
 		return NT_STATUS_OK;
 	}
 
 	/* and now encode the reply */
 	packet_out_wrap.packet = call->rep_packet;
-	ndr_err = ndr_push_struct_blob(&packet_out_blob, call, 
-				       lp_iconv_convenience(wreplconn->service->task->lp_ctx),
+	ndr_err = ndr_push_struct_blob(&call->out, call,
+				       lp_iconv_convenience(wrepl_conn->service->task->lp_ctx),
 				       &packet_out_wrap,
-				      (ndr_push_flags_fn_t)ndr_push_wrepl_wrap);
+				       (ndr_push_flags_fn_t) ndr_push_wrepl_wrap);
 	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 		return ndr_map_error2ntstatus(ndr_err);
 	}
 
 	if (DEBUGLVL(10)) {
-		DEBUG(10,("Sending WINS-Replication packet of length %d\n", (int)packet_out_blob.length));
+		DEBUG(10,("Sending WINS-Replication packet of length %u\n",
+			 (unsigned int) call->out.length));
 		NDR_PRINT_DEBUG(wrepl_packet, &call->rep_packet);
 	}
 
-	if (call->terminate_after_send) {
-		struct wreplsrv_in_connection **tas;
-		tas = talloc(packet_out_blob.data, struct wreplsrv_in_connection *);
-		NT_STATUS_HAVE_NO_MEMORY(tas);
-		*tas = wreplconn;
-		talloc_set_destructor(tas, terminate_after_send_destructor);
-	}
-
-	status = packet_send(wreplconn->packet, packet_out_blob);
-	NT_STATUS_NOT_OK_RETURN(status);
-
-	talloc_free(call);
 	return NT_STATUS_OK;
 }
 
-/*
-  called when the socket becomes readable
-*/
-static void wreplsrv_recv(struct stream_connection *conn, uint16_t flags)
-{
-	struct wreplsrv_in_connection *wreplconn = talloc_get_type(conn->private_data,
-								   struct wreplsrv_in_connection);
-
-	packet_recv(wreplconn->packet);
-}
-
-/*
-  called when the socket becomes writable
-*/
-static void wreplsrv_send(struct stream_connection *conn, uint16_t flags)
-{
-	struct wreplsrv_in_connection *wreplconn = talloc_get_type(conn->private_data,
-								   struct wreplsrv_in_connection);
-	packet_queue_run(wreplconn->packet);
-}
-
-/*
-  handle socket recv errors
-*/
-static void wreplsrv_recv_error(void *private_data, NTSTATUS status)
-{
-	struct wreplsrv_in_connection *wreplconn = talloc_get_type(private_data,
-								   struct wreplsrv_in_connection);
-	wreplsrv_terminate_in_connection(wreplconn, nt_errstr(status));
-}
+static void wreplsrv_call_loop(struct tevent_req *subreq);
 
 /*
   called when we get a new connection
@@ -155,43 +102,240 @@ static void wreplsrv_recv_error(void *private_data, NTSTATUS status)
 static void wreplsrv_accept(struct stream_connection *conn)
 {
 	struct wreplsrv_service *service = talloc_get_type(conn->private_data, struct wreplsrv_service);
-	struct wreplsrv_in_connection *wreplconn;
+	struct wreplsrv_in_connection *wrepl_conn;
 	struct socket_address *peer_ip;
+	struct tevent_req *subreq;
+	int rc, fd;
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list