[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-635-gc6b440d

Stefan Metzmacher metze at samba.org
Mon Feb 9 10:57:50 GMT 2009


The branch, master has been updated
       via  c6b440d1b7f88af2897b9b2e9b09f05b488a1685 (commit)
       via  5438d7dad8d349f8fdc07a89870ddafb9c54a68f (commit)
      from  15243c13e914b1ecc6f0eec924cc587a4069c62b (commit)

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


- Log -----------------------------------------------------------------
commit c6b440d1b7f88af2897b9b2e9b09f05b488a1685
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Feb 9 11:56:05 2009 +0100

    s4:Makefile: fix PUBLIC_HEADERS typo
    
    metze

commit 5438d7dad8d349f8fdc07a89870ddafb9c54a68f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Feb 9 11:54:34 2009 +0100

    testprogs/win32: add npecho_*2.c
    
    This exlores some details of message type named pipes.
    
    metze

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

Summary of changes:
 source4/Makefile                        |    2 +-
 testprogs/win32/npecho/GNUmakefile      |   23 +++++++------
 testprogs/win32/npecho/NMakefile        |   12 ++++++-
 testprogs/win32/npecho/npecho_client2.c |   48 +++++++++++++++++++++++++++
 testprogs/win32/npecho/npecho_server2.c |   55 +++++++++++++++++++++++++++++++
 5 files changed, 128 insertions(+), 12 deletions(-)
 create mode 100755 testprogs/win32/npecho/npecho_client2.c
 create mode 100755 testprogs/win32/npecho/npecho_server2.c


Changeset truncated at 500 lines:

diff --git a/source4/Makefile b/source4/Makefile
index 267e302..508836f 100644
--- a/source4/Makefile
+++ b/source4/Makefile
@@ -146,7 +146,7 @@ endif
 clean::
 	@find ../lib ../libcli ../librpc ../nsswitch -name '*.o' -o -name '*.ho' | xargs rm -f
 
-PUBLIC_HEADES += $(srcdir)/version.h
+PUBLIC_HEADERS += $(srcdir)/version.h
 
 libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
 modules:: $(PLUGINS)
diff --git a/testprogs/win32/npecho/GNUmakefile b/testprogs/win32/npecho/GNUmakefile
index 33cf95d..64fb79f 100755
--- a/testprogs/win32/npecho/GNUmakefile
+++ b/testprogs/win32/npecho/GNUmakefile
@@ -1,20 +1,23 @@
 INCLUDES=-I.
-CFLAGS=$(INCLUDES) 
+CFLAGS=$(INCLUDES)
 
-all: npecho_client.exe npecho_server.exe
+NPECHO = npecho_client.exe
+#npecho_server.exe
+
+NPECHO2 = npecho_client2.exe npecho_server2.exe
+
+all: $(NPECHO) $(NPECHO2)
 
 CC = i586-mingw32msvc-gcc
 
-.SUFFIXES: .c .obj
+.SUFFIXES: .c .obj .exe
 
-.c.obj: 
+.c.obj:
 	$(CC) $(CFLAGS) -c $< -o $@
 
-clean:
-	del *~ *.obj *.exe 
+.obj.exe:
+	$(CC) $(CFLAGS) -o $@ $< $(LIBS)
 
-npecho_client.exe: npecho_client.obj
-npecho_server.exe: npecho_server.obj
+clean:
+	del *~ *.obj *.exe
 
-%.exe: 
-	$(CC) $(CFLAGS) -o $@ $< $(LIBS)
diff --git a/testprogs/win32/npecho/NMakefile b/testprogs/win32/npecho/NMakefile
index b52a9c7..a0951b0 100755
--- a/testprogs/win32/npecho/NMakefile
+++ b/testprogs/win32/npecho/NMakefile
@@ -1,7 +1,11 @@
 INCLUDES=-I 
 CFLAGS=$(INCLUDES) -Zi -nologo
 
-all: npecho_client.exe npecho_server.exe
+NPECHO = npecho_client.exe
+# missing npecho_server.exe
+NPECHO2 = npecho_client2.exe npecho_server2.exe
+
+all: $(NPECHO) $(NPECHO2)
 
 clean:
 	del *~ *.obj *.exe 
@@ -11,3 +15,9 @@ npecho_client.exe: npecho_client.obj
 
 npecho_server.exe: npecho_server.obj 
 	$(CC) $(CFLAGS) -o npecho_server.exe npecho_server.obj $(LIBS)
+
+npecho_client2.exe: npecho_client2.obj
+	$(CC) $(CFLAGS) -o npecho_client2.exe npecho_client2.obj $(LIBS)
+
+npecho_server2.exe: npecho_server2.obj
+	$(CC) $(CFLAGS) -o npecho_server2.exe npecho_server2.obj $(LIBS)
diff --git a/testprogs/win32/npecho/npecho_client2.c b/testprogs/win32/npecho/npecho_client2.c
new file mode 100755
index 0000000..0486cef
--- /dev/null
+++ b/testprogs/win32/npecho/npecho_client2.c
@@ -0,0 +1,48 @@
+/*
+ * Simple Named Pipe Client
+ * (C) 2005 Jelmer Vernooij <jelmer at samba.org>
+ * (C) 2009 Stefan Metzmacher <metze at samba.org>
+ * Published to the public domain
+ */
+
+#include <windows.h>
+#include <stdio.h>
+
+#define ECHODATA "Black Dog"
+
+int main(int argc, char *argv[])
+{
+	HANDLE h;
+	DWORD numread = 0;
+	char *outbuffer = malloc(sizeof(ECHODATA)*2);
+
+	if (argc == 1) {
+		printf("Usage: %s pipename\n", argv[0]);
+		printf("  Where pipename is something like \\\\servername\\NPECHO\n");
+		return -1;
+	}
+
+	h = CreateFile(argv[1], GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+	if (h == INVALID_HANDLE_VALUE) {
+		printf("Error opening: %d\n", GetLastError());
+		return -1;
+	}
+
+	Sleep(1000);
+
+	if (!ReadFile(h, outbuffer, sizeof(ECHODATA)*2, &numread, NULL)) {
+		printf("Error reading: %d\n", GetLastError());
+		return -1;
+	}
+
+	printf("Read: %s %d\n", outbuffer, numread);
+
+	if (!ReadFile(h, outbuffer, sizeof(ECHODATA)*2, &numread, NULL)) {
+		printf("Error reading: %d\n", GetLastError());
+		return -1;
+	}
+
+	printf("Read: %s %d\n", outbuffer, numread);
+
+	return 0;
+}
diff --git a/testprogs/win32/npecho/npecho_server2.c b/testprogs/win32/npecho/npecho_server2.c
new file mode 100755
index 0000000..72edb02
--- /dev/null
+++ b/testprogs/win32/npecho/npecho_server2.c
@@ -0,0 +1,55 @@
+/*
+ * Simple Named Pipe Client
+ * (C) 2005 Jelmer Vernooij <jelmer at samba.org>
+ * (C) 2009 Stefan Metzmacher <metze at samba.org>
+ * Published to the public domain
+ */
+
+#include <windows.h>
+#include <stdio.h>
+
+#define ECHODATA "Black Dog"
+
+int main(int argc, char *argv[])
+{
+	HANDLE h;
+	DWORD numread = 0;
+	char *outbuffer = malloc(sizeof(ECHODATA));
+
+	if (argc == 1) {
+		printf("Usage: %s pipename\n", argv[0]);
+		printf("  Where pipename is something like \\\\servername\\NPECHO\n");
+		return -1;
+	}
+
+	h = CreateNamedPipe(argv[1],
+			    PIPE_ACCESS_DUPLEX,
+			    PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
+			    PIPE_UNLIMITED_INSTANCES,
+			    1024,
+			    1024,
+			    0,
+			    NULL);
+	if (h == INVALID_HANDLE_VALUE) {
+		printf("Error opening: %d\n", GetLastError());
+		return -1;
+	}
+
+	ConnectNamedPipe(h, NULL);
+
+	if (!WriteFile(h, ECHODATA, sizeof(ECHODATA), &numread, NULL)) {
+		printf("Error writing: %d\n", GetLastError());
+		return -1;
+	}
+
+	if (!WriteFile(h, ECHODATA, sizeof(ECHODATA), &numread, NULL)) {
+		printf("Error writing: %d\n", GetLastError());
+		return -1;
+	}
+
+	FlushFileBuffers(h);
+	DisconnectNamedPipe(h);
+	CloseHandle(h);
+
+	return 0;
+}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list