Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access IPC sockets created by another user account #48

Closed
stewdog opened this issue Aug 11, 2010 · 7 comments
Closed

Unable to access IPC sockets created by another user account #48

stewdog opened this issue Aug 11, 2010 · 7 comments

Comments

@stewdog
Copy link

stewdog commented Aug 11, 2010

Workarounds have been suggested to have zmq create the files used for the UDS sockets in the file system with the appropriate permissions. My suggestion is to instead use anonymous sockets, created by ensuring the first character of the char* path passed in is zero. Example below, possibly could be added to zmq::resolve_local_path in ipc.cpp

struct sockaddr_un address;
bzero(&address, sizeof(address));
address.sun_family = AF_UNIX;
strncpy(address.sun_path, localSocketName.c_str(), sizeof(address.sun_path));

int length = sizeof(address.sun_family) + strlen(address.sun_path);

// make sure we use an abstract name for the socket
address.sun_path[0] = 0;

// call bind / connect as normal

@stewdog
Copy link
Author

stewdog commented Aug 11, 2010

This solution may only work on Linux

@sustrik
Copy link
Member

sustrik commented Aug 30, 2010

Yes. Any idea how to solve it in general manner?

@stewdog
Copy link
Author

stewdog commented Aug 30, 2010

I think the only option is to go with the approach where zmq creates a directory with the appropriate permissions, so that all unix domain sockets can be created with a path in that directory and with all users having permission to access them - I believe someone else posted a partial solution along those lines.

Its not neat but its the only solution I can see

@sustrik
Copy link
Member

sustrik commented Aug 30, 2010

wouldn't 0mq need permission to create a directory same way as it needs permissions to open a unix domain socket?

@stewdog
Copy link
Author

stewdog commented Aug 30, 2010

True, so could go with creating all the sockets in /tmp and chmod them to 777 on creation ?

@stewdog
Copy link
Author

stewdog commented Aug 30, 2010

In fact I think thats what was proposed by the original poster on the list

@sustrik
Copy link
Member

sustrik commented Oct 19, 2010

There's no point in 0mq implementing workarounds around OS behaviour. Users can either pre-create the file with adequate permissions or use tcp transport. Closing the issue.

csrl pushed a commit to exosite/zeromq2 that referenced this issue Dec 22, 2012
drahosp pushed a commit to LuaDist/libzmq that referenced this issue Feb 13, 2014
Fix Build Regression zeromq#449: Move socket_base.hpp and err.hpp after poll.h include
mrvn pushed a commit to mrvn/libzmq that referenced this issue Jul 2, 2015
benjdero pushed a commit to benjdero/libzmq that referenced this issue Feb 20, 2023
first working draft of java zyre
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants