.net remoting server can't read file it should have access to read. -
11-16-2007
, 08:57 AM
Hi, I think I have a .net remoting permissions problem.
This is WinXP SP2
I have a .net ipc remoting client and server.
Each proc runs as the user who is logged in.
I add props to and set up my remoting as follows
IPC SERVER:
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilter Level.Full;
IDictionary props = new Hashtable();
props.Add("authorizedGroup", "Users");
props.Add("portName", Environment.MachineName);
props.Add("exclusiveAddressUse", false);
m_ipcChannel = new IpcServerChannel(props, serverProv);
ChannelServices.RegisterChannel(m_ipcChannel, false);
RemotingServices.Marshal(this, "IServer");
IPC CLIENT:
IChannel clientChannel = null;
IDictionary props = null;
string name = Constants.NAME_REMOTING_SERVER + "_CLIENT_CHANNEL";
uri = @"ipc://" + Environment.MachineName + "/IServer";
try
{
// Don't wait more than 2 seconds to connect
// Not sure what this does.
// If the server is not available, ie not running
// the function calls return immediately.
props = new Hashtable();
props.Add("name", name);
props.Add("connectionTimeout", 2000);
// this will only work in english, need to use
// LookupAccountSid for internationalization
props.Add("authorizedGroup", "Users");
if (null == ChannelServices.GetChannel(name))
{
clientChannel = new IpcClientChannel(props, null);
ChannelServices.RegisterChannel(clientChannel, false);
}
}
Now, if I log in as an admin, all is well.
If I log in as someone in the users group I have issues.
My assumption was "authorizedGroup", "Users" would allow users to
work.
The issue is that I need to read a file and when I'm not admin, I
don't have access.
The ntfs permissions are fine. That is, while logged in as a user, I
can read the file via notepad.
But the remoting processes don't have access to the file.
The client calls into the server who then reads the file to determine
an IP address.
It reports.
L 2007-11-16 09:39:25Z 5 readLineFromFile:0 0: Access to the path 'C:
\Program Files\company\product\Data\ip.dat' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at readLineFromFile(String file)
Can anyone help?
Thanks a million. |