On Mon, Aug 15, 2011 at 09:58:13AM +0200, Jiri Denemark wrote: > This patch allows owner's UID to be changed as well. > --- > src/rpc/virnetserverservice.c | 2 +- > src/rpc/virnetsocket.c | 7 ++++--- > src/rpc/virnetsocket.h | 1 + > tests/virnetsockettest.c | 4 ++-- > 4 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c > index e63603f..9f82a8d 100644 > --- a/src/rpc/virnetserverservice.c > +++ b/src/rpc/virnetserverservice.c > @@ -182,7 +182,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path, > > if (virNetSocketNewListenUNIX(path, > mask, > - grp, > + -1, grp, Only comment would be that if we started with one line per arg, the patch should probably keep that (but I don't like this much so ...) > &svc->socks[0]) < 0) > goto error; > > diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c > index c19dcfa..23ec5ca 100644 > --- a/src/rpc/virnetsocket.c > +++ b/src/rpc/virnetsocket.c > @@ -302,6 +302,7 @@ error: > #if HAVE_SYS_UN_H > int virNetSocketNewListenUNIX(const char *path, > mode_t mask, > + uid_t user, > gid_t grp, > virNetSocketPtr *retsock) > { > @@ -344,10 +345,10 @@ int virNetSocketNewListenUNIX(const char *path, > /* chown() doesn't work for abstract sockets but we use them only > * if libvirtd runs unprivileged > */ > - if (grp != 0 && chown(path, -1, grp)) { > + if (grp != 0 && chown(path, user, grp)) { > virReportSystemError(errno, > - _("Failed to change group ID of '%s' to %u"), > - path, (unsigned int) grp); > + _("Failed to change ownership of '%s' to %d:%d"), > + path, (int) user, (int) grp); > goto error; > } > > diff --git a/src/rpc/virnetsocket.h b/src/rpc/virnetsocket.h > index 24110a6..f7e5ebb 100644 > --- a/src/rpc/virnetsocket.h > +++ b/src/rpc/virnetsocket.h > @@ -47,6 +47,7 @@ int virNetSocketNewListenTCP(const char *nodename, > > int virNetSocketNewListenUNIX(const char *path, > mode_t mask, > + uid_t user, > gid_t grp, > virNetSocketPtr *addr); > > diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c > index fba7e15..fae15a3 100644 > --- a/tests/virnetsockettest.c > +++ b/tests/virnetsockettest.c > @@ -214,7 +214,7 @@ static int testSocketUNIXAccept(const void *data ATTRIBUTE_UNUSED) > } > } > > - if (virNetSocketNewListenUNIX(path, 0700, getgid(), &lsock) < 0) > + if (virNetSocketNewListenUNIX(path, 0700, -1, getgid(), &lsock) < 0) > goto cleanup; > > if (virNetSocketListen(lsock, 0) < 0) > @@ -263,7 +263,7 @@ static int testSocketUNIXAddrs(const void *data ATTRIBUTE_UNUSED) > } > } > > - if (virNetSocketNewListenUNIX(path, 0700, getgid(), &lsock) < 0) > + if (virNetSocketNewListenUNIX(path, 0700, -1, getgid(), &lsock) < 0) > goto cleanup; > > if (STRNEQ(virNetSocketLocalAddrString(lsock), "127.0.0.1;0")) { ACK, that too seems uncontroversial Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list