From a08fb7de7e89fdd974cad40d5850680bfe7b8f22 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Sat, 30 Aug 2003 17:29:14 +0000 Subject: [PATCH] Expose SASL context to SLAPI plugins (SLAPI_X_CONN_SASL_CONTEXT) Useful for plugins that may wish to collude with the SASL library to, for example, retrieve a user's authorization data from a Kerberos ticket for access control purposes --- servers/slapd/slapi/slapi.h | 1 + servers/slapd/slapi/slapi_pblock.c | 1 + servers/slapd/slapi/slapi_utils.c | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/servers/slapd/slapi/slapi.h b/servers/slapd/slapi/slapi.h index 3b5bd4f6e7..bf1e0953ed 100644 --- a/servers/slapd/slapi/slapi.h +++ b/servers/slapd/slapi/slapi.h @@ -274,6 +274,7 @@ extern Backend * slapi_cl_get_be(char *dn); #define SLAPI_X_CONN_SERVERPATH 1301 #define SLAPI_X_CONN_IS_UDP 1302 #define SLAPI_X_CONN_SSF 1303 +#define SLAPI_X_CONN_SASL_CONTEXT 1304 #define SLAPD_AUTH_NONE "none" #define SLAPD_AUTH_SIMPLE "simple" diff --git a/servers/slapd/slapi/slapi_pblock.c b/servers/slapd/slapi/slapi_pblock.c index dc0897d146..a366859f65 100644 --- a/servers/slapd/slapi/slapi_pblock.c +++ b/servers/slapd/slapi/slapi_pblock.c @@ -45,6 +45,7 @@ isOkNetscapeParam( int param ) case SLAPI_X_CONN_CLIENTPATH: case SLAPI_X_CONN_SERVERPATH: case SLAPI_X_CONN_SSF: + case SLAPI_X_CONN_SASL_CONTEXT: case SLAPI_IBM_CONN_DN_ALT: case SLAPI_IBM_CONN_DN_ORIG: case SLAPI_IBM_GSSAPI_CONTEXT: diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 8764ceed82..f53ebd1874 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -2265,6 +2265,14 @@ static int initConnectionPB( Slapi_PBlock *pb, Connection *conn ) } rc = slapi_pblock_set(pb, SLAPI_X_CONN_SSF, (void *)conn->c_ssf); + if ( rc != LDAP_SUCCESS ) + return rc; + + rc = slapi_pblock_set(pb, SLAPI_X_CONN_SASL_CONTEXT, + ( conn->c_sasl_authctx != NULL ? conn->c_sasl_authctx : + conn->c_sasl_sockctx ) ); + if ( rc != LDAP_SUCCESS ) + return rc; return rc; } -- 2.39.5