named-pipes

Why are pipes considered dangerous to use in Windows/unix/linux?

两盒软妹~` 提交于 2019-12-21 04:42:30
问题 Why are pipes considered dangerous to use? What can be done to avoid these security issues? I'm mostly interested in Windows, but if you have other OS information, please provide. 回答1: (assuming you're talking about Unix named pipes from the mention of 'c' and 'IPC'. Windows named pipes work somewhat differently) Anyone with permissions can write to a named pipe, so you have to be careful with permissions and locking (see flock()). If an application trusts the input it's getting from the

Making a Perl daemon that runs 24/7 and reads from named pipes

孤街浪徒 提交于 2019-12-21 04:29:31
问题 I'm trying to make a log analyser using perl. The analyser would run 24/7 in the background on an AIX server and read from pipes that syslog directs logs to (from the entire network). Basically: logs from network ----> named pipe A --------> | perl daemon ----> named pipe B --------> | * reads pipes ----> named pipe c --------> | * decides what to do based on which pipe So, for example, I want my daemon to be able to be configured to mail root@domain.com all logs that are written to named

Windows Named Pipe Support in Linux

泄露秘密 提交于 2019-12-21 02:35:11
问题 I'm looking at a project which will require inter-process communication between a legacy Windows application using named pipes, and a new service running on a Linux server. The windows application cannot be changed. Does anyone know if there is a Linux library available that supports Windows named pipes? Or even better, can anyone recommend a library they have used for this purpose? 回答1: Windows and Linux named pipes are different animals. If an interop solution exists you are going to be one

How do you send a named pipe string from umnanaged to managed code space?

只愿长相守 提交于 2019-12-20 20:42:11
问题 I appear to have a named pipes 101 issue. I have a very simple set up to connect a simplex named pipe transmitting from a C++ unmanaged app to a C# managed app. The pipe connects, but I cannot send a "message" through the pipe unless I close the handle which appears to flush the buffer and pass the message through. It's like the message is blocked. I have tried reversing the roles of client/server and invoking them with different Flag combinations without any luck. I can easily send messages

WCF Named Pipe Security and Multiple User Sessions?

允我心安 提交于 2019-12-20 12:38:07
问题 I have setup a WPF application that is single instance using a Mutex, this allows for the application to run within each user account if you are using user switching. The application sets up a WCF named pipe so that I can communicate to the single instance from another process (i.e. when the second process runs before it terminates due to the Mutex). I would like to know if anything should be done (best practices) to secure the named pipe? Also I would like to know if the named pipe messages

Prevent FIFO from closing / reuse closed FIFO

时光总嘲笑我的痴心妄想 提交于 2019-12-20 11:44:11
问题 Consider the following scenario: a FIFO named test is created. In one terminal window (A) I run cat <test and in another (B) cat >test . It is now possible to write in window B and get the output in window A. It is also possible to terminate the process A and relaunch it and still be able to use this setup as suspected. However if you terminate the process in window B, B will (as far as I know) send an EOF through the FIFO to process A and terminate that as well. In fact, if you run a process

Read on closed named pipe blocks

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 05:15:22
问题 I am trying to read from a named pipe (FIFO) with Fortran. Reading the data works, but the Fortran program does not seem to notice when the pipe is closed on the other end; reads simply block rather than getting an EOF. Sample program: program kitten character(256) :: buf open(22, file='test') do read(22, *) buf print*, trim(buf) end do end program kitten Now with $ mkfifo test $ echo -e '1\n2\n3' >test & $ ./kitten the program prints 1\n2\n3\n as expected, but then simply hangs. Instead, the

WPF access GUI from other thread

ε祈祈猫儿з 提交于 2019-12-20 03:14:06
问题 I am working through the requirement to make a WPF Application single instance only. However - I have to pass the command line to the first instance and then perform some UI action. I am using a Mutext to check for already running instances, I do use NamedPipes to transfer the command line to the already running instance. But of course I am not in the correct Thread to access "Window1". I tried to store a reference to "Window1" in a static class and then use the Dispatcher to call a Method in

how to determine if pipe can be written

两盒软妹~` 提交于 2019-12-19 05:37:09
问题 Is there a way (in C, or preferably in Perl) to determine whether a named pipe may be written - i.e. there is an active reading process It seems that if I open for write nonblocking, the open returns at once but a select for write also returns immediately. The goal is for the writing process to just carry on (i.e. skip sending) if the reading end is not ready 回答1: Chances are that you are not paying attention to the return codes from open . If you open a FIFO for writing and as non-blocking

How to work with named pipes (C++ server , C# client)

匆匆过客 提交于 2019-12-19 04:06:11
问题 I am trying to get started with working with named pipes as I will need to use them for a project of mine in the future. At the moment I have a C++ server which waits until a client connects and sends over a test message. I roughly followed this tutorial to get started. The relevant code is below: #define MESSAGE L"TestMessage" HANDLE hnamedPipe = INVALID_HANDLE_VALUE; hnamedPipe = CreateNamedPipe( L"\\\\.\\pipe\\testpipe", PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE| PIPE_READMODE_MESSAGE| PIPE