report to command requester the errno if credential failure,
rather than to only close the connection.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
struct lxc_handler *handler = data;
ret = lxc_af_unix_rcv_credential(fd, &request, sizeof(request));
- if (ret < 0) {
+ if (ret < 0 && ret == -EACCES) {
+ /* we don't care for the peer, just send and close */
+ struct lxc_answer answer = { .ret = ret };
+ send(fd, &answer, sizeof(answer), 0);
+ goto out_close;
+ } else if (ret < 0) {
SYSERROR("failed to receive data on command socket");
goto out_close;
}
return -1;
}
+ if (command.answer.ret) {
+ ERROR("console access denied: %s",
+ strerror(-command.answer.ret));
+ return -1;
+ }
+
*fd = command.answer.fd;
if (*fd <0) {
ERROR("unable to allocate fd for tty %d", ttynum);