Commit Diff


commit - 02dd6ee50e0e52c1581e43fb1910bc44604dcf7f
commit + 1cb49b67c167a14c547143ce621e7573f59c82a3
blob - 82cbd62438015fab107bd4aa25d20bd02e800127
blob + 768dd71c9d5971dd3cc7801fc4692bbe4f2b56d6
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -1011,7 +1011,6 @@ connect_repo_child(struct gotd_client *client,
 		fatal("socketpair");
 
 	memset(&ireq, 0, sizeof(ireq));
-	ireq.client_id = client->id;
 	ireq.proc_id = repo_proc->type;
 
 	/* Pass repo child pipe to session child process. */
blob - d6d5b413a46c4062f8b7a4a635cd9ffea6d6c49f
blob + f79b125406b4bb07bdc361abda15856360b65719
--- gotd/gotd.h
+++ gotd/gotd.h
@@ -293,11 +293,6 @@ struct gotd_imsg_list_refs {
 	int client_is_reading; /* 1 if reading, 0 if writing */
 };
 
-/* Structure for GOTD_IMSG_LIST_REFS_INTERNAL. */
-struct gotd_imsg_list_refs_internal {
-	uint32_t client_id;
-};
-
 /* Structure for GOTD_IMSG_REFLIST. */
 struct gotd_imsg_reflist {
 	size_t nrefs;
@@ -345,25 +340,21 @@ struct gotd_imsg_capability {
 /* Structure for GOTD_IMSG_WANT data. */
 struct gotd_imsg_want {
 	uint8_t object_id[SHA1_DIGEST_LENGTH];
-	uint32_t client_id;
 } __attribute__((__packed__));
 
 /* Structure for GOTD_IMSG_HAVE data. */
 struct gotd_imsg_have {
 	uint8_t object_id[SHA1_DIGEST_LENGTH];
-	uint32_t client_id;
 } __attribute__((__packed__));
 
 /* Structure for GOTD_IMSG_ACK data. */
 struct gotd_imsg_ack {
 	uint8_t object_id[SHA1_DIGEST_LENGTH];
-	uint32_t client_id;
 } __attribute__((__packed__));
 
 /* Structure for GOTD_IMSG_NAK data. */
 struct gotd_imsg_nak {
 	uint8_t object_id[SHA1_DIGEST_LENGTH];
-	uint32_t client_id;
 } __attribute__((__packed__));
 
 /* Structure for GOTD_IMSG_PACKFILE_STATUS data. */
@@ -380,7 +371,6 @@ struct gotd_imsg_ref_update {
 	uint8_t new_id[SHA1_DIGEST_LENGTH];
 	int ref_is_new;
 	int delete_ref;
-	uint32_t client_id;
 	size_t name_len;
 
 	/* Followed by name_len data bytes. */
@@ -389,7 +379,6 @@ struct gotd_imsg_ref_update {
 /* Structure for GOTD_IMSG_REF_UPDATES_START data. */
 struct gotd_imsg_ref_updates_start {
 	int nref_updates;
-	uint32_t client_id;
 
 	/* Followed by nref_updates GOT_IMSG_REF_UPDATE_OK/NG messages. */
 };
@@ -399,7 +388,6 @@ struct gotd_imsg_ref_update_ok {
 	uint8_t old_id[SHA1_DIGEST_LENGTH];
 	uint8_t new_id[SHA1_DIGEST_LENGTH];
 	int ref_is_new;
-	uint32_t client_id;
 	size_t name_len;
 
 	/* Followed by name_len data bytes. */
@@ -409,7 +397,6 @@ struct gotd_imsg_ref_update_ok {
 struct gotd_imsg_ref_update_ng {
 	uint8_t old_id[SHA1_DIGEST_LENGTH];
 	uint8_t new_id[SHA1_DIGEST_LENGTH];
-	uint32_t client_id;
 	size_t name_len;
 	size_t reason_len;
 
@@ -418,7 +405,6 @@ struct gotd_imsg_ref_update_ng {
 
 /* Structure for GOTD_IMSG_SEND_PACKFILE data. */
 struct gotd_imsg_send_packfile {
-	uint32_t client_id;
 	int report_progress;
 
 	/* delta cache file is sent as a file descriptor */
@@ -428,29 +414,16 @@ struct gotd_imsg_send_packfile {
 
 /* Structure for GOTD_IMSG_RECV_PACKFILE data. */
 struct gotd_imsg_recv_packfile {
-	uint32_t client_id;
 	int report_status;
 
 	/* pack destination temp file is sent as a file descriptor */
 };
 
-/* Structure for GOTD_IMSG_PACKFILE_PIPE data. */
-struct gotd_imsg_packfile_pipe {
-	uint32_t client_id;
-};
-
-/* Structure for GOTD_IMSG_PACKIDX_FILE data. */
-struct gotd_imsg_packidx_file {
-	uint32_t client_id;
-};
-
-
 /*
  * Structure for GOTD_IMSG_PACKFILE_PROGRESS and
  * GOTD_IMSG_PACKFILE_READY data.
  */
 struct gotd_imsg_packfile_progress {
-	uint32_t client_id;
 	int ncolored;
 	int nfound;
 	int ntrees;
@@ -463,15 +436,9 @@ struct gotd_imsg_packfile_progress {
 
 /* Structure for GOTD_IMSG_PACKFILE_INSTALL. */
 struct gotd_imsg_packfile_install {
-	uint32_t client_id;
 	uint8_t pack_sha1[SHA1_DIGEST_LENGTH];
 };
 
-/* Structure for GOTD_IMSG_PACKFILE_DONE data. */
-struct gotd_imsg_packfile_done {
-	uint32_t client_id;
-};
-
 /* Structure for GOTD_IMSG_DISCONNECT data. */
 struct gotd_imsg_disconnect {
 	uint32_t client_id;
@@ -489,7 +456,6 @@ struct gotd_imsg_connect {
 
 /* Structure for GOTD_IMSG_CONNECT_REPO_CHILD. */
 struct gotd_imsg_connect_repo_child {
-	uint32_t client_id;
 	enum gotd_procid proc_id;
 
 	/* repo child imsg pipe is passed via imsg fd */
@@ -511,7 +477,6 @@ enum gotd_notification_action {
 };
 /* IMSG_NOTIFY session <-> repo_write */
 struct gotd_imsg_notification_content {
-	uint32_t client_id;
 	enum gotd_notification_action action;
 	uint8_t old_id[SHA1_DIGEST_LENGTH];
 	uint8_t new_id[SHA1_DIGEST_LENGTH];
blob - af1549ed25e2702af538cb0dd91835c1faaeca83
blob + f7e53300d55277bab10c4e324bca646100104c8b
--- gotd/repo_read.c
+++ gotd/repo_read.c
@@ -64,6 +64,7 @@ static struct repo_read {
 	int *temp_fds;
 	int session_fd;
 	struct gotd_imsgev session_iev;
+	int refs_listed;
 } repo_read;
 
 static struct repo_read_client {
@@ -260,7 +261,6 @@ list_refs(struct imsg *imsg)
 	struct repo_read_client *client = &repo_read_client;
 	struct got_reflist_head refs;
 	struct got_reflist_entry *re;
-	struct gotd_imsg_list_refs_internal ireq;
 	size_t datalen;
 	struct gotd_imsg_reflist irefs;
 	struct imsgbuf ibuf;
@@ -274,17 +274,15 @@ list_refs(struct imsg *imsg)
 		return got_error(GOT_ERR_PRIVSEP_NO_FD);
 
 	datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
-	if (datalen != sizeof(ireq))
+	if (datalen != 0)
 		return got_error(GOT_ERR_PRIVSEP_LEN);
-	memcpy(&ireq, imsg->data, sizeof(ireq));
 
-	if (ireq.client_id == 0)
-		return got_error(GOT_ERR_CLIENT_ID);
-	if (client->id != 0) {
+	if (repo_read.refs_listed) {
 		return got_error_msg(GOT_ERR_CLIENT_ID,
 		    "duplicate list-refs request");
 	}
-	client->id = ireq.client_id;
+	repo_read.refs_listed = 1;
+
 	client->fd = client_fd;
 
 	imsg_init(&ibuf, client_fd);
@@ -580,15 +578,13 @@ static const struct got_error *
 receive_pack_pipe(struct imsg *imsg, struct gotd_imsgev *iev)
 {
 	struct repo_read_client *client = &repo_read_client;
-	struct gotd_imsg_packfile_pipe ireq;
 	size_t datalen;
 
 	log_debug("receiving pack pipe descriptor");
 
 	datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
-	if (datalen != sizeof(ireq))
+	if (datalen != 0)
 		return got_error(GOT_ERR_PRIVSEP_LEN);
-	memcpy(&ireq, imsg->data, sizeof(ireq));
 
 	if (client->pack_pipe != -1)
 		return got_error(GOT_ERR_PRIVSEP_MSG);
@@ -605,7 +601,6 @@ send_packfile(struct imsg *imsg, struct gotd_imsgev *i
 {
 	const struct got_error *err = NULL;
 	struct repo_read_client *client = &repo_read_client;
-	struct gotd_imsg_packfile_done idone;
 	uint8_t packsha1[SHA1_DIGEST_LENGTH];
 	char hex[SHA1_DIGEST_STRING_LENGTH];
 	FILE *delta_cache = NULL;
@@ -658,10 +653,8 @@ send_packfile(struct imsg *imsg, struct gotd_imsgev *i
 	    got_sha1_digest_to_str(packsha1, hex, sizeof(hex)))
 		log_debug("sent pack-%s.pack", hex);
 
-	memset(&idone, 0, sizeof(idone));
-	idone.client_id = client->id;
-	if (gotd_imsg_compose_event(iev, GOTD_IMSG_PACKFILE_DONE,
-	    PROC_REPO_READ, -1, &idone, sizeof(idone)) == -1)
+	if (gotd_imsg_compose_event(iev, GOTD_IMSG_PACKFILE_DONE,
+	    PROC_REPO_READ, -1, NULL, 0) == -1)
 		err = got_error_from_errno("imsg compose PACKFILE_DONE");
 done:
 	if (client->delta_cache_fd != -1 &&
@@ -709,7 +702,7 @@ repo_read_dispatch_session(int fd, short event, void *
 			break;
 
 		if (imsg.hdr.type != GOTD_IMSG_LIST_REFS_INTERNAL &&
-		    client->id == 0) {
+		    !repo_read.refs_listed) {
 			err = got_error(GOT_ERR_PRIVSEP_MSG);
 			break;
 		}
blob - 2ff8767a91c4ae5e858bc0906a5889a4179c3f35
blob + 3bd3f24dbb7a637581477fdf36227426f8b6a00b
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -85,6 +85,7 @@ static struct repo_write {
 		int fd1;
 		int fd2;
 	} diff;
+	int refs_listed;
 } repo_write;
 
 struct gotd_ref_update {
@@ -248,7 +249,6 @@ list_refs(struct imsg *imsg)
 	struct repo_write_client *client = &repo_write_client;
 	struct got_reflist_head refs;
 	struct got_reflist_entry *re;
-	struct gotd_imsg_list_refs_internal ireq;
 	size_t datalen;
 	struct gotd_imsg_reflist irefs;
 	struct imsgbuf ibuf;
@@ -261,17 +261,15 @@ list_refs(struct imsg *imsg)
 		return got_error(GOT_ERR_PRIVSEP_NO_FD);
 
 	datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
-	if (datalen != sizeof(ireq))
+	if (datalen != 0)
 		return got_error(GOT_ERR_PRIVSEP_LEN);
-	memcpy(&ireq, imsg->data, sizeof(ireq));
 
-	if (ireq.client_id == 0)
-		return got_error(GOT_ERR_CLIENT_ID);
-	if (client->id != 0) {
+	if (repo_write.refs_listed) {
 		return got_error_msg(GOT_ERR_CLIENT_ID,
 		    "duplicate list-refs request");
 	}
-	client->id = ireq.client_id;
+	repo_write.refs_listed = 1;
+
 	client->fd = client_fd;
 	client->nref_updates = 0;
 	client->nref_del = 0;
@@ -1507,7 +1505,6 @@ install_packfile(struct gotd_imsgev *iev)
 	int ret;
 
 	memset(&inst, 0, sizeof(inst));
-	inst.client_id = client->id;
 	memcpy(inst.pack_sha1, client->pack_sha1, SHA1_DIGEST_LENGTH);
 
 	ret = gotd_imsg_compose_event(iev, GOTD_IMSG_PACKFILE_INSTALL,
@@ -1521,13 +1518,11 @@ install_packfile(struct gotd_imsgev *iev)
 static const struct got_error *
 send_ref_updates_start(int nref_updates, struct gotd_imsgev *iev)
 {
-	struct repo_write_client *client = &repo_write_client;
 	struct gotd_imsg_ref_updates_start istart;
 	int ret;
 
 	memset(&istart, 0, sizeof(istart));
 	istart.nref_updates = nref_updates;
-	istart.client_id = client->id;
 
 	ret = gotd_imsg_compose_event(iev, GOTD_IMSG_REF_UPDATES_START,
 	    PROC_REPO_WRITE, -1, &istart, sizeof(istart));
@@ -1541,7 +1536,6 @@ send_ref_updates_start(int nref_updates, struct gotd_i
 static const struct got_error *
 send_ref_update(struct gotd_ref_update *ref_update, struct gotd_imsgev *iev)
 {
-	struct repo_write_client *client = &repo_write_client;
 	struct gotd_imsg_ref_update iref;
 	const char *refname = got_ref_get_name(ref_update->ref);
 	struct ibuf *wbuf;
@@ -1552,7 +1546,6 @@ send_ref_update(struct gotd_ref_update *ref_update, st
 	memcpy(iref.new_id, ref_update->new_id.sha1, SHA1_DIGEST_LENGTH);
 	iref.ref_is_new = ref_update->ref_is_new;
 	iref.delete_ref = ref_update->delete_ref;
-	iref.client_id = client->id;
 	iref.name_len = strlen(refname);
 
 	len = sizeof(iref) + iref.name_len;
@@ -1596,15 +1589,13 @@ static const struct got_error *
 receive_pack_pipe(struct imsg *imsg, struct gotd_imsgev *iev)
 {
 	struct repo_write_client *client = &repo_write_client;
-	struct gotd_imsg_packfile_pipe ireq;
 	size_t datalen;
 
 	log_debug("receiving pack pipe descriptor");
 
 	datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
-	if (datalen != sizeof(ireq))
+	if (datalen != 0)
 		return got_error(GOT_ERR_PRIVSEP_LEN);
-	memcpy(&ireq, imsg->data, sizeof(ireq));
 
 	if (client->pack_pipe != -1)
 		return got_error(GOT_ERR_PRIVSEP_MSG);
@@ -1620,15 +1611,13 @@ static const struct got_error *
 receive_pack_idx(struct imsg *imsg, struct gotd_imsgev *iev)
 {
 	struct repo_write_client *client = &repo_write_client;
-	struct gotd_imsg_packidx_file ireq;
 	size_t datalen;
 
 	log_debug("receiving pack index output file");
 
 	datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
-	if (datalen != sizeof(ireq))
+	if (datalen != 0)
 		return got_error(GOT_ERR_PRIVSEP_LEN);
-	memcpy(&ireq, imsg->data, sizeof(ireq));
 
 	if (client->packidx_fd != -1)
 		return got_error(GOT_ERR_PRIVSEP_MSG);
@@ -2241,7 +2230,7 @@ repo_write_dispatch_session(int fd, short event, void 
 			break;
 
 		if (imsg.hdr.type != GOTD_IMSG_LIST_REFS_INTERNAL &&
-		    client->id == 0) {
+		    !repo_write.refs_listed) {
 			err = got_error(GOT_ERR_PRIVSEP_MSG);
 			break;
 		}
blob - f452173f6d3d7b1aed664ef373549fedd7933036
blob + 2d25688e104f748188eb06b72e9caa52e4918aa0
--- gotd/session.c
+++ gotd/session.c
@@ -182,24 +182,21 @@ gotd_session_sighdlr(int sig, short event, void *arg)
 }
 
 static const struct got_error *
-recv_packfile_done(uint32_t *client_id, struct imsg *imsg)
+recv_packfile_done(struct imsg *imsg)
 {
-	struct gotd_imsg_packfile_done idone;
 	size_t datalen;
 
 	log_debug("packfile-done received");
 
 	datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
-	if (datalen != sizeof(idone))
+	if (datalen != 0)
 		return got_error(GOT_ERR_PRIVSEP_LEN);
-	memcpy(&idone, imsg->data, sizeof(idone));
 
-	*client_id = idone.client_id;
 	return NULL;
 }
 
 static const struct got_error *
-recv_packfile_install(uint32_t *client_id, struct imsg *imsg)
+recv_packfile_install(struct imsg *imsg)
 {
 	struct gotd_imsg_packfile_install inst;
 	size_t datalen;
@@ -211,12 +208,11 @@ recv_packfile_install(uint32_t *client_id, struct imsg
 		return got_error(GOT_ERR_PRIVSEP_LEN);
 	memcpy(&inst, imsg->data, sizeof(inst));
 
-	*client_id = inst.client_id;
 	return NULL;
 }
 
 static const struct got_error *
-recv_ref_updates_start(uint32_t *client_id, struct imsg *imsg)
+recv_ref_updates_start(struct imsg *imsg)
 {
 	struct gotd_imsg_ref_updates_start istart;
 	size_t datalen;
@@ -228,12 +224,11 @@ recv_ref_updates_start(uint32_t *client_id, struct ims
 		return got_error(GOT_ERR_PRIVSEP_LEN);
 	memcpy(&istart, imsg->data, sizeof(istart));
 
-	*client_id = istart.client_id;
 	return NULL;
 }
 
 static const struct got_error *
-recv_ref_update(uint32_t *client_id, struct imsg *imsg)
+recv_ref_update(struct imsg *imsg)
 {
 	struct gotd_imsg_ref_update iref;
 	size_t datalen;
@@ -245,7 +240,6 @@ recv_ref_update(uint32_t *client_id, struct imsg *imsg
 		return got_error(GOT_ERR_PRIVSEP_LEN);
 	memcpy(&iref, imsg->data, sizeof(iref));
 
-	*client_id = iref.client_id;
 	return NULL;
 }
 
@@ -259,7 +253,6 @@ send_ref_update_ok(struct gotd_session_client *client,
 	size_t len;
 
 	memset(&iok, 0, sizeof(iok));
-	iok.client_id = client->id;
 	memcpy(iok.old_id, iref->old_id, SHA1_DIGEST_LENGTH);
 	memcpy(iok.new_id, iref->new_id, SHA1_DIGEST_LENGTH);
 	iok.name_len = strlen(refname);
@@ -300,7 +293,6 @@ send_ref_update_ng(struct gotd_session_client *client,
 	size_t len;
 
 	memset(&ing, 0, sizeof(ing));
-	ing.client_id = client->id;
 	memcpy(ing.old_id, iref->old_id, SHA1_DIGEST_LENGTH);
 	memcpy(ing.new_id, iref->new_id, SHA1_DIGEST_LENGTH);
 	ing.name_len = strlen(refname);
@@ -602,7 +594,6 @@ static const struct got_error *
 request_notification(struct gotd_session_notif *notif)
 {
 	const struct got_error *err = NULL;
-	struct gotd_session_client *client = &gotd_session_client;
 	struct gotd_imsgev *iev = &gotd_session.repo_child_iev;
 	struct gotd_imsg_notification_content icontent;
 	struct ibuf *wbuf;
@@ -614,7 +605,6 @@ request_notification(struct gotd_session_notif *notif)
 		return got_error_from_errno("got_opentemp");
 
 	memset(&icontent, 0, sizeof(icontent));
-	icontent.client_id = client->id;
 
 	icontent.action = notif->action;
 	memcpy(&icontent.old_id, &notif->old_id, sizeof(notif->old_id));
@@ -833,7 +823,7 @@ done:
 }
 
 static const struct got_error *
-recv_notification_content(uint32_t *client_id, struct imsg *imsg)
+recv_notification_content(struct imsg *imsg)
 {
 	struct gotd_imsg_notification_content inotif;
 	size_t datalen;
@@ -843,7 +833,6 @@ recv_notification_content(uint32_t *client_id, struct 
 		return got_error(GOT_ERR_PRIVSEP_LEN);
 	memcpy(&inotif, imsg->data, sizeof(inotif));
 
-	*client_id = inotif.client_id;
 	return NULL;
 }
 
@@ -897,25 +886,25 @@ session_dispatch_repo_child(int fd, short event, void 
 			break;
 		case GOTD_IMSG_PACKFILE_DONE:
 			do_disconnect = 1;
-			err = recv_packfile_done(&client_id, &imsg);
+			err = recv_packfile_done(&imsg);
 			break;
 		case GOTD_IMSG_PACKFILE_INSTALL:
-			err = recv_packfile_install(&client_id, &imsg);
+			err = recv_packfile_install(&imsg);
 			if (err == NULL)
 				do_packfile_install = 1;
 			break;
 		case GOTD_IMSG_REF_UPDATES_START:
-			err = recv_ref_updates_start(&client_id, &imsg);
+			err = recv_ref_updates_start(&imsg);
 			if (err == NULL)
 				do_ref_updates = 1;
 			break;
 		case GOTD_IMSG_REF_UPDATE:
-			err = recv_ref_update(&client_id, &imsg);
+			err = recv_ref_update(&imsg);
 			if (err == NULL)
 				do_ref_update = 1;
 			break;
 		case GOTD_IMSG_NOTIFY:
-			err = recv_notification_content(&client_id, &imsg);
+			err = recv_notification_content(&imsg);
 			if (err == NULL)
 				do_notify = 1;
 			break;
@@ -1079,7 +1068,6 @@ forward_want(struct gotd_session_client *client, struc
 
 	memset(&iwant, 0, sizeof(iwant));
 	memcpy(iwant.object_id, ireq.object_id, SHA1_DIGEST_LENGTH);
-	iwant.client_id = client->id;
 
 	if (gotd_imsg_compose_event(&gotd_session.repo_child_iev,
 	    GOTD_IMSG_WANT, gotd_session.proc_id, -1,
@@ -1109,7 +1097,6 @@ forward_ref_update(struct gotd_session_client *client,
 		return got_error_from_errno("malloc");
 	memcpy(iref, imsg->data, datalen);
 
-	iref->client_id = client->id;
 	if (gotd_imsg_compose_event(&gotd_session.repo_child_iev,
 	    GOTD_IMSG_REF_UPDATE, gotd_session.proc_id, -1,
 	    iref, datalen) == -1)
@@ -1133,7 +1120,6 @@ forward_have(struct gotd_session_client *client, struc
 
 	memset(&ihave, 0, sizeof(ihave));
 	memcpy(ihave.object_id, ireq.object_id, SHA1_DIGEST_LENGTH);
-	ihave.client_id = client->id;
 
 	if (gotd_imsg_compose_event(&gotd_session.repo_child_iev,
 	    GOTD_IMSG_HAVE, gotd_session.proc_id, -1,
@@ -1166,8 +1152,6 @@ recv_packfile(struct gotd_session_client *client)
 {
 	const struct got_error *err = NULL;
 	struct gotd_imsg_recv_packfile ipack;
-	struct gotd_imsg_packfile_pipe ipipe;
-	struct gotd_imsg_packidx_file ifile;
 	char *basepath = NULL, *pack_path = NULL, *idx_path = NULL;
 	int packfd = -1, idxfd = -1;
 	int pipe[2] = { -1, -1 };
@@ -1179,14 +1163,11 @@ recv_packfile(struct gotd_session_client *client)
 
 	if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe) == -1)
 		return got_error_from_errno("socketpair");
-
-	memset(&ipipe, 0, sizeof(ipipe));
-	ipipe.client_id = client->id;
 
 	/* Send pack pipe end 0 to repo child process. */
 	if (gotd_imsg_compose_event(&gotd_session.repo_child_iev,
 	    GOTD_IMSG_PACKFILE_PIPE, gotd_session.proc_id, pipe[0],
-	        &ipipe, sizeof(ipipe)) == -1) {
+	        NULL, 0) == -1) {
 		err = got_error_from_errno("imsg compose PACKFILE_PIPE");
 		pipe[0] = -1;
 		goto done;
@@ -1231,11 +1212,9 @@ recv_packfile(struct gotd_session_client *client)
 		goto done;
 	}
 
-	memset(&ifile, 0, sizeof(ifile));
-	ifile.client_id = client->id;
 	if (gotd_imsg_compose_event(&gotd_session.repo_child_iev,
 	    GOTD_IMSG_PACKIDX_FILE, gotd_session.proc_id,
-	    idxfd, &ifile, sizeof(ifile)) == -1) {
+	    idxfd, NULL, 0) == -1) {
 		err = got_error_from_errno("imsg compose PACKIDX_FILE");
 		idxfd = -1;
 		goto done;
@@ -1243,7 +1222,6 @@ recv_packfile(struct gotd_session_client *client)
 	idxfd = -1;
 
 	memset(&ipack, 0, sizeof(ipack));
-	ipack.client_id = client->id;
 	if (client_has_capability(client, GOT_CAPA_REPORT_STATUS))
 		ipack.report_status = 1;
 
@@ -1281,16 +1259,13 @@ send_packfile(struct gotd_session_client *client)
 {
 	const struct got_error *err = NULL;
 	struct gotd_imsg_send_packfile ipack;
-	struct gotd_imsg_packfile_pipe ipipe;
 	int pipe[2];
 
 	if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe) == -1)
 		return got_error_from_errno("socketpair");
 
 	memset(&ipack, 0, sizeof(ipack));
-	memset(&ipipe, 0, sizeof(ipipe));
 
-	ipack.client_id = client->id;
 	if (client_has_capability(client, GOT_CAPA_SIDE_BAND_64K))
 		ipack.report_progress = 1;
 
@@ -1307,12 +1282,9 @@ send_packfile(struct gotd_session_client *client)
 		return err;
 	}
 
-	ipipe.client_id = client->id;
-
 	/* Send pack pipe end 0 to repo child process. */
 	if (gotd_imsg_compose_event(&gotd_session.repo_child_iev,
-	    GOTD_IMSG_PACKFILE_PIPE, PROC_GOTD,
-	    pipe[0], &ipipe, sizeof(ipipe)) == -1) {
+	    GOTD_IMSG_PACKFILE_PIPE, PROC_GOTD, pipe[0], NULL, 0) == -1) {
 		err = got_error_from_errno("imsg compose PACKFILE_PIPE");
 		close(pipe[1]);
 		return err;
@@ -1570,21 +1542,17 @@ list_refs_request(void)
 	static const struct got_error *err;
 	struct gotd_session_client *client = &gotd_session_client;
 	struct gotd_imsgev *iev = &gotd_session.repo_child_iev;
-	struct gotd_imsg_list_refs_internal ilref;
 	int fd;
 
 	if (gotd_session.state != GOTD_STATE_EXPECT_LIST_REFS)
 		return got_error(GOT_ERR_PRIVSEP_MSG);
 
-	memset(&ilref, 0, sizeof(ilref));
-	ilref.client_id = client->id;
-
 	fd = dup(client->fd);
 	if (fd == -1)
 		return got_error_from_errno("dup");
 
 	if (gotd_imsg_compose_event(iev, GOTD_IMSG_LIST_REFS_INTERNAL,
-	    gotd_session.proc_id, fd, &ilref, sizeof(ilref)) == -1) {
+	    gotd_session.proc_id, fd, NULL, 0) == -1) {
 		err = got_error_from_errno("imsg compose LIST_REFS_INTERNAL");
 		close(fd);
 		return err;
@@ -1767,7 +1735,6 @@ recv_repo_child(struct imsg *imsg)
 
 	memcpy(&ichild, imsg->data, sizeof(ichild));
 
-	client->id = ichild.client_id;
 	if (ichild.proc_id == PROC_REPO_WRITE)
 		client->is_writing = 1;
 	else if (ichild.proc_id == PROC_REPO_READ)