summaryrefslogtreecommitdiff
path: root/usr.sbin/ypldap
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2023-03-31 03:38:27 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2023-03-31 03:38:27 +0000
commitc73d389d5ba0c3dc114d829c82a966dae8c1060a (patch)
treedb9e5764dc868ee50907f49624d623233ad7b109 /usr.sbin/ypldap
parent56c784286f9ab9dfc29fc6a1458871ce551a2a8b (diff)
Only send the used portion of struct idm_req in imsgs from the ldapclient
process to the main process. This significantly reduces memory usage when updating larger directories. ok aisha@
Diffstat (limited to 'usr.sbin/ypldap')
-rw-r--r--usr.sbin/ypldap/ldapclient.c5
-rw-r--r--usr.sbin/ypldap/ypldap.c6
2 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/ypldap/ldapclient.c b/usr.sbin/ypldap/ldapclient.c
index f9e089aeb80..c47fb2314e8 100644
--- a/usr.sbin/ypldap/ldapclient.c
+++ b/usr.sbin/ypldap/ldapclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldapclient.c,v 1.46 2022/10/13 04:55:33 jmatthew Exp $ */
+/* $OpenBSD: ldapclient.c,v 1.47 2023/03/31 03:38:26 jmatthew Exp $ */
/*
* Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org>
@@ -567,7 +567,8 @@ client_search_idm(struct env *env, struct idm *idm, struct aldap *al,
if (client_build_req(idm, &ir, m, min_attr, max_attr) == 0)
imsg_compose_event(env->sc_iev, type, 0, 0, -1,
- &ir, sizeof(ir));
+ &ir, sizeof(ir.ir_key) +
+ strlen(ir.ir_line) + 1);
aldap_freemsg(m);
}
diff --git a/usr.sbin/ypldap/ypldap.c b/usr.sbin/ypldap/ypldap.c
index 0d3d11703ba..8aa2c2b0077 100644
--- a/usr.sbin/ypldap/ypldap.c
+++ b/usr.sbin/ypldap/ypldap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypldap.c,v 1.23 2022/08/22 08:02:02 jmatthew Exp $ */
+/* $OpenBSD: ypldap.c,v 1.24 2023/03/31 03:38:26 jmatthew Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -392,7 +392,7 @@ main_dispatch_client(int fd, short events, void *p)
if (env->update_trashed)
break;
- (void)memcpy(&ir, imsg.data, sizeof(ir));
+ (void)memcpy(&ir, imsg.data, n - IMSG_HEADER_SIZE);
if ((ue = calloc(1, sizeof(*ue))) == NULL ||
(ue->ue_line = strdup(ir.ir_line)) == NULL) {
/*
@@ -418,7 +418,7 @@ main_dispatch_client(int fd, short events, void *p)
if (env->update_trashed)
break;
- (void)memcpy(&ir, imsg.data, sizeof(ir));
+ (void)memcpy(&ir, imsg.data, n - IMSG_HEADER_SIZE);
if ((ge = calloc(1, sizeof(*ge))) == NULL ||
(ge->ge_line = strdup(ir.ir_line)) == NULL) {
/*