- Bug 242404. Use "lstat()" to find the owner of micasad socket file.
This commit is contained in:
parent
27a4acbb83
commit
9f2f0ff262
@ -25,6 +25,7 @@ using System.Net;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using Mono.Unix;
|
||||
using Mono.Unix.Native;
|
||||
using System.Text;
|
||||
|
||||
namespace Novell.CASA.MiCasa.Communication
|
||||
@ -45,6 +46,7 @@ namespace Novell.CASA.MiCasa.Communication
|
||||
|
||||
public void Open()
|
||||
{
|
||||
Stat socketFileStatus;
|
||||
mSocket = new Socket(AddressFamily.Unix,
|
||||
SocketType.Stream,
|
||||
ProtocolType.IP);
|
||||
@ -54,13 +56,11 @@ namespace Novell.CASA.MiCasa.Communication
|
||||
throw new Exception("could not get socket");
|
||||
}
|
||||
|
||||
sockEndPoint = new UnixEndPoint(socketFileName);
|
||||
UnixFileSystemInfo sockFileInfo = new UnixFileInfo(socketFileName);
|
||||
UnixUserInfo sockFileOwner = sockFileInfo.OwnerUser;
|
||||
|
||||
Syscall.lstat(socketFileName, out socketFileStatus);
|
||||
// root is the owner of the file "/tmp/.novellCASA"
|
||||
if (sockFileOwner.UserId == 0)
|
||||
if (socketFileStatus.st_uid == 0)
|
||||
{
|
||||
sockEndPoint = new UnixEndPoint(socketFileName);
|
||||
mSocket.Connect(sockEndPoint);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user