- case SLAPD_EXTOP_GETPROTO:
- *(int *)argp = op->o_protocol;
- return(0);
-
- case SLAPD_EXTOP_GETAUTH:
- *(int *)argp = op->o_authtype;
- return(0);
-
- case SLAPD_EXTOP_GETDN:
- *(char **)argp = op->o_dn;
- return(0);
-
- case SLAPD_EXTOP_GETCLIENT:
- if (conn->c_peer_domain != NULL && *conn->c_peer_domain != 0) {
- *(char **)argp = conn->c_peer_domain;
- return(0);
- }
- if (conn->c_peer_name != NULL && *conn->c_peer_name != 0) {
- *(char **)argp = conn->c_peer_name;
- return(0);
- }
- break;
-
- default:
- break;
+ {
+ int rc;
+ struct berval whoami = BER_BVC( LDAP_EXOP_X_WHO_AM_I );
+
+ rc = backend_check_restrictions( conn->c_authz_backend,
+ conn, op, &whoami, text );
+
+ if( rc != LDAP_SUCCESS ) return rc;
+ }
+
+ bv = (struct berval *) ch_malloc( sizeof(struct berval) );
+ if( op->o_dn.bv_len ) {
+ bv->bv_len = op->o_dn.bv_len + sizeof("dn:")-1;
+ bv->bv_val = ch_malloc( bv->bv_len + 1 );
+ AC_MEMCPY( bv->bv_val, "dn:", sizeof("dn:")-1 );
+ AC_MEMCPY( &bv->bv_val[sizeof("dn:")-1], op->o_dn.bv_val,
+ op->o_dn.bv_len );
+ bv->bv_val[bv->bv_len] = '\0';
+
+ } else {
+ bv->bv_len = 0;
+ bv->bv_val = NULL;