Log identify messages.

This commit is contained in:
nicm 2015-10-22 11:00:51 +00:00
parent 515dfea4b7
commit c2c2d44c72

View File

@ -1155,38 +1155,45 @@ server_client_msg_identify(struct client *c, struct imsg *imsg)
fatalx("bad MSG_IDENTIFY_FLAGS size"); fatalx("bad MSG_IDENTIFY_FLAGS size");
memcpy(&flags, data, sizeof flags); memcpy(&flags, data, sizeof flags);
c->flags |= flags; c->flags |= flags;
log_debug("client %p IDENTIFY_FLAGS %#x", c, flags);
break; break;
case MSG_IDENTIFY_TERM: case MSG_IDENTIFY_TERM:
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_TERM string"); fatalx("bad MSG_IDENTIFY_TERM string");
c->term = xstrdup(data); c->term = xstrdup(data);
log_debug("client %p IDENTIFY_TERM %s", c, data);
break; break;
case MSG_IDENTIFY_TTYNAME: case MSG_IDENTIFY_TTYNAME:
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_TTYNAME string"); fatalx("bad MSG_IDENTIFY_TTYNAME string");
c->ttyname = xstrdup(data); c->ttyname = xstrdup(data);
log_debug("client %p IDENTIFY_TTYNAME %s", c, data);
break; break;
case MSG_IDENTIFY_CWD: case MSG_IDENTIFY_CWD:
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_CWD string"); fatalx("bad MSG_IDENTIFY_CWD string");
if ((c->cwd = open(data, O_RDONLY)) == -1) if ((c->cwd = open(data, O_RDONLY)) == -1)
c->cwd = open("/", O_RDONLY); c->cwd = open("/", O_RDONLY);
log_debug("client %p IDENTIFY_CWD %s", c, data);
break; break;
case MSG_IDENTIFY_STDIN: case MSG_IDENTIFY_STDIN:
if (datalen != 0) if (datalen != 0)
fatalx("bad MSG_IDENTIFY_STDIN size"); fatalx("bad MSG_IDENTIFY_STDIN size");
c->fd = imsg->fd; c->fd = imsg->fd;
log_debug("client %p IDENTIFY_STDIN %d", c, imsg->fd);
break; break;
case MSG_IDENTIFY_ENVIRON: case MSG_IDENTIFY_ENVIRON:
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_ENVIRON string"); fatalx("bad MSG_IDENTIFY_ENVIRON string");
if (strchr(data, '=') != NULL) if (strchr(data, '=') != NULL)
environ_put(&c->environ, data); environ_put(&c->environ, data);
log_debug("client %p IDENTIFY_ENVIRON %s", c, data);
break; break;
case MSG_IDENTIFY_CLIENTPID: case MSG_IDENTIFY_CLIENTPID:
if (datalen != sizeof c->pid) if (datalen != sizeof c->pid)
fatalx("bad MSG_IDENTIFY_CLIENTPID size"); fatalx("bad MSG_IDENTIFY_CLIENTPID size");
memcpy(&c->pid, data, sizeof c->pid); memcpy(&c->pid, data, sizeof c->pid);
log_debug("client %p IDENTIFY_CLIENTPID %ld", c, (long)c->pid);
break; break;
default: default:
break; break;