pblock.c 85 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #include <stdio.h>
  39. #include <string.h>
  40. #include <sys/types.h>
  41. #include "slap.h"
  42. #include "cert.h"
  43. void
  44. pblock_init( Slapi_PBlock *pb )
  45. {
  46. memset( pb, '\0', sizeof(Slapi_PBlock) );
  47. }
  48. void
  49. pblock_init_common(
  50. Slapi_PBlock *pb,
  51. Slapi_Backend *be,
  52. Connection *conn,
  53. Operation *op
  54. )
  55. {
  56. PR_ASSERT( NULL != pb );
  57. memset( pb, '\0', sizeof(Slapi_PBlock) );
  58. pb->pb_backend = be;
  59. pb->pb_conn = conn;
  60. pb->pb_op = op;
  61. }
  62. void
  63. slapi_pblock_get_common(
  64. Slapi_PBlock *pb,
  65. Slapi_Backend **be,
  66. Connection **conn,
  67. Operation **op
  68. )
  69. {
  70. PR_ASSERT( NULL != pb );
  71. PR_ASSERT( NULL != be );
  72. PR_ASSERT( NULL != conn );
  73. PR_ASSERT( NULL != op );
  74. *be = pb->pb_backend;
  75. *conn = pb->pb_conn;
  76. *op = pb->pb_op;
  77. }
  78. Slapi_PBlock *
  79. slapi_pblock_new()
  80. {
  81. Slapi_PBlock *pb;
  82. pb = (Slapi_PBlock *) slapi_ch_calloc( 1, sizeof(Slapi_PBlock) );
  83. return pb;
  84. }
  85. void
  86. pblock_done( Slapi_PBlock *pb )
  87. {
  88. if(pb->pb_op!=NULL)
  89. {
  90. operation_free(&pb->pb_op,pb->pb_conn);
  91. }
  92. slapi_ch_free((void**)&(pb->pb_result_text));
  93. }
  94. void
  95. slapi_pblock_destroy( Slapi_PBlock* pb )
  96. {
  97. if(pb!=NULL)
  98. {
  99. pblock_done(pb);
  100. slapi_ch_free((void**)&pb);
  101. }
  102. }
  103. /* JCM - when pb_o_params is used, check the operation type. */
  104. /* JCM - when pb_o_results is used, check the operation type. */
  105. #define SLAPI_PLUGIN_TYPE_CHECK(PBLOCK,TYPE) \
  106. if ( PBLOCK ->pb_plugin->plg_type != TYPE) return( -1 )
  107. /*
  108. * Macro used to safely retrieve a plugin related pblock value (if the
  109. * pb_plugin element is NULL, NULL is returned).
  110. */
  111. #define SLAPI_PBLOCK_GET_PLUGIN_RELATED_POINTER( pb, element ) \
  112. ((pb)->pb_plugin == NULL ? NULL : (pb)->pb_plugin->element)
  113. int
  114. slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
  115. {
  116. char *authtype;
  117. Slapi_Backend *be;
  118. PR_ASSERT( NULL != pblock );
  119. PR_ASSERT( NULL != value );
  120. be = pblock->pb_backend;
  121. switch ( arg ) {
  122. case SLAPI_BACKEND:
  123. (*(Slapi_Backend **)value) = be;
  124. break;
  125. case SLAPI_BACKEND_COUNT:
  126. (*(int *)value) = pblock->pb_backend_count;
  127. break;
  128. case SLAPI_BE_TYPE:
  129. if ( NULL == be ) {
  130. return( -1 );
  131. }
  132. (*(char **)value) = be->be_type;
  133. break;
  134. case SLAPI_BE_READONLY:
  135. if ( NULL == be ) {
  136. (*(int *)value) = 0; /* default value */
  137. } else {
  138. (*(int *)value) = be->be_readonly;
  139. }
  140. break;
  141. case SLAPI_BE_LASTMOD:
  142. if ( NULL == be ) {
  143. (*(int *)value) = (g_get_global_lastmod() == LDAP_ON);
  144. } else {
  145. (*(int *)value) = (be->be_lastmod == LDAP_ON || (be->be_lastmod
  146. == LDAP_UNDEFINED && g_get_global_lastmod() == LDAP_ON));
  147. }
  148. break;
  149. case SLAPI_CONNECTION:
  150. (*(Connection **)value) = pblock->pb_conn;
  151. break;
  152. case SLAPI_CONN_ID:
  153. if (pblock->pb_conn == NULL) {
  154. LDAPDebug( LDAP_DEBUG_ANY,
  155. "Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
  156. return (-1);
  157. }
  158. (*(int *)value) = pblock->pb_conn->c_connid;
  159. break;
  160. case SLAPI_CONN_DN:
  161. /*
  162. * NOTE: we have to make a copy of this that the caller
  163. * is responsible for freeing. otherwise, they would get
  164. * a pointer that could be freed out from under them.
  165. */
  166. if (pblock->pb_conn == NULL) {
  167. LDAPDebug( LDAP_DEBUG_ANY,
  168. "Connection is NULL and hence cannot access SLAPI_CONN_DN \n", 0, 0, 0 );
  169. return (-1);
  170. }
  171. PR_Lock( pblock->pb_conn->c_mutex );
  172. (*(char **)value) = (NULL == pblock->pb_conn->c_dn ? NULL :
  173. slapi_ch_strdup( pblock->pb_conn->c_dn ));
  174. PR_Unlock( pblock->pb_conn->c_mutex );
  175. break;
  176. case SLAPI_CONN_AUTHTYPE:/* deprecated */
  177. if (pblock->pb_conn == NULL) {
  178. LDAPDebug( LDAP_DEBUG_ANY,
  179. "Connection is NULL and hence cannot access SLAPI_CONN_AUTHTYPE \n", 0, 0, 0 );
  180. return (-1);
  181. }
  182. PR_Lock( pblock->pb_conn->c_mutex );
  183. authtype = pblock->pb_conn->c_authtype;
  184. PR_Unlock( pblock->pb_conn->c_mutex );
  185. if (authtype == NULL) {
  186. (*(char **)value) = NULL;
  187. } else if (strcasecmp(authtype, SLAPD_AUTH_NONE) == 0) {
  188. (*(char **)value) = SLAPD_AUTH_NONE;
  189. } else if (strcasecmp(authtype, SLAPD_AUTH_SIMPLE) == 0) {
  190. (*(char **)value) = SLAPD_AUTH_SIMPLE;
  191. } else if (strcasecmp(authtype, SLAPD_AUTH_SSL) == 0) {
  192. (*(char **)value) = SLAPD_AUTH_SSL;
  193. } else if (strncasecmp(authtype, SLAPD_AUTH_SASL,
  194. strlen(SLAPD_AUTH_SASL)) == 0) {
  195. (*(char **)value) = SLAPD_AUTH_SASL;
  196. } else {
  197. (*(char **)value) = "unknown";
  198. }
  199. break;
  200. case SLAPI_CONN_AUTHMETHOD:
  201. /* returns a copy */
  202. if (pblock->pb_conn == NULL) {
  203. LDAPDebug( LDAP_DEBUG_ANY,
  204. "Connection is NULL and hence cannot access SLAPI_CONN_AUTHMETHOD \n", 0, 0, 0 );
  205. return (-1);
  206. }
  207. PR_Lock( pblock->pb_conn->c_mutex );
  208. (*(char **)value) = pblock->pb_conn->c_authtype ?
  209. slapi_ch_strdup(pblock->pb_conn->c_authtype) : NULL;
  210. PR_Unlock( pblock->pb_conn->c_mutex );
  211. break;
  212. case SLAPI_CONN_CLIENTNETADDR:
  213. if (pblock->pb_conn == NULL)
  214. {
  215. memset( value, 0, sizeof( PRNetAddr ));
  216. break;
  217. }
  218. PR_Lock( pblock->pb_conn->c_mutex );
  219. if ( pblock->pb_conn->cin_addr == NULL ) {
  220. memset( value, 0, sizeof( PRNetAddr ));
  221. } else {
  222. (*(PRNetAddr *)value) =
  223. *(pblock->pb_conn->cin_addr);
  224. }
  225. PR_Unlock( pblock->pb_conn->c_mutex );
  226. break;
  227. case SLAPI_CONN_SERVERNETADDR:
  228. if (pblock->pb_conn == NULL)
  229. {
  230. memset( value, 0, sizeof( PRNetAddr ));
  231. break;
  232. }
  233. PR_Lock( pblock->pb_conn->c_mutex );
  234. if ( pblock->pb_conn->cin_destaddr == NULL ) {
  235. memset( value, 0, sizeof( PRNetAddr ));
  236. } else {
  237. (*(PRNetAddr *)value) =
  238. *(pblock->pb_conn->cin_destaddr);
  239. }
  240. PR_Unlock( pblock->pb_conn->c_mutex );
  241. break;
  242. case SLAPI_CONN_CLIENTIP:
  243. if (pblock->pb_conn == NULL)
  244. {
  245. memset( value, 0, sizeof( struct in_addr ));
  246. break;
  247. }
  248. PR_Lock( pblock->pb_conn->c_mutex );
  249. if ( pblock->pb_conn->cin_addr == NULL ) {
  250. memset( value, 0, sizeof( struct in_addr ));
  251. } else {
  252. if ( PR_IsNetAddrType(pblock->pb_conn->cin_addr,
  253. PR_IpAddrV4Mapped) ) {
  254. (*(struct in_addr *)value).s_addr =
  255. (*(pblock->pb_conn->cin_addr)).ipv6.ip.pr_s6_addr32[3];
  256. } else {
  257. memset( value, 0, sizeof( struct in_addr ));
  258. }
  259. }
  260. PR_Unlock( pblock->pb_conn->c_mutex );
  261. break;
  262. case SLAPI_CONN_SERVERIP:
  263. if (pblock->pb_conn == NULL)
  264. {
  265. memset( value, 0, sizeof( struct in_addr ));
  266. break;
  267. }
  268. PR_Lock( pblock->pb_conn->c_mutex );
  269. if ( pblock->pb_conn->cin_destaddr == NULL ) {
  270. memset( value, 0, sizeof( PRNetAddr ));
  271. } else {
  272. if ( PR_IsNetAddrType(pblock->pb_conn->cin_destaddr,
  273. PR_IpAddrV4Mapped) ) {
  274. (*(struct in_addr *)value).s_addr =
  275. (*(pblock->pb_conn->cin_destaddr)).ipv6.ip.pr_s6_addr32[3];
  276. } else {
  277. memset( value, 0, sizeof( struct in_addr ));
  278. }
  279. }
  280. PR_Unlock( pblock->pb_conn->c_mutex );
  281. break;
  282. case SLAPI_CONN_IS_REPLICATION_SESSION:
  283. if (pblock->pb_conn == NULL) {
  284. LDAPDebug( LDAP_DEBUG_ANY,
  285. "Connection is NULL and hence cannot access SLAPI_CONN_IS_REPLICATION_SESSION \n", 0, 0, 0 );
  286. return (-1);
  287. }
  288. PR_Lock( pblock->pb_conn->c_mutex );
  289. (*(int *)value) = pblock->pb_conn->c_isreplication_session;
  290. PR_Unlock( pblock->pb_conn->c_mutex );
  291. break;
  292. case SLAPI_CONN_IS_SSL_SESSION:
  293. if (pblock->pb_conn == NULL) {
  294. LDAPDebug( LDAP_DEBUG_ANY,
  295. "Connection is NULL and hence cannot access SLAPI_CONN_IS_SSL_SESSION \n", 0, 0, 0 );
  296. return (-1);
  297. }
  298. PR_Lock( pblock->pb_conn->c_mutex );
  299. (*(int *)value) = pblock->pb_conn->c_flags & CONN_FLAG_SSL;
  300. PR_Unlock( pblock->pb_conn->c_mutex );
  301. break;
  302. case SLAPI_CONN_CERT:
  303. if (pblock->pb_conn == NULL) {
  304. LDAPDebug( LDAP_DEBUG_ANY,
  305. "Connection is NULL and hence cannot access SLAPI_CONN_CERT \n", 0, 0, 0 );
  306. return (-1);
  307. }
  308. ( *(CERTCertificate **) value) = pblock->pb_conn->c_client_cert;
  309. break;
  310. case SLAPI_OPERATION:
  311. (*(Operation **)value) = pblock->pb_op;
  312. break;
  313. case SLAPI_OPERATION_TYPE:
  314. (*(int *)value) = pblock->pb_op->o_params.operation_type;
  315. break;
  316. case SLAPI_OPINITIATED_TIME:
  317. (*(int *)value) = pblock->pb_op->o_time;
  318. break;
  319. case SLAPI_REQUESTOR_ISROOT:
  320. (*(int *)value) = pblock->pb_requestor_isroot;
  321. break;
  322. case SLAPI_IS_REPLICATED_OPERATION:
  323. if(pblock->pb_op==NULL)
  324. {
  325. (*(int *)value) = 0; /* No Operation -> Not Replicated */
  326. }
  327. else
  328. {
  329. (*(int *)value) = (pblock->pb_op->o_flags & (OP_FLAG_REPLICATED | OP_FLAG_LEGACY_REPLICATION_DN));
  330. }
  331. break;
  332. case SLAPI_IS_MMR_REPLICATED_OPERATION:
  333. if(pblock->pb_op==NULL)
  334. {
  335. (*(int *)value) = 0; /* No Operation -> Not Replicated */
  336. }
  337. else
  338. {
  339. (*(int *)value) = (pblock->pb_op->o_flags & OP_FLAG_REPLICATED);
  340. }
  341. break;
  342. case SLAPI_IS_LEGACY_REPLICATED_OPERATION:
  343. if(pblock->pb_op==NULL)
  344. {
  345. (*(int *)value) = 0; /* No Operation -> Not Replicated */
  346. }
  347. else
  348. {
  349. (*(int *)value) = (pblock->pb_op->o_flags & OP_FLAG_LEGACY_REPLICATION_DN);
  350. }
  351. break;
  352. case SLAPI_OPERATION_PARAMETERS:
  353. if(pblock->pb_op!=NULL)
  354. {
  355. (*(struct slapi_operation_parameters **)value) = &pblock->pb_op->o_params;
  356. }
  357. break;
  358. /* stuff related to config file processing */
  359. case SLAPI_CONFIG_FILENAME:
  360. case SLAPI_CONFIG_LINENO:
  361. case SLAPI_CONFIG_ARGC:
  362. case SLAPI_CONFIG_ARGV:
  363. return (-1); /* deprecated since DS 5.0 (no longer useful) */
  364. /* pblock memory management */
  365. case SLAPI_DESTROY_CONTENT:
  366. (*(int *)value) = pblock->pb_destroy_content;
  367. break;
  368. /* stuff related to the current plugin */
  369. case SLAPI_PLUGIN:
  370. (*(struct slapdplugin **)value) = pblock->pb_plugin;
  371. break;
  372. case SLAPI_PLUGIN_PRIVATE:
  373. (*(void **)value) = pblock->pb_plugin->plg_private;
  374. break;
  375. case SLAPI_PLUGIN_TYPE:
  376. (*(int *)value) = pblock->pb_plugin->plg_type;
  377. break;
  378. case SLAPI_PLUGIN_ARGV:
  379. (*(char ***)value) = pblock->pb_plugin->plg_argv;
  380. break;
  381. case SLAPI_PLUGIN_ARGC:
  382. (*(int *)value) = pblock->pb_plugin->plg_argc;
  383. break;
  384. case SLAPI_PLUGIN_VERSION:
  385. (*(char **)value) = pblock->pb_plugin->plg_version;
  386. break;
  387. case SLAPI_PLUGIN_OPRETURN:
  388. (*(int *)value) = pblock->pb_opreturn;
  389. break;
  390. case SLAPI_PLUGIN_OBJECT:
  391. (*(void **)value) = pblock->pb_object;
  392. break;
  393. case SLAPI_PLUGIN_DESTROY_FN:
  394. (*(IFP*)value) = pblock->pb_destroy_fn;
  395. break;
  396. case SLAPI_PLUGIN_DESCRIPTION:
  397. (*(Slapi_PluginDesc *)value) = pblock->pb_plugin->plg_desc;
  398. break;
  399. case SLAPI_PLUGIN_IDENTITY:
  400. (*(void**)value) = pblock->pb_plugin_identity;
  401. break;
  402. case SLAPI_PLUGIN_INTOP_RESULT:
  403. (*(int *)value) = pblock->pb_internal_op_result;
  404. break;
  405. case SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES:
  406. (*(Slapi_Entry ***)value) = pblock->pb_plugin_internal_search_op_entries;
  407. break;
  408. case SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS:
  409. (*(char ***)value) = pblock->pb_plugin_internal_search_op_referrals;
  410. break;
  411. /* database plugin functions */
  412. case SLAPI_PLUGIN_DB_BIND_FN:
  413. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  414. return( -1 );
  415. }
  416. (*(IFP *)value) = pblock->pb_plugin->plg_bind;
  417. break;
  418. case SLAPI_PLUGIN_DB_UNBIND_FN:
  419. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  420. return( -1 );
  421. }
  422. (*(IFP *)value) = pblock->pb_plugin->plg_unbind;
  423. break;
  424. case SLAPI_PLUGIN_DB_SEARCH_FN:
  425. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  426. return( -1 );
  427. }
  428. (*(IFP *)value) = pblock->pb_plugin->plg_search;
  429. break;
  430. case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN:
  431. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  432. return( -1 );
  433. }
  434. (*(IFP *)value) = pblock->pb_plugin->plg_next_search_entry;
  435. break;
  436. case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_EXT_FN:
  437. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  438. return( -1 );
  439. }
  440. (*(IFP *)value) = pblock->pb_plugin->plg_next_search_entry_ext;
  441. break;
  442. case SLAPI_PLUGIN_DB_ENTRY_RELEASE_FN:
  443. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  444. return( -1 );
  445. }
  446. (*(IFP *)value) = pblock->pb_plugin->plg_entry_release;
  447. break;
  448. case SLAPI_PLUGIN_DB_COMPARE_FN:
  449. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  450. return( -1 );
  451. }
  452. (*(IFP *)value) = pblock->pb_plugin->plg_compare;
  453. break;
  454. case SLAPI_PLUGIN_DB_MODIFY_FN:
  455. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  456. return( -1 );
  457. }
  458. (*(IFP *)value) = pblock->pb_plugin->plg_modify;
  459. break;
  460. case SLAPI_PLUGIN_DB_MODRDN_FN:
  461. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  462. return( -1 );
  463. }
  464. (*(IFP *)value) = pblock->pb_plugin->plg_modrdn;
  465. break;
  466. case SLAPI_PLUGIN_DB_ADD_FN:
  467. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  468. return( -1 );
  469. }
  470. (*(IFP *)value) = pblock->pb_plugin->plg_add;
  471. break;
  472. case SLAPI_PLUGIN_DB_DELETE_FN:
  473. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  474. return( -1 );
  475. }
  476. (*(IFP *)value) = pblock->pb_plugin->plg_delete;
  477. break;
  478. case SLAPI_PLUGIN_DB_ABANDON_FN:
  479. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  480. return( -1 );
  481. }
  482. (*(IFP *)value) = pblock->pb_plugin->plg_abandon;
  483. break;
  484. case SLAPI_PLUGIN_DB_CONFIG_FN:
  485. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  486. return( -1 );
  487. }
  488. (*(IFP *)value) = pblock->pb_plugin->plg_config;
  489. break;
  490. case SLAPI_PLUGIN_CLOSE_FN:
  491. (*(IFP *)value) = pblock->pb_plugin->plg_close;
  492. break;
  493. case SLAPI_PLUGIN_CLEANUP_FN:
  494. (*(IFP *)value) = pblock->pb_plugin->plg_cleanup;
  495. break;
  496. case SLAPI_PLUGIN_DB_FLUSH_FN:
  497. (*(IFP *)value) = pblock->pb_plugin->plg_flush;
  498. break;
  499. case SLAPI_PLUGIN_START_FN:
  500. (*(IFP *)value) = pblock->pb_plugin->plg_start;
  501. break;
  502. case SLAPI_PLUGIN_POSTSTART_FN:
  503. (*(IFP *)value) = pblock->pb_plugin->plg_poststart;
  504. break;
  505. case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN:
  506. (*(IFP *)value) = pblock->pb_plugin->plg_wire_import;
  507. break;
  508. case SLAPI_PLUGIN_DB_SEQ_FN:
  509. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  510. return( -1 );
  511. }
  512. (*(IFP *)value) = pblock->pb_plugin->plg_seq;
  513. break;
  514. case SLAPI_PLUGIN_DB_ENTRY_FN:
  515. (*(IFP *)value) = SLAPI_PBLOCK_GET_PLUGIN_RELATED_POINTER( pblock,
  516. plg_entry );
  517. break;
  518. case SLAPI_PLUGIN_DB_REFERRAL_FN:
  519. (*(IFP *)value) = SLAPI_PBLOCK_GET_PLUGIN_RELATED_POINTER( pblock,
  520. plg_referral );
  521. break;
  522. case SLAPI_PLUGIN_DB_RESULT_FN:
  523. (*(IFP *)value) = SLAPI_PBLOCK_GET_PLUGIN_RELATED_POINTER( pblock,
  524. plg_result );
  525. break;
  526. case SLAPI_PLUGIN_DB_RMDB_FN:
  527. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  528. return( -1 );
  529. }
  530. (*(IFP *)value) = pblock->pb_plugin->plg_rmdb;
  531. break;
  532. case SLAPI_PLUGIN_DB_INIT_INSTANCE_FN:
  533. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  534. return( -1 );
  535. }
  536. (*(IFP *)value) = pblock->pb_plugin->plg_init_instance;
  537. break;
  538. case SLAPI_PLUGIN_DB_LDIF2DB_FN:
  539. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  540. return( -1 );
  541. }
  542. (*(IFP *)value) = pblock->pb_plugin->plg_ldif2db;
  543. break;
  544. case SLAPI_PLUGIN_DB_DB2LDIF_FN:
  545. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  546. return( -1 );
  547. }
  548. (*(IFP *)value) = pblock->pb_plugin->plg_db2ldif;
  549. break;
  550. case SLAPI_PLUGIN_DB_DB2INDEX_FN:
  551. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  552. return( -1 );
  553. }
  554. (*(IFP *)value) = pblock->pb_plugin->plg_db2index;
  555. break;
  556. case SLAPI_PLUGIN_DB_ARCHIVE2DB_FN:
  557. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  558. return( -1 );
  559. }
  560. (*(IFP *)value) = pblock->pb_plugin->plg_archive2db;
  561. break;
  562. case SLAPI_PLUGIN_DB_DB2ARCHIVE_FN:
  563. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  564. return( -1 );
  565. }
  566. (*(IFP *)value) = pblock->pb_plugin->plg_db2archive;
  567. break;
  568. #if defined(UPGRADEDB)
  569. case SLAPI_PLUGIN_DB_UPGRADEDB_FN:
  570. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  571. return( -1 );
  572. }
  573. (*(IFP *)value) = pblock->pb_plugin->plg_upgradedb;
  574. break;
  575. #endif
  576. case SLAPI_PLUGIN_DB_BEGIN_FN:
  577. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  578. return( -1 );
  579. }
  580. (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_begin;
  581. break;
  582. case SLAPI_PLUGIN_DB_COMMIT_FN:
  583. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  584. return( -1 );
  585. }
  586. (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_commit;
  587. break;
  588. case SLAPI_PLUGIN_DB_ABORT_FN:
  589. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  590. return( -1 );
  591. }
  592. (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_abort;
  593. break;
  594. case SLAPI_PLUGIN_DB_SIZE_FN:
  595. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  596. return( -1 );
  597. }
  598. (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_dbsize;
  599. break;
  600. case SLAPI_PLUGIN_DB_TEST_FN:
  601. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  602. return( -1 );
  603. }
  604. (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_dbtest;
  605. break;
  606. /* database plugin-specific parameters */
  607. case SLAPI_PLUGIN_DB_NO_ACL:
  608. if ( pblock->pb_plugin && pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  609. return( -1 );
  610. }
  611. if ( NULL == be ) {
  612. (*(int *)value) = 0; /* default value */
  613. } else {
  614. (*(int *)value) = be->be_noacl;
  615. }
  616. break;
  617. /* extendedop plugin functions */
  618. case SLAPI_PLUGIN_EXT_OP_FN:
  619. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP ) {
  620. return( -1 );
  621. }
  622. (*(IFP *)value) = pblock->pb_plugin->plg_exhandler;
  623. break;
  624. case SLAPI_PLUGIN_EXT_OP_OIDLIST:
  625. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP ) {
  626. return( -1 );
  627. }
  628. (*(char ***)value) = pblock->pb_plugin->plg_exoids;
  629. break;
  630. case SLAPI_PLUGIN_EXT_OP_NAMELIST:
  631. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP ) {
  632. return( -1 );
  633. }
  634. (*(char ***)value) = pblock->pb_plugin->plg_exnames;
  635. break;
  636. /* preoperation plugin functions */
  637. case SLAPI_PLUGIN_PRE_BIND_FN:
  638. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  639. return( -1 );
  640. }
  641. (*(IFP *)value) = pblock->pb_plugin->plg_prebind;
  642. break;
  643. case SLAPI_PLUGIN_PRE_UNBIND_FN:
  644. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  645. return( -1 );
  646. }
  647. (*(IFP *)value) = pblock->pb_plugin->plg_preunbind;
  648. break;
  649. case SLAPI_PLUGIN_PRE_SEARCH_FN:
  650. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  651. return( -1 );
  652. }
  653. (*(IFP *)value) = pblock->pb_plugin->plg_presearch;
  654. break;
  655. case SLAPI_PLUGIN_PRE_COMPARE_FN:
  656. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  657. return( -1 );
  658. }
  659. (*(IFP *)value) = pblock->pb_plugin->plg_precompare;
  660. break;
  661. case SLAPI_PLUGIN_PRE_MODIFY_FN:
  662. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  663. return( -1 );
  664. }
  665. (*(IFP *)value) = pblock->pb_plugin->plg_premodify;
  666. break;
  667. case SLAPI_PLUGIN_PRE_MODRDN_FN:
  668. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  669. return( -1 );
  670. }
  671. (*(IFP *)value) = pblock->pb_plugin->plg_premodrdn;
  672. break;
  673. case SLAPI_PLUGIN_PRE_ADD_FN:
  674. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  675. return( -1 );
  676. }
  677. (*(IFP *)value) = pblock->pb_plugin->plg_preadd;
  678. break;
  679. case SLAPI_PLUGIN_PRE_DELETE_FN:
  680. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  681. return( -1 );
  682. }
  683. (*(IFP *)value) = pblock->pb_plugin->plg_predelete;
  684. break;
  685. case SLAPI_PLUGIN_PRE_ABANDON_FN:
  686. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  687. return( -1 );
  688. }
  689. (*(IFP *)value) = pblock->pb_plugin->plg_preabandon;
  690. break;
  691. case SLAPI_PLUGIN_PRE_ENTRY_FN:
  692. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  693. return( -1 );
  694. }
  695. (*(IFP *)value) = pblock->pb_plugin->plg_preentry;
  696. break;
  697. case SLAPI_PLUGIN_PRE_REFERRAL_FN:
  698. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  699. return( -1 );
  700. }
  701. (*(IFP *)value) = pblock->pb_plugin->plg_prereferral;
  702. break;
  703. case SLAPI_PLUGIN_PRE_RESULT_FN:
  704. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  705. return( -1 );
  706. }
  707. (*(IFP *)value) = pblock->pb_plugin->plg_preresult;
  708. break;
  709. /* postoperation plugin functions */
  710. case SLAPI_PLUGIN_POST_BIND_FN:
  711. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  712. return( -1 );
  713. }
  714. (*(IFP *)value) = pblock->pb_plugin->plg_postbind;
  715. break;
  716. case SLAPI_PLUGIN_POST_UNBIND_FN:
  717. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  718. return( -1 );
  719. }
  720. (*(IFP *)value) = pblock->pb_plugin->plg_postunbind;
  721. break;
  722. case SLAPI_PLUGIN_POST_SEARCH_FN:
  723. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  724. return( -1 );
  725. }
  726. (*(IFP *)value) = pblock->pb_plugin->plg_postsearch;
  727. break;
  728. case SLAPI_PLUGIN_POST_SEARCH_FAIL_FN:
  729. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  730. return( -1 );
  731. }
  732. (*(IFP *)value) = pblock->pb_plugin->plg_postsearchfail;
  733. break;
  734. case SLAPI_PLUGIN_POST_COMPARE_FN:
  735. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  736. return( -1 );
  737. }
  738. (*(IFP *)value) = pblock->pb_plugin->plg_postcompare;
  739. break;
  740. case SLAPI_PLUGIN_POST_MODIFY_FN:
  741. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  742. return( -1 );
  743. }
  744. (*(IFP *)value) = pblock->pb_plugin->plg_postmodify;
  745. break;
  746. case SLAPI_PLUGIN_POST_MODRDN_FN:
  747. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  748. return( -1 );
  749. }
  750. (*(IFP *)value) = pblock->pb_plugin->plg_postmodrdn;
  751. break;
  752. case SLAPI_PLUGIN_POST_ADD_FN:
  753. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  754. return( -1 );
  755. }
  756. (*(IFP *)value) = pblock->pb_plugin->plg_postadd;
  757. break;
  758. case SLAPI_PLUGIN_POST_DELETE_FN:
  759. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  760. return( -1 );
  761. }
  762. (*(IFP *)value) = pblock->pb_plugin->plg_postdelete;
  763. break;
  764. case SLAPI_PLUGIN_POST_ABANDON_FN:
  765. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  766. return( -1 );
  767. }
  768. (*(IFP *)value) = pblock->pb_plugin->plg_postabandon;
  769. break;
  770. case SLAPI_PLUGIN_POST_ENTRY_FN:
  771. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  772. return( -1 );
  773. }
  774. (*(IFP *)value) = pblock->pb_plugin->plg_postentry;
  775. break;
  776. case SLAPI_PLUGIN_POST_REFERRAL_FN:
  777. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  778. return( -1 );
  779. }
  780. (*(IFP *)value) = pblock->pb_plugin->plg_postreferral;
  781. break;
  782. case SLAPI_PLUGIN_POST_RESULT_FN:
  783. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  784. return( -1 );
  785. }
  786. (*(IFP *)value) = pblock->pb_plugin->plg_postresult;
  787. break;
  788. case SLAPI_ENTRY_PRE_OP:
  789. (*(Slapi_Entry **)value) = pblock->pb_pre_op_entry;
  790. break;
  791. case SLAPI_ENTRY_POST_OP:
  792. (*(Slapi_Entry **)value) = pblock->pb_post_op_entry;
  793. break;
  794. /* backend preoperation plugin */
  795. case SLAPI_PLUGIN_BE_PRE_MODIFY_FN:
  796. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
  797. return( -1 );
  798. }
  799. (*(IFP *)value) = pblock->pb_plugin->plg_bepremodify;
  800. break;
  801. case SLAPI_PLUGIN_BE_PRE_MODRDN_FN:
  802. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
  803. return( -1 );
  804. }
  805. (*(IFP *)value) = pblock->pb_plugin->plg_bepremodrdn;
  806. break;
  807. case SLAPI_PLUGIN_BE_PRE_ADD_FN:
  808. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
  809. return( -1 );
  810. }
  811. (*(IFP *)value) = pblock->pb_plugin->plg_bepreadd;
  812. break;
  813. case SLAPI_PLUGIN_BE_PRE_DELETE_FN:
  814. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
  815. return( -1 );
  816. }
  817. (*(IFP *)value) = pblock->pb_plugin->plg_bepredelete;
  818. break;
  819. /* backend postoperation plugin */
  820. case SLAPI_PLUGIN_BE_POST_MODIFY_FN:
  821. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
  822. return( -1 );
  823. }
  824. (*(IFP *)value) = pblock->pb_plugin->plg_bepostmodify;
  825. break;
  826. case SLAPI_PLUGIN_BE_POST_MODRDN_FN:
  827. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
  828. return( -1 );
  829. }
  830. (*(IFP *)value) = pblock->pb_plugin->plg_bepostmodrdn;
  831. break;
  832. case SLAPI_PLUGIN_BE_POST_ADD_FN:
  833. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
  834. return( -1 );
  835. }
  836. (*(IFP *)value) = pblock->pb_plugin->plg_bepostadd;
  837. break;
  838. case SLAPI_PLUGIN_BE_POST_DELETE_FN:
  839. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
  840. return( -1 );
  841. }
  842. (*(IFP *)value) = pblock->pb_plugin->plg_bepostdelete;
  843. break;
  844. /* internal preoperation plugin */
  845. case SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN:
  846. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
  847. return( -1 );
  848. }
  849. (*(IFP *)value) = pblock->pb_plugin->plg_internal_pre_modify;
  850. break;
  851. case SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN:
  852. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
  853. return( -1 );
  854. }
  855. (*(IFP *)value) = pblock->pb_plugin->plg_internal_pre_modrdn;
  856. break;
  857. case SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN:
  858. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
  859. return( -1 );
  860. }
  861. (*(IFP *)value) = pblock->pb_plugin->plg_internal_pre_add;
  862. break;
  863. case SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN:
  864. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
  865. return( -1 );
  866. }
  867. (*(IFP *)value) = pblock->pb_plugin->plg_internal_pre_delete;
  868. break;
  869. /* internal postoperation plugin */
  870. case SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN:
  871. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
  872. return( -1 );
  873. }
  874. (*(IFP *)value) = pblock->pb_plugin->plg_internal_post_modify;
  875. break;
  876. case SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN:
  877. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
  878. return( -1 );
  879. }
  880. (*(IFP *)value) = pblock->pb_plugin->plg_internal_post_modrdn;
  881. break;
  882. case SLAPI_PLUGIN_INTERNAL_POST_ADD_FN:
  883. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
  884. return( -1 );
  885. }
  886. (*(IFP *)value) = pblock->pb_plugin->plg_internal_post_add;
  887. break;
  888. case SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN:
  889. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
  890. return( -1 );
  891. }
  892. (*(IFP *)value) = pblock->pb_plugin->plg_internal_post_delete;
  893. break;
  894. /* target address & controls for all operations should be normalized */
  895. case SLAPI_TARGET_ADDRESS:
  896. if(pblock->pb_op!=NULL)
  897. {
  898. (*(entry_address **)value) = &(pblock->pb_op->o_params.target_address);
  899. }
  900. break;
  901. /* should be normalized */
  902. case SLAPI_TARGET_DN:
  903. if(pblock->pb_op!=NULL)
  904. {
  905. (*(char **)value) = pblock->pb_op->o_params.target_address.dn;
  906. }
  907. break;
  908. case SLAPI_ORIGINAL_TARGET_DN:
  909. if(pblock->pb_op!=NULL)
  910. {
  911. (*(char **)value) = pblock->pb_op->o_params.target_address.udn;
  912. }
  913. break;
  914. case SLAPI_TARGET_UNIQUEID:
  915. if(pblock->pb_op!=NULL)
  916. {
  917. (*(char **)value) = pblock->pb_op->o_params.target_address.uniqueid;
  918. }
  919. break;
  920. case SLAPI_REQCONTROLS:
  921. (*(LDAPControl ***)value) = pblock->pb_op->o_params.request_controls;
  922. break;
  923. case SLAPI_RESCONTROLS:
  924. (*(LDAPControl ***)value) = pblock->pb_op->o_results.result_controls;
  925. break;
  926. case SLAPI_CONTROLS_ARG: /* used to pass control argument before operation is created */
  927. (*(LDAPControl ***)value) = pblock->pb_ctrls_arg;
  928. break;
  929. /* notes to be added to the access log RESULT line for this op. */
  930. case SLAPI_OPERATION_NOTES:
  931. (*(unsigned int *)value) = pblock->pb_operation_notes;
  932. break;
  933. /* syntax plugin functions */
  934. case SLAPI_PLUGIN_SYNTAX_FILTER_AVA:
  935. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  936. return( -1 );
  937. }
  938. (*(IFP *)value) = pblock->pb_plugin->plg_syntax_filter_ava;
  939. break;
  940. case SLAPI_PLUGIN_SYNTAX_FILTER_SUB:
  941. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  942. return( -1 );
  943. }
  944. (*(IFP *)value) = pblock->pb_plugin->plg_syntax_filter_sub;
  945. break;
  946. case SLAPI_PLUGIN_SYNTAX_VALUES2KEYS:
  947. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  948. return( -1 );
  949. }
  950. (*(IFP *)value) = pblock->pb_plugin->plg_syntax_values2keys;
  951. break;
  952. case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA:
  953. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  954. return( -1 );
  955. }
  956. (*(IFP *)value) = pblock->pb_plugin->plg_syntax_assertion2keys_ava;
  957. break;
  958. case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB:
  959. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  960. return( -1 );
  961. }
  962. (*(IFP *)value) = pblock->pb_plugin->plg_syntax_assertion2keys_sub;
  963. break;
  964. case SLAPI_PLUGIN_SYNTAX_NAMES:
  965. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  966. return( -1 );
  967. }
  968. (*(char ***)value) = pblock->pb_plugin->plg_syntax_names;
  969. break;
  970. case SLAPI_PLUGIN_SYNTAX_OID:
  971. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  972. return( -1 );
  973. }
  974. (*(char **)value) = pblock->pb_plugin->plg_syntax_oid;
  975. break;
  976. case SLAPI_PLUGIN_SYNTAX_FLAGS:
  977. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  978. return( -1 );
  979. }
  980. (*(int *)value) = pblock->pb_plugin->plg_syntax_flags;
  981. break;
  982. case SLAPI_PLUGIN_SYNTAX_COMPARE:
  983. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  984. return( -1 );
  985. }
  986. (*(IFP *)value) = pblock->pb_plugin->plg_syntax_compare;
  987. break;
  988. /* controls we know about */
  989. case SLAPI_MANAGEDSAIT:
  990. (*(int *)value) = pblock->pb_managedsait;
  991. break;
  992. case SLAPI_PWPOLICY:
  993. (*(int *)value) = pblock->pb_pwpolicy_ctrl;
  994. break;
  995. /* add arguments */
  996. case SLAPI_ADD_ENTRY:
  997. if(pblock->pb_op!=NULL)
  998. {
  999. (*(Slapi_Entry **)value) = pblock->pb_op->o_params.p.p_add.target_entry;
  1000. }
  1001. break;
  1002. case SLAPI_ADD_EXISTING_DN_ENTRY:
  1003. (*(Slapi_Entry **)value) = pblock->pb_existing_dn_entry;
  1004. break;
  1005. case SLAPI_ADD_EXISTING_UNIQUEID_ENTRY:
  1006. (*(Slapi_Entry **)value) = pblock->pb_existing_uniqueid_entry;
  1007. break;
  1008. case SLAPI_ADD_PARENT_ENTRY:
  1009. (*(Slapi_Entry **)value) = pblock->pb_parent_entry;
  1010. break;
  1011. case SLAPI_ADD_PARENT_UNIQUEID:
  1012. if(pblock->pb_op!=NULL)
  1013. {
  1014. (*(char **)value) = pblock->pb_op->o_params.p.p_add.parentuniqueid;
  1015. }
  1016. break;
  1017. /* bind arguments */
  1018. case SLAPI_BIND_METHOD:
  1019. if(pblock->pb_op!=NULL)
  1020. {
  1021. (*(int *)value) = pblock->pb_op->o_params.p.p_bind.bind_method;
  1022. }
  1023. break;
  1024. case SLAPI_BIND_CREDENTIALS:
  1025. if(pblock->pb_op!=NULL)
  1026. {
  1027. (*(struct berval **)value) = pblock->pb_op->o_params.p.p_bind.bind_creds;
  1028. }
  1029. break;
  1030. case SLAPI_BIND_SASLMECHANISM:
  1031. if(pblock->pb_op!=NULL)
  1032. {
  1033. (*(char **)value) = pblock->pb_op->o_params.p.p_bind.bind_saslmechanism;
  1034. }
  1035. break;
  1036. /* bind return values */
  1037. case SLAPI_BIND_RET_SASLCREDS:
  1038. if(pblock->pb_op!=NULL)
  1039. {
  1040. (*(struct berval **)value) = pblock->pb_op->o_results.r.r_bind.bind_ret_saslcreds;
  1041. }
  1042. break;
  1043. /* compare arguments */
  1044. case SLAPI_COMPARE_TYPE:
  1045. if(pblock->pb_op!=NULL)
  1046. {
  1047. (*(char **)value) = pblock->pb_op->o_params.p.p_compare.compare_ava.ava_type;
  1048. }
  1049. break;
  1050. case SLAPI_COMPARE_VALUE:
  1051. if(pblock->pb_op!=NULL)
  1052. {
  1053. (*(struct berval **)value) = &pblock->pb_op->o_params.p.p_compare.compare_ava.ava_value;
  1054. }
  1055. break;
  1056. /* modify arguments */
  1057. case SLAPI_MODIFY_MODS:
  1058. PR_ASSERT(pblock->pb_op);
  1059. if(pblock->pb_op!=NULL)
  1060. {
  1061. if(pblock->pb_op->o_params.operation_type==SLAPI_OPERATION_MODIFY)
  1062. {
  1063. (*(LDAPMod ***)value) = pblock->pb_op->o_params.p.p_modify.modify_mods;
  1064. }
  1065. else if(pblock->pb_op->o_params.operation_type==SLAPI_OPERATION_MODRDN)
  1066. {
  1067. (*(LDAPMod ***)value) = pblock->pb_op->o_params.p.p_modrdn.modrdn_mods;
  1068. }
  1069. else
  1070. {
  1071. PR_ASSERT(0); /* JCM */
  1072. }
  1073. }
  1074. break;
  1075. /* modrdn arguments */
  1076. case SLAPI_MODRDN_NEWRDN:
  1077. if(pblock->pb_op!=NULL)
  1078. {
  1079. (*(char **)value) = pblock->pb_op->o_params.p.p_modrdn.modrdn_newrdn;
  1080. }
  1081. break;
  1082. case SLAPI_MODRDN_DELOLDRDN:
  1083. if(pblock->pb_op!=NULL)
  1084. {
  1085. (*(int *)value) = pblock->pb_op->o_params.p.p_modrdn.modrdn_deloldrdn;
  1086. }
  1087. break;
  1088. case SLAPI_MODRDN_NEWSUPERIOR:
  1089. if(pblock->pb_op!=NULL)
  1090. {
  1091. (*(char **)value) =
  1092. pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address.dn;
  1093. }
  1094. break;
  1095. case SLAPI_MODRDN_PARENT_ENTRY:
  1096. (*(Slapi_Entry **)value) = pblock->pb_parent_entry;
  1097. break;
  1098. case SLAPI_MODRDN_NEWPARENT_ENTRY:
  1099. (*(Slapi_Entry **)value) = pblock->pb_newparent_entry;
  1100. break;
  1101. case SLAPI_MODRDN_TARGET_ENTRY:
  1102. (*(Slapi_Entry **)value) = pblock->pb_target_entry;
  1103. break;
  1104. case SLAPI_MODRDN_NEWSUPERIOR_ADDRESS:
  1105. if(pblock->pb_op!=NULL)
  1106. {
  1107. (*(entry_address **)value) = &(pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address);
  1108. break;
  1109. }
  1110. /* search arguments */
  1111. case SLAPI_SEARCH_SCOPE:
  1112. if(pblock->pb_op!=NULL)
  1113. {
  1114. (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_scope;
  1115. }
  1116. break;
  1117. case SLAPI_SEARCH_DEREF:
  1118. if(pblock->pb_op!=NULL)
  1119. {
  1120. (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_deref;
  1121. }
  1122. break;
  1123. case SLAPI_SEARCH_SIZELIMIT:
  1124. if(pblock->pb_op!=NULL)
  1125. {
  1126. (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_sizelimit;
  1127. }
  1128. break;
  1129. case SLAPI_SEARCH_TIMELIMIT:
  1130. if(pblock->pb_op!=NULL)
  1131. {
  1132. (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_timelimit;
  1133. }
  1134. break;
  1135. case SLAPI_SEARCH_FILTER:
  1136. if(pblock->pb_op!=NULL)
  1137. {
  1138. (*(struct slapi_filter **)value) = pblock->pb_op->o_params.p.p_search.search_filter;
  1139. }
  1140. break;
  1141. case SLAPI_SEARCH_STRFILTER:
  1142. if(pblock->pb_op!=NULL)
  1143. {
  1144. (*(char **)value) = pblock->pb_op->o_params.p.p_search.search_strfilter;
  1145. }
  1146. break;
  1147. case SLAPI_SEARCH_ATTRS:
  1148. if(pblock->pb_op!=NULL)
  1149. {
  1150. (*(char ***)value) = pblock->pb_op->o_params.p.p_search.search_attrs;
  1151. }
  1152. break;
  1153. case SLAPI_SEARCH_ATTRSONLY:
  1154. if(pblock->pb_op!=NULL)
  1155. {
  1156. (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_attrsonly;
  1157. }
  1158. break;
  1159. case SLAPI_SEARCH_IS_AND:
  1160. if(pblock->pb_op!=NULL)
  1161. {
  1162. (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_is_and;
  1163. }
  1164. break;
  1165. case SLAPI_ABANDON_MSGID:
  1166. if(pblock->pb_op!=NULL)
  1167. {
  1168. (*(int *)value) = pblock->pb_op->o_params.p.p_abandon.abandon_targetmsgid;
  1169. }
  1170. break;
  1171. /* extended operation arguments */
  1172. case SLAPI_EXT_OP_REQ_OID:
  1173. if(pblock->pb_op!=NULL)
  1174. {
  1175. (*(char **) value) = pblock->pb_op->o_params.p.p_extended.exop_oid;
  1176. }
  1177. break;
  1178. case SLAPI_EXT_OP_REQ_VALUE:
  1179. if(pblock->pb_op!=NULL)
  1180. {
  1181. (*(struct berval **)value) = pblock->pb_op->o_params.p.p_extended.exop_value;
  1182. }
  1183. break;
  1184. /* extended operation return values */
  1185. case SLAPI_EXT_OP_RET_OID:
  1186. if(pblock->pb_op!=NULL)
  1187. {
  1188. (*(char **) value) = pblock->pb_op->o_results.r.r_extended.exop_ret_oid;
  1189. }
  1190. break;
  1191. case SLAPI_EXT_OP_RET_VALUE:
  1192. if(pblock->pb_op!=NULL)
  1193. {
  1194. (*(struct berval **)value) = pblock->pb_op->o_results.r.r_extended.exop_ret_value;
  1195. }
  1196. break;
  1197. /* matching rule plugin functions */
  1198. case SLAPI_PLUGIN_MR_FILTER_CREATE_FN:
  1199. SLAPI_PLUGIN_TYPE_CHECK (pblock, SLAPI_PLUGIN_MATCHINGRULE);
  1200. (*(IFP *)value) = pblock->pb_plugin->plg_mr_filter_create;
  1201. break;
  1202. case SLAPI_PLUGIN_MR_INDEXER_CREATE_FN:
  1203. SLAPI_PLUGIN_TYPE_CHECK (pblock, SLAPI_PLUGIN_MATCHINGRULE);
  1204. (*(IFP *)value) = pblock->pb_plugin->plg_mr_indexer_create;
  1205. break;
  1206. case SLAPI_PLUGIN_MR_FILTER_MATCH_FN:
  1207. (*(mrFilterMatchFn *)value) = pblock->pb_mr_filter_match_fn;
  1208. break;
  1209. case SLAPI_PLUGIN_MR_FILTER_INDEX_FN:
  1210. (*(IFP *)value) = pblock->pb_mr_filter_index_fn;
  1211. break;
  1212. case SLAPI_PLUGIN_MR_FILTER_RESET_FN:
  1213. (*(IFP *)value) = pblock->pb_mr_filter_reset_fn;
  1214. break;
  1215. case SLAPI_PLUGIN_MR_INDEX_FN:
  1216. (*(IFP *)value) = pblock->pb_mr_index_fn;
  1217. break;
  1218. /* matching rule plugin arguments */
  1219. case SLAPI_PLUGIN_MR_OID:
  1220. (*(char **) value) = pblock->pb_mr_oid;
  1221. break;
  1222. case SLAPI_PLUGIN_MR_TYPE:
  1223. (*(char **) value) = pblock->pb_mr_type;
  1224. break;
  1225. case SLAPI_PLUGIN_MR_VALUE:
  1226. (*(struct berval **) value) = pblock->pb_mr_value;
  1227. break;
  1228. case SLAPI_PLUGIN_MR_VALUES:
  1229. (*(struct berval ***) value) = pblock->pb_mr_values;
  1230. break;
  1231. case SLAPI_PLUGIN_MR_KEYS:
  1232. (*(struct berval ***) value) = pblock->pb_mr_keys;
  1233. break;
  1234. case SLAPI_PLUGIN_MR_FILTER_REUSABLE:
  1235. (*(unsigned int *) value) = pblock->pb_mr_filter_reusable;
  1236. break;
  1237. case SLAPI_PLUGIN_MR_QUERY_OPERATOR:
  1238. (*(int *) value) = pblock->pb_mr_query_operator;
  1239. break;
  1240. case SLAPI_PLUGIN_MR_USAGE:
  1241. (*(unsigned int *) value) = pblock->pb_mr_usage;
  1242. break;
  1243. /* seq arguments */
  1244. case SLAPI_SEQ_TYPE:
  1245. (*(int *)value) = pblock->pb_seq_type;
  1246. break;
  1247. case SLAPI_SEQ_ATTRNAME:
  1248. (*(char **)value) = pblock->pb_seq_attrname;
  1249. break;
  1250. case SLAPI_SEQ_VAL:
  1251. (*(char **)value) = pblock->pb_seq_val;
  1252. break;
  1253. /* ldif2db arguments */
  1254. case SLAPI_LDIF2DB_FILE:
  1255. (*(char ***)value) = pblock->pb_ldif_files;
  1256. break;
  1257. case SLAPI_LDIF2DB_REMOVEDUPVALS:
  1258. (*(int *)value) = pblock->pb_removedupvals;
  1259. break;
  1260. case SLAPI_DB2INDEX_ATTRS:
  1261. (*(char ***)value) = pblock->pb_db2index_attrs;
  1262. break;
  1263. case SLAPI_LDIF2DB_NOATTRINDEXES:
  1264. (*(int *)value) = pblock->pb_ldif2db_noattrindexes;
  1265. break;
  1266. case SLAPI_LDIF2DB_INCLUDE:
  1267. (*(char ***)value) = pblock->pb_ldif_include;
  1268. break;
  1269. case SLAPI_LDIF2DB_EXCLUDE:
  1270. (*(char ***)value) = pblock->pb_ldif_exclude;
  1271. break;
  1272. case SLAPI_LDIF2DB_GENERATE_UNIQUEID:
  1273. (*(int *)value) = pblock->pb_ldif_generate_uniqueid;
  1274. break;
  1275. case SLAPI_LDIF2DB_ENCRYPT:
  1276. case SLAPI_DB2LDIF_DECRYPT:
  1277. (*(int *)value) = pblock->pb_ldif_encrypt;
  1278. break;
  1279. case SLAPI_LDIF2DB_NAMESPACEID:
  1280. (*(char **)value) = pblock->pb_ldif_namespaceid;
  1281. break;
  1282. /* db2ldif arguments */
  1283. case SLAPI_DB2LDIF_PRINTKEY:
  1284. (*(int *)value) = pblock->pb_ldif_printkey;
  1285. break;
  1286. case SLAPI_DB2LDIF_DUMP_UNIQUEID:
  1287. (*(int *)value) = pblock->pb_ldif_dump_uniqueid;
  1288. break;
  1289. case SLAPI_DB2LDIF_FILE:
  1290. (*(char **)value) = pblock->pb_ldif_file;
  1291. break;
  1292. /* db2ldif/ldif2db/db2bak/bak2db arguments */
  1293. case SLAPI_BACKEND_INSTANCE_NAME:
  1294. (*(char **)value) = pblock->pb_instance_name;
  1295. break;
  1296. case SLAPI_BACKEND_TASK:
  1297. (*(Slapi_Task **)value) = pblock->pb_task;
  1298. break;
  1299. case SLAPI_TASK_FLAGS:
  1300. (*(int *)value) = pblock->pb_task_flags;
  1301. break;
  1302. case SLAPI_DB2LDIF_SERVER_RUNNING:
  1303. (*(int *)value) = pblock->pb_server_running;
  1304. break;
  1305. case SLAPI_BULK_IMPORT_ENTRY:
  1306. (*(Slapi_Entry **)value) = pblock->pb_import_entry;
  1307. break;
  1308. case SLAPI_BULK_IMPORT_STATE:
  1309. (*(int *)value) = pblock->pb_import_state;
  1310. break;
  1311. /* transaction arguments */
  1312. case SLAPI_PARENT_TXN:
  1313. (*(void **)value) = pblock->pb_parent_txn;
  1314. break;
  1315. case SLAPI_TXN:
  1316. (*(void **)value) = pblock->pb_txn;
  1317. break;
  1318. /* Search results set */
  1319. case SLAPI_SEARCH_RESULT_SET:
  1320. if(pblock->pb_op!=NULL)
  1321. {
  1322. (*(void **)value) = pblock->pb_op->o_results.r.r_search.search_result_set;
  1323. }
  1324. break;
  1325. /* Entry returned from iterating over results set */
  1326. case SLAPI_SEARCH_RESULT_ENTRY:
  1327. if(pblock->pb_op!=NULL)
  1328. {
  1329. (*(void **)value) = pblock->pb_op->o_results.r.r_search.search_result_entry;
  1330. }
  1331. break;
  1332. case SLAPI_SEARCH_RESULT_ENTRY_EXT:
  1333. if(pblock->pb_op!=NULL)
  1334. {
  1335. (*(void **)value) = pblock->pb_op->o_results.r.r_search.opaque_backend_ptr;
  1336. }
  1337. break;
  1338. /* Number of entries returned from search */
  1339. case SLAPI_NENTRIES:
  1340. if(pblock->pb_op!=NULL)
  1341. {
  1342. (*(int *)value) = pblock->pb_op->o_results.r.r_search.nentries;
  1343. }
  1344. break;
  1345. /* Referrals encountered while iterating over result set */
  1346. case SLAPI_SEARCH_REFERRALS:
  1347. if(pblock->pb_op!=NULL)
  1348. {
  1349. (*(struct berval ***)value) = pblock->pb_op->o_results.r.r_search.search_referrals;
  1350. }
  1351. break;
  1352. case SLAPI_RESULT_CODE:
  1353. if (pblock->pb_op != NULL)
  1354. * ((int *) value) = pblock->pb_op->o_results.result_code;
  1355. break;
  1356. case SLAPI_RESULT_MATCHED:
  1357. if (pblock->pb_op != NULL)
  1358. * ((char **) value) = pblock->pb_op->o_results.result_matched;
  1359. break;
  1360. case SLAPI_RESULT_TEXT:
  1361. if (pblock->pb_op != NULL)
  1362. * ((char **) value) = pblock->pb_op->o_results.result_text;
  1363. break;
  1364. case SLAPI_PB_RESULT_TEXT:
  1365. * ((char **) value) = pblock->pb_result_text;
  1366. break;
  1367. /* Size of the database, in kb */
  1368. case SLAPI_DBSIZE:
  1369. (*(unsigned int *)value) = pblock->pb_dbsize;
  1370. break;
  1371. /* ACL Plugin */
  1372. case SLAPI_PLUGIN_ACL_INIT:
  1373. (*(IFP *)value) = pblock->pb_plugin->plg_acl_init;
  1374. break;
  1375. case SLAPI_PLUGIN_ACL_SYNTAX_CHECK:
  1376. (*(IFP *)value) = pblock->pb_plugin->plg_acl_syntax_check;
  1377. break;
  1378. case SLAPI_PLUGIN_ACL_ALLOW_ACCESS:
  1379. (*(IFP *)value) = pblock->pb_plugin->plg_acl_access_allowed;
  1380. break;
  1381. case SLAPI_PLUGIN_ACL_MODS_ALLOWED:
  1382. (*(IFP *)value) = pblock->pb_plugin->plg_acl_mods_allowed;
  1383. break;
  1384. case SLAPI_PLUGIN_ACL_MODS_UPDATE:
  1385. (*(IFP *)value) = pblock->pb_plugin->plg_acl_mods_update;
  1386. break;
  1387. case SLAPI_REQUESTOR_DN:
  1388. /* NOTE: It's not a copy of the DN */
  1389. {
  1390. char *dn= (char*)slapi_sdn_get_dn(&pblock->pb_op->o_sdn);
  1391. if(dn==NULL)
  1392. (*( char **)value ) = "";
  1393. else
  1394. (*( char **)value ) = dn;
  1395. }
  1396. break;
  1397. case SLAPI_OPERATION_AUTHTYPE:
  1398. if(pblock->pb_op->o_authtype==NULL)
  1399. (*( char **)value ) = "";
  1400. else
  1401. (*( char **)value ) = pblock->pb_op->o_authtype;
  1402. break;
  1403. case SLAPI_CLIENT_DNS:
  1404. if (pblock->pb_conn == NULL) {
  1405. LDAPDebug( LDAP_DEBUG_ANY,
  1406. "Connection is NULL and hence cannot access SLAPI_CLIENT_DNS \n", 0, 0, 0 );
  1407. return (-1);
  1408. }
  1409. (*(struct berval ***)value ) = pblock->pb_conn->c_domain;
  1410. break;
  1411. case SLAPI_BE_MAXNESTLEVEL:
  1412. if ( NULL == be ) {
  1413. return( -1 );
  1414. }
  1415. (*(int *)value ) = be->be_maxnestlevel;
  1416. break;
  1417. case SLAPI_OPERATION_ID:
  1418. (*(int *)value ) = pblock->pb_op->o_opid;
  1419. break;
  1420. /* Command line arguments */
  1421. case SLAPI_ARGC:
  1422. (*(int *)value) = pblock->pb_slapd_argc;
  1423. break;
  1424. case SLAPI_ARGV:
  1425. (*(char ***)value) = pblock->pb_slapd_argv;
  1426. break;
  1427. /* Config file directory */
  1428. case SLAPI_CONFIG_DIRECTORY:
  1429. (*(char **)value) = pblock->pb_slapd_configdir;
  1430. break;
  1431. /* password storage scheme (kexcoff */
  1432. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_NAME:
  1433. (*(char **)value) = pblock->pb_plugin->plg_pwdstorageschemename;
  1434. break;
  1435. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_USER_PWD:
  1436. (*(char **)value) = pblock->pb_pwd_storage_scheme_user_passwd;
  1437. break;
  1438. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DB_PWD:
  1439. (*(char **)value) = pblock->pb_pwd_storage_scheme_db_passwd;
  1440. break;
  1441. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_ENC_FN:
  1442. (*(CFP *)value) = pblock->pb_plugin->plg_pwdstorageschemeenc;
  1443. break;
  1444. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DEC_FN:
  1445. (*(IFP *)value) = pblock->pb_plugin->plg_pwdstorageschemedec;
  1446. break;
  1447. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_CMP_FN:
  1448. (*(IFP *)value) = pblock->pb_plugin->plg_pwdstorageschemecmp;
  1449. break;
  1450. /* entry fetch/store plugin */
  1451. case SLAPI_PLUGIN_ENTRY_FETCH_FUNC:
  1452. (*(IFP *)value) = pblock->pb_plugin->plg_entryfetchfunc;
  1453. break;
  1454. case SLAPI_PLUGIN_ENTRY_STORE_FUNC:
  1455. (*(IFP *)value) = pblock->pb_plugin->plg_entrystorefunc;
  1456. break;
  1457. /* DSE add parameters */
  1458. case SLAPI_DSE_DONT_WRITE_WHEN_ADDING:
  1459. (*(int *)value) = pblock->pb_dse_dont_add_write;
  1460. break;
  1461. /* DSE add parameters */
  1462. case SLAPI_DSE_MERGE_WHEN_ADDING:
  1463. (*(int *)value) = pblock->pb_dse_add_merge;
  1464. break;
  1465. /* DSE add parameters */
  1466. case SLAPI_DSE_DONT_CHECK_DUPS:
  1467. (*(int *)value) = pblock->pb_dse_dont_check_dups;
  1468. break;
  1469. /* DSE modify parameters */
  1470. case SLAPI_DSE_REAPPLY_MODS:
  1471. (*(int *)value) = pblock->pb_dse_reapply_mods;
  1472. break;
  1473. /* DSE read parameters */
  1474. case SLAPI_DSE_IS_PRIMARY_FILE:
  1475. (*(int *)value) = pblock->pb_dse_is_primary_file;
  1476. break;
  1477. /* used internally by schema code */
  1478. case SLAPI_SCHEMA_USER_DEFINED_ONLY:
  1479. (*(int *)value) = pblock->pb_schema_user_defined_only;
  1480. break;
  1481. case SLAPI_URP_NAMING_COLLISION_DN:
  1482. (*(char **)value) = pblock->pb_urp_naming_collision_dn;
  1483. break;
  1484. case SLAPI_URP_TOMBSTONE_UNIQUEID:
  1485. (*(char **)value) = pblock->pb_urp_tombstone_uniqueid;
  1486. break;
  1487. default:
  1488. LDAPDebug( LDAP_DEBUG_ANY,
  1489. "Unknown parameter block argument %d\n", arg, 0, 0 );
  1490. return( -1 );
  1491. }
  1492. return( 0 );
  1493. }
  1494. int
  1495. slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
  1496. {
  1497. char *authtype;
  1498. PR_ASSERT( NULL != pblock );
  1499. switch ( arg ) {
  1500. case SLAPI_BACKEND:
  1501. pblock->pb_backend = (Slapi_Backend *) value;
  1502. break;
  1503. case SLAPI_BACKEND_COUNT:
  1504. pblock->pb_backend_count = *((int *) value);
  1505. break;
  1506. case SLAPI_CONNECTION:
  1507. pblock->pb_conn = (Connection *) value;
  1508. break;
  1509. case SLAPI_OPERATION:
  1510. pblock->pb_op = (Operation *) value;
  1511. break;
  1512. case SLAPI_OPINITIATED_TIME:
  1513. pblock->pb_op->o_time = *((time_t *) value);
  1514. break;
  1515. case SLAPI_REQUESTOR_ISROOT:
  1516. pblock->pb_requestor_isroot = *((int *) value);
  1517. break;
  1518. case SLAPI_IS_REPLICATED_OPERATION:
  1519. PR_ASSERT(0);
  1520. break;
  1521. case SLAPI_OPERATION_PARAMETERS:
  1522. PR_ASSERT(0);
  1523. break;
  1524. case SLAPI_CONN_ID:
  1525. if (pblock->pb_conn == NULL) {
  1526. LDAPDebug( LDAP_DEBUG_ANY,
  1527. "Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
  1528. return (-1);
  1529. }
  1530. pblock->pb_conn->c_connid = *((int *) value);
  1531. break;
  1532. case SLAPI_CONN_DN:
  1533. /*
  1534. * Slightly crazy but we must pass a copy of the current
  1535. * authtype into bind_credentials_set() since it will
  1536. * free the current authtype.
  1537. */
  1538. if (pblock->pb_conn == NULL) {
  1539. LDAPDebug( LDAP_DEBUG_ANY,
  1540. "Connection is NULL and hence cannot access SLAPI_CONN_DN \n", 0, 0, 0 );
  1541. return (-1);
  1542. }
  1543. slapi_pblock_get(pblock, SLAPI_CONN_AUTHMETHOD, &authtype);
  1544. bind_credentials_set( pblock->pb_conn, authtype,
  1545. (char *)value, NULL, NULL, NULL , NULL);
  1546. slapi_ch_free((void**)&authtype);
  1547. break;
  1548. case SLAPI_CONN_AUTHTYPE: /* deprecated */
  1549. case SLAPI_CONN_AUTHMETHOD:
  1550. if (pblock->pb_conn == NULL) {
  1551. LDAPDebug( LDAP_DEBUG_ANY,
  1552. "Connection is NULL and hence cannot access SLAPI_CONN_AUTHMETHOD \n", 0, 0, 0 );
  1553. return (-1);
  1554. }
  1555. PR_Lock( pblock->pb_conn->c_mutex );
  1556. slapi_ch_free((void**)&pblock->pb_conn->c_authtype);
  1557. pblock->pb_conn->c_authtype = slapi_ch_strdup((char *) value);
  1558. PR_Unlock( pblock->pb_conn->c_mutex );
  1559. break;
  1560. case SLAPI_CONN_IS_REPLICATION_SESSION:
  1561. if (pblock->pb_conn == NULL) {
  1562. LDAPDebug( LDAP_DEBUG_ANY,
  1563. "Connection is NULL and hence cannot access SLAPI_CONN_IS_REPLICATION_SESSION \n", 0, 0, 0 );
  1564. return (-1);
  1565. }
  1566. PR_Lock( pblock->pb_conn->c_mutex );
  1567. pblock->pb_conn->c_isreplication_session = *((int *) value);
  1568. PR_Unlock( pblock->pb_conn->c_mutex );
  1569. break;
  1570. /* stuff related to config file processing */
  1571. case SLAPI_CONFIG_FILENAME:
  1572. case SLAPI_CONFIG_LINENO:
  1573. case SLAPI_CONFIG_ARGC:
  1574. case SLAPI_CONFIG_ARGV:
  1575. return (-1); /* deprecated since DS 5.0 (no longer useful) */
  1576. /* pblock memory management */
  1577. case SLAPI_DESTROY_CONTENT:
  1578. pblock->pb_destroy_content = *((int *) value);
  1579. break;
  1580. /* stuff related to the current plugin */
  1581. case SLAPI_PLUGIN:
  1582. pblock->pb_plugin = (struct slapdplugin *) value;
  1583. break;
  1584. case SLAPI_PLUGIN_PRIVATE:
  1585. pblock->pb_plugin->plg_private = (void *) value;
  1586. break;
  1587. case SLAPI_PLUGIN_TYPE:
  1588. pblock->pb_plugin->plg_type = *((int *) value);
  1589. break;
  1590. case SLAPI_PLUGIN_ARGV:
  1591. pblock->pb_plugin->plg_argv = (char **) value;
  1592. break;
  1593. case SLAPI_PLUGIN_ARGC:
  1594. pblock->pb_plugin->plg_argc = *((int *) value);
  1595. break;
  1596. case SLAPI_PLUGIN_VERSION:
  1597. pblock->pb_plugin->plg_version = (char *) value;
  1598. break;
  1599. case SLAPI_PLUGIN_OPRETURN:
  1600. pblock->pb_opreturn = *((int *) value);
  1601. break;
  1602. case SLAPI_PLUGIN_OBJECT:
  1603. pblock->pb_object = (void *) value;
  1604. break;
  1605. case SLAPI_PLUGIN_IDENTITY:
  1606. pblock->pb_plugin_identity = (void*)value;
  1607. break;
  1608. case SLAPI_PLUGIN_DESTROY_FN:
  1609. pblock->pb_destroy_fn = (IFP) value;
  1610. break;
  1611. case SLAPI_PLUGIN_DESCRIPTION:
  1612. pblock->pb_plugin->plg_desc = *((Slapi_PluginDesc *)value);
  1613. break;
  1614. case SLAPI_PLUGIN_INTOP_RESULT:
  1615. pblock->pb_internal_op_result = *((int *) value);
  1616. break;
  1617. case SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES:
  1618. pblock->pb_plugin_internal_search_op_entries = (Slapi_Entry **) value;
  1619. break;
  1620. case SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS:
  1621. pblock->pb_plugin_internal_search_op_referrals = (char **) value;
  1622. break;
  1623. /* database plugin functions */
  1624. case SLAPI_PLUGIN_DB_BIND_FN:
  1625. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1626. return( -1 );
  1627. }
  1628. pblock->pb_plugin->plg_bind = (IFP) value;
  1629. break;
  1630. case SLAPI_PLUGIN_DB_UNBIND_FN:
  1631. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1632. return( -1 );
  1633. }
  1634. pblock->pb_plugin->plg_unbind = (IFP) value;
  1635. break;
  1636. case SLAPI_PLUGIN_DB_SEARCH_FN:
  1637. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1638. return( -1 );
  1639. }
  1640. pblock->pb_plugin->plg_search = (IFP) value;
  1641. break;
  1642. case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN:
  1643. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1644. return( -1 );
  1645. }
  1646. pblock->pb_plugin->plg_next_search_entry = (IFP) value;
  1647. break;
  1648. case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_EXT_FN:
  1649. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1650. return( -1 );
  1651. }
  1652. pblock->pb_plugin->plg_next_search_entry_ext = (IFP) value;
  1653. break;
  1654. case SLAPI_PLUGIN_DB_ENTRY_RELEASE_FN:
  1655. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1656. return( -1 );
  1657. }
  1658. pblock->pb_plugin->plg_entry_release = (IFP) value;
  1659. break;
  1660. case SLAPI_PLUGIN_DB_COMPARE_FN:
  1661. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1662. return( -1 );
  1663. }
  1664. pblock->pb_plugin->plg_compare = (IFP) value;
  1665. break;
  1666. case SLAPI_PLUGIN_DB_MODIFY_FN:
  1667. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1668. return( -1 );
  1669. }
  1670. pblock->pb_plugin->plg_modify = (IFP) value;
  1671. break;
  1672. case SLAPI_PLUGIN_DB_MODRDN_FN:
  1673. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1674. return( -1 );
  1675. }
  1676. pblock->pb_plugin->plg_modrdn = (IFP) value;
  1677. break;
  1678. case SLAPI_PLUGIN_DB_ADD_FN:
  1679. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1680. return( -1 );
  1681. }
  1682. pblock->pb_plugin->plg_add = (IFP) value;
  1683. break;
  1684. case SLAPI_PLUGIN_DB_DELETE_FN:
  1685. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1686. return( -1 );
  1687. }
  1688. pblock->pb_plugin->plg_delete = (IFP) value;
  1689. break;
  1690. case SLAPI_PLUGIN_DB_ABANDON_FN:
  1691. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1692. return( -1 );
  1693. }
  1694. pblock->pb_plugin->plg_abandon = (IFP) value;
  1695. break;
  1696. case SLAPI_PLUGIN_DB_CONFIG_FN:
  1697. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1698. return( -1 );
  1699. }
  1700. pblock->pb_plugin->plg_config = (IFP) value;
  1701. break;
  1702. case SLAPI_PLUGIN_CLOSE_FN:
  1703. pblock->pb_plugin->plg_close = (IFP) value;
  1704. break;
  1705. case SLAPI_PLUGIN_CLEANUP_FN:
  1706. pblock->pb_plugin->plg_cleanup = (IFP) value;
  1707. break;
  1708. case SLAPI_PLUGIN_DB_FLUSH_FN:
  1709. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1710. return( -1 );
  1711. }
  1712. pblock->pb_plugin->plg_flush = (IFP) value;
  1713. break;
  1714. case SLAPI_PLUGIN_START_FN:
  1715. pblock->pb_plugin->plg_start = (IFP) value;
  1716. break;
  1717. case SLAPI_PLUGIN_POSTSTART_FN:
  1718. pblock->pb_plugin->plg_poststart = (IFP) value;
  1719. break;
  1720. case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN:
  1721. pblock->pb_plugin->plg_wire_import = (IFP) value;
  1722. break;
  1723. case SLAPI_PLUGIN_DB_SEQ_FN:
  1724. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1725. return( -1 );
  1726. }
  1727. pblock->pb_plugin->plg_seq = (IFP) value;
  1728. break;
  1729. case SLAPI_PLUGIN_DB_ENTRY_FN:
  1730. pblock->pb_plugin->plg_entry = (IFP) value;
  1731. break;
  1732. case SLAPI_PLUGIN_DB_REFERRAL_FN:
  1733. pblock->pb_plugin->plg_referral = (IFP) value;
  1734. break;
  1735. case SLAPI_PLUGIN_DB_RESULT_FN:
  1736. pblock->pb_plugin->plg_result = (IFP) value;
  1737. break;
  1738. case SLAPI_PLUGIN_DB_RMDB_FN:
  1739. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1740. return( -1 );
  1741. }
  1742. pblock->pb_plugin->plg_rmdb = (IFP) value;
  1743. break;
  1744. case SLAPI_PLUGIN_DB_INIT_INSTANCE_FN:
  1745. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1746. return( -1 );
  1747. }
  1748. pblock->pb_plugin->plg_init_instance = (IFP) value;
  1749. break;
  1750. case SLAPI_PLUGIN_DB_LDIF2DB_FN:
  1751. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1752. return( -1 );
  1753. }
  1754. pblock->pb_plugin->plg_ldif2db = (IFP) value;
  1755. break;
  1756. case SLAPI_PLUGIN_DB_DB2LDIF_FN:
  1757. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1758. return( -1 );
  1759. }
  1760. pblock->pb_plugin->plg_db2ldif = (IFP) value;
  1761. break;
  1762. case SLAPI_PLUGIN_DB_DB2INDEX_FN:
  1763. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1764. return( -1 );
  1765. }
  1766. pblock->pb_plugin->plg_db2index = (IFP) value;
  1767. break;
  1768. case SLAPI_PLUGIN_DB_ARCHIVE2DB_FN:
  1769. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1770. return( -1 );
  1771. }
  1772. pblock->pb_plugin->plg_archive2db = (IFP) value;
  1773. break;
  1774. case SLAPI_PLUGIN_DB_DB2ARCHIVE_FN:
  1775. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1776. return( -1 );
  1777. }
  1778. pblock->pb_plugin->plg_db2archive = (IFP) value;
  1779. break;
  1780. #if defined(UPGRADEDB)
  1781. case SLAPI_PLUGIN_DB_UPGRADEDB_FN:
  1782. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1783. return( -1 );
  1784. }
  1785. pblock->pb_plugin->plg_upgradedb = (IFP) value;
  1786. break;
  1787. #endif
  1788. case SLAPI_PLUGIN_DB_BEGIN_FN:
  1789. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1790. return( -1 );
  1791. }
  1792. pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_begin = (IFP) value;
  1793. break;
  1794. case SLAPI_PLUGIN_DB_COMMIT_FN:
  1795. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1796. return( -1 );
  1797. }
  1798. pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_commit = (IFP) value;
  1799. break;
  1800. case SLAPI_PLUGIN_DB_ABORT_FN:
  1801. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1802. return( -1 );
  1803. }
  1804. pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_abort = (IFP) value;
  1805. break;
  1806. case SLAPI_PLUGIN_DB_SIZE_FN:
  1807. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1808. return( -1 );
  1809. }
  1810. pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_dbsize = (IFP) value;
  1811. break;
  1812. case SLAPI_PLUGIN_DB_TEST_FN:
  1813. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1814. return( -1 );
  1815. }
  1816. pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_dbtest = (IFP) value;
  1817. break;
  1818. /* database plugin-specific parameters */
  1819. case SLAPI_PLUGIN_DB_NO_ACL:
  1820. if ( pblock->pb_plugin && pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) {
  1821. return( -1 );
  1822. }
  1823. if ( NULL == pblock->pb_backend ) {
  1824. return( -1 );
  1825. }
  1826. pblock->pb_backend->be_noacl = *((int *)value);
  1827. break;
  1828. /* extendedop plugin functions */
  1829. case SLAPI_PLUGIN_EXT_OP_FN:
  1830. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP ) {
  1831. return( -1 );
  1832. }
  1833. pblock->pb_plugin->plg_exhandler = (IFP) value;
  1834. break;
  1835. case SLAPI_PLUGIN_EXT_OP_OIDLIST:
  1836. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP ) {
  1837. return( -1 );
  1838. }
  1839. pblock->pb_plugin->plg_exoids = (char **) value;
  1840. ldapi_register_extended_op( (char **)value );
  1841. break;
  1842. case SLAPI_PLUGIN_EXT_OP_NAMELIST:
  1843. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP ) {
  1844. return( -1 );
  1845. }
  1846. pblock->pb_plugin->plg_exnames = (char **) value;
  1847. break;
  1848. /* preoperation plugin functions */
  1849. case SLAPI_PLUGIN_PRE_BIND_FN:
  1850. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1851. return( -1 );
  1852. }
  1853. pblock->pb_plugin->plg_prebind = (IFP) value;
  1854. break;
  1855. case SLAPI_PLUGIN_PRE_UNBIND_FN:
  1856. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1857. return( -1 );
  1858. }
  1859. pblock->pb_plugin->plg_preunbind = (IFP) value;
  1860. break;
  1861. case SLAPI_PLUGIN_PRE_SEARCH_FN:
  1862. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1863. return( -1 );
  1864. }
  1865. pblock->pb_plugin->plg_presearch = (IFP) value;
  1866. break;
  1867. case SLAPI_PLUGIN_PRE_COMPARE_FN:
  1868. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1869. return( -1 );
  1870. }
  1871. pblock->pb_plugin->plg_precompare = (IFP) value;
  1872. break;
  1873. case SLAPI_PLUGIN_PRE_MODIFY_FN:
  1874. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1875. return( -1 );
  1876. }
  1877. pblock->pb_plugin->plg_premodify = (IFP) value;
  1878. break;
  1879. case SLAPI_PLUGIN_PRE_MODRDN_FN:
  1880. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1881. return( -1 );
  1882. }
  1883. pblock->pb_plugin->plg_premodrdn = (IFP) value;
  1884. break;
  1885. case SLAPI_PLUGIN_PRE_ADD_FN:
  1886. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1887. return( -1 );
  1888. }
  1889. pblock->pb_plugin->plg_preadd = (IFP) value;
  1890. break;
  1891. case SLAPI_PLUGIN_PRE_DELETE_FN:
  1892. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1893. return( -1 );
  1894. }
  1895. pblock->pb_plugin->plg_predelete = (IFP) value;
  1896. break;
  1897. case SLAPI_PLUGIN_PRE_ABANDON_FN:
  1898. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1899. return( -1 );
  1900. }
  1901. pblock->pb_plugin->plg_preabandon = (IFP) value;
  1902. break;
  1903. case SLAPI_PLUGIN_PRE_ENTRY_FN:
  1904. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1905. return( -1 );
  1906. }
  1907. pblock->pb_plugin->plg_preentry = (IFP) value;
  1908. break;
  1909. case SLAPI_PLUGIN_PRE_REFERRAL_FN:
  1910. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1911. return( -1 );
  1912. }
  1913. pblock->pb_plugin->plg_prereferral = (IFP) value;
  1914. break;
  1915. case SLAPI_PLUGIN_PRE_RESULT_FN:
  1916. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
  1917. return( -1 );
  1918. }
  1919. pblock->pb_plugin->plg_preresult = (IFP) value;
  1920. break;
  1921. /* postoperation plugin functions */
  1922. case SLAPI_PLUGIN_POST_BIND_FN:
  1923. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1924. return( -1 );
  1925. }
  1926. pblock->pb_plugin->plg_postbind = (IFP) value;
  1927. break;
  1928. case SLAPI_PLUGIN_POST_UNBIND_FN:
  1929. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1930. return( -1 );
  1931. }
  1932. pblock->pb_plugin->plg_postunbind = (IFP) value;
  1933. break;
  1934. case SLAPI_PLUGIN_POST_SEARCH_FN:
  1935. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1936. return( -1 );
  1937. }
  1938. pblock->pb_plugin->plg_postsearch = (IFP) value;
  1939. break;
  1940. case SLAPI_PLUGIN_POST_SEARCH_FAIL_FN:
  1941. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1942. return( -1 );
  1943. }
  1944. pblock->pb_plugin->plg_postsearchfail = (IFP) value;
  1945. break;
  1946. case SLAPI_PLUGIN_POST_COMPARE_FN:
  1947. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1948. return( -1 );
  1949. }
  1950. pblock->pb_plugin->plg_postcompare = (IFP) value;
  1951. break;
  1952. case SLAPI_PLUGIN_POST_MODIFY_FN:
  1953. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1954. return( -1 );
  1955. }
  1956. pblock->pb_plugin->plg_postmodify = (IFP) value;
  1957. break;
  1958. case SLAPI_PLUGIN_POST_MODRDN_FN:
  1959. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1960. return( -1 );
  1961. }
  1962. pblock->pb_plugin->plg_postmodrdn = (IFP) value;
  1963. break;
  1964. case SLAPI_PLUGIN_POST_ADD_FN:
  1965. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1966. return( -1 );
  1967. }
  1968. pblock->pb_plugin->plg_postadd = (IFP) value;
  1969. break;
  1970. case SLAPI_PLUGIN_POST_DELETE_FN:
  1971. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1972. return( -1 );
  1973. }
  1974. pblock->pb_plugin->plg_postdelete = (IFP) value;
  1975. break;
  1976. case SLAPI_PLUGIN_POST_ABANDON_FN:
  1977. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1978. return( -1 );
  1979. }
  1980. pblock->pb_plugin->plg_postabandon = (IFP) value;
  1981. break;
  1982. case SLAPI_PLUGIN_POST_ENTRY_FN:
  1983. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1984. return( -1 );
  1985. }
  1986. pblock->pb_plugin->plg_postentry = (IFP) value;
  1987. break;
  1988. case SLAPI_PLUGIN_POST_REFERRAL_FN:
  1989. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1990. return( -1 );
  1991. }
  1992. pblock->pb_plugin->plg_postreferral = (IFP) value;
  1993. break;
  1994. case SLAPI_PLUGIN_POST_RESULT_FN:
  1995. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
  1996. return( -1 );
  1997. }
  1998. pblock->pb_plugin->plg_postresult = (IFP) value;
  1999. break;
  2000. /* backend preoperation plugin */
  2001. case SLAPI_PLUGIN_BE_PRE_MODIFY_FN:
  2002. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
  2003. return( -1 );
  2004. }
  2005. pblock->pb_plugin->plg_bepremodify = (IFP) value;
  2006. break;
  2007. case SLAPI_PLUGIN_BE_PRE_MODRDN_FN:
  2008. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
  2009. return( -1 );
  2010. }
  2011. pblock->pb_plugin->plg_bepremodrdn = (IFP) value;
  2012. break;
  2013. case SLAPI_PLUGIN_BE_PRE_ADD_FN:
  2014. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
  2015. return( -1 );
  2016. }
  2017. pblock->pb_plugin->plg_bepreadd = (IFP) value;
  2018. break;
  2019. case SLAPI_PLUGIN_BE_PRE_DELETE_FN:
  2020. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
  2021. return( -1 );
  2022. }
  2023. pblock->pb_plugin->plg_bepredelete = (IFP) value;
  2024. break;
  2025. /* backend postoperation plugin */
  2026. case SLAPI_PLUGIN_BE_POST_MODIFY_FN:
  2027. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
  2028. return( -1 );
  2029. }
  2030. pblock->pb_plugin->plg_bepostmodify = (IFP) value;
  2031. break;
  2032. case SLAPI_PLUGIN_BE_POST_MODRDN_FN:
  2033. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
  2034. return( -1 );
  2035. }
  2036. pblock->pb_plugin->plg_bepostmodrdn = (IFP) value;
  2037. break;
  2038. case SLAPI_PLUGIN_BE_POST_ADD_FN:
  2039. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
  2040. return( -1 );
  2041. }
  2042. pblock->pb_plugin->plg_bepostadd = (IFP) value;
  2043. break;
  2044. case SLAPI_PLUGIN_BE_POST_DELETE_FN:
  2045. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
  2046. return( -1 );
  2047. }
  2048. pblock->pb_plugin->plg_bepostdelete = (IFP) value;
  2049. break;
  2050. /* internal preoperation plugin */
  2051. case SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN:
  2052. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
  2053. return( -1 );
  2054. }
  2055. pblock->pb_plugin->plg_internal_pre_modify = (IFP) value;
  2056. break;
  2057. case SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN:
  2058. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
  2059. return( -1 );
  2060. }
  2061. pblock->pb_plugin->plg_internal_pre_modrdn = (IFP) value;
  2062. break;
  2063. case SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN:
  2064. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
  2065. return( -1 );
  2066. }
  2067. pblock->pb_plugin->plg_internal_pre_add = (IFP) value;
  2068. break;
  2069. case SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN:
  2070. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
  2071. return( -1 );
  2072. }
  2073. pblock->pb_plugin->plg_internal_pre_delete = (IFP) value;
  2074. break;
  2075. /* internal postoperation plugin */
  2076. case SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN:
  2077. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
  2078. return( -1 );
  2079. }
  2080. pblock->pb_plugin->plg_internal_post_modify = (IFP) value;
  2081. break;
  2082. case SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN:
  2083. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
  2084. return( -1 );
  2085. }
  2086. pblock->pb_plugin->plg_internal_post_modrdn = (IFP) value;
  2087. break;
  2088. case SLAPI_PLUGIN_INTERNAL_POST_ADD_FN:
  2089. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
  2090. return( -1 );
  2091. }
  2092. pblock->pb_plugin->plg_internal_post_add = (IFP) value;
  2093. break;
  2094. case SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN:
  2095. if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
  2096. return( -1 );
  2097. }
  2098. pblock->pb_plugin->plg_internal_post_delete = (IFP) value;
  2099. break;
  2100. /* syntax plugin functions */
  2101. case SLAPI_PLUGIN_SYNTAX_FILTER_AVA:
  2102. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  2103. return( -1 );
  2104. }
  2105. pblock->pb_plugin->plg_syntax_filter_ava = (IFP) value;
  2106. break;
  2107. case SLAPI_PLUGIN_SYNTAX_FILTER_SUB:
  2108. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  2109. return( -1 );
  2110. }
  2111. pblock->pb_plugin->plg_syntax_filter_sub = (IFP) value;
  2112. break;
  2113. case SLAPI_PLUGIN_SYNTAX_VALUES2KEYS:
  2114. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  2115. return( -1 );
  2116. }
  2117. pblock->pb_plugin->plg_syntax_values2keys = (IFP) value;
  2118. break;
  2119. case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA:
  2120. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  2121. return( -1 );
  2122. }
  2123. pblock->pb_plugin->plg_syntax_assertion2keys_ava = (IFP) value;
  2124. break;
  2125. case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB:
  2126. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  2127. return( -1 );
  2128. }
  2129. pblock->pb_plugin->plg_syntax_assertion2keys_sub = (IFP) value;
  2130. break;
  2131. case SLAPI_PLUGIN_SYNTAX_NAMES:
  2132. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  2133. return( -1 );
  2134. }
  2135. pblock->pb_plugin->plg_syntax_names = (char **) value;
  2136. break;
  2137. case SLAPI_PLUGIN_SYNTAX_OID:
  2138. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  2139. return( -1 );
  2140. }
  2141. pblock->pb_plugin->plg_syntax_oid = (char *) value;
  2142. break;
  2143. case SLAPI_PLUGIN_SYNTAX_FLAGS:
  2144. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  2145. return( -1 );
  2146. }
  2147. pblock->pb_plugin->plg_syntax_flags = *((int *) value);
  2148. break;
  2149. case SLAPI_PLUGIN_SYNTAX_COMPARE:
  2150. if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
  2151. return( -1 );
  2152. }
  2153. pblock->pb_plugin->plg_syntax_compare = (IFP) value;
  2154. break;
  2155. case SLAPI_ENTRY_PRE_OP:
  2156. pblock->pb_pre_op_entry = (Slapi_Entry *) value;
  2157. break;
  2158. case SLAPI_ENTRY_POST_OP:
  2159. pblock->pb_post_op_entry = (Slapi_Entry *) value;
  2160. break;
  2161. /* target address for all operations */
  2162. case SLAPI_TARGET_ADDRESS:
  2163. PR_ASSERT (PR_FALSE); /* can't do this */
  2164. break;
  2165. case SLAPI_TARGET_DN:
  2166. if(pblock->pb_op!=NULL)
  2167. {
  2168. pblock->pb_op->o_params.target_address.dn = (char *)value;
  2169. }
  2170. break;
  2171. case SLAPI_ORIGINAL_TARGET_DN:
  2172. if(pblock->pb_op!=NULL)
  2173. {
  2174. pblock->pb_op->o_params.target_address.udn = (char *)value;
  2175. }
  2176. break;
  2177. case SLAPI_TARGET_UNIQUEID:
  2178. if(pblock->pb_op!=NULL)
  2179. {
  2180. pblock->pb_op->o_params.target_address.uniqueid = (char *) value;
  2181. }
  2182. break;
  2183. case SLAPI_REQCONTROLS:
  2184. pblock->pb_op->o_params.request_controls = (LDAPControl **) value;
  2185. break;
  2186. case SLAPI_RESCONTROLS:
  2187. pblock->pb_op->o_results.result_controls = (LDAPControl **) value;
  2188. break;
  2189. case SLAPI_CONTROLS_ARG: /* used to pass control argument before operation is created */
  2190. pblock->pb_ctrls_arg = (LDAPControl **) value;
  2191. break;
  2192. case SLAPI_ADD_RESCONTROL:
  2193. add_control( &pblock->pb_op->o_results.result_controls, (LDAPControl *)value );
  2194. break;
  2195. /* notes to be added to the access log RESULT line for this op. */
  2196. case SLAPI_OPERATION_NOTES:
  2197. if ( value == NULL ) {
  2198. pblock->pb_operation_notes = 0; /* cleared */
  2199. } else {
  2200. pblock->pb_operation_notes |= *((unsigned int *)value );
  2201. }
  2202. break;
  2203. /* controls we know about */
  2204. case SLAPI_MANAGEDSAIT:
  2205. pblock->pb_managedsait = *((int *) value);
  2206. break;
  2207. case SLAPI_PWPOLICY:
  2208. pblock->pb_pwpolicy_ctrl = *((int *) value);
  2209. break;
  2210. /* add arguments */
  2211. case SLAPI_ADD_ENTRY:
  2212. if(pblock->pb_op!=NULL)
  2213. {
  2214. pblock->pb_op->o_params.p.p_add.target_entry = (Slapi_Entry *) value;
  2215. }
  2216. break;
  2217. case SLAPI_ADD_EXISTING_DN_ENTRY:
  2218. pblock->pb_existing_dn_entry = (Slapi_Entry *) value;
  2219. break;
  2220. case SLAPI_ADD_EXISTING_UNIQUEID_ENTRY:
  2221. pblock->pb_existing_uniqueid_entry = (Slapi_Entry *) value;
  2222. break;
  2223. case SLAPI_ADD_PARENT_ENTRY:
  2224. pblock->pb_parent_entry = (Slapi_Entry *) value;
  2225. break;
  2226. case SLAPI_ADD_PARENT_UNIQUEID:
  2227. if(pblock->pb_op!=NULL)
  2228. {
  2229. pblock->pb_op->o_params.p.p_add.parentuniqueid = (char *) value;
  2230. }
  2231. break;
  2232. /* bind arguments */
  2233. case SLAPI_BIND_METHOD:
  2234. if(pblock->pb_op!=NULL)
  2235. {
  2236. pblock->pb_op->o_params.p.p_bind.bind_method = *((int *) value);
  2237. }
  2238. break;
  2239. case SLAPI_BIND_CREDENTIALS:
  2240. if(pblock->pb_op!=NULL)
  2241. {
  2242. pblock->pb_op->o_params.p.p_bind.bind_creds = (struct berval *) value;
  2243. }
  2244. break;
  2245. case SLAPI_BIND_SASLMECHANISM:
  2246. if(pblock->pb_op!=NULL)
  2247. {
  2248. pblock->pb_op->o_params.p.p_bind.bind_saslmechanism = (char *) value;
  2249. }
  2250. break;
  2251. /* bind return values */
  2252. case SLAPI_BIND_RET_SASLCREDS:
  2253. if(pblock->pb_op!=NULL)
  2254. {
  2255. pblock->pb_op->o_results.r.r_bind.bind_ret_saslcreds = (struct berval *) value;
  2256. }
  2257. break;
  2258. /* compare arguments */
  2259. case SLAPI_COMPARE_TYPE:
  2260. if(pblock->pb_op!=NULL)
  2261. {
  2262. pblock->pb_op->o_params.p.p_compare.compare_ava.ava_type = (char *) value;
  2263. }
  2264. break;
  2265. case SLAPI_COMPARE_VALUE:
  2266. if(pblock->pb_op!=NULL)
  2267. {
  2268. pblock->pb_op->o_params.p.p_compare.compare_ava.ava_value = *((struct berval *) value);
  2269. }
  2270. break;
  2271. /* modify arguments */
  2272. case SLAPI_MODIFY_MODS:
  2273. PR_ASSERT(pblock->pb_op);
  2274. if(pblock->pb_op!=NULL)
  2275. {
  2276. if(pblock->pb_op->o_params.operation_type==SLAPI_OPERATION_MODIFY)
  2277. {
  2278. pblock->pb_op->o_params.p.p_modify.modify_mods = (LDAPMod **) value;
  2279. }
  2280. else if(pblock->pb_op->o_params.operation_type==SLAPI_OPERATION_MODRDN)
  2281. {
  2282. pblock->pb_op->o_params.p.p_modrdn.modrdn_mods = (LDAPMod **) value;
  2283. }
  2284. else
  2285. {
  2286. PR_ASSERT(0);
  2287. }
  2288. }
  2289. break;
  2290. /* modrdn arguments */
  2291. case SLAPI_MODRDN_NEWRDN:
  2292. if(pblock->pb_op!=NULL)
  2293. {
  2294. pblock->pb_op->o_params.p.p_modrdn.modrdn_newrdn = (char *) value;
  2295. }
  2296. break;
  2297. case SLAPI_MODRDN_DELOLDRDN:
  2298. if(pblock->pb_op!=NULL)
  2299. {
  2300. pblock->pb_op->o_params.p.p_modrdn.modrdn_deloldrdn = *((int *) value);
  2301. }
  2302. break;
  2303. case SLAPI_MODRDN_NEWSUPERIOR:
  2304. if(pblock->pb_op!=NULL)
  2305. {
  2306. pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address.dn = (char *) value;
  2307. }
  2308. break;
  2309. case SLAPI_MODRDN_PARENT_ENTRY:
  2310. pblock->pb_parent_entry = (Slapi_Entry *) value;
  2311. break;
  2312. case SLAPI_MODRDN_NEWPARENT_ENTRY:
  2313. pblock->pb_newparent_entry = (Slapi_Entry *) value;
  2314. break;
  2315. case SLAPI_MODRDN_TARGET_ENTRY:
  2316. pblock->pb_target_entry = (Slapi_Entry *) value;
  2317. break;
  2318. case SLAPI_MODRDN_NEWSUPERIOR_ADDRESS:
  2319. PR_ASSERT (PR_FALSE); /* can't do this */
  2320. /* search arguments */
  2321. case SLAPI_SEARCH_SCOPE:
  2322. if(pblock->pb_op!=NULL)
  2323. {
  2324. pblock->pb_op->o_params.p.p_search.search_scope = *((int *) value);
  2325. }
  2326. break;
  2327. case SLAPI_SEARCH_DEREF:
  2328. if(pblock->pb_op!=NULL)
  2329. {
  2330. pblock->pb_op->o_params.p.p_search.search_deref = *((int *) value);
  2331. }
  2332. break;
  2333. case SLAPI_SEARCH_SIZELIMIT:
  2334. if(pblock->pb_op!=NULL)
  2335. {
  2336. pblock->pb_op->o_params.p.p_search.search_sizelimit = *((int *) value);
  2337. }
  2338. break;
  2339. case SLAPI_SEARCH_TIMELIMIT:
  2340. if(pblock->pb_op!=NULL)
  2341. {
  2342. pblock->pb_op->o_params.p.p_search.search_timelimit = *((int *) value);
  2343. }
  2344. break;
  2345. case SLAPI_SEARCH_FILTER:
  2346. if(pblock->pb_op!=NULL)
  2347. {
  2348. pblock->pb_op->o_params.p.p_search.search_filter = (struct slapi_filter *) value;
  2349. }
  2350. break;
  2351. case SLAPI_SEARCH_STRFILTER:
  2352. if(pblock->pb_op!=NULL)
  2353. {
  2354. pblock->pb_op->o_params.p.p_search.search_strfilter = (char *) value;
  2355. }
  2356. break;
  2357. case SLAPI_SEARCH_ATTRS:
  2358. if(pblock->pb_op!=NULL)
  2359. {
  2360. pblock->pb_op->o_params.p.p_search.search_attrs = (char **) value;
  2361. }
  2362. break;
  2363. case SLAPI_SEARCH_ATTRSONLY:
  2364. if(pblock->pb_op!=NULL)
  2365. {
  2366. pblock->pb_op->o_params.p.p_search.search_attrsonly = *((int *) value);
  2367. }
  2368. break;
  2369. case SLAPI_SEARCH_IS_AND:
  2370. if(pblock->pb_op!=NULL)
  2371. {
  2372. pblock->pb_op->o_params.p.p_search.search_is_and = *((int *) value);
  2373. }
  2374. break;
  2375. /* abandon operation arguments */
  2376. case SLAPI_ABANDON_MSGID:
  2377. if(pblock->pb_op!=NULL)
  2378. {
  2379. pblock->pb_op->o_params.p.p_abandon.abandon_targetmsgid = *((int *) value);
  2380. }
  2381. break;
  2382. /* extended operation arguments */
  2383. case SLAPI_EXT_OP_REQ_OID:
  2384. if(pblock->pb_op!=NULL)
  2385. {
  2386. pblock->pb_op->o_params.p.p_extended.exop_oid = (char *) value;
  2387. }
  2388. break;
  2389. case SLAPI_EXT_OP_REQ_VALUE:
  2390. if(pblock->pb_op!=NULL)
  2391. {
  2392. pblock->pb_op->o_params.p.p_extended.exop_value = (struct berval *) value;
  2393. }
  2394. break;
  2395. /* extended operation return values */
  2396. case SLAPI_EXT_OP_RET_OID:
  2397. if(pblock->pb_op!=NULL)
  2398. {
  2399. pblock->pb_op->o_results.r.r_extended.exop_ret_oid = (char *) value;
  2400. }
  2401. break;
  2402. case SLAPI_EXT_OP_RET_VALUE:
  2403. if(pblock->pb_op!=NULL)
  2404. {
  2405. pblock->pb_op->o_results.r.r_extended.exop_ret_value = (struct berval *) value;
  2406. }
  2407. break;
  2408. /* matching rule plugin functions */
  2409. case SLAPI_PLUGIN_MR_FILTER_CREATE_FN:
  2410. SLAPI_PLUGIN_TYPE_CHECK (pblock, SLAPI_PLUGIN_MATCHINGRULE);
  2411. pblock->pb_plugin->plg_mr_filter_create = (IFP) value;
  2412. break;
  2413. case SLAPI_PLUGIN_MR_INDEXER_CREATE_FN:
  2414. SLAPI_PLUGIN_TYPE_CHECK (pblock, SLAPI_PLUGIN_MATCHINGRULE);
  2415. pblock->pb_plugin->plg_mr_indexer_create = (IFP) value;
  2416. break;
  2417. case SLAPI_PLUGIN_MR_FILTER_MATCH_FN:
  2418. pblock->pb_mr_filter_match_fn = (mrFilterMatchFn) value;
  2419. break;
  2420. case SLAPI_PLUGIN_MR_FILTER_INDEX_FN:
  2421. pblock->pb_mr_filter_index_fn = (IFP) value;
  2422. break;
  2423. case SLAPI_PLUGIN_MR_FILTER_RESET_FN:
  2424. pblock->pb_mr_filter_reset_fn = (IFP) value;
  2425. break;
  2426. case SLAPI_PLUGIN_MR_INDEX_FN:
  2427. pblock->pb_mr_index_fn = (IFP) value;
  2428. break;
  2429. /* matching rule plugin arguments */
  2430. case SLAPI_PLUGIN_MR_OID:
  2431. pblock->pb_mr_oid = (char *) value;
  2432. break;
  2433. case SLAPI_PLUGIN_MR_TYPE:
  2434. pblock->pb_mr_type = (char *) value;
  2435. break;
  2436. case SLAPI_PLUGIN_MR_VALUE:
  2437. pblock->pb_mr_value = (struct berval *) value;
  2438. break;
  2439. case SLAPI_PLUGIN_MR_VALUES:
  2440. pblock->pb_mr_values = (struct berval **) value;
  2441. break;
  2442. case SLAPI_PLUGIN_MR_KEYS:
  2443. pblock->pb_mr_keys = (struct berval **) value;
  2444. break;
  2445. case SLAPI_PLUGIN_MR_FILTER_REUSABLE:
  2446. pblock->pb_mr_filter_reusable = *(unsigned int *) value;
  2447. break;
  2448. case SLAPI_PLUGIN_MR_QUERY_OPERATOR:
  2449. pblock->pb_mr_query_operator = *(int *) value;
  2450. break;
  2451. case SLAPI_PLUGIN_MR_USAGE:
  2452. pblock->pb_mr_usage = *(unsigned int *) value;
  2453. break;
  2454. /* seq arguments */
  2455. case SLAPI_SEQ_TYPE:
  2456. pblock->pb_seq_type = *((int *)value);
  2457. break;
  2458. case SLAPI_SEQ_ATTRNAME:
  2459. pblock->pb_seq_attrname = (char *) value;
  2460. break;
  2461. case SLAPI_SEQ_VAL:
  2462. pblock->pb_seq_val = (char *) value;
  2463. break;
  2464. /* ldif2db arguments */
  2465. case SLAPI_LDIF2DB_FILE:
  2466. pblock->pb_ldif_file = (char *) value;
  2467. break;
  2468. case SLAPI_LDIF2DB_REMOVEDUPVALS:
  2469. pblock->pb_removedupvals = *((int *)value);
  2470. break;
  2471. case SLAPI_DB2INDEX_ATTRS:
  2472. pblock->pb_db2index_attrs = (char **) value;
  2473. break;
  2474. case SLAPI_LDIF2DB_NOATTRINDEXES:
  2475. pblock->pb_ldif2db_noattrindexes = *((int *)value);
  2476. break;
  2477. case SLAPI_LDIF2DB_GENERATE_UNIQUEID:
  2478. pblock->pb_ldif_generate_uniqueid = *((int *)value);
  2479. break;
  2480. case SLAPI_LDIF2DB_NAMESPACEID:
  2481. pblock->pb_ldif_namespaceid = (char *)value;
  2482. break;
  2483. /* db2ldif arguments */
  2484. case SLAPI_DB2LDIF_PRINTKEY:
  2485. pblock->pb_ldif_printkey = *((int *)value);
  2486. break;
  2487. case SLAPI_DB2LDIF_DUMP_UNIQUEID:
  2488. pblock->pb_ldif_dump_uniqueid = *((int *)value);
  2489. break;
  2490. /* db2ldif/ldif2db/db2bak/bak2db arguments */
  2491. case SLAPI_BACKEND_INSTANCE_NAME:
  2492. pblock->pb_instance_name = (char *) value;
  2493. break;
  2494. case SLAPI_BACKEND_TASK:
  2495. pblock->pb_task = (Slapi_Task *)value;
  2496. break;
  2497. case SLAPI_TASK_FLAGS:
  2498. pblock->pb_task_flags = *((int *)value);
  2499. break;
  2500. case SLAPI_DB2LDIF_SERVER_RUNNING:
  2501. pblock->pb_server_running = *((int *)value);
  2502. break;
  2503. case SLAPI_BULK_IMPORT_ENTRY:
  2504. pblock->pb_import_entry = (Slapi_Entry *)value;
  2505. break;
  2506. case SLAPI_BULK_IMPORT_STATE:
  2507. pblock->pb_import_state = *((int *)value);
  2508. break;
  2509. /* transaction arguments */
  2510. case SLAPI_PARENT_TXN:
  2511. pblock->pb_parent_txn = (void *)value;
  2512. break;
  2513. case SLAPI_TXN:
  2514. pblock->pb_txn = (void *)value;
  2515. break;
  2516. /* Search results set */
  2517. case SLAPI_SEARCH_RESULT_SET:
  2518. if(pblock->pb_op!=NULL)
  2519. {
  2520. pblock->pb_op->o_results.r.r_search.search_result_set = (void *)value;
  2521. }
  2522. break;
  2523. /* Search result - entry returned from iterating over result set */
  2524. case SLAPI_SEARCH_RESULT_ENTRY:
  2525. if(pblock->pb_op!=NULL)
  2526. {
  2527. pblock->pb_op->o_results.r.r_search.search_result_entry = (void *)value;
  2528. }
  2529. break;
  2530. case SLAPI_SEARCH_RESULT_ENTRY_EXT:
  2531. if(pblock->pb_op!=NULL)
  2532. {
  2533. pblock->pb_op->o_results.r.r_search.opaque_backend_ptr = (void *)value;
  2534. }
  2535. break;
  2536. /* Number of entries returned from search */
  2537. case SLAPI_NENTRIES:
  2538. if(pblock->pb_op!=NULL)
  2539. {
  2540. pblock->pb_op->o_results.r.r_search.nentries = *((int *)value);
  2541. }
  2542. break;
  2543. /* Referrals encountered while iterating over the result set */
  2544. case SLAPI_SEARCH_REFERRALS:
  2545. if(pblock->pb_op!=NULL)
  2546. {
  2547. pblock->pb_op->o_results.r.r_search.search_referrals = (struct berval **)value;
  2548. }
  2549. break;
  2550. case SLAPI_RESULT_CODE:
  2551. if (pblock->pb_op != NULL)
  2552. pblock->pb_op->o_results.result_code = (* (int *) value);
  2553. break;
  2554. case SLAPI_RESULT_MATCHED:
  2555. if (pblock->pb_op != NULL)
  2556. pblock->pb_op->o_results.result_matched = (char *) value;
  2557. break;
  2558. case SLAPI_RESULT_TEXT:
  2559. if (pblock->pb_op != NULL)
  2560. pblock->pb_op->o_results.result_text = (char *) value;
  2561. break;
  2562. case SLAPI_PB_RESULT_TEXT:
  2563. slapi_ch_free((void**)&(pblock->pb_result_text));
  2564. pblock->pb_result_text = slapi_ch_strdup ((char *) value);
  2565. break;
  2566. /* Size of the database, in kb */
  2567. case SLAPI_DBSIZE:
  2568. pblock->pb_dbsize = *((unsigned int *)value);
  2569. break;
  2570. /* ACL Plugin */
  2571. case SLAPI_PLUGIN_ACL_INIT:
  2572. pblock->pb_plugin->plg_acl_init = (IFP) value;
  2573. break;
  2574. case SLAPI_PLUGIN_ACL_SYNTAX_CHECK:
  2575. pblock->pb_plugin->plg_acl_syntax_check = (IFP) value;
  2576. break;
  2577. case SLAPI_PLUGIN_ACL_ALLOW_ACCESS:
  2578. pblock->pb_plugin->plg_acl_access_allowed = (IFP) value;
  2579. break;
  2580. case SLAPI_PLUGIN_ACL_MODS_ALLOWED:
  2581. pblock->pb_plugin->plg_acl_mods_allowed = (IFP) value;
  2582. break;
  2583. case SLAPI_PLUGIN_ACL_MODS_UPDATE:
  2584. pblock->pb_plugin->plg_acl_mods_update = (IFP) value;
  2585. break;
  2586. case SLAPI_CLIENT_DNS:
  2587. if (pblock->pb_conn == NULL) {
  2588. LDAPDebug( LDAP_DEBUG_ANY,
  2589. "Connection is NULL and hence cannot access SLAPI_CLIENT_DNS \n", 0, 0, 0 );
  2590. return (-1);
  2591. }
  2592. pblock->pb_conn->c_domain = *((struct berval ***) value );
  2593. break;
  2594. /* Command line arguments */
  2595. case SLAPI_ARGC:
  2596. pblock->pb_slapd_argc= *((int *)value);
  2597. break;
  2598. case SLAPI_ARGV:
  2599. pblock->pb_slapd_argv = *((char***)value);
  2600. break;
  2601. /* Config file directory */
  2602. case SLAPI_CONFIG_DIRECTORY:
  2603. pblock->pb_slapd_configdir = (char *)value;
  2604. break;
  2605. /* password storage scheme (kexcoff) */
  2606. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_NAME:
  2607. pblock->pb_plugin->plg_pwdstorageschemename = (char *)value;
  2608. break;
  2609. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_USER_PWD:
  2610. pblock->pb_pwd_storage_scheme_user_passwd = (char *)value;
  2611. break;
  2612. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DB_PWD:
  2613. pblock->pb_pwd_storage_scheme_db_passwd = (char *)value;
  2614. break;
  2615. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_ENC_FN:
  2616. pblock->pb_plugin->plg_pwdstorageschemeenc = (CFP)value;
  2617. break;
  2618. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DEC_FN:
  2619. pblock->pb_plugin->plg_pwdstorageschemedec = (IFP)value;
  2620. break;
  2621. case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_CMP_FN:
  2622. /* must provide a comparison function */
  2623. if ( value == NULL )
  2624. {
  2625. return(-1);
  2626. }
  2627. pblock->pb_plugin->plg_pwdstorageschemecmp = (IFP)value;
  2628. break;
  2629. /* entry fetch store */
  2630. case SLAPI_PLUGIN_ENTRY_FETCH_FUNC:
  2631. pblock->pb_plugin->plg_entryfetchfunc = (IFP) value;
  2632. break;
  2633. case SLAPI_PLUGIN_ENTRY_STORE_FUNC:
  2634. pblock->pb_plugin->plg_entrystorefunc = (IFP) value;
  2635. break;
  2636. /* DSE add parameters */
  2637. case SLAPI_DSE_DONT_WRITE_WHEN_ADDING:
  2638. pblock->pb_dse_dont_add_write = *((int *)value);
  2639. break;
  2640. /* DSE add parameters */
  2641. case SLAPI_DSE_MERGE_WHEN_ADDING:
  2642. pblock->pb_dse_add_merge = *((int *)value);
  2643. break;
  2644. /* DSE add parameters */
  2645. case SLAPI_DSE_DONT_CHECK_DUPS:
  2646. pblock->pb_dse_dont_check_dups = *((int *)value);
  2647. break;
  2648. /* DSE modify parameters */
  2649. case SLAPI_DSE_REAPPLY_MODS:
  2650. pblock->pb_dse_reapply_mods = *((int *)value);
  2651. break;
  2652. /* DSE read parameters */
  2653. case SLAPI_DSE_IS_PRIMARY_FILE:
  2654. pblock->pb_dse_is_primary_file = *((int *)value);
  2655. break;
  2656. /* used internally by schema code only */
  2657. case SLAPI_SCHEMA_USER_DEFINED_ONLY:
  2658. pblock->pb_schema_user_defined_only = *((int *)value);
  2659. break;
  2660. case SLAPI_URP_NAMING_COLLISION_DN:
  2661. pblock->pb_urp_naming_collision_dn = (char *)value;
  2662. break;
  2663. case SLAPI_URP_TOMBSTONE_UNIQUEID:
  2664. pblock->pb_urp_tombstone_uniqueid = (char *)value;
  2665. break;
  2666. case SLAPI_LDIF2DB_ENCRYPT:
  2667. case SLAPI_DB2LDIF_DECRYPT:
  2668. pblock->pb_ldif_encrypt = (int)value;
  2669. break;
  2670. default:
  2671. LDAPDebug( LDAP_DEBUG_ANY,
  2672. "Unknown parameter block argument %d\n", arg, 0, 0 );
  2673. return( -1 );
  2674. }
  2675. return( 0 );
  2676. }
  2677. /*
  2678. * Clears (and free's as appropriate) the bind DN and related credentials
  2679. * for the connection `conn'.
  2680. *
  2681. * If `lock_conn' is true, 'conn' is locked before touching it; otherwise
  2682. * this function assumes that conn->c_mutex is ALREADY locked.
  2683. *
  2684. * If `clear_externalcreds' is true, the external DN, external authtype,
  2685. * and client certificate are also cleared and free'd.
  2686. *
  2687. * Connection structure members that are potentially changed by this function:
  2688. * c_dn, c_isroot, c_authtype
  2689. * c_external_dn, c_external_authtype, c_client_cert
  2690. *
  2691. * This function might better belong on bind.c or perhaps connection.c but
  2692. * it needs to be in libslapd because FE code and libslapd code calls it.
  2693. */
  2694. void
  2695. bind_credentials_clear( Connection *conn, PRBool lock_conn,
  2696. PRBool clear_externalcreds )
  2697. {
  2698. if ( lock_conn ) {
  2699. PR_Lock( conn->c_mutex );
  2700. }
  2701. if ( conn->c_dn != NULL ) { /* a non-anonymous bind has occurred */
  2702. reslimit_update_from_entry( conn, NULL ); /* clear resource limits */
  2703. if ( conn->c_dn != conn->c_external_dn ) {
  2704. slapi_ch_free((void**)&conn->c_dn);
  2705. }
  2706. conn->c_dn = NULL;
  2707. }
  2708. slapi_ch_free((void**)&conn->c_authtype);
  2709. conn->c_isroot = 0;
  2710. conn->c_authtype = slapi_ch_strdup(SLAPD_AUTH_NONE);
  2711. if ( clear_externalcreds ) {
  2712. slapi_ch_free( (void**)&conn->c_external_dn );
  2713. conn->c_external_dn = NULL;
  2714. conn->c_external_authtype = SLAPD_AUTH_NONE;
  2715. if ( conn->c_client_cert ) {
  2716. CERT_DestroyCertificate (conn->c_client_cert);
  2717. conn->c_client_cert = NULL;
  2718. }
  2719. }
  2720. if ( lock_conn ) {
  2721. PR_Unlock( conn->c_mutex );
  2722. }
  2723. }
  2724. /*
  2725. * Clear and then set the bind DN and related credentials for the
  2726. * connection `conn'.
  2727. *
  2728. * `authtype' should be one of the SLAPD_AUTH_... constants defined in
  2729. * slapu-plugin.h or NULL.
  2730. *
  2731. * `normdn' must be a normalized DN and it must be malloc'd memory (it
  2732. * is consumed by this function). If there is an existing DN value
  2733. * associated with the connection, it is free'd. Pass NULL for `normdn'
  2734. * to clear the DN.
  2735. *
  2736. * If `extauthtype' is non-NULL we also clear and then set the
  2737. * external (e.g., SSL) credentials from the `externaldn' and `clientcert'.
  2738. * Note that it is okay for `externaldn' and 'normdn' to have the same
  2739. * (pointer) value. This code and that in bind_credentials_clear()
  2740. * is smart enough to know to only free the memory once. Like `normdn',
  2741. * `externaldn' and `clientcert' should be NULL or point to malloc'd memory
  2742. * as they are both consumed by this function.
  2743. *
  2744. * We also:
  2745. *
  2746. * 1) Test to see if the DN is the root DN and set the c_isroot flag
  2747. * appropriately.
  2748. * And
  2749. *
  2750. * 2) Call the binder-based resource limits subsystem so it can
  2751. * update the per-connection resource limit data it maintains.
  2752. *
  2753. * Note that this function should ALWAYS be used instead of manipulating
  2754. * conn->c_dn directly; otherwise, subsystems like the binder-based resource
  2755. * limits (see resourcelimit.c) won't be called.
  2756. *
  2757. * It is also acceptable to set the DN via a call slapi_pblock_set(), e.g.,
  2758. *
  2759. * slapi_pblock_set( pb, SLAPI_CONN_DN, ndn );
  2760. *
  2761. * because it calls this function.
  2762. *
  2763. * Connection structure members that are potentially changed by this function:
  2764. * c_dn, c_isroot, c_authtype
  2765. * c_external_dn, c_external_authtype, c_client_cert
  2766. *
  2767. * This function might better belong on bind.c or perhaps connection.c but
  2768. * it needs to be in libslapd because FE code and libslapd code calls it.
  2769. */
  2770. void
  2771. bind_credentials_set( Connection *conn, char *authtype, char *normdn,
  2772. char *extauthtype, char *externaldn, CERTCertificate *clientcert, Slapi_Entry * bind_target_entry )
  2773. {
  2774. PR_Lock( conn->c_mutex );
  2775. /* clear credentials */
  2776. bind_credentials_clear( conn, PR_FALSE /* conn is already locked */,
  2777. ( extauthtype != NULL ) /* clear external creds. if requested */ );
  2778. /* set primary credentials */
  2779. slapi_ch_free((void**)&conn->c_authtype);
  2780. conn->c_authtype = slapi_ch_strdup(authtype);
  2781. conn->c_dn = normdn;
  2782. conn->c_isroot = slapi_dn_isroot( normdn );
  2783. /* set external credentials if requested */
  2784. if ( extauthtype != NULL ) {
  2785. conn->c_external_authtype = extauthtype;
  2786. conn->c_external_dn = externaldn;
  2787. conn->c_client_cert = clientcert;
  2788. }
  2789. /* notify binder-based resource limit subsystem about the change in DN */
  2790. if ( !conn->c_isroot )
  2791. {
  2792. if ( conn->c_dn != NULL ) {
  2793. if ( bind_target_entry == NULL )
  2794. {
  2795. Slapi_DN *sdn;
  2796. sdn = slapi_sdn_new_dn_byref( conn->c_dn ); /* set */
  2797. reslimit_update_from_dn( conn, sdn );
  2798. slapi_sdn_free( &sdn );
  2799. }
  2800. else
  2801. reslimit_update_from_entry( conn, bind_target_entry );
  2802. }
  2803. }
  2804. PR_Unlock( conn->c_mutex );
  2805. }