From c8f49d0337b411bc4608d3e6fb0e0f45a53cf893 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 19 Nov 2004 22:19:13 +0000 Subject: [PATCH] Add SLAP_EXOP_WRITES flag, expose flags in Operation, add exop_is_write() macro for detecting exops that modify a target entry --- servers/slapd/extended.c | 9 +++------ servers/slapd/proto-slap.h | 2 ++ servers/slapd/slap.h | 10 ++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/servers/slapd/extended.c b/servers/slapd/extended.c index 072b9f0205..8a62bf8f71 100644 --- a/servers/slapd/extended.c +++ b/servers/slapd/extended.c @@ -45,11 +45,6 @@ #define UNSUPPORTED_EXOP "unsupported extended operation" -#ifdef LDAP_DEVEL -#define SLAP_EXOP_HIDE 0x0000 -#else -#define SLAP_EXOP_HIDE 0x8000 -#endif static struct extop_list { struct extop_list *next; @@ -77,7 +72,7 @@ static struct { } builtin_extops[] = { { &slap_EXOP_CANCEL, SLAP_EXOP_HIDE, cancel_extop }, { &slap_EXOP_WHOAMI, 0, whoami_extop }, - { &slap_EXOP_MODIFY_PASSWD, 0, passwd_extop }, + { &slap_EXOP_MODIFY_PASSWD, SLAP_EXOP_WRITES, passwd_extop }, #ifdef HAVE_TLS { &slap_EXOP_START_TLS, 0, starttls_extop }, #endif @@ -225,6 +220,8 @@ fe_extended( Operation *op, SlapReply *rs ) goto done; } + op->ore_flags = ext->flags; + Debug( LDAP_DEBUG_ARGS, "do_extended: oid=%s\n", op->ore_reqoid.bv_val, 0 ,0 ); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 8487be92e0..b0cc478630 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -616,6 +616,8 @@ LDAP_SLAPD_F (Entry *) entry_dup LDAP_P(( Entry *e )); */ LDAP_SLAPD_F (int) exop_root_dse_info LDAP_P ((Entry *e)); +#define exop_is_write( op ) ((op->ore_flags & SLAP_EXOP_WRITES) != 0) + LDAP_SLAPD_V( const struct berval ) slap_EXOP_CANCEL; LDAP_SLAPD_V( const struct berval ) slap_EXOP_WHOAMI; LDAP_SLAPD_V( const struct berval ) slap_EXOP_MODIFY_PASSWD; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 2ec8b7ec7a..26eee2c8d8 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1696,13 +1696,22 @@ typedef struct req_abandon_s { ber_int_t rs_msgid; } req_abandon_s; +#ifdef LDAP_DEVEL +#define SLAP_EXOP_HIDE 0x0000 +#else +#define SLAP_EXOP_HIDE 0x8000 +#endif +#define SLAP_EXOP_WRITES 0x0001 /* Exop does writes */ + typedef struct req_extended_s { struct berval rs_reqoid; + int rs_flags; struct berval *rs_reqdata; } req_extended_s; typedef struct req_pwdexop_s { struct berval rs_reqoid; + int rs_flags; struct berval rs_old; struct berval rs_new; Modifications *rs_mods; @@ -2134,6 +2143,7 @@ typedef struct slap_op { #define orm_increment oq_modify.rs_increment #define ore_reqoid oq_extended.rs_reqoid +#define ore_flags oq_extended.rs_flags #define ore_reqdata oq_extended.rs_reqdata ldap_pvt_thread_t o_tid; /* thread handling this op */ -- 2.39.5