Commit Diff


commit - 74e851329d3fcbf91f1507fed1c06a539232c4db
commit + b92adf1098ff071aae49472f3b68dc77ed7faf53
blob - 756938c467d7079aa27e255734cf520a38679349
blob + affce7352cd512fefa9ae73c75bdadd77b81ac82
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -1029,7 +1029,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 - 608ed1cd441c475c8a0d2bc1c4abed54442d8c7e
blob + bc7890d04bfe94fa82ebec73e3f4eafae2333385
--- gotd/gotd.h
+++ gotd/gotd.h
@@ -296,11 +296,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;
@@ -348,25 +343,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. */
@@ -383,7 +374,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. */
@@ -392,7 +382,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. */
 };
@@ -402,7 +391,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. */
@@ -412,7 +400,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;
 
@@ -421,7 +408,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 */
@@ -431,29 +417,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;
@@ -466,15 +439,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;
@@ -492,7 +459,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 */
@@ -514,7 +480,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 - 637c06d4d3ac3d8802c1e03ece3bb210e4708ae0
blob + a2025149109eb642360878c57d63fd56b65955e7
--- gotd/repo_read.c
+++ gotd/repo_read.c
@@ -63,6 +63,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 {
@@ -259,7 +260,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;
@@ -273,17 +273,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);
@@ -579,15 +577,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);
@@ -604,7 +600,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;
@@ -657,10 +652,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 &&
@@ -708,7 +701,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 - 7e12b3db952dc5257bc13548172003e037a91305
blob + c3f391185d58b6019a467fff4a2b6c4d4cbe5523
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -83,6 +83,7 @@ static struct repo_write {
 		int fd1;
 		int fd2;
 	} diff;
+	int refs_listed;
 } repo_write;
 
 struct gotd_ref_update {
@@ -246,7 +247,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;
@@ -259,17 +259,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;
@@ -1505,7 +1503,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,
@@ -1519,13 +1516,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));
@@ -1539,7 +1534,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;
@@ -1550,7 +1544,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;
@@ -1594,15 +1587,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);
@@ -1618,15 +1609,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);
@@ -2239,7 +2228,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 - 7d5b280bbef3944568265f9f911d5bf7c6735d4d
blob + a193b928bd7c56754a723db55aadb745dba3c6a6
--- gotd/session.c
+++ gotd/session.c
@@ -183,24 +183,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;
@@ -212,12 +209,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;
@@ -229,12 +225,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;
@@ -246,7 +241,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;
 }
 
@@ -260,7 +254,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);
@@ -301,7 +294,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);
@@ -603,7 +595,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;
@@ -615,7 +606,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));
@@ -834,7 +824,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;
@@ -844,7 +834,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;
 }
 
@@ -898,25 +887,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;
@@ -1080,7 +1069,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,
@@ -1110,7 +1098,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)
@@ -1134,7 +1121,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,
@@ -1167,8 +1153,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 };
@@ -1180,14 +1164,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;
@@ -1232,11 +1213,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;
@@ -1244,7 +1223,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;
 
@@ -1282,16 +1260,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;
 
@@ -1308,12 +1283,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;
@@ -1571,21 +1543,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;
@@ -1768,7 +1736,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)