SHA256
1
0
forked from pool/openldap2

Accepting request 521624 from home:stroeder:branches:network:ldap

- updated 0014-ITS-8714-Send-out-EXTENDED-operation-message-from-back-sock.patch

OBS-URL: https://build.opensuse.org/request/show/521624
OBS-URL: https://build.opensuse.org/package/show/network:ldap/openldap2?expand=0&rev=190
This commit is contained in:
Michael Ströder 2017-09-06 08:08:24 +00:00 committed by Git OBS Bridge
parent b40ad97191
commit 5e1d6e7359
2 changed files with 47 additions and 28 deletions

View File

@ -1,21 +1,5 @@
From 732c5646e0a03be8b58e52527b25742f0495807e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Str=C3=B6der?= <michael@stroeder.com>
Date: Fri, 18 Aug 2017 18:47:41 +0200
Subject: [PATCH] ITS#8714 Send out EXTENDED operation message from back-sock
to external program
---
doc/man/man5/slapd-sock.5 | 19 +++++++++++-
servers/slapd/back-sock/Makefile.in | 4 +--
servers/slapd/back-sock/config.c | 12 ++++++--
servers/slapd/back-sock/extended.c | 58 ++++++++++++++++++++++++++++++++++++
servers/slapd/back-sock/init.c | 2 +-
servers/slapd/back-sock/proto-sock.h | 2 ++
6 files changed, 91 insertions(+), 6 deletions(-)
create mode 100644 servers/slapd/back-sock/extended.c
diff --git a/doc/man/man5/slapd-sock.5 b/doc/man/man5/slapd-sock.5
index 1ac4f7fdd..0c4fc3fdd 100644
index 1ac4f7fdd..903155fa4 100644
--- a/doc/man/man5/slapd-sock.5
+++ b/doc/man/man5/slapd-sock.5
@@ -49,7 +49,7 @@ be sent and from which replies are received.
@ -27,7 +11,7 @@ index 1ac4f7fdd..0c4fc3fdd 100644
Specify which request types to send to the external program. The default is
empty (no requests are sent).
.TP
@@ -115,6 +115,18 @@ dn: <DN>
@@ -115,6 +115,17 @@ dn: <DN>
.PP
.RS
.nf
@ -35,8 +19,7 @@ index 1ac4f7fdd..0c4fc3fdd 100644
+msgid: <message id>
+<repeat { "suffix:" <database suffix DN> }>
+oid: <OID>
+valuelen: <length of <value>>
+value: <credentials>
+value: <base64-value>
+<blank line>
+.fi
+.RE
@ -46,7 +29,19 @@ index 1ac4f7fdd..0c4fc3fdd 100644
MODIFY
msgid: <message id>
<repeat { "suffix:" <database suffix DN> }>
@@ -292,6 +304,11 @@ access to the
@@ -213,6 +224,11 @@ msgid: <message id>
.fi
.RE
+.SH KNOWN LIMITATIONS
+The
+.B sock
+backend does not process extended operation results from an external program.
+
.SH ACCESS CONTROL
The
.B sock
@@ -292,6 +308,11 @@ access to the
pseudo_attribute of the searchBase;
.B search (=s)
access to the attributes and values used in the filter is not checked.
@ -134,10 +129,10 @@ index dc3f1365c..2dcf68bf6 100644
sockover.on_bi.bi_cf_ocs = osocs;
diff --git a/servers/slapd/back-sock/extended.c b/servers/slapd/back-sock/extended.c
new file mode 100644
index 000000000..15493ea98
index 000000000..dfe56b32b
--- /dev/null
+++ b/servers/slapd/back-sock/extended.c
@@ -0,0 +1,58 @@
@@ -0,0 +1,80 @@
+/* extended.c - sock backend extended routines */
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
@ -162,12 +157,15 @@ index 000000000..15493ea98
+#include "slap.h"
+#include "back-sock.h"
+
+#include "lutil.h"
+
+int
+sock_back_extended( Operation *op, SlapReply *rs )
+{
+ int rc;
+ struct sockinfo *si = (struct sockinfo *) op->o_bd->be_private;
+ FILE *fp;
+ struct berval b64;
+
+ Debug( LDAP_DEBUG_ARGS, "==> sock_back_extended(%s)\n",
+ op->ore_reqoid.bv_val, op->o_req_dn.bv_val, 0 );
@ -184,10 +182,29 @@ index 000000000..15493ea98
+ sock_print_conn( fp, op->o_conn, si );
+ sock_print_suffixes( fp, op->o_bd );
+ fprintf( fp, "oid: %s\n", op->ore_reqoid.bv_val );
+
+ if (op->ore_reqdata) {
+ fprintf( fp, "valuelen: %lu\n", op->ore_reqdata->bv_len );
+ fprintf( fp, "value: %s\n", op->ore_reqdata->bv_val );
+
+ b64.bv_len = LUTIL_BASE64_ENCODE_LEN( op->ore_reqdata->bv_len ) + 1;
+ b64.bv_val = ber_memalloc( b64.bv_len + 1 );
+
+ if( b64.bv_val == NULL ) {
+ return LUTIL_PASSWD_ERR;
+ }
+
+ rc = lutil_b64_ntop(
+ (unsigned char *) op->ore_reqdata->bv_val, op->ore_reqdata->bv_len,
+ b64.bv_val, b64.bv_len );
+
+ b64.bv_len = rc;
+ assert( strlen(b64.bv_val) == b64.bv_len );
+
+ fprintf( fp, "value: %s\n", b64.bv_val );
+
+ ber_memfree( b64.bv_val );
+
+ }
+
+ fprintf( fp, "\n" );
+
+ /* read in the results and send them along */
@ -222,6 +239,3 @@ index fa02ab896..8b3b5f3ef 100644
extern int sock_back_init_cf( BackendInfo *bi );
LDAP_END_DECL
--
2.14.0

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Sep 6 07:58:06 UTC 2017 - michael@stroeder.com
- updated 0014-ITS-8714-Send-out-EXTENDED-operation-message-from-back-sock.patch
-------------------------------------------------------------------
Fri Aug 18 17:00:54 UTC 2017 - michael@stroeder.com