Solved

cross users named pipes

Posted on 1998-11-26
4
299 Views
Last Modified: 2013-12-03
I tried running a simple-client server
program using named pipes, when different users are
running the client and the server.
I got ACCESS_DENIED error when the client used CreateFile
to connect to the pipe.
Should the server change the sercurity attributes of the
named pipe ?
I created the pipe with default security attributes.

Could you tell me exactly how to allow a client to
connect to a named pipe (a short working piece of code
will be welcomed).

thanks in advance,
Avi.
0
Comment
Question by:kavas
  • 2
4 Comments
 
LVL 2

Expert Comment

by:lortega
ID: 1416379
both users must have running windows NT, windows 95 just can't create a server side of a named pipe...
0
 

Author Comment

by:kavas
ID: 1416380
Both of my client and server are running windows NT.

0
 

Author Comment

by:kavas
ID: 1416381
Adjusted points to 150
0
 
LVL 3

Accepted Solution

by:
stefanr earned 150 total points
ID: 1416382
Create a NULL DACL, that will allow all access to the named pipe:

PSECURITY_DESCRIPTOR pSecurityDescriptor = PSECURITY_DESCRIPTOR(new BYTE[SECURITY_DESCRIPTOR_MIN_LENGTH]);

::InitializeSecurityDescriptor(pSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
::SetSecurityDescriptorDacl(pSecurityDescriptor, TRUE, NULL, FALSE);

SECURITY_ATTRIBUTES SecurityAttributes = { 0 };

SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
SecurityAttributes.lpSecurityDescriptor = pSecurityDescriptor;
SecurityAttributes.bInheritHandle = FALSE;

HANDLE hFile =
      ::CreateFile(
         sPipeName,                 // LPCTSTR lpFileName: pointer to name of the file
         dwDesiredAccess,           // DWORD dwDesiredAccess: access (read-write) mode
         dwShareMode,               // DWORD dwShareMode: share mode
         &SecurityAttributes, // LPSECURITY_ATTRIBUTES lpSecurityAttributes: pointer to security attributes
         dwCreationDisposition,     // DWORD dwCreationDisposition: how to create
         dwFlagsAndAttributes,      // DWORD dwFlagsAndAttributes: file attributes
         NULL                       // HANDLE hTemplateFile: handle to file with attributes to copy
      );

delete pSecurityDescriptor;

if (INVALID_HANDLE_VALUE == hFile)
   return FALSE;

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now