| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669 |
- /* BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK */
- #ifdef HAVE_CONFIG_H
- # include <config.h>
- #endif
- /*! \file slapi-plugin.h
- * \brief Public Directory Server plugin interface.
- *
- * The SLAPI plugin interface allows complex plugins to be created
- * for Directory Server.
- */
- #ifndef _SLAPIPLUGIN
- #define _SLAPIPLUGIN
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "prtypes.h"
- #include "ldap.h"
- #include "prprf.h"
- NSPR_API(PRUint32) PR_snprintf(char *out, PRUint32 outlen, const char *fmt, ...)
- #ifdef __GNUC__
- __attribute__ ((format (printf, 3, 4)));
- #else
- ;
- #endif
- NSPR_API(char*) PR_smprintf(const char *fmt, ...)
- #ifdef __GNUC__
- __attribute__ ((format (printf, 1, 2)));
- #else
- ;
- #endif
- NSPR_API(char*) PR_sprintf_append(char *last, const char *fmt, ...)
- #ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)));
- #else
- ;
- #endif
- NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
- #ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)));
- #else
- ;
- #endif
- /* NSPR uses the print macros a bit differently than ANSI C. We
- * need to use ll for a 64-bit integer, even when a long is 64-bit.
- */
- #define NSPRIu64 "llu"
- #define NSPRI64 "ll"
- /*
- * The slapi_attr_get_flags() routine returns a bitmap that contains one or
- * more of these values.
- *
- * Note that the flag values 0x0010, 0x0020, 0x4000, and 0x8000 are reserved.
- */
- #define SLAPI_ATTR_FLAG_SINGLE 0x0001 /* single-valued attribute */
- #define SLAPI_ATTR_FLAG_OPATTR 0x0002 /* operational attribute */
- #define SLAPI_ATTR_FLAG_READONLY 0x0004 /* read from shipped config file */
- #define SLAPI_ATTR_FLAG_STD_ATTR SLAPI_ATTR_FLAG_READONLY /* alias for read only */
- #define SLAPI_ATTR_FLAG_OBSOLETE 0x0040 /* an outdated definition */
- #define SLAPI_ATTR_FLAG_COLLECTIVE 0x0080 /* collective (not supported) */
- #define SLAPI_ATTR_FLAG_NOUSERMOD 0x0100 /* can't be modified over LDAP */
- #define SLAPI_ATTR_FLAG_NORMALIZED 0x0200 /* the attr value is normalized */
- /* operation flags */
- #define SLAPI_OP_FLAG_INTERNAL 0x00020 /* An operation generated by the core server or a plugin. */
- #define SLAPI_OP_FLAG_NEVER_CHAIN 0x00800 /* Do not chain the operation */
- #define SLAPI_OP_FLAG_NO_ACCESS_CHECK 0x10000 /* Do not check for access control - bypass them */
- #define SLAPI_OC_FLAG_REQUIRED 0x0001
- #define SLAPI_OC_FLAG_ALLOWED 0x0002
- /*
- * access control levels
- */
- #define SLAPI_ACL_COMPARE 0x01
- #define SLAPI_ACL_SEARCH 0x02
- #define SLAPI_ACL_READ 0x04
- #define SLAPI_ACL_WRITE 0x08
- #define SLAPI_ACL_DELETE 0x10
- #define SLAPI_ACL_ADD 0x20
- #define SLAPI_ACL_SELF 0x40
- #define SLAPI_ACL_PROXY 0x80
- #define SLAPI_ACL_ALL 0x7f
- /*
- * filter types
- * openldap defines these, but not mozldap
- */
- #ifndef LDAP_FILTER_AND
- #define LDAP_FILTER_AND 0xa0L
- #endif
- #ifndef LDAP_FILTER_OR
- #define LDAP_FILTER_OR 0xa1L
- #endif
- #ifndef LDAP_FILTER_NOT
- #define LDAP_FILTER_NOT 0xa2L
- #endif
- #ifndef LDAP_FILTER_EQUALITY
- #define LDAP_FILTER_EQUALITY 0xa3L
- #endif
- #ifndef LDAP_FILTER_SUBSTRINGS
- #define LDAP_FILTER_SUBSTRINGS 0xa4L
- #endif
- #ifndef LDAP_FILTER_GE
- #define LDAP_FILTER_GE 0xa5L
- #endif
- #ifndef LDAP_FILTER_LE
- #define LDAP_FILTER_LE 0xa6L
- #endif
- #ifndef LDAP_FILTER_PRESENT
- #define LDAP_FILTER_PRESENT 0x87L
- #endif
- #ifndef LDAP_FILTER_APPROX
- #define LDAP_FILTER_APPROX 0xa8L
- #endif
- #ifndef LDAP_FILTER_EXTENDED
- #ifdef LDAP_FILTER_EXT
- #define LDAP_FILTER_EXTENDED LDAP_FILTER_EXT
- #else
- #define LDAP_FILTER_EXTENDED 0xa9L
- #endif
- #endif
- #ifndef LBER_END_OF_SEQORSET
- #define LBER_END_OF_SEQORSET ((ber_tag_t) -2) /* 0xfffffffeU */
- #endif
- #ifndef LDAP_CHANGETYPE_ADD
- #ifdef LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_ADD
- #define LDAP_CHANGETYPE_ADD LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_ADD
- #else
- #define LDAP_CHANGETYPE_ADD 1
- #endif
- #endif
- #ifndef LDAP_CHANGETYPE_DELETE
- #ifdef LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_DELETE
- #define LDAP_CHANGETYPE_DELETE LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_DELETE
- #else
- #define LDAP_CHANGETYPE_DELETE 2
- #endif
- #endif
- #ifndef LDAP_CHANGETYPE_MODIFY
- #ifdef LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_MODIFY
- #define LDAP_CHANGETYPE_MODIFY LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_MODIFY
- #else
- #define LDAP_CHANGETYPE_MODIFY 4
- #endif
- #endif
- #ifndef LDAP_CHANGETYPE_MODDN
- #ifdef LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_RENAME
- #define LDAP_CHANGETYPE_MODDN LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_RENAME
- #else
- #define LDAP_CHANGETYPE_MODDN 8
- #endif
- #endif
- #ifndef LDAP_CHANGETYPE_ANY
- #define LDAP_CHANGETYPE_ANY (1|2|4|8)
- #endif
- #ifndef LDAP_CONTROL_PERSISTENTSEARCH
- #ifdef LDAP_CONTROL_PERSIST_REQUEST
- #define LDAP_CONTROL_PERSISTENTSEARCH LDAP_CONTROL_PERSIST_REQUEST
- #else
- #define LDAP_CONTROL_PERSISTENTSEARCH "2.16.840.1.113730.3.4.3"
- #endif
- #endif
- #ifndef LDAP_CONTROL_ENTRYCHANGE
- #ifdef LDAP_CONTROL_PERSIST_ENTRY_CHANGE_NOTICE
- #define LDAP_CONTROL_ENTRYCHANGE LDAP_CONTROL_PERSIST_ENTRY_CHANGE_NOTICE
- #else
- #define LDAP_CONTROL_ENTRYCHANGE "2.16.840.1.113730.3.4.7"
- #endif
- #endif
- #ifndef LDAP_CONTROL_PWEXPIRED
- #define LDAP_CONTROL_PWEXPIRED "2.16.840.1.113730.3.4.4"
- #endif
- #ifndef LDAP_CONTROL_PWEXPIRING
- #define LDAP_CONTROL_PWEXPIRING "2.16.840.1.113730.3.4.5"
- #endif
- #ifndef LDAP_X_CONTROL_PWPOLICY_REQUEST
- #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
- #define LDAP_X_CONTROL_PWPOLICY_REQUEST LDAP_CONTROL_PASSWORDPOLICYREQUEST
- #else
- #define LDAP_X_CONTROL_PWPOLICY_REQUEST "1.3.6.1.4.1.42.2.27.8.5.1"
- #endif
- #endif
- #ifndef LDAP_X_CONTROL_PWPOLICY_RESPONSE
- #ifdef LDAP_CONTROL_PASSWORDPOLICYRESPONSE
- #define LDAP_X_CONTROL_PWPOLICY_RESPONSE LDAP_CONTROL_PASSWORDPOLICYRESPONSE
- #else
- #define LDAP_X_CONTROL_PWPOLICY_RESPONSE "1.3.6.1.4.1.42.2.27.8.5.1"
- #endif
- #endif
- #ifndef LDAP_CONTROL_PROXYAUTH
- #define LDAP_CONTROL_PROXYAUTH "2.16.840.1.113730.3.4.12" /* version 1 */
- #endif
- #ifndef LDAP_CONTROL_PROXIEDAUTH
- #ifdef LDAP_CONTROL_PROXY_AUTHZ
- #define LDAP_CONTROL_PROXIEDAUTH LDAP_CONTROL_PROXY_AUTHZ
- #else
- #define LDAP_CONTROL_PROXIEDAUTH "2.16.840.1.113730.3.4.18" /* version 2 */
- #endif
- #endif
- #ifndef LDAP_CONTROL_AUTH_REQUEST
- #define LDAP_CONTROL_AUTH_REQUEST "2.16.840.1.113730.3.4.16"
- #endif
- #ifndef LDAP_SORT_CONTROL_MISSING
- #define LDAP_SORT_CONTROL_MISSING 0x3C /* 60 (server side sort extn) */
- #endif
- #ifndef LDAP_INDEX_RANGE_ERROR
- #define LDAP_INDEX_RANGE_ERROR 0x3D /* 61 (VLV extn) */
- #endif
- /* openldap does not use this */
- #ifndef LBER_OVERFLOW
- #define LBER_OVERFLOW ((ber_tag_t) -3) /* 0xfffffffdU */
- #endif
- /*
- * Sequential access types
- */
- #define SLAPI_SEQ_FIRST 1
- #define SLAPI_SEQ_LAST 2
- #define SLAPI_SEQ_PREV 3
- #define SLAPI_SEQ_NEXT 4
- /*
- * return codes from a backend API call
- */
- #define SLAPI_FAIL_GENERAL -1
- #define SLAPI_FAIL_DISKFULL -2
- /*
- * return codes used by BIND functions
- */
- #define SLAPI_BIND_SUCCESS 0 /* front end will send result */
- #define SLAPI_BIND_FAIL 2 /* back end should send result */
- #define SLAPI_BIND_ANONYMOUS 3 /* front end will send result */
- /* commonly used attributes names */
- #define SLAPI_ATTR_UNIQUEID "nsuniqueid"
- #define SLAPI_ATTR_OBJECTCLASS "objectclass"
- #define SLAPI_ATTR_VALUE_TOMBSTONE "nsTombstone"
- #define SLAPI_ATTR_VALUE_PARENT_UNIQUEID "nsParentUniqueID"
- #define SLAPI_ATTR_NSCP_ENTRYDN "nscpEntryDN"
- #define SLAPI_ATTR_ENTRYUSN "entryusn"
- #define SLAPI_ATTR_ENTRYUSN_PREV "preventryusn"
- /* opaque structures */
- /**
- * Contains name-value pairs, known as parameter blocks, that you can get or set for
- * each LDAP operation.
- *
- * #Slapi_PBlock contains name-value pairs that you can use to retrieve information
- * from the server and set information to be used by the server.
- *
- * For most types of plug-in functions, the server passes in a #Slapi_PBlock
- * structure that typically includes data relevant to the operation being processed.
- * You can get the value of a parameter by calling the slapi_pblock_get() function.
- *
- * For example, when the plug-in function for an LDAP bind operation is called, the
- * server puts the DN and credentials in the #SLAPI_BIND_TARGET and
- * #SLAPI_BIND_CREDENTIALS parameters of the Slapi_PBlock structure. You can
- * call slapi_pblock_get() to get the DN and credentials of the client requesting
- * authentication.
- *
- * For plug-in initialization functions, you can use the #Slapi_PBlock structure to
- * pass information to the server, such as the description of your plug-in and the
- * names of your plug-in functions. You can set the value of a parameter by calling
- * the slapi_pblock_set() function.
- *
- * For example, in order to register a pre-operation bind plug-in function, you need to
- * call slapi_pblock_set() to set the version number, description, and name of the
- * plug-in function as the #SLAPI_PLUGIN_VERSION, #SLAPI_PLUGIN_DESCRIPTION,
- * and #SLAPI_PLUGIN_PRE_BIND_FN parameters.
- *
- * The available parameters that you can use depends on the type of plug-in function
- * you are writing.
- */
- typedef struct slapi_pblock Slapi_PBlock;
- /**
- * Represents an entry in the directory.
- *
- * #Slapi_Entry is the data type for an opaque structure that represents an entry in
- * the directory. In certain cases, your server plug-in may need to work with an entry
- * in the directory.
- */
- typedef struct slapi_entry Slapi_Entry;
- /**
- * Represents an attribute in an entry.
- *
- * #Slapi_Attr is the data type for an opaque structure that represents an attribute
- * in a directory entry. In certain cases, your server plug-in may need to work with
- * an entry’s attributes.
- */
- typedef struct slapi_attr Slapi_Attr;
- /**
- * Represents the value of the attribute in a directory entry.
- *
- * #Slapi_Value is the data type for an opaque structure that represents the value of
- * an attribute in a directory entry.
- */
- typedef struct slapi_value Slapi_Value;
- /**
- * Represents a set of Slapi_Value (or a list of Slapi_Value).
- *
- * #Slapi_ValueSet is the data type for an opaque structure that represents set of
- * #Slapi_Value (or a list of #Slapi_Value).
- */
- typedef struct slapi_value_set Slapi_ValueSet;
- /**
- * Represents a search filter.
- *
- * #Slapi_Filter is the data type for an opaque structure that represents an search
- * filter.
- */
- typedef struct slapi_filter Slapi_Filter;
- /**
- * Represents a backend operation in the server plug-in.
- *
- * #Slapi_Backend is the data type for an opaque structure that represents a backend
- * operation.
- */
- typedef struct backend Slapi_Backend;
- /**
- * Represents the unique identifier of a directory entry.
- *
- * #Slapi_UniqueID is the data type for an opaque structure that represents the
- * unique identifier of a directory entry. All directory entries contain a unique
- * identifier. Unlike the distinguished name (DN), the unique identifier of an entry
- * never changes, providing a good way to refer unambiguously to an entry in a
- * distributed/replicated environment.
- */
- typedef struct _guid_t Slapi_UniqueID;
- /**
- * Represents an operation pending from an LDAP client.
- *
- * #Slapi_Operation is the data type for an opaque structure that represents an
- * operation pending from an LDAP client.
- */
- typedef struct op Slapi_Operation;
- /**
- * Represents a connection.
- *
- * #Slapi_Connection is the data type for an opaque structure that represents a
- * connection.
- */
- typedef struct conn Slapi_Connection;
- /**
- * Represents a distinguished name in a directory entry.
- *
- * #Slapi_DN is the data type for an opaque structure that represents a distinguished
- * name in the server plug-in.
- */
- typedef struct slapi_dn Slapi_DN;
- /**
- * Represents a relative distinguished name in a directory entry.
- *
- * #Slapi_RDN is the data type for an opaque structure that represents a relative
- * distinguished name in the server plug-in.
- */
- typedef struct slapi_rdn Slapi_RDN;
- /**
- * Represents a single LDAP modification to a directory entry.
- *
- * #Slapi_Mod is the data type for an opaque structure that represents LDAPMod
- * modifications to an attribute in a directory entry.
- */
- typedef struct slapi_mod Slapi_Mod;
- /**
- * Represents two or more LDAP modifications to a directory entry
- *
- * #Slapi_Mods is the data type for an opaque structure that represents LDAPMod
- * manipulations that can be made to a directory entry.
- */
- typedef struct slapi_mods Slapi_Mods;
- /**
- * Represents a the component ID in a directory entry.
- *
- * #Slapi_ComponentId is the data type for an opaque structure that represents the
- * component ID in a directory entry.
- */
- typedef struct slapi_componentid Slapi_ComponentId;
- /**
- * Represents an integral counter.
- *
- * Provides 64-bit integers with support for atomic operations, even on 32-bit
- * systems. This lets your plug-in have global integers that can be updated by
- * multiple worker threads in a thread-safe manner.
- *
- * The #Slapi_Counter structure is a wrapper around the actual counter value
- */
- typedef struct slapi_counter Slapi_Counter;
- /* Online tasks interface (to support import, export, etc) */
- #define SLAPI_TASK_PUBLIC 1 /* tell old plugins that the task api is now public */
- /**
- * An opaque structure that represents a task that has been initiated.
- *
- * Common Directory Server tasks, including importing, exporting, and indexing
- * databases, can be initiated through a special task configuration entry in
- * cn=tasks,cn=config. These task operations are managed using the #Slapi_Task
- * structure.
- */
- typedef struct slapi_task Slapi_Task;
- /**
- * Defines a callback used specifically by Slapi_Task structure cancel and
- * destructor functions.
- *
- * \param task The task that is being cancelled or destroyed.
- */
- typedef void (*TaskCallbackFn)(Slapi_Task *task);
- /*
- * The default thread stacksize for nspr21 is 64k (except on IRIX! It's 32k!).
- * For OSF, we require a larger stacksize as actual storage allocation is
- * higher i.e pointers are allocated 8 bytes but lower 4 bytes are used.
- * The value 0 means use the default stacksize.
- *
- * larger stacksize (256KB) is needed on IRIX due to its 4KB BUFSIZ.
- * (@ pthread IRIX porting -- 01/11/99)
- *
- * Don't know why HP was defined as follows up until DS6.1x. HP BUFSIZ is 1KB
- #elif ( defined( hpux ))
- #define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
- */
- #if ( defined( irix ))
- #define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
- #elif ( defined ( OSF1 ))
- #define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
- #elif ( defined ( AIX ))
- #define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
- /* All other platforms use the default stack size */
- #else
- #define SLAPD_DEFAULT_THREAD_STACKSIZE 0
- #endif
- /*---------------------------
- * parameter block routines
- *--------------------------*/
- /**
- * Creates a new parameter block.
- *
- * \return This function returns a pointer to the new parameter block.
- * \warning The pblock pointer allocated with this function must always be freed by
- * slapi_pblock_destroy(). The use of other memory deallocators (for example,
- * <tt>free()</tt>) is not supported and may lead to crashes or memory leaks.
- * \see slapi_pblock_destroy()
- */
- Slapi_PBlock *slapi_pblock_new( void ); /* allocate and initialize */
- /**
- * Initializes an existing parameter block for re-use.
- *
- * \param pb The parameter block to initialize.
- * \warning The parameter block that you wish to free must have been created using
- * slapi_pblock_new(). When you are finished with the parameter block, you
- * must free it using the slapi_pblock_destroy() function.
- *
- * \warning Note that search results will not be freed from the parameter block by
- * slapi_pblock_init(). You must free any internal search results with the
- * slapi_free_search_results_internal() function prior to calling
- * slapi_pblock_init(), otherwise the search results will be leaked.
- * \see slapi_pblock_new()
- * \see slapi_pblock_destroy()
- * \see slapi_free_search_results_internal()
- */
- void slapi_pblock_init( Slapi_PBlock *pb ); /* clear out for re-use */
- /**
- * Gets the value of a name-value pair from a parameter block.
- *
- * \param pb Parameter block.
- * \param arg ID of the name-value pair that you want to get.
- * \param value Pointer to the value retrieved from the parameter block.
- * \return \c 0 if successful.
- * \return \c -1 if an error occurs (for example, if an invalid ID is specified).
- * \todo Document valid values for the ID.
- * \warning The <tt>void *value</tt> argument should always be a pointer to the
- * type of value you are retrieving:
- * \code
- * int connid = 0;
- * ...
- * retval = slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
- * \endcode
- *
- * \warning #SLAPI_CONN_ID is an integer value, so you will pass in a pointer
- * to/address of an integer to get the value. Similarly, for a
- * <tt>char *</tt> value (a string), pass in a pointer to/address of the value.
- * For example:
- * \code
- * char *binddn = NULL;
- * ...
- * retval = slapi_pblock_get(pb, SLAPI_CONN_DN, &binddn);
- * \endcode
- *
- * \warning With certain compilers on some platforms, you may have to cast the
- * value to <tt>(void *)</tt>.
- *
- * \warning We recommend that you set the value to \c 0 or \c NULL before calling
- * slapi_pblock_get() to avoid reading from uninitialized memory, in
- * case the call to slapi_pblock_get() fails.
- *
- * \warning In most instances, the caller should not free the returned value.
- * The value will usually be freed internally or through the call to
- * slapi_pblock_destroy(). The exception is if the value is explicitly
- * set by the caller through slapi_pblock_set(). In this case, the caller
- * is responsible for memory management. If the value is freed, it is
- * strongly recommended that the free is followed by a call to
- * slapi_pblock_set() with a value of \c NULL. For example:
- * \code
- * char *someparam = NULL;
- * ...
- * someparam = slapi_ch_strdup(somestring);
- * slapi_pblock_set(pb, SOME_PARAM, someparam);
- * someparam = NULL;
- * ...
- * slapi_pblock_get(pb, SOME_PARAM, &someparam);
- * slapi_pblock_set(pb, SOME_PARAM, NULL);
- * slapi_ch_free_string(&someparam);
- * ...
- * \endcode
- *
- * \warning Some internal functions may change the value passed in, so it is
- * recommended to use slapi_pblock_get() to retrieve the value again,
- * rather than relying on a potential dangling pointer. This is shown
- * in the example above, which sets someparam to \c NULL after setting
- * it in the pblock.
- *
- * \see slapi_pblock_destroy()
- * \see slapi_pblock_set()
- */
- int slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value );
- /**
- * Sets the value of a name-value pair in a parameter block.
- *
- * \param pb Parameter block.
- * \param arg ID of the name-value pair that you want to get.
- * \param value Pointer to the value you want to set in the parameter block.
- * \return \c 0 if successful.
- * \return \c -1 if an error occurs (for example, if an invalid ID is specified).
- * \warning The value to be passed in must always be a pointer, even for integer
- * arguments. For example, if you wanted to do a search with the
- * \c ManageDSAIT control:
- * \code
- * int managedsait = 1;
- * ...
- * slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, &managedsait);
- * \endcode
- *
- * \warning A call similar to the following example will cause a crash:
- * \code
- * slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, 1);
- * \endcode
- *
- * \warning However, for values which are already pointers, (<tt>char * string</tt>,
- * <tt>char **arrays</tt>, <tt>#Slapi_Backend *</tt>, etc.), you can pass
- * in the value directly. For example:
- * \code
- * char *target_dn = slapi_ch_strdup(some_dn);
- * slapi_pblock_set(pb, SLAPI_TARGET_DN, target_dn);
- * \endcode
- *
- * \warning or
- * \code
- * slapi_pblock_set(pb, SLAPI_TARGET_DN, NULL);
- * \endcode
- *
- * \warning With some compilers, you will have to cast the value argument to
- * <tt>(void *)</tt>. If the caller allocates the memory passed in, the
- * caller is responsible for freeing that memory. Also, it is recommended
- * to use slapi_pblock_get() to retrieve the value to free, rather than
- * relying on a potentially dangling pointer. See the slapi_pblock_get()
- * example for more details.
- *
- * \warning When setting parameters to register a plug-in, the plug-in type must
- * always be set first, since many of the plug-in parameters depend on
- * the type. For example, set the #SLAPI_PLUGIN_TYPE to extended
- * operation before setting the list of extended operation OIDs for
- * the plug-in.
- *
- * \see slapi_pblock_get()
- */
- int slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value );
- /**
- * Frees the specified parameter block from memory.
- *
- * \param pb Parameter block you want to free.
- * \warning The parameter block that you wish to free must have been created
- * using slapi_pblock_new(). Use of this function with parameter
- * blocks allocated on the stack (for example, <tt>#Slapi_PBlock pb;</tt>)
- * or using another memory allocator is not supported and may lead to
- * memory errors and memory leaks. For example:
- * \code
- * Slapi_PBlock *pb = malloc(sizeof(Slapi_PBlock));
- * \endcode
- *
- * \warning After calling this function, you should set the parameter block
- * pointer to \c NULL to avoid reusing freed memory in your function
- * context, as in the following:
- * \code
- * slapi_pblock_destroy(pb);
- * pb =NULL;
- * \endcode
- *
- * \warning If you reuse the pointer in this way, it makes it easier to
- * identify a Segmentation Fault, rather than using some difficult
- * method to detect memory leaks or other abnormal behavior.
- *
- * \warning It is safe to call this function with a \c NULL pointer. For
- * example:
- * \code
- * Slapi_PBlock *pb = NULL;
- * slapi_pblock_destroy(pb);
- * \endcode
- *
- * \warning This saves the trouble of checking for \c NULL before calling
- * slapi_pblock_destroy().
- *
- * \see slapi_pblock_new()
- */
- void slapi_pblock_destroy( Slapi_PBlock *pb );
- /*----------------
- * entry routines
- *---------------*/
- /**
- * Converts an LDIF description of a directory entry (a string value) into
- * an entry of the #Slapi_Entry type.
- *
- * A directory entry can be described by a string in LDIF format. Calling
- * the slapi_str2entry() function converts a string description in this
- * format to a #Slapi_Entry structure, which you can pass to other API
- * functions.
- *
- * \param s Description of an entry that you want to convert to a #Slapi_Entry.
- * \param flags One or more flags specifying how the entry should be generated.
- * The valid values of the \c flags argument are:
- * \arg #SLAPI_STR2ENTRY_REMOVEDUPVALS
- * \arg #SLAPI_STR2ENTRY_ADDRDNVALS
- * \arg #SLAPI_STR2ENTRY_BIGENTRY
- * \arg #SLAPI_STR2ENTRY_TOMBSTONE_CHECK
- * \arg #SLAPI_STR2ENTRY_IGNORE_STATE
- * \arg #SLAPI_STR2ENTRY_INCLUDE_VERSION_STR
- * \arg #SLAPI_STR2ENTRY_EXPAND_OBJECTCLASSES
- * \arg #SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF
- * \arg #SLAPI_STR2ENTRY_NO_SCHEMA_LOCK
- * \return A pointer to the #Slapi_Entry structure representing the entry.
- * \return \c NULL if the string cannot be converted; for example, if no DN is
- * specified in the string.
- * \warning This function modifies the string argument s. If you still need to
- * use this string value, you should make a copy of this string before
- * calling slapi_str2entry().
- *
- * \warning When you are done working with the entry, you should call the
- * slapi_entry_free() function.
- *
- * \note To convert an entry to a string description, call the slapi_entry2str()
- * function.
- *
- * \see slapi_entry_free()
- * \see slapi_entry2str()
- */
- Slapi_Entry *slapi_str2entry( char *s, int flags );
- /*-----------------------------
- * Flags for slapi_str2entry()
- *----------------------------*/
- /**
- * Removes any duplicate values in the attributes of the entry.
- *
- * \see slapi_str2entry()
- */
- #define SLAPI_STR2ENTRY_REMOVEDUPVALS 1
- /**
- * Adds the relative distinguished name (RDN) components (for example,
- * \c uid=bjensen) as attributes of the entry.
- *
- * \see slapi_str2entry()
- */
- #define SLAPI_STR2ENTRY_ADDRDNVALS 2
- /**
- * Provide a hint that the entry is large. This enables some optimizations
- * related to large entries.
- *
- * \see slapi_str2entry()
- */
- #define SLAPI_STR2ENTRY_BIGENTRY 4
- /**
- * Check to see if the entry is a tombstone. If so, set the tombstone flag
- * (#SLAPI_ENTRY_FLAG_TOMBSTONE).
- *
- * \see slapi_str2entry()
- */
- #define SLAPI_STR2ENTRY_TOMBSTONE_CHECK 8
- /**
- * Ignore entry state information if present.
- *
- * \see slapi_str2entry()
- */
- #define SLAPI_STR2ENTRY_IGNORE_STATE 16
- /**
- * Return entries that have a <tt>version: 1</tt> line as part of the LDIF
- * representation.
- *
- * \see slapi_str2entry()
- */
- #define SLAPI_STR2ENTRY_INCLUDE_VERSION_STR 32
- /**
- * Add any missing ancestor values based on the object class hierarchy.
- *
- * \see slapi_str2entry()
- */
- #define SLAPI_STR2ENTRY_EXPAND_OBJECTCLASSES 64
- /**
- * Inform slapi_str2entry() that the LDIF input is not well formed.
- *
- * Well formed LDIF has no duplicate attribute values, already has the RDN
- * as an attribute of the entry, and has all values for a given attribute
- * type listed contiguously.
- *
- * \see slapi_str2entry()
- */
- #define SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF 128
- /**
- * Don't acquire the schema lock.
- *
- * You should use this flag if you are sure that the lock is already held,
- * or if the server has not started it's threads yet during startup.
- *
- * \see slapi_str2entry()
- */
- #define SLAPI_STR2ENTRY_NO_SCHEMA_LOCK 256
- /**
- * Generates a description of an entry as an LDIF string.
- *
- * This function behaves much like slapi_entry2str(); however, you can specify
- * output options with this function.
- *
- * This function generates an LDIF string value conforming to the following syntax:
- * \code
- * dn: dn\n
- * [attr: value\n]*
- * \endcode
- *
- * For example:
- * \code
- * dn: uid=jdoe, ou=People, dc=example,dc=com
- * cn: Jane Doe
- * sn: Doe
- * ...
- * \endcode
- *
- * To convert an entry described in LDIF string format to an LDAP entry using
- * the #Slapi_Entry data type, call the slapi_str2entry() function.
- *
- * \param e Entry that you want to convert into an LDIF string.
- * \param len Length of the LDIF string returned by this function.
- * \param options An option set that specifies how you want the string
- * converted. You can \c OR together any of the following options
- * when you call this function:
- * \arg #SLAPI_DUMP_STATEINFO
- * \arg #SLAPI_DUMP_UNIQUEID
- * \arg #SLAPI_DUMP_NOOPATTRS
- * \arg #SLAPI_DUMP_NOWRAP
- * \arg #SLAPI_DUMP_MINIMAL_ENCODING
- * \return The LDIF string representation of the entry you specify.
- * \return \c NULL if an error occurs.
- * \warning When you no longer need to use the string, you should free it
- * from memory by calling the slapi_ch_free_string() function.
- *
- * \see slapi_entry2str()
- * \see slapi_str2entry()
- */
- char *slapi_entry2str_with_options( Slapi_Entry *e, int *len, int options );
- /*---------------------------------------------
- * Options for slapi_entry2str_with_options()
- *--------------------------------------------*/
- /**
- * Output entry with replication state info.
- *
- * This allows access to the internal data used by multi-master replication.
- *
- * \see slapi_entry2str_with_options()
- */
- #define SLAPI_DUMP_STATEINFO 1 /* replication state */
- /**
- * Output entry with uniqueid.
- *
- * This option is used when creating an LDIF file to be used to initialize
- * a replica. Each entry will contain the nsuniqueID operational attribute.
- *
- * \see slapi_entry2str_with_options()
- */
- #define SLAPI_DUMP_UNIQUEID 2 /* unique ID */
- /**
- * Output entry without operational attributes.
- *
- * By default, certain operational attributes (such as \c creatorsName,
- * \c modifiersName, \c createTimestamp, \c modifyTimestamp) may be
- * included in the output. With this option, no operational attributes
- * will be included.
- *
- * \see slapi_entry2str_with_options()
- */
- #define SLAPI_DUMP_NOOPATTRS 4 /* suppress operational attrs */
- /**
- * Output entry without LDIF line wrapping.
- *
- * By default, lines will be wrapped as defined in the LDIF specification.
- * With this option, line wrapping is disabled.
- *
- * \see slapi_entry2str_with_options()
- */
- #define SLAPI_DUMP_NOWRAP 8 /* no line breaks */
- /**
- * Output entry with less base64 encoding.
- *
- * Uses as little base64 encoding as possible in the output.
- *
- * \see slapi_entry2str_with_options()
- */
- #define SLAPI_DUMP_MINIMAL_ENCODING 16 /* use less base64 encoding */
- /**
- * Generates an LDIF string description of an LDAP entry.
- *
- * This function generates an LDIF string value conforming to the following syntax:
- * \code
- * dn: dn\n
- * [attr: value\n]*
- * \endcode
- *
- * For example:
- * \code
- * dn: uid=jdoe, ou=People, dc=example,dc=com
- * cn: Jane Doe
- * sn: Doe
- * ...
- * \endcode
- *
- * To convert an entry described in LDIF string format to an LDAP entry using
- * the #Slapi_Entry data type, call the slapi_str2entry() function.
- *
- * \param e Entry that you want to convert into an LDIF string.
- * \param len Length of the LDIF string returned by this function.
- * \return The LDIF string representation of the entry you specify.
- * \return \c NULL if an error occurs.
- * \warning When you no longer need to use the string, you should free it
- * from memory by calling the slapi_ch_free_string() function.
- *
- * \see slapi_entry2str_with_options()
- * \see slapi_str2entry()
- */
- char *slapi_entry2str( Slapi_Entry *e, int *len );
- /**
- * Allocates memory for a new entry of the data type #Slapi_Entry.
- *
- * This function returns an empty #Slapi_Entry structure. You can call other
- * front-end functions to set the DN and attributes of this entry.
- *
- * When you are no longer using the entry, you should free it from memory by
- * calling the slapi_entry_free() function.
- *
- * \return This function returns a pointer to the newly allocated entry of the
- * data type #Slapi_Entry. If space cannot be allocated, e.g., no more
- * virtual memory exists, the \c ns-slapd program terminates.
- * \warning When you no longer use the entry, free it from memory by calling the
- * slapi_entry_free() function.
- *
- * \see slapi_entry_dup()
- * \see slapi_entry_free()
- */
- Slapi_Entry *slapi_entry_alloc(void);
- /**
- * Initializes the values of an entry with the DN and attribute value pairs you
- * supply.
- *
- * This function initializes the attributes and the corresponding attribute values
- * of an entry. Also, during the course of processing, the unique ID of the entry
- * is set to \c NULL, and the flag value is set to \c 0.
- *
- * Use this function to initialize a #Slapi_Entry pointer.
- *
- * \param e The entry you want to initialize.
- * \param dn The DN of the entry you are initializing.
- * \param a Initialization list of attribute value pairs, supplied as a
- * #Slapi_Attr data value.
- * \warning This function should always be used after slapi_entry_alloc() and
- * never otherwise. For example:
- * \code
- * Slapi_Entry *e = slapi_entry_alloc();
- * slapi_entry_init(e, NULL, NULL);
- * \endcode
- *
- * \warning To set the DN in the entry:
- * \code
- * slapi_sdn_set_dn_passin(slapi_entry_get_sdn(e), dn);
- * \endcode
- *
- * \warning In this case, the dn argument is not copied but is consumed by the
- * function. To copy the argument, see the following example:
- * \code
- * char *dn = slapi_ch_strdup(some_dn);
- * Slapi_Entry *e = slapi_entry_alloc();
- * slapi_entry_init(e, dn, NULL);
- * \endcode
- *
- * \warning The \c dn argument is not freed in this context but will eventually
- * be freed when slapi_entry_free() is called.
- *
- * \see slapi_entry_free()
- * \see slapi_entry_alloc()
- */
- void slapi_entry_init(Slapi_Entry *e, char *dn, Slapi_Attr *a);
- /**
- * Frees an entry, its DN, and its attributes from memory.
- *
- * Call this function to free an entry that you have allocated by using the
- * slapi_entry_alloc() function or the slapi_entry_dup() function.
- *
- * \param e Entry that you want to free. If \c NULL, no action occurs.
- * \warning To free entries, always use this function instead of using
- * slapi_ch_free() or free().
- *
- * \see slapi_entry_alloc()
- * \see slapi_entry_dup()
- */
- void slapi_entry_free( Slapi_Entry *e );
- /**
- * Makes a copy of an entry, its DN, and its attributes.
- *
- * This function returns a copy of an existing #Slapi_Entry structure. You can
- * call other front-end functions to change the DN and attributes of this entry.
- *
- * \param e Entry that you want to copy.
- * \return This function returns the new copy of the entry. If the structure
- * cannot be duplicated, for example, if no more virtual memory exists,
- * the \c ns-slapd program terminates.
- * \warning When you are no longer using the entry, free it from memory by
- * calling the slapi_entry_free() function.
- * \see slapi_entry_alloc()
- * \see slapi_entry_free()
- */
- Slapi_Entry *slapi_entry_dup( const Slapi_Entry *e );
- /**
- * Gets the distinguished name (DN) of the specified entry.
- *
- * \param e Entry from which you want to get the DN.
- * \return This function returns the DN of the entry. This returns a pointer
- * to the actual DN in the entry, not a copy of the DN. You should not
- * free the DN unless you plan to replace it by calling slapi_entry_set_dn().
- * \warning Use slapi_ch_free_string() if you are replacing the DN with
- * slapi_entry_set_dn().
- * \see slapi_ch_free_string()
- * \see slapi_entry_set_dn()
- */
- char *slapi_entry_get_dn( Slapi_Entry *e );
- /**
- * Returns the normalized DN from the entry that you specify.
- *
- * \param e Entry from which you want to obtain the normalized DN.
- * \return This function returns the normalized DN from the entry that you
- * specify. If the entry you specify does not contain a normalized DN,
- * one is created through the processing of this function.
- * \warning Never free the returned value.
- * \see slapi_entry_get_dn()
- */
- char *slapi_entry_get_ndn( Slapi_Entry *e );
- /**
- * Returns as a \c const the value of the #Slapi_DN object from the entry
- * that you specify.
- *
- * \param e Entry from which you want to get the #Slapi_DN object.
- * \return Returns as a \c const the #Slapi_DN object from the entry that you
- * specify.
- * \warning Never free the returned value. If you need a copy, use
- * slapi_sdn_dup().
- * \see slapi_sdn_dup()
- * \see slapi_entry_get_sdn()
- */
- const Slapi_DN *slapi_entry_get_sdn_const( const Slapi_Entry *e );
- /**
- * Returns the #Slapi_DN object from the entry that you specify.
- *
- * \param e Entry from which you want to get the #Slapi_DN object.
- * \return Returns the #Slapi_DN object from the entry that you specify.
- * \warning Never free the returned value. If you need a copy, use
- * slapi_sdn_dup().
- * \see slapi_entry_get_sdn_const()
- * \see slapi_sdn_dup()
- */
- Slapi_DN *slapi_entry_get_sdn( Slapi_Entry *e );
- /**
- * Returns as a \c const the DN value of the entry that you specify.
- *
- * \param e Entry from which you want to get the DN as a constant.
- * \return This function returns one of the following values:
- * \arg The DN of the entry that you specify. The DN is returned
- * as a const; you are not able to modify the DN value.
- * \arg The NDN value of Slapi_DN if the DN of the Slapi_DN object is NULL.
- * \warning Never free the returned value.
- * \see slapi_entry_set_sdn()
- */
- const char *slapi_entry_get_dn_const( const Slapi_Entry *e );
- /**
- * Sets the distinguished name (DN) of an entry.
- *
- * This function sets the DN pointer in the specified entry to the DN that you supply.
- *
- * \param e Entry to which you want to assign the DN.
- * \param dn Distinguished name you want assigned to the entry.
- * \warning The dn will be freed eventually when slapi_entry_free() is called.
- * \warning A copy of dn should be passed. For example:
- * \code
- * char *dn = slapi_ch_strdup(some_dn):
- * slapi_entry_set_dn(e, dn);
- * \endcode
- *
- * \warning The old dn will be freed as a result of this call. Do not pass in
- * a \c NULL value.
- * \see slapi_entry_free()
- * \see slapi_entry_get_dn()
- */
- void slapi_entry_set_dn( Slapi_Entry *e, char *dn );
- /**
- * Sets the Slapi_DN value in an entry.
- *
- * This function sets the value for the #Slapi_DN object in the entry you specify.
- *
- * \param e Entry to which you want to set the value of the #Slapi_DN.
- * \param sdn The specified #Slapi_DN value that you want to set.
- * \warning This function makes a copy of the \c sdn parameter.
- * \see slapi_entry_get_sdn()
- */
- void slapi_entry_set_sdn( Slapi_Entry *e, const Slapi_DN *sdn );
- /**
- * Determines if an entry contains the specified attribute.
- *
- * If the entry contains the attribute, the function returns a pointer to
- * the attribute.
- *
- * \param e Entry that you want to check.
- * \param type Name of the attribute that you want to check.
- * \param attr Pointer to the attribute, if the attribute is found in the
- * entry.
- * \return \c 0 if the entry contains the specified attribute.
- * \return \c -1 if the entry does not contain the specified attribute.
- * \warning Do not free the returned \c attr. It is a pointer to the internal
- * entry data structure. It is usually wise to make a copy of the
- * returned attribute, using slapi_attr_dup(), to avoid dangling pointers
- * if the entry is freed while the pointer to attr is still being used.
- * \see slapi_attr_dup()
- */
- int slapi_entry_attr_find( const Slapi_Entry *e, const char *type, Slapi_Attr **attr );
- /**
- * Finds the first attribute in an entry.
- *
- * If you want to iterate through the attributes in an entry, use this function
- * in conjunction with the slapi_entry_next_attr() function.
- *
- * \param e Entry from which you want to get the attribute.
- * \param attr Pointer to the first attribute in the entry.
- * \return Returns 0 when successful; any other value returned signals failure.
- * \warning Do not free the returned \c attr. This is a pointer into the
- * internal entry data structure. If you need a copy, use slapi_attr_dup().
- * \see slapi_entry_next_attr()
- * \see slapi_attr_dup()
- */
- int slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr );
- /**
- * Finds the next attribute after \c prevattr in an entry.
- *
- * To iterate through the attributes in an entry, use this function in conjunction
- * with the slapi_entry_first_attr() function.
- *
- * \param e Entry from which you want to get the attribute.
- * \param prevattr Previous attribute in the entry.
- * \param attr Pointer to the next attribute after \c prevattr in the entry.
- * \return \c 0 if successful.
- * \return \c -1 if \c prevattr was the last attribute in the entry.
- * \warning Do not free the returned \c attr. This is a pointer into the
- * internal entry data structure. If you need a copy, use slapi_attr_dup().
- * \see slapi_entry_first_attr()
- * \see slapi_entry_dup()
- */
- int slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr );
- /**
- * Gets the unique ID value of the entry.
- *
- * \param e Entry from which you want to obtain the unique ID.
- * \return This function returns the unique ID value of the entry specified.
- * \warning Never free this value. If you need a copy, use slapi_ch_strdup().
- * \see slapi_entry_set_uniqueid()
- * \see slapi_ch_strdup()
- */
- const char *slapi_entry_get_uniqueid( const Slapi_Entry *e );
- /**
- * Replaces the unique ID value of an entry with the unique ID value that you
- * supply.
- *
- * This function replaces the unique ID value of the entry with the \c uniqueid
- * value that you specify. In addition, the function adds #SLAPI_ATTR_UNIQUEID to
- * the attribute list and gives it the unique ID value supplied. If the entry
- * already contains a #SLAPI_ATTR_UNIQUEID attribute, its value is updated with
- * the new value supplied.
- *
- * \param e Entry for which you want to generate a unique ID.
- * \param uniqueid The unique ID value that you want to assign to the entry.
- * \warning Do not free the \c uniqueid after calling this function. The value
- * will eventually be freed when slapi_entry_free() is called.
- *
- * \warning You should pass in a copy of the value because this function will
- * consume the value passed in. For example:
- * \code
- * char *uniqueid = slapi_ch_strdup(some_uniqueid);
- * slapi_entry_set_uniqueid(e, uniqueid);
- * \endcode
- *
- * \warning Do not pass in a \c NULL for \c uniqueid.
- * \see slapi_entry_get_uniqueid()
- * \see slapi_entry_free()
- */
- void slapi_entry_set_uniqueid( Slapi_Entry *e, char *uniqueid );
- /**
- * Determines whether the specified entry complies with the schema for its object
- * class.
- *
- * \param pb Parmeter block.
- * \param e Entry that you want to check.
- * \return \c 0 if the entry complies with the schema or if schema checking is
- * turned off. The function also returns \c 0 if the entry has additional
- * attributes not allowed by the schema and has the object class
- * \c extensibleObject.
- * \return \c 1 if the entry is missing the \c objectclass attribute, if it is missing
- * any required attributes, if it has any attributes not allowed by the schema
- * but does not have the object class \c extensibleObject, or if the entry has
- * multiple values for a single-valued attribute.
- * \warning The \c pb argument can be \c NULL. It is only used to get the
- * #SLAPI_IS_REPLICATED_OPERATION flag. If that flag is present, no schema
- * checking is done.
- */
- int slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e );
- /**
- * Determines whether the specified entry complies with the syntax rules imposed
- * by it's attribute types.
- *
- * \param pb Parameter block.
- * \param e Entry that you want to check.
- * \param override Flag to override the server configuration and force syntax checking
- * to be performed.
- * \return \c 0 if the entry complies with the syntax rules or if syntax checking
- * is disabled.
- * \return \c 1 if the entry has any attribute values that violate the syntax rules
- * imposed by the associated attribute type. If the \c pb parameter was
- * passed in, an error message describing the syntax violations will be
- * set in the #SLAPI_PB_RESULT_TEXT paramter.
- * \warning The \c pb parameter can be \c NULL. It is used to store an error
- * message with details of any syntax violations. The \c pb paramter
- * is also used to check if the #SLAPI_IS_REPLICATED_OPERATION flag is
- * set. If that flag is present, no syntax checking is performed.
- */
- int slapi_entry_syntax_check( Slapi_PBlock *pb, Slapi_Entry *e, int override );
- /**
- * Determines if any values being added to an entry violate the syntax rules
- * imposed by the associated attribute type.
- *
- * \param pb Parameter block.
- * \param mods Array of mods that you want to check.
- * \param override Flag to override the server configuration and force syntax checking
- * to be performed.
- * \return \c 0 if the mods comply with the syntax rules or if syntax checking
- * is disabled.
- * \return \c 1 if the mods are adding any new attribute values that violate the
- * syntax rules imposed by the associated attribute type. If the \c pb
- * parameter was passed in, an error message describing the syntax violations
- * will be set in the #SLAPI_PB_RESULT_TEXT paramter.
- * \warning The \c pb parameter can be \c NULL. It is used to store an error
- * message with details of any syntax violations. The \c pb paramter
- * is also used to check if the #SLAPI_IS_REPLICATED_OPERATION flag is
- * set. If that flag is present, no syntax checking is performed.
- */
- int slapi_mods_syntax_check( Slapi_PBlock *pb, LDAPMod **mods, int override );
- /**
- * Determines whether the values in an entry’s relative distinguished name (RDN)
- * are also present as attribute values.
- *
- * For example, if the entry’s RDN is <tt>cn=Barbara Jensen</tt>, the function determines
- * if the entry has the \c cn attribute with the value <tt>Barbara Jensen</tt>.
- *
- * \param e Entry that you want to check for RDN values.
- * \return \c 1 if the values in the RDN are present in the attributes of the entry.
- * \return \c 0 if the values are not present.
- */
- int slapi_entry_rdn_values_present( const Slapi_Entry *e );
- /**
- * Adds the components in an entry’s relative distinguished name (RDN) to the entry
- * as attribute values.
- *
- * For example, if the entry’s RDN is <tt>uid=bjensen</tt>, the function adds
- * <tt>uid=bjensen</tt> to the entry as an attribute value.
- *
- * \param e Entry to which you want to add the RDN attributes.
- * \return \c LDAP_SUCCESS if the values were successfully added to the entry. The
- * function also returns \c LDAP_SUCCESS if the entry is \c NULL, if the
- * entry’s DN is \c NULL, or if the entry’s RDN is \c NULL.
- * \return \c LDAP_INVALID_DN_SYNTAX if the DN of the entry cannot be parsed.
- * \warning Free the entry from memory by using the slapi_entry_free() function, if the
- * entry was allocated by the user.
- * \see slapi_entry_free()
- */
- int slapi_entry_add_rdn_values( Slapi_Entry *e );
- /**
- * Deletes an attribute (and all its associated values) from an entry.
- *
- * \param e Entry from which you want to delete the attribute.
- * \param type Attribute type that you want to delete.
- * \return \c 0 if successful.
- * \return \c 1 if the specified attribute is not part of the entry.
- * \return \c -1 if an error occurred.
- */
- int slapi_entry_attr_delete( Slapi_Entry *e, const char *type );
- /**
- * Gets the values of a multi-valued attribute of an entry.
- *
- * This function is very similar to slapi_entry_attr_get_charptr(), except that it
- * returns a <tt>char **</tt> array for multi-valued attributes. The array and all
- * values are copies. Even if the attribute values are not strings, they will still
- * be \c NULL terminated so that they can be used safely in a string context. If there
- * are no values, \c NULL will be returned. Because the array is \c NULL terminated,
- * the usage should be similar to the sample shown below:
- *
- * \code
- * char **ary = slapi_entry_attr_get_charray(e, someattr);
- * int ii;
- * for (ii = 0; ary && ary[ii]; ++ii) {
- * char *strval = ary[ii];
- * ...
- * }
- * slapi_ch_array_free(ary);
- * \endcode
- *
- * \param e Entry from which you want to get the values.
- * \param type Attribute type from which you want to get the values.
- * \return A copy of all the values of the attribute.
- * \return \c NULL if the entry does not contain the attribute or if the attribute
- * has no values.
- * \warning When you are done working with the values, free them from memory by calling
- * the slapi_ch_array_free() function.
- * \see slapi_entry_attr_get_charptr()
- */
- char **slapi_entry_attr_get_charray(const Slapi_Entry* e, const char *type);
- /**
- * Gets the first value of an attribute of an entry as a string.
- *
- * \param e Entry from which you want to get the string value.
- * \param type Attribute type from which you want to get the value.
- * \return A copy of the first value in the attribute.
- * \return \c NULL if the entry does not contain the attribute.
- * \warning When you are done working with this value, free it from memory by calling the
- * slapi_ch_free_string() function.
- * \see slapi_entry_attr_get_charray()
- */
- char *slapi_entry_attr_get_charptr(const Slapi_Entry* e, const char *type);
- /**
- * Gets the first value of an attribute in an entry as an integer.
- *
- * \param e Entry from which you want to get the integer value.
- * \param type Attribute type from which you want to get the value.
- * \return The first value of the attribute converted to an integer.
- * \return \c 0 if the entry does not contain the attribute.
- */
- int slapi_entry_attr_get_int(const Slapi_Entry* e, const char *type);
- /**
- * Gets the first value of an attribute in an entry as an unsigned integer data type.
- *
- * \param e Entry from which you want to get the integer value.
- * \param type Attribute type from which you want to get the value.
- * \return The first value of the attribute converted to an unsigned integer.
- * \return \c 0 if the entry does not contain the attribute.
- */
- unsigned int slapi_entry_attr_get_uint(const Slapi_Entry* e, const char *type);
- /**
- * Gets the first value of an attribute in an entry as a long data type.
- *
- * \param e Entry from which you want to get the long value.
- * \param type Attribute type from which you want to get the value.
- * \return The first value of the attribute converted to a \c long type.
- * \return \c 0 if the entry does not contain the attribute.
- */
- long slapi_entry_attr_get_long( const Slapi_Entry* e, const char *type);
- /**
- * Gets the first value of an attribute in an entry as an unsigned long
- * data type.
- *
- * \param e Entry from which you want to get the unsigned long value.
- * \param type Attribute type from which you want to get the value.
- * \return The first value of the attribute converted to an <tt>
- * unsigned long</tt>.
- * \return \c 0 if the entry does not contain the attribute.
- */
- unsigned long slapi_entry_attr_get_ulong( const Slapi_Entry* e, const char *type);
- /**
- * Gets the first value of an attribute in an entry as a long long data type.
- *
- * \param e Entry from which you want to get the long long value.
- * \param type Attribute type from which you want to get the value.
- * \return The first value of the attribute converted to a <tt>long long</tt>.
- * \return \c 0 if the entry does not contain the attribute.
- */
- long long slapi_entry_attr_get_longlong( const Slapi_Entry* e, const char *type);
- /**
- * Gets the first value of an attribute in an entry as an unsigned
- * long long data type.
- *
- * \param e Entry from which you want to get the unsigned long long value.
- * \param type Attribute type from which you want to get the value.
- * \return The first value of the attribute converted to an <tt>unsigned
- * long long</tt>.
- * \return \c 0 if the entry does not contain the attribute.
- */
- unsigned long long slapi_entry_attr_get_ulonglong( const Slapi_Entry* e, const char *type);
- /**
- * Gets the value of a given attribute of a given entry as a boolean value.
- *
- * Comparisons are case-insensitive (\c TRUE, \c trUe, and \c true are all the
- * same), and unique substrings can be matched (\c t and \c tr will be interpreted
- * as \c true). If the attribute value is a number, then non-zero numbers are
- * interpreted as \c true, and \c 0 is interpreted as \c false.
- *
- * \param e Entry from which you want to get the boolean value.
- * \param type Attribute type from which you want to get the value.
- * \return \c PR_TRUE | \c PR_FALSE
- */
- PRBool slapi_entry_attr_get_bool( const Slapi_Entry* e, const char *type);
- /**
- * Replaces the value or values of an attribute in an entry with a specified string
- * value.
- *
- * \param e Entry in which you want to set the value.
- * \param type Attribute type in which you want to set the value.
- * \param value String value that you want to assign to the attribute.
- * \warning This function makes a copy of the parameter \c value. The \c value
- * parameter can be \c NULL; if so, this function is roughly equivalent
- * to slapi_entry_attr_delete().
- * \see slapi_entry_attr_delete()
- */
- void slapi_entry_attr_set_charptr(Slapi_Entry* e, const char *type, const char *value);
- /**
- * Replaces the value or values of an attribute in an entry with a specified integer
- * data value.
- *
- * This function will replace the value or values of an attribute with the
- * integer value that you specify. If the attribute does not exist, it is created
- * with the integer value that you specify.
- *
- * \param e Entry in which you want to set the value.
- * \param type Attribute type in which you want to set the value.
- * \param l Integer value that you want to assign to the attribute.
- */
- void slapi_entry_attr_set_int( Slapi_Entry* e, const char *type, int l);
- /**
- * Replaces the value or values of an attribute in an entry with a specified
- * unsigned integer data type value.
- *
- * This function will replace the value or values of an attribute with the
- * unsigned integer value that you specify. If the attribute does not exist,
- * it is created with the unsigned integer value you specify.
- *
- * \param e Entry in which you want to set the value.
- * \param type Attribute type in which you want to set the value.
- * \param l Unsigned integer value that you want to assign to the attribute.
- */
- void slapi_entry_attr_set_uint( Slapi_Entry* e, const char *type, unsigned int l);
- /**
- * Replaces the value or values of an attribute in an entry with a specified long data
- * type value.
- *
- * \param e Entry in which you want to set the value.
- * \param type Attribute type in which you want to set the value.
- * \param l Long integer value that you want to assign to the attribute.
- */
- void slapi_entry_attr_set_long(Slapi_Entry* e, const char *type, long l);
- /**
- * Replaces the value or values of an attribute in an entry with a specified unsigned
- * long data type value.
- *
- * This function will replace the value or values of an attribute with the unsigned
- * long value that you specify. If the attribute does not exist, it is created with the
- * unsigned long value that you specify.
- *
- * \param e Entry in which you want to set the value.
- * \param type Attribute type in which you want to set the value.
- * \param l Unsigned long value that you want to assign to the attribute.
- */
- void slapi_entry_attr_set_ulong(Slapi_Entry* e, const char *type, unsigned long l);
- /**
- * Determines if an attribute in an entry contains a specified value.
- *
- * The syntax of the attribute type is taken into account when checking
- * for the specified value.
- *
- * \param e Entry that you want to check.
- * \param type Attribute type that you want to test for the value specified.
- * \param value Value that you want to find in the attribute.
- * \return \c 1 if the attribute contains the specified value.
- * \return \c 0 if the attribute does not contain the specified value.
- * \warning \c value must not be \c NULL.
- */
- int slapi_entry_attr_has_syntax_value(const Slapi_Entry *e, const char *type, const Slapi_Value *value);
- /**
- * This function determines if the specified entry has child entries.
- *
- * \param e Entry that you want to test for child entries.
- * \return \c 1 if the entry you supply has child entries.
- * \return \c 0 if the entry you supply has child entries.
- */
- int slapi_entry_has_children(const Slapi_Entry *e);
- /**
- * This function determines if an entry is the root DSE.
- *
- * The root DSE is a special entry that contains information about the Directory
- * Server, including its capabilities and configuration.
- *
- * \param dn The DN that you want to test to see if it is the root DSE entry.
- * \return \c 1 if \c dn is the root DSE.
- * \return \c 0 if \c dn is not the root DSE.
- */
- int slapi_is_rootdse( const char *dn );
- /**
- * This function returns the approximate size of an entry, rounded to the nearest 1k.
- *
- * This can be useful for checking cache sizes, estimating storage needs, and so on.
- *
- * When determining the size of an entry, only the sizes of the attribute values are
- * counted; the size of other entry values (such as the size of attribute names,
- * variously-normalized DNs, or any metadata) are not included in the size
- * returned. It is assumed that the size of the metadata, et al., is well enough
- * accounted for by the rounding of the size to the next largest 1k . This holds true
- * especially in larger entries, where the actual size of the attribute values far
- * outweighs the size of the metadata.
- *
- * When determining the size of the entry, both deleted values and deleted
- * attributes are included in the count.
- *
- * \param e Entry from which you want the size returned.
- * \return The size of the entry, rounded to the nearest 1k. The value returned is a
- * size_t data type with a u_long value.
- * \return A size of 1k if the entry is empty.
- * \warning The \c e parameter must not be \c NULL.
- */
- size_t slapi_entry_size(Slapi_Entry *e);
- /**
- * Adds an array of #Slapi_Value data values to the existing attribute values in
- * an entry.
- *
- * If the attribute does not exist, it is created with the #Slapi_Value specified.
- *
- * \param e Entry to which you want to add values.
- * \param type Attribute type to which you want to add values.
- * \param vals \c NULL terminated array of #Slapi_Value data values you want to add.
- * \return This function returns \c 0 if successful; any other value returned
- * signals failure.
- * \warning This function makes a copy of the parameter \c vals. The \c vals
- * parameter can be \c NULL.
- */
- int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
- /**
- * Adds and array of #Slapi_Value data values to the specified attribute in an entry.
- *
- * This function adds an array of #Slapi_Value data values to an attribute. If the
- * attribute does not exist, it is created and given the value contained in the
- * #Slapi_Value array.
- *
- * \param e Entry to which you want to add values.
- * \param type Attribute type to which you want to add values.
- * \param vals \c NULL terminated array of #Slapi_Value data values you want to add.
- * \return \c LDAP_SUCCESS if the #Slapi_Value array if successfully added to the
- * attribute.
- * \return \c LDAP_TYPE_OR_VALUE_EXISTS if any values you are trying to add duplicate
- * an existing value in the attribute.
- * \return \c LDAP_OPERATIONS_ERROR if there are pre-existing duplicate values in the
- * attribute.
- * \warning This function makes a copy of the parameter \c vals. The \c vals
- * parameter can be \c NULL.
- */
- int slapi_entry_add_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
- /**
- * Add a Slapi_ValueSet data value to the specified attribute in an entry.
- *
- * This function adds a set of values to an attribute in an entry. The values added
- * are in the form of a #Slapi_ValueSet data type. If the entry does not contain the
- * attribute specified, it is created with the specified #Slapi_ValueSet values.
- *
- * \param e Entry to which you want to add values.
- * \param type Attribute type to which you want to add values.
- * \param vs #Slapi_ValueSet data value that you want to add to the entry.
- * \return \c 0 when successful; any other value returned signals failure.
- * \warning This function makes a copy of the parameter \c vs. The \c vs
- * parameter can be \c NULL.
- */
- int slapi_entry_add_valueset(Slapi_Entry *e, const char *type, Slapi_ValueSet *vs);
- /**
- * Removes an array of Slapi_Value data values from an attribute in an entry.
- *
- * This function removes an attribute/valueset from an entry. Both the attribute
- * and its #Slapi_Value data values are removed from the entry. If you supply a
- * #Slapi_Value whose value is \c NULL, the function will delete the specified
- * attribute from the entry. In either case, the function returns \c LDAP_SUCCESS.
- *
- * \param e Entry from which you want to delete values.
- * \param type Attribute type from which you want to delete values.
- * \param vals \c NULL terminated array of #Slapi_Value data values that you
- * want to delete.
- * \return \c LDAP_SUCCESS if the specified attribute and the array of #Slapi_Value
- * data values are deleted from the entry.
- * \return If the specified attribute contains a \c NULL value, the attribute is
- * deleted from the attribute list, and the function returns
- * \c LDAP_NO_SUCH_ATTRIBUTE. As well, if the attribute is not found in the
- * list of attributes for the specified entry, the function returns
- * \c LDAP_NO_SUCH_ATTRIBUTE.
- * \return If there is an operational error during the processing of this call such
- * as a duplicate value found, the function will return
- * \c LDAP_OPERATIONS_ERROR.
- * \warning The \c vals parameter can be \c NULL, in which case this function does
- * nothing.
- */
- int slapi_entry_delete_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
- /**
- * Merges (adds) and array of #Slapi_Value data values to a specified attribute in
- * an entry.
- *
- * This function adds additional #Slapi_Value data values to the existing values
- * contained in an attribute. If the attribute type does not exist, it is created.
- *
- * If the specified attribute exists in the entry, the function merges the value
- * specified and returns \c LDAP_SUCCESS. If the attribute is not found in the entry,
- * the function creates it with the #Slapi_Value specified and returns \c
- * LDAP_NO_SUCH_ATTRIBUTE.
- *
- * If this function fails, it leaves the values for \c type within a pointer to
- * \c e in an indeterminate state. The present valueset may be truncated.
- *
- * \param e Entry into which you want to merge values.
- * \param type Attribute type that you want to merge the values into.
- * \param vals \c NULL terminated array of #Slapi_Value values that you want to merge
- * into the entry.
- * \return \c LDAP_SUCCESS
- * \return \c LDAP_NO_SUCH_ATTRIBUTE
- * \warning This function makes a copy of \c vals. The \c vals parameter
- * can be \c NULL.
- */
- int slapi_entry_merge_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
- /**
- * Replaces the values of an attribute with the #Slapi_Value data value you specify.
- *
- * This function replaces existing attribute values in a specified entry with a single
- * #Slapi_Value data value. The function first deletes the existing attribute from the
- * entry, then replaces it with the new value specified.
- *
- * \param e Entry in which you want to replace values.
- * \param type Attribute type which will receive the replaced values
- * \param vals \c NULL terminated array of #Slapi_Value valyes that should replace
- * the existing values of the attribute.
- * \return \c 0 when successfull; any other value returned signals failure.
- * \warning This function makes a copy of \c vals. The \c vals parameter
- * can be \c NULL.
- */
- int slapi_entry_attr_replace_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
- /**
- * Adds a specified #Slapi_Value data value to an attribute in an entry.
- *
- * This function adds a #Slapi_Value data value to the existing attribute values in an
- * entry. If the specified attribute does not exist in the entry, the attribute is
- * created with the #Slapi_Value specified. The function doesn’t check for duplicate
- * values, meaning it does not check if the value being added is already there.
- *
- * \param e Entry to which you want to add a value.
- * \param type Attribute to which you want to add a value.
- * \param value The #Slapi_Value data value you want to add to the entry.
- * \return \c 0 when successfull; any other value returned signals failure.
- * \warning This function makes a copy of \c value. The \c value parameter
- * can be \c NULL.
- */
- int slapi_entry_add_value(Slapi_Entry *e, const char *type, const Slapi_Value *value);
- /**
- * Adds a string value to an attribute in an entry.
- *
- * This function adds a string value to the existing attribute values in an entry. If
- * the specified attribute does not exist in the entry, the attribute is created with
- * the string value specified. The function doesn’t check for duplicate values; it
- * does not check if the string value being added is already there.
- *
- * \param e Entry to which you want to add a string value.
- * \param type Attribute to which you want to add a string value.
- * \param value String value you want to add.
- * \return \c 0 when successfull; any other value returned signals failure.
- * \warning This function makes a copy of \c value. The \c value parameter
- * can be \c NULL.
- */
- int slapi_entry_add_string(Slapi_Entry *e, const char *type, const char *value);
- /**
- * Deletes a string value from an attribute in an entry.
- *
- * \param e Entry from which you want the string deleted.
- * \param type Attribute type from which you want the string deleted.
- * \param value Value of string to delete.
- * \return \c 0 when successfull; any other value returned signals failure.
- */
- int slapi_entry_delete_string(Slapi_Entry *e, const char *type, const char *value);
- /**
- * Find differences between two entries.
- *
- * Compares two #Slapi_Entry entries and determines the difference between them. The
- * differences are returned as the modifications needed to the first entry to make it
- * match the second entry.
- *
- * \param smods An empty #Slapi_Mods that will be filled in with the modifications
- * needed to make \c e1 the same as \c e2.
- * \param e1 The first entry you want to compare.
- * \param e2 The second entry you want to compare.
- * \param diff_ctrl Allows you to skip comparing operational attributes by passing
- * #SLAPI_DUMP_NOOPATTRS. Pass \c 0 if you want to compare the
- * operational attributes.
- * \warning The caller must allocate the #Slapi_Mods that is passed in as \c smods.
- * This must be an empty #Slapi_Mods, otherwise the contents will be leaked.
- * \warning It is up to the caller to free \c smods when they are finished using them
- * by calling slapi_mods_free() or slapi_mods_done() if \c smods was allocated
- * on the stack.
- */
- void slapi_entry_diff(Slapi_Mods *smods, Slapi_Entry *e1, Slapi_Entry *e2, int diff_ctrl);
- /**
- * Applies an array of \c LDAPMod modifications a Slapi_Entry.
- *
- * \param e Entry to which you want to apply the modifications.
- * \param mods \c NULL terminated array of \c LDAPMod modifications that you
- * want to apply to the specified entry.
- * \return \c LDAP_SUCCESS if the mods applied to the entry cleanly, otherwise an
- * LDAP error is returned.
- * \warning It is up to the caller to free the \c LDAPMod array after the mods have
- * been applied.
- */
- int slapi_entry_apply_mods(Slapi_Entry *e, LDAPMod **mods);
- /*------------------------
- * Entry flags.
- *-----------------------*/
- /**
- * Flag that signifies that an entry is a tombstone entry
- *
- * \see slapi_entry_flag_is_set()
- * \see slapi_entry_set_flag()
- * \see slapi_entry_clear_flag()
- */
- #define SLAPI_ENTRY_FLAG_TOMBSTONE 1
- /**
- * Determines if certain flags are set for a specified entry.
- *
- * \param e Entry for which you want to check for the specified flag.
- * \param flag The flag whose presense you want to check for. Valid flags are:
- * \arg #SLAPI_ENTRY_FLAG_TOMBSTONE
- * \return \c 0 if the flag is not set.
- * \return The value of the flag if it is set.
- * \see slapi_entry_clear_flag()
- * \see slapi_entry_set_flag()
- */
- int slapi_entry_flag_is_set( const Slapi_Entry *e, unsigned char flag );
- /**
- * Sets a flag for a specified entry.
- *
- * \param e Entry for which you want to set the flag.
- * \param flag Flag that you want to set. Valid flags are:
- * \arg #SLAPI_ENTRY_FLAG_TOMBSTONE
- * \see slapi_entry_clear_flag()
- * \see slapi_entry_flag_is_set()
- */
- void slapi_entry_set_flag( Slapi_Entry *e, unsigned char flag);
- /**
- * Clears a flag for a specified entry.
- *
- * \param e Entry for which you want to clear the flag.
- * \param flag Flag that you want to clear. Valid flags are:
- * \arg #SLAPI_ENTRY_FLAG_TOMBSTONE
- * \see slapi_entry_flag_is_set()
- * \see slapi_entry_set_flag()
- */
- void slapi_entry_clear_flag( Slapi_Entry *e, unsigned char flag);
- /*------------------------------
- * exported vattrcache routines
- *------------------------------*/
- /**
- * Check if an entry is current in the virtual attribute cache.
- *
- * \param e The entry for which you want to check the virtual attribute cache
- * validity.
- * \return \c 1 if the entry is valid in the cache.
- * \return \c 0 if the entry is invalid in the cache.
- */
- int slapi_entry_vattrcache_watermark_isvalid(const Slapi_Entry *e);
- /**
- * Mark an entry as valid in the virtual attribute cache.
- *
- * \param e The entry that you want to mark as valid.
- */
- void slapi_entry_vattrcache_watermark_set(Slapi_Entry *e);
- /**
- * Mark an entry as invalid in the virtual attribute cache.
- *
- * \param e The entry that you want to mark as invalid.
- */
- void slapi_entry_vattrcache_watermark_invalidate(Slapi_Entry *e);
- /**
- * Invalidate all entries in the virtual attribute cache.
- */
- void slapi_entrycache_vattrcache_watermark_invalidate();
- /* TODO - Pickup Doxygen work here */
- /*
- * Slapi_DN routines
- */
- Slapi_DN *slapi_sdn_new( void );
- Slapi_DN *slapi_sdn_new_dn_byval(const char *dn);
- Slapi_DN *slapi_sdn_new_ndn_byval(const char *ndn);
- Slapi_DN *slapi_sdn_new_dn_byref(const char *dn);
- Slapi_DN *slapi_sdn_new_ndn_byref(const char *ndn);
- Slapi_DN *slapi_sdn_new_dn_passin(const char *dn);
- Slapi_DN *slapi_sdn_set_dn_byval(Slapi_DN *sdn, const char *dn);
- Slapi_DN *slapi_sdn_set_dn_byref(Slapi_DN *sdn, const char *dn);
- Slapi_DN *slapi_sdn_set_dn_passin(Slapi_DN *sdn, const char *dn);
- Slapi_DN *slapi_sdn_set_ndn_byval(Slapi_DN *sdn, const char *ndn);
- Slapi_DN *slapi_sdn_set_ndn_byref(Slapi_DN *sdn, const char *ndn);
- void slapi_sdn_done(Slapi_DN *sdn);
- void slapi_sdn_free(Slapi_DN **sdn);
- const char * slapi_sdn_get_dn(const Slapi_DN *sdn);
- const char * slapi_sdn_get_ndn(const Slapi_DN *sdn);
- void slapi_sdn_get_parent(const Slapi_DN *sdn,Slapi_DN *sdn_parent);
- void slapi_sdn_get_backend_parent(const Slapi_DN *sdn,Slapi_DN *sdn_parent,const Slapi_Backend *backend);
- Slapi_DN * slapi_sdn_dup(const Slapi_DN *sdn);
- void slapi_sdn_copy(const Slapi_DN *from, Slapi_DN *to);
- int slapi_sdn_compare( const Slapi_DN *sdn1, const Slapi_DN *sdn2 );
- int slapi_sdn_isempty( const Slapi_DN *sdn);
- int slapi_sdn_issuffix(const Slapi_DN *sdn, const Slapi_DN *suffixsdn);
- int slapi_sdn_isparent( const Slapi_DN *parent, const Slapi_DN *child );
- int slapi_sdn_isgrandparent( const Slapi_DN *parent, const Slapi_DN *child );
- int slapi_sdn_get_ndn_len(const Slapi_DN *sdn);
- int slapi_sdn_scope_test( const Slapi_DN *dn, const Slapi_DN *base, int scope );
- void slapi_sdn_get_rdn(const Slapi_DN *sdn,Slapi_RDN *rdn);
- Slapi_DN *slapi_sdn_set_rdn(Slapi_DN *sdn, const Slapi_RDN *rdn);
- Slapi_DN *slapi_sdn_set_parent(Slapi_DN *sdn, const Slapi_DN *parentdn);
- int slapi_sdn_is_rdn_component(const Slapi_DN *rdn, const Slapi_Attr *a, const Slapi_Value *v);
- char * slapi_moddn_get_newdn(Slapi_DN *dn_olddn, char *newrdn, char *newsuperiordn);
- /*
- * Slapi_RDN functions
- */
- Slapi_RDN *slapi_rdn_new( void );
- Slapi_RDN *slapi_rdn_new_dn(const char *dn);
- Slapi_RDN *slapi_rdn_new_sdn(const Slapi_DN *sdn);
- Slapi_RDN *slapi_rdn_new_rdn(const Slapi_RDN *fromrdn);
- void slapi_rdn_init(Slapi_RDN *rdn);
- void slapi_rdn_init_dn(Slapi_RDN *rdn,const char *dn);
- void slapi_rdn_init_sdn(Slapi_RDN *rdn,const Slapi_DN *sdn);
- void slapi_rdn_init_rdn(Slapi_RDN *rdn,const Slapi_RDN *fromrdn);
- void slapi_rdn_set_dn(Slapi_RDN *rdn,const char *dn);
- void slapi_rdn_set_sdn(Slapi_RDN *rdn,const Slapi_DN *sdn);
- void slapi_rdn_set_rdn(Slapi_RDN *rdn,const Slapi_RDN *fromrdn);
- void slapi_rdn_free(Slapi_RDN **rdn);
- void slapi_rdn_done(Slapi_RDN *rdn);
- int slapi_rdn_get_first(Slapi_RDN *rdn, char **type, char **value);
- int slapi_rdn_get_next(Slapi_RDN *rdn, int index, char **type, char **value);
- int slapi_rdn_get_index(Slapi_RDN *rdn, const char *type, const char *value,size_t length);
- int slapi_rdn_get_index_attr(Slapi_RDN *rdn, const char *type, char **value);
- int slapi_rdn_contains(Slapi_RDN *rdn, const char *type, const char *value,size_t length);
- int slapi_rdn_contains_attr(Slapi_RDN *rdn, const char *type, char **value);
- int slapi_rdn_add(Slapi_RDN *rdn, const char *type, const char *value);
- int slapi_rdn_remove_index(Slapi_RDN *rdn, int atindex);
- int slapi_rdn_remove(Slapi_RDN *rdn, const char *type, const char *value, size_t length);
- int slapi_rdn_remove_attr(Slapi_RDN *rdn, const char *type);
- int slapi_rdn_isempty(const Slapi_RDN *rdn);
- int slapi_rdn_get_num_components(Slapi_RDN *rdn);
- int slapi_rdn_compare(Slapi_RDN *rdn1, Slapi_RDN *rdn2);
- const char *slapi_rdn_get_rdn(const Slapi_RDN *rdn);
- const char *slapi_rdn_get_nrdn(const Slapi_RDN *rdn);
- Slapi_DN *slapi_sdn_add_rdn(Slapi_DN *sdn, const Slapi_RDN *rdn);
- /*
- * utility routines for dealing with DNs
- */
- char *slapi_dn_normalize( char *dn );
- char *slapi_dn_normalize_to_end( char *dn, char *end );
- char *slapi_dn_ignore_case( char *dn );
- char *slapi_dn_normalize_case( char *dn );
- char *slapi_dn_beparent( Slapi_PBlock *pb, const char *dn );
- const char *slapi_dn_find_parent( const char *dn );
- char *slapi_dn_parent( const char *dn );
- int slapi_dn_issuffix( const char *dn, const char *suffix );
- int slapi_dn_isparent( const char *parentdn, const char *childdn );
- int slapi_dn_isroot( const char *dn );
- int slapi_dn_isbesuffix( Slapi_PBlock *pb, const char *dn );
- int slapi_rdn2typeval( char *rdn, char **type, struct berval *bv );
- char *slapi_dn_plus_rdn(const char *dn, const char *rdn);
- /*
- * thread safe random functions
- */
- int slapi_rand_r(unsigned int * seed);
- void slapi_rand_array(void *randx, size_t len);
- int slapi_rand();
- /*
- * attribute routines
- */
- Slapi_Attr *slapi_attr_new( void );
- Slapi_Attr *slapi_attr_init(Slapi_Attr *a, const char *type);
- void slapi_attr_free( Slapi_Attr **a );
- Slapi_Attr *slapi_attr_dup(const Slapi_Attr *attr);
- int slapi_attr_add_value(Slapi_Attr *a, const Slapi_Value *v);
- int slapi_attr_type2plugin( const char *type, void **pi );
- int slapi_attr_get_type( Slapi_Attr *attr, char **type );
- int slapi_attr_get_oid_copy( const Slapi_Attr *attr, char **oidp );
- int slapi_attr_get_syntax_oid_copy( const Slapi_Attr *a, char **oidp );
- int slapi_attr_get_flags( const Slapi_Attr *attr, unsigned long *flags );
- int slapi_attr_flag_is_set( const Slapi_Attr *attr, unsigned long flag );
- int slapi_attr_value_cmp( const Slapi_Attr *attr, const struct berval *v1, const struct berval *v2 );
- int slapi_attr_value_find( const Slapi_Attr *a, const struct berval *v );
- int slapi_attr_type_cmp( const char *t1, const char *t2, int opt );
- /* Mode of operation (opt) values for slapi_attr_type_cmp() */
- #define SLAPI_TYPE_CMP_EXACT 0
- #define SLAPI_TYPE_CMP_BASE 1
- #define SLAPI_TYPE_CMP_SUBTYPE 2
- int slapi_attr_types_equivalent(const char *t1, const char *t2);
- char *slapi_attr_basetype( const char *type, char *buf, size_t bufsiz );
- int slapi_attr_first_value( Slapi_Attr *a, Slapi_Value **v );
- int slapi_attr_next_value( Slapi_Attr *a, int hint, Slapi_Value **v );
- int slapi_attr_get_numvalues( const Slapi_Attr *a, int *numValues);
- int slapi_attr_get_valueset(const Slapi_Attr *a, Slapi_ValueSet **vs);
- /* Make the valuset in Slapi_Attr be *vs--not a copy */
- int slapi_attr_set_valueset(Slapi_Attr *a, const Slapi_ValueSet *vs);
- int slapi_attr_set_type(Slapi_Attr *a, const char *type);
- int slapi_attr_get_bervals_copy( Slapi_Attr *a, struct berval ***vals );
- char * slapi_attr_syntax_normalize( const char *s );
- void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2);
- void slapi_valueset_set_from_smod(Slapi_ValueSet *vs, Slapi_Mod *smod);
- /*
- * value routines
- */
- Slapi_Value *slapi_value_new( void );
- Slapi_Value *slapi_value_new_berval(const struct berval *bval);
- Slapi_Value *slapi_value_new_value(const Slapi_Value *v);
- Slapi_Value *slapi_value_new_string(const char *s);
- Slapi_Value *slapi_value_new_string_passin(char *s);
- Slapi_Value *slapi_value_init(Slapi_Value *v);
- Slapi_Value *slapi_value_init_berval(Slapi_Value *v, struct berval *bval);
- Slapi_Value *slapi_value_init_string(Slapi_Value *v,const char *s);
- Slapi_Value *slapi_value_init_string_passin(Slapi_Value *v, char *s);
- Slapi_Value *slapi_value_dup(const Slapi_Value *v);
- void slapi_value_set_flags(Slapi_Value *v, unsigned long flags);
- void slapi_values_set_flags(Slapi_Value **vs, unsigned long flags);
- unsigned long slapi_value_get_flags(Slapi_Value *v);
- void slapi_value_free(Slapi_Value **value);
- const struct berval *slapi_value_get_berval( const Slapi_Value *value );
- Slapi_Value *slapi_value_set_berval( Slapi_Value *value, const struct berval *bval );
- Slapi_Value *slapi_value_set_value( Slapi_Value *value, const Slapi_Value *vfrom);
- Slapi_Value *slapi_value_set( Slapi_Value *value, void *val, unsigned long len);
- int slapi_value_set_string(Slapi_Value *value, const char *strVal);
- int slapi_value_set_string_passin(Slapi_Value *value, char *strVal);
- int slapi_value_set_int(Slapi_Value *value, int intVal);
- const char*slapi_value_get_string(const Slapi_Value *value);
- int slapi_value_get_int(const Slapi_Value *value);
- unsigned int slapi_value_get_uint(const Slapi_Value *value);
- long slapi_value_get_long(const Slapi_Value *value);
- unsigned long slapi_value_get_ulong(const Slapi_Value *value);
- long long slapi_value_get_longlong(const Slapi_Value *value);
- unsigned long long slapi_value_get_ulonglong(const Slapi_Value *value);
- size_t slapi_value_get_length(const Slapi_Value *value);
- int slapi_value_compare(const Slapi_Attr *a,const Slapi_Value *v1,const Slapi_Value *v2);
- /*
- * Valueset functions.
- */
- #define SLAPI_VALUE_FLAG_PASSIN 0x1
- #define SLAPI_VALUE_FLAG_IGNOREERROR 0x2
- #define SLAPI_VALUE_FLAG_PRESERVECSNSET 0x4
- #define SLAPI_VALUE_FLAG_USENEWVALUE 0x8 /* see valueset_remove_valuearray */
- Slapi_ValueSet *slapi_valueset_new( void );
- void slapi_valueset_free(Slapi_ValueSet *vs);
- void slapi_valueset_init(Slapi_ValueSet *vs);
- void slapi_valueset_done(Slapi_ValueSet *vs);
- void slapi_valueset_add_value(Slapi_ValueSet *vs, const Slapi_Value *addval);
- void slapi_valueset_add_value_ext(Slapi_ValueSet *vs, Slapi_Value *addval, unsigned long flags);
- int slapi_valueset_first_value( Slapi_ValueSet *vs, Slapi_Value **v );
- int slapi_valueset_next_value( Slapi_ValueSet *vs, int index, Slapi_Value **v);
- int slapi_valueset_count( const Slapi_ValueSet *vs);
- void slapi_valueset_set_from_smod(Slapi_ValueSet *vs, Slapi_Mod *smod);
- void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2);
- Slapi_Value *slapi_valueset_find(const Slapi_Attr *a, const Slapi_ValueSet *vs, const Slapi_Value *v);
- /*
- * operation routines
- */
- int slapi_op_abandoned( Slapi_PBlock *pb );
- unsigned long slapi_op_get_type(Slapi_Operation * op);
- void slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag);
- void slapi_operation_clear_flag(Slapi_Operation *op, unsigned long flag);
- int slapi_operation_is_flag_set(Slapi_Operation *op, unsigned long flag);
- int slapi_op_reserved(Slapi_PBlock *pb);
- void slapi_operation_set_csngen_handler ( Slapi_Operation *op, void *callback );
- void slapi_operation_set_replica_attr_handler ( Slapi_Operation *op, void *callback );
- int slapi_operation_get_replica_attr ( Slapi_PBlock *pb, Slapi_Operation *op, const char *type, void *value );
- char *slapi_op_type_to_string(unsigned long type);
- /*
- * LDAPMod manipulation routines
- */
- Slapi_Mods* slapi_mods_new( void );
- void slapi_mods_init(Slapi_Mods *smods, int initCount);
- void slapi_mods_init_byref(Slapi_Mods *smods, LDAPMod **mods);
- void slapi_mods_init_passin(Slapi_Mods *smods, LDAPMod **mods);
- void slapi_mods_free(Slapi_Mods **smods);
- void slapi_mods_done(Slapi_Mods *smods);
- void slapi_mods_insert_at(Slapi_Mods *smods, LDAPMod *mod, int pos);
- void slapi_mods_insert_smod_at(Slapi_Mods *smods, Slapi_Mod *smod, int pos);
- void slapi_mods_insert_before(Slapi_Mods *smods, LDAPMod *mod);
- void slapi_mods_insert_smod_before(Slapi_Mods *smods, Slapi_Mod *smod);
- void slapi_mods_insert_after(Slapi_Mods *smods, LDAPMod *mod);
- void slapi_mods_insert_after(Slapi_Mods *smods, LDAPMod *mod);
- void slapi_mods_add( Slapi_Mods *smods, int modtype, const char *type, unsigned long len, const char *val);
- void slapi_mods_add_ldapmod(Slapi_Mods *smods, LDAPMod *mod);
- void slapi_mods_add_modbvps( Slapi_Mods *smods, int modtype, const char *type, struct berval **bvps );
- void slapi_mods_add_mod_values( Slapi_Mods *smods, int modtype, const char *type, Slapi_Value **va );
- void slapi_mods_add_smod(Slapi_Mods *smods, Slapi_Mod *smod);
- void slapi_mods_add_string( Slapi_Mods *smods, int modtype, const char *type, const char *val);
- void slapi_mods_remove(Slapi_Mods *smods);
- LDAPMod *slapi_mods_get_first_mod(Slapi_Mods *smods);
- LDAPMod *slapi_mods_get_next_mod(Slapi_Mods *smods);
- Slapi_Mod *slapi_mods_get_first_smod(Slapi_Mods *smods, Slapi_Mod *smod);
- Slapi_Mod *slapi_mods_get_next_smod(Slapi_Mods *smods, Slapi_Mod *smod);
- void slapi_mods_iterator_backone(Slapi_Mods *smods);
- LDAPMod **slapi_mods_get_ldapmods_byref(Slapi_Mods *smods);
- LDAPMod **slapi_mods_get_ldapmods_passout(Slapi_Mods *smods);
- int slapi_mods_get_num_mods(const Slapi_Mods *smods);
- void slapi_mods_dump(const Slapi_Mods *smods, const char *text);
- Slapi_Mod* slapi_mod_new( void );
- void slapi_mod_init(Slapi_Mod *smod, int initCount);
- void slapi_mod_init_byval(Slapi_Mod *smod, const LDAPMod *mod);
- void slapi_mod_init_byref(Slapi_Mod *smod, LDAPMod *mod);
- void slapi_mod_init_passin(Slapi_Mod *smod, LDAPMod *mod);
- /* init a mod and set the mod values to be a copy of the given valueset */
- void slapi_mod_init_valueset_byval(Slapi_Mod *smod, int op, const char *type, const Slapi_ValueSet *svs);
- void slapi_mod_add_value(Slapi_Mod *smod, const struct berval *val);
- void slapi_mod_remove_value(Slapi_Mod *smod);
- struct berval *slapi_mod_get_first_value(Slapi_Mod *smod);
- struct berval *slapi_mod_get_next_value(Slapi_Mod *smod);
- const char *slapi_mod_get_type(const Slapi_Mod *smod);
- int slapi_mod_get_operation(const Slapi_Mod *smod);
- void slapi_mod_set_type(Slapi_Mod *smod, const char *type);
- void slapi_mod_set_operation(Slapi_Mod *smod, int op);
- int slapi_mod_get_num_values(const Slapi_Mod *smod);
- const LDAPMod *slapi_mod_get_ldapmod_byref(const Slapi_Mod *smod);
- LDAPMod *slapi_mod_get_ldapmod_passout(Slapi_Mod *smod);
- void slapi_mod_free(Slapi_Mod **smod);
- void slapi_mod_done(Slapi_Mod *mod);
- int slapi_mod_isvalid(const Slapi_Mod *mod);
- void slapi_mod_dump(LDAPMod *mod, int n);
- /* helper functions to translate between entry and a set of mods */
- int slapi_mods2entry(Slapi_Entry **e, const char *dn, LDAPMod **attrs);
- int slapi_entry2mods(const Slapi_Entry *e, char **dn, LDAPMod ***attrs);
- /*
- * routines for dealing with filters
- */
- int slapi_filter_get_choice( Slapi_Filter *f );
- int slapi_filter_get_ava( Slapi_Filter *f, char **type, struct berval **bval );
- int slapi_filter_get_attribute_type( Slapi_Filter *f, char **type );
- int slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial,
- char ***any, char **final );
- Slapi_Filter *slapi_filter_list_first( Slapi_Filter *f );
- Slapi_Filter *slapi_filter_list_next( Slapi_Filter *f, Slapi_Filter *fprev );
- Slapi_Filter *slapi_str2filter( char *str );
- Slapi_Filter *slapi_filter_join( int ftype, Slapi_Filter *f1,
- Slapi_Filter *f2 );
- Slapi_Filter *slapi_filter_join_ex( int ftype, Slapi_Filter *f1,
- Slapi_Filter *f2, int recurse_always );
- void slapi_filter_free( Slapi_Filter *f, int recurse );
- int slapi_filter_test( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f,
- int verify_access );
- int slapi_vattr_filter_test( Slapi_PBlock *pb, Slapi_Entry *e,
- struct slapi_filter *f, int verify_access);
- int slapi_filter_test_simple( Slapi_Entry *e, Slapi_Filter *f);
- char *slapi_find_matching_paren( const char *str );
- int slapi_filter_test_ext( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f,
- int verify_access , int only_test_access);
- int slapi_vattr_filter_test_ext( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f,
- int verify_access , int only_test_access);
- int slapi_filter_compare(struct slapi_filter *f1, struct slapi_filter *f2);
- Slapi_Filter *slapi_filter_dup(Slapi_Filter *f);
- int slapi_filter_changetype(Slapi_Filter *f, const char *newtype);
- /*
- * slapi_filter_apply() is used to apply a function to each simple filter
- * component within a complex filter. A 'simple filter' is anything other
- * than AND, OR or NOT.
- */
- typedef int (*FILTER_APPLY_FN)( Slapi_Filter *f, void *arg);
- int slapi_filter_apply( struct slapi_filter *f, FILTER_APPLY_FN fn, void *arg,
- int *error_code );
- /*
- * Possible return values for slapi_filter_apply() and FILTER_APPLY_FNs.
- * Note that a FILTER_APPLY_FN should return _STOP or _CONTINUE only.
- */
- #define SLAPI_FILTER_SCAN_STOP -1 /* premature abort */
- #define SLAPI_FILTER_SCAN_ERROR -2 /* an error occurred */
- #define SLAPI_FILTER_SCAN_NOMORE 0 /* success */
- #define SLAPI_FILTER_SCAN_CONTINUE 1 /* continue scanning */
- /* Error codes that slapi_filter_apply() may set in *error_code */
- #define SLAPI_FILTER_UNKNOWN_FILTER_TYPE 2
-
- /*
- * Bit-Twiddlers
- */
- unsigned char slapi_setbit_uchar(unsigned char f,unsigned char bitnum);
- unsigned char slapi_unsetbit_uchar(unsigned char f,unsigned char bitnum);
- int slapi_isbitset_uchar(unsigned char f,unsigned char bitnum);
- unsigned int slapi_setbit_int(unsigned int f,unsigned int bitnum);
- unsigned int slapi_unsetbit_int(unsigned int f,unsigned int bitnum);
- int slapi_isbitset_int(unsigned int f,unsigned int bitnum);
- /*
- * routines for sending entries and results to the client
- */
- int slapi_send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e,
- LDAPControl **ectrls, char **attrs, int attrsonly );
- void slapi_send_ldap_result( Slapi_PBlock *pb, int err, char *matched,
- char *text, int nentries, struct berval **urls );
- int slapi_send_ldap_referral( Slapi_PBlock *pb, Slapi_Entry *e,
- struct berval **refs, struct berval ***urls );
- typedef int (*send_ldap_search_entry_fn_ptr_t)( Slapi_PBlock *pb,
- Slapi_Entry *e, LDAPControl **ectrls, char **attrs, int attrsonly );
- typedef void (*send_ldap_result_fn_ptr_t)( Slapi_PBlock *pb, int err,
- char *matched, char *text, int nentries, struct berval **urls );
- typedef int (*send_ldap_referral_fn_ptr_t)( Slapi_PBlock *pb,
- Slapi_Entry *e, struct berval **refs, struct berval ***urls );
- /*
- * matching rule
- */
- typedef int (*mrFilterMatchFn) (void* filter, Slapi_Entry*, Slapi_Attr* vals);
- /* returns: 0 filter matched
- * -1 filter did not match
- * >0 an LDAP error code
- */
- int slapi_mr_indexer_create(Slapi_PBlock* opb);
- int slapi_mr_filter_index(Slapi_Filter* f, Slapi_PBlock* pb);
- int slapi_berval_cmp(const struct berval* L, const struct berval* R);
- #define SLAPI_BERVAL_EQ(L,R) ((L)->bv_len == (R)->bv_len && \
- ! memcmp ((L)->bv_val, (R)->bv_val, (L)->bv_len))
- typedef struct slapi_matchingRuleEntry {
- char *mr_oid;
- char *mr_oidalias;
- char *mr_name;
- char *mr_desc;
- char *mr_syntax;
- int mr_obsolete;
- } slapi_matchingRuleEntry;
- typedef struct slapi_matchingRuleEntry Slapi_MatchingRuleEntry;
- Slapi_MatchingRuleEntry *slapi_matchingrule_new(void);
- void slapi_matchingrule_free(Slapi_MatchingRuleEntry **mrEntry,
- int freeMembers);
- int slapi_matchingrule_get(Slapi_MatchingRuleEntry *mr, int arg, void *value);
- int slapi_matchingrule_set(Slapi_MatchingRuleEntry *mr, int arg, void *value);
- int slapi_matchingrule_register(Slapi_MatchingRuleEntry *mrEntry);
- int slapi_matchingrule_unregister(char *oid);
- int slapi_matchingrule_is_ordering(const char *oid_or_name, const char *syntax_oid);
- /*
- * access control
- */
- int slapi_access_allowed( Slapi_PBlock *pb, Slapi_Entry *e, char *attr,
- struct berval *val, int access );
- int slapi_acl_check_mods( Slapi_PBlock *pb, Slapi_Entry *e,
- LDAPMod **mods, char **errbuf );
- int slapi_acl_verify_aci_syntax(Slapi_PBlock *pb, Slapi_Entry *e, char **errbuf);
- /*
- * attribute stuff
- */
- int slapi_value_find( void *plugin, struct berval **vals, struct berval *v );
- /*
- * password handling
- */
- #define SLAPI_USERPWD_ATTR "userpassword"
- int slapi_pw_find_sv( Slapi_Value **vals, const Slapi_Value *v );
- /* value encoding encoding */
- /* checks if the value is encoded with any known algorithm*/
- int slapi_is_encoded(char *value);
- /* encode value with the specified algorithm */
- char* slapi_encode(char *value, char *alg);
- /* UTF8 related */
- int slapi_has8thBit(unsigned char *s);
- unsigned char *slapi_utf8StrToLower(unsigned char *s);
- void slapi_utf8ToLower(unsigned char *s, unsigned char *d, int *ssz, int *dsz);
- int slapi_utf8isUpper(unsigned char *s);
- unsigned char *slapi_utf8StrToUpper(unsigned char *s);
- void slapi_utf8ToUpper(unsigned char *s, unsigned char *d, int *ssz, int *dsz);
- int slapi_utf8isLower(unsigned char *s);
- int slapi_utf8casecmp(unsigned char *s0, unsigned char *s1);
- int slapi_utf8ncasecmp(unsigned char *s0, unsigned char *s1, int n);
- unsigned char *slapi_UTF8STRTOLOWER(char *s);
- void slapi_UTF8TOLOWER(char *s, char *d, int *ssz, int *dsz);
- int slapi_UTF8ISUPPER(char *s);
- unsigned char *slapi_UTF8STRTOUPPER(char *s);
- void slapi_UTF8TOUPPER(char *s, char *d, int *ssz, int *dsz);
- int slapi_UTF8ISLOWER(char *s);
- int slapi_UTF8CASECMP(char *s0, char *s1);
- int slapi_UTF8NCASECMP(char *s0, char *s1, int n);
- /*
- * Interface to the API broker service
- *
- * The API broker allows plugins to publish an API that may be discovered
- * and used dynamically at run time by other subsystems e.g. other plugins.
- */
-
- /* Function: slapi_apib_register
- Description: this function allows publication of an interface
- Parameters: guid - a string constant that uniquely identifies the
- interface (must exist for the life of the server)
- api - a vtable for the published api (must exist for the
- life of the server or until the reference count,
- if it exists, reaches zero)
- Return: 0 if function succeeds
- non-zero otherwise
- */
- int slapi_apib_register(char *guid, void **api); /* publish an interface */
- /* Function: slapi_apib_unregister
- Description: this function allows removal of a published interface
- Parameters: guid - a string constant that uniquely identifies the interface
- Return: 0 if function succeeds
- non-zero otherwise
- */
- int slapi_apib_unregister(char *guid); /* remove interface from published list */
- /* Function: slapi_apib_get_interface
- Description: this function allows retrieval of a published interface,
- if the api reference counted, then the reference
- count is incremented
- Parameters: guid - a string constant that uniquely identifies the
- interface requested
- api - the retrieved vtable for the published api (must NOT
- be freed)
- Return: 0 if function succeeds
- non-zero otherwise
- */
- int slapi_apib_get_interface(char *guid, void ***api); /* retrieve an interface for use */
- /* Function: slapi_apib_make_reference_counted
- Description: this function makes an interface a reference counted interface
- it must be called prior to registering the interface
- Parameters: api - the api to make a reference counted api
- callback - if non-zero, this must be a pointer to a function
- which the api broker will call when the ref count for
- the api reaches zero. This function must return 0 if
- it deregisters the api, non-zero otherwise
- api - the retrieved vtable for the published api (must NOT
- be freed)
- Return: 0 if function succeeds
- non-zero otherwise
- */
- typedef int (*slapi_apib_callback_on_zero)(void **api);
- int slapi_apib_make_reference_counted(void **api,
- slapi_apib_callback_on_zero callback);
- /* Function: slapi_apib_addref
- Description: this function adds to the reference count of an api - a
- call to this function should be paired with a call
- to slapi_apib_release
- - ONLY FOR REFERENCE COUNTED APIS
- Parameters: api - the api to add a reference to
- Return: the new reference count
- */
- int slapi_apib_addref(void **api);
- /* Function: slapi_apib_release
- Description: this function adds to the reference count of an api - a
- call to this function should be paired with a prior call
- to slapi_apib_addref or slapi_apib_get_interface
- - ONLY FOR REFERENCE COUNTED APIS
- Parameters: api - the api to add a reference to
- Return: the new reference count
- */
- int slapi_apib_release(void **api);
- /**** End of API broker interface. *******************************************/
- /*
- * routines for dealing with controls
- */
- int slapi_control_present( LDAPControl **controls, char *oid,
- struct berval **val, int *iscritical );
- void slapi_register_supported_control( char *controloid,
- unsigned long controlops );
- LDAPControl * slapi_dup_control( LDAPControl *ctrl );
- #define SLAPI_OPERATION_BIND 0x00000001UL
- #define SLAPI_OPERATION_UNBIND 0x00000002UL
- #define SLAPI_OPERATION_SEARCH 0x00000004UL
- #define SLAPI_OPERATION_MODIFY 0x00000008UL
- #define SLAPI_OPERATION_ADD 0x00000010UL
- #define SLAPI_OPERATION_DELETE 0x00000020UL
- #define SLAPI_OPERATION_MODDN 0x00000040UL
- #define SLAPI_OPERATION_MODRDN SLAPI_OPERATION_MODDN
- #define SLAPI_OPERATION_COMPARE 0x00000080UL
- #define SLAPI_OPERATION_ABANDON 0x00000100UL
- #define SLAPI_OPERATION_EXTENDED 0x00000200UL
- #define SLAPI_OPERATION_ANY 0xFFFFFFFFUL
- #define SLAPI_OPERATION_NONE 0x00000000UL
- int slapi_get_supported_controls_copy( char ***ctrloidsp,
- unsigned long **ctrlopsp );
- int slapi_build_control( char *oid, BerElement *ber,
- char iscritical, LDAPControl **ctrlp );
- int slapi_build_control_from_berval( char *oid, struct berval *bvp,
- char iscritical, LDAPControl **ctrlp );
- /* Given an array of controls e.g. LDAPControl **ctrls, add the given
- control to the end of the array, growing the array with realloc
- e.g. slapi_add_control_ext(&ctrls, newctrl, 1);
- if ctrls is NULL, the array will be created with malloc
- if copy is true, the given control will be copied
- if copy is false, the given control will be used and owned by the array
- if copy is false, make sure the control can be freed by ldap_controls_free
- */
- void slapi_add_control_ext( LDAPControl ***ctrlsp, LDAPControl *newctrl, int copy );
- /* Given an array of controls e.g. LDAPControl **ctrls, add all of the given
- controls in the newctrls array to the end of ctrls, growing the array with realloc
- if ctrls is NULL, the array will be created with malloc
- if copy is true, each given control will be copied
- if copy is false, each given control will be used and owned by the array
- if copy is false, make sure each control can be freed by ldap_controls_free
- */
- void slapi_add_controls( LDAPControl ***ctrlsp, LDAPControl **newctrls, int copy );
- /*
- * routines for dealing with extended operations
- */
- char **slapi_get_supported_extended_ops_copy( void );
- /*
- * bind, including SASL
- */
- void slapi_register_supported_saslmechanism( char *mechanism );
- char ** slapi_get_supported_saslmechanisms_copy( void );
- void slapi_add_auth_response_control( Slapi_PBlock *pb, const char *binddn );
- int slapi_add_pwd_control( Slapi_PBlock *pb, char *arg, long time );
- int slapi_pwpolicy_make_response_control (Slapi_PBlock *pb, int seconds, int logins, int error);
- /* Password Policy Response Control stuff - the error argument above */
- #define LDAP_PWPOLICY_PWDEXPIRED 0
- #define LDAP_PWPOLICY_ACCTLOCKED 1
- #define LDAP_PWPOLICY_CHGAFTERRESET 2
- #define LDAP_PWPOLICY_PWDMODNOTALLOWED 3
- #define LDAP_PWPOLICY_MUSTSUPPLYOLDPWD 4
- #define LDAP_PWPOLICY_INVALIDPWDSYNTAX 5
- #define LDAP_PWPOLICY_PWDTOOSHORT 6
- #define LDAP_PWPOLICY_PWDTOOYOUNG 7
- #define LDAP_PWPOLICY_PWDINHISTORY 8
- /*
- * routine for freeing the ch_arrays returned by the slapi_get*_copy functions above
- */
- void slapi_ch_array_free( char **array );
- /*
- * Add the given string to the given null terminated array.
- * s is not copied, so if you want to add a copy of s to the
- * array, use slapi_ch_strdup(s)
- * if *a is NULL, a new array will be created
- */
- void slapi_ch_array_add( char ***array, char *string );
- /*
- * checking routines for allocating and freeing memory
- */
- char * slapi_ch_malloc( unsigned long size );
- char * slapi_ch_realloc( char *block, unsigned long size );
- char * slapi_ch_calloc( unsigned long nelem, unsigned long size );
- char * slapi_ch_strdup( const char *s );
- void slapi_ch_free( void **ptr );
- void slapi_ch_free_string( char **s );
- struct berval* slapi_ch_bvdup(const struct berval*);
- struct berval** slapi_ch_bvecdup(struct berval**);
- void slapi_ch_bvfree(struct berval** v);
- char * slapi_ch_smprintf(const char *fmt, ...)
- #ifdef __GNUC__
- __attribute__ ((format (printf, 1, 2)));
- #else
- ;
- #endif
- /*
- * syntax plugin routines
- */
- int slapi_call_syntax_values2keys_sv( void *vpi, Slapi_Value **vals,
- Slapi_Value ***ivals, int ftype );
- int slapi_call_syntax_values2keys_sv_pb( void *vpi, Slapi_Value **vals,
- Slapi_Value ***ivals, int ftype, Slapi_PBlock *pb );
- int slapi_call_syntax_assertion2keys_ava_sv( void *vpi, Slapi_Value *val,
- Slapi_Value ***ivals, int ftype );
- int slapi_call_syntax_assertion2keys_sub_sv( void *vpi, char *initial,
- char **any, char *final, Slapi_Value ***ivals );
- /*
- * internal operation and plugin callback routines
- */
- typedef void (*plugin_result_callback)(int rc, void *callback_data);
- typedef int (*plugin_referral_entry_callback)(char * referral,
- void *callback_data);
- typedef int (*plugin_search_entry_callback)(Slapi_Entry *e,
- void *callback_data);
- void slapi_free_search_results_internal(Slapi_PBlock *pb);
- /*
- * The following functions can be used for internal operations based on DN
- * as well as on uniqueid. These functions should be used by all new plugins
- * and preferrably old plugins should be changed to use them to take
- * advantage of new plugin configuration capabilities and to use an
- * extensible interface.
- *
- * These functions return -1 if pb is NULL and 0 otherwise.
- * The SLAPI_PLUGIN_INTOP_RESULT pblock parameter should be checked to
- * check if the operation was successful.
- *
- * Helper functions are provided to set up pblock parameters currently used
- * by the functions, e.g., slapi_search_internal_set_pb().
- * Additional parameters may be set directly in the pblock.
- */
- int slapi_search_internal_pb(Slapi_PBlock *pb);
- int slapi_search_internal_callback_pb(Slapi_PBlock *pb, void *callback_data,
- plugin_result_callback prc, plugin_search_entry_callback psec,
- plugin_referral_entry_callback prec);
- int slapi_add_internal_pb(Slapi_PBlock *pb);
- int slapi_modify_internal_pb(Slapi_PBlock *pb);
- int slapi_modrdn_internal_pb(Slapi_PBlock *pb);
- int slapi_delete_internal_pb(Slapi_PBlock *pb);
- int slapi_seq_internal_callback_pb(Slapi_PBlock *pb, void *callback_data,
- plugin_result_callback res_callback,
- plugin_search_entry_callback srch_callback,
- plugin_referral_entry_callback ref_callback);
- void slapi_search_internal_set_pb(Slapi_PBlock *pb, const char *base,
- int scope, const char *filter, char **attrs, int attrsonly,
- LDAPControl **controls, const char *uniqueid,
- Slapi_ComponentId *plugin_identity, int operation_flags);
- void slapi_add_entry_internal_set_pb(Slapi_PBlock *pb, Slapi_Entry *e,
- LDAPControl **controls, Slapi_ComponentId *plugin_identity,
- int operation_flags);
- int slapi_add_internal_set_pb(Slapi_PBlock *pb, const char *dn,
- LDAPMod **attrs, LDAPControl **controls,
- Slapi_ComponentId *plugin_identity, int operation_flags);
- void slapi_modify_internal_set_pb(Slapi_PBlock *pb, const char *dn,
- LDAPMod **mods, LDAPControl **controls, const char *uniqueid,
- Slapi_ComponentId *plugin_identity, int operation_flags);
- void slapi_rename_internal_set_pb(Slapi_PBlock *pb, const char *olddn,
- const char *newrdn, const char *newsuperior, int deloldrdn,
- LDAPControl **controls, const char *uniqueid,
- Slapi_ComponentId *plugin_identity, int operation_flags);
- void slapi_delete_internal_set_pb(Slapi_PBlock *pb, const char *dn,
- LDAPControl **controls, const char *uniqueid,
- Slapi_ComponentId *plugin_identity, int operation_flags);
- void slapi_seq_internal_set_pb(Slapi_PBlock *pb, char *ibase, int type,
- char *attrname, char *val, char **attrs, int attrsonly,
- LDAPControl **controls, Slapi_ComponentId *plugin_identity,
- int operation_flags);
- /*
- * slapi_search_internal_get_entry() finds an entry given a dn. It returns
- * an LDAP error code (LDAP_SUCCESS if all goes well).
- */
- int slapi_search_internal_get_entry( Slapi_DN *dn, char ** attrlist,
- Slapi_Entry **ret_entry , void *caller_identity);
- /*
- * interface for registering object extensions.
- */
- typedef void *(*slapi_extension_constructor_fnptr)(void *object, void *parent);
- typedef void (*slapi_extension_destructor_fnptr)(void *extension,
- void *object, void *parent);
- int slapi_register_object_extension( const char *pluginname,
- const char *objectname, slapi_extension_constructor_fnptr constructor,
- slapi_extension_destructor_fnptr destructor, int *objecttype,
- int *extensionhandle);
- /* objects that can be extended (possible values for the objectname param.) */
- #define SLAPI_EXT_CONNECTION "Connection"
- #define SLAPI_EXT_OPERATION "Operation"
- #define SLAPI_EXT_ENTRY "Entry"
- #define SLAPI_EXT_MTNODE "Mapping Tree Node"
- void *slapi_get_object_extension(int objecttype, void *object,
- int extensionhandle);
- void slapi_set_object_extension(int objecttype, void *object,
- int extensionhandle, void *extension);
- /*
- * interface to allow a plugin to register additional plugins.
- */
- typedef int (*slapi_plugin_init_fnptr)( Slapi_PBlock *pb );
- int slapi_register_plugin( const char *plugintype, int enabled,
- const char *initsymbol, slapi_plugin_init_fnptr initfunc,
- const char *name, char **argv, void *group_identity);
- /*
- * logging
- */
- int slapi_log_error( int severity, char *subsystem, char *fmt, ... )
- #ifdef __GNUC__
- __attribute__ ((format (printf, 3, 4)));
- #else
- ;
- #endif
- /* allowed values for the "severity" parameter */
- #define SLAPI_LOG_FATAL 0
- #define SLAPI_LOG_TRACE 1
- #define SLAPI_LOG_PACKETS 2
- #define SLAPI_LOG_ARGS 3
- #define SLAPI_LOG_CONNS 4
- #define SLAPI_LOG_BER 5
- #define SLAPI_LOG_FILTER 6
- #define SLAPI_LOG_CONFIG 7
- #define SLAPI_LOG_ACL 8
- #define SLAPI_LOG_SHELL 9
- #define SLAPI_LOG_PARSE 10
- #define SLAPI_LOG_HOUSE 11
- #define SLAPI_LOG_REPL 12
- #define SLAPI_LOG_CACHE 13
- #define SLAPI_LOG_PLUGIN 14
- #define SLAPI_LOG_TIMING 15
- #define SLAPI_LOG_ACLSUMMARY 16
- int slapi_is_loglevel_set( const int loglevel );
- /*
- * locks and synchronization
- */
- typedef struct slapi_mutex Slapi_Mutex;
- typedef struct slapi_condvar Slapi_CondVar;
- Slapi_Mutex *slapi_new_mutex( void );
- void slapi_destroy_mutex( Slapi_Mutex *mutex );
- void slapi_lock_mutex( Slapi_Mutex *mutex );
- int slapi_unlock_mutex( Slapi_Mutex *mutex );
- Slapi_CondVar *slapi_new_condvar( Slapi_Mutex *mutex );
- void slapi_destroy_condvar( Slapi_CondVar *cvar );
- int slapi_wait_condvar( Slapi_CondVar *cvar, struct timeval *timeout );
- int slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all );
- /*
- * thread-safe LDAP connections
- */
- LDAP *slapi_ldap_init( char *ldaphost, int ldapport, int secure, int shared );
- void slapi_ldap_unbind( LDAP *ld );
- LDAP *
- slapi_ldap_init_ext(
- const char *ldapurl, /* full ldap url */
- const char *hostname, /* can also use this to override
- host in url */
- int port, /* can also use this to override port in url */
- int secure, /* 0 for ldap, 1 for ldaps, 2 for starttls -
- override proto in url */
- int shared, /* if true, LDAP* will be shared among multiple threads */
- const char *filename /* for ldapi */
- );
- int
- slapi_ldap_bind(
- LDAP *ld, /* ldap connection */
- const char *bindid, /* usually a bind DN for simple bind */
- const char *creds, /* usually a password for simple bind */
- const char *mech, /* name of mechanism */
- LDAPControl **serverctrls, /* additional controls to send */
- LDAPControl ***returnedctrls, /* returned controls */
- struct timeval *timeout, /* timeout */
- int *msgidp /* pass in non-NULL for async handling */
- );
- /*
- * computed attributes
- */
- struct _computed_attr_context;
- typedef struct _computed_attr_context computed_attr_context;
- typedef int (*slapi_compute_output_t)(computed_attr_context *c,Slapi_Attr *a , Slapi_Entry *e);
- typedef int (*slapi_compute_callback_t)(computed_attr_context *c,char* type,Slapi_Entry *e,slapi_compute_output_t outputfn);
- typedef int (*slapi_search_rewrite_callback_t)(Slapi_PBlock *pb);
- int slapi_compute_add_evaluator(slapi_compute_callback_t function);
- int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function);
- int compute_rewrite_search_filter(Slapi_PBlock *pb);
- /*
- * routines for dealing with backends
- */
- Slapi_Backend *slapi_be_new( const char *type, const char *name,
- int isprivate, int logchanges );
- void slapi_be_free(Slapi_Backend **be);
- Slapi_Backend *slapi_be_select( const Slapi_DN *sdn );
- Slapi_Backend *slapi_be_select_by_instance_name( const char *name );
- int slapi_be_exist(const Slapi_DN *sdn);
- void slapi_be_delete_onexit(Slapi_Backend *be);
- void slapi_be_set_readonly(Slapi_Backend *be, int readonly);
- int slapi_be_get_readonly(Slapi_Backend *be);
- int slapi_be_getentrypoint(Slapi_Backend *be, int entrypoint, void **ret_fnptr,
- Slapi_PBlock *pb);
- int slapi_be_setentrypoint(Slapi_Backend *be, int entrypoint, void *ret_fnptr,
- Slapi_PBlock *pb);
- int slapi_be_logchanges(Slapi_Backend *be);
- int slapi_be_issuffix(const Slapi_Backend *be, const Slapi_DN *suffix );
- void slapi_be_addsuffix(Slapi_Backend *be,const Slapi_DN *suffix);
- char * slapi_be_get_name(Slapi_Backend * be);
- const Slapi_DN *slapi_be_getsuffix(Slapi_Backend *be, int n);
- Slapi_Backend* slapi_get_first_backend(char **cookie);
- Slapi_Backend* slapi_get_next_backend(char *cookie);
- int slapi_be_private( Slapi_Backend *be );
- void * slapi_be_get_instance_info(Slapi_Backend * be);
- void slapi_be_set_instance_info(Slapi_Backend * be, void * data);
- Slapi_DN * slapi_get_first_suffix(void ** node, int show_private);
- Slapi_DN * slapi_get_next_suffix(void ** node, int show_private);
- int slapi_is_root_suffix(Slapi_DN * dn);
- const char * slapi_be_gettype(Slapi_Backend *be);
- int slapi_be_is_flag_set(Slapi_Backend * be, int flag);
- void slapi_be_set_flag(Slapi_Backend * be, int flag);
- #define SLAPI_BE_FLAG_REMOTE_DATA 0x1 /* entries held by backend are remote */
- #define SLAPI_BE_FLAG_DONT_BYPASS_FILTERTEST 0x10 /* force to call filter_test (search only) */
- /* These functions allow a plugin to register for callback when
- * a backend state change
- */
- typedef void (*slapi_backend_state_change_fnptr)(void *handle, char *be_name,
- int old_be_state, int new_be_state);
- void slapi_register_backend_state_change(void * handle, slapi_backend_state_change_fnptr funct);
- int slapi_unregister_backend_state_change(void * handle);
- #define SLAPI_BE_STATE_ON 1 /* backend is ON */
- #define SLAPI_BE_STATE_OFFLINE 2 /* backend is OFFLINE (import process) */
- #define SLAPI_BE_STATE_DELETE 3 /* backend has been deleted */
- /*
- * Distribution.
- */
- /* SLAPI_BE_ALL_BACKENDS is a special value that is returned by
- * a distribution plugin function to indicate that all backends
- * should be searched (it is only used for search operations).
- */
- #define SLAPI_BE_ALL_BACKENDS -1
- /*
- * virtual attribute service
- */
- /* General flags (flags parameter) */
- #define SLAPI_REALATTRS_ONLY 1
- #define SLAPI_VIRTUALATTRS_ONLY 2
- #define SLAPI_VIRTUALATTRS_REQUEST_POINTERS 4 /* I want to receive pointers into the entry, if possible */
- #define SLAPI_VIRTUALATTRS_LIST_OPERATIONAL_ATTRS 8 /* Include operational attributes in attribute lists */
- #define SLAPI_VIRTUALATTRS_SUPPRESS_SUBTYPES 16 /* I want only the requested attribute */
- /* Buffer disposition flags (buffer_flags parameter) */
- #define SLAPI_VIRTUALATTRS_RETURNED_POINTERS 1
- #define SLAPI_VIRTUALATTRS_RETURNED_COPIES 2
- #define SLAPI_VIRTUALATTRS_REALATTRS_ONLY 4
- /* Attribute type name disposition values (type_name_disposition parameter) */
- #define SLAPI_VIRTUALATTRS_TYPE_NAME_MATCHED_EXACTLY_OR_ALIAS 1
- #define SLAPI_VIRTUALATTRS_TYPE_NAME_MATCHED_SUBTYPE 2
- #define SLAPI_VIRTUALATTRS_NOT_FOUND -1
- #define SLAPI_VIRTUALATTRS_LOOP_DETECTED -2
- typedef struct _vattr_type_thang vattr_type_thang;
- typedef struct _vattr_get_thang vattr_get_thang;
- vattr_get_thang *slapi_vattr_getthang_first(vattr_get_thang *t);
- vattr_get_thang *slapi_vattr_getthang_next(vattr_get_thang *t);
- int slapi_vattr_values_type_thang_get(
- /* Entry we're interested in */ Slapi_Entry *e,
- /* attr type */ vattr_type_thang *type_thang,
- /* pointer to result set */ Slapi_ValueSet** results,
- int *type_name_disposition, char **actual_type_name, int flags,
- int *buffer_flags);
- int slapi_vattr_values_get(
- /* Entry we're interested in */ Slapi_Entry *e,
- /* attr type name */ char *type,
- /* pointer to result set */ Slapi_ValueSet** results,
- int *type_name_disposition, char **actual_type_name, int flags,
- int *buffer_flags);
- int slapi_vattr_values_get_ex(
- /* Entry we're interested in */ Slapi_Entry *e,
- /* attr type name */ char *type,
- /* pointer to result set */ Slapi_ValueSet*** results,
- int **type_name_disposition, char ***actual_type_name, int flags,
- int *buffer_flags, int *subtype_count);
- int slapi_vattr_namespace_values_get(
- /* Entry we're interested in */ Slapi_Entry *e,
- /* backend namespace dn */ Slapi_DN *namespace_dn,
- /* attr type name */ char *type,
- /* pointer to result set */ Slapi_ValueSet*** results,
- int **type_name_disposition, char ***actual_type_name, int flags,
- int *buffer_flags, int *subtype_count);
- void slapi_vattr_values_free(Slapi_ValueSet **value, char **actual_type_name,
- int flags);
- int slapi_vattr_value_compare(
- /* Entry we're interested in */ Slapi_Entry *e,
- /* attr type name */ char *type,
- Slapi_Value *test_this,/* pointer to result */ int *result,
- int flags);
- int slapi_vattr_namespace_value_compare(
- /* Entry we're interested in */ Slapi_Entry *e,
- /* backend namespace dn */ Slapi_DN *namespace_dn,
- /* attr type name */ const char *type,
- Slapi_Value *test_this,/* pointer to result */ int *result,
- int flags);
- int slapi_vattr_list_attrs(
- /* Entry we're interested in */ Slapi_Entry *e,
- /* pointer to receive the list */ vattr_type_thang **types,
- int flags, int *buffer_flags);
- void slapi_vattr_attrs_free(vattr_type_thang **types, int flags);
- char *vattr_typethang_get_name(vattr_type_thang *t);
- unsigned long vattr_typethang_get_flags(vattr_type_thang *t);
- vattr_type_thang *vattr_typethang_next(vattr_type_thang *t);
- vattr_type_thang *vattr_typethang_first(vattr_type_thang *t);
- int slapi_vattr_schema_check_type(Slapi_Entry *e, char *type);
- /* roles */
- typedef int (*roles_check_fn_type)(Slapi_Entry *entry_to_check, Slapi_DN *role_dn, int *present);
- int slapi_role_check(Slapi_Entry *entry_to_check, Slapi_DN *role_dn, int *present);
- void slapi_register_role_check(roles_check_fn_type check_fn);
- /* DSE */
- /* Front end configuration */
- typedef int (*dseCallbackFn)(Slapi_PBlock *, Slapi_Entry *, Slapi_Entry *,
- int *, char*, void *);
- /*
- * Note: DSE callback functions MUST return one of these three values:
- *
- * SLAPI_DSE_CALLBACK_OK -- no errors occurred; apply changes.
- * SLAPI_DSE_CALLBACK_ERROR -- an error occurred; don't apply changes.
- * SLAPI_DSE_CALLBACK_DO_NOT_APPLY -- no error, but do not apply changes.
- *
- * SLAPI_DSE_CALLBACK_DO_NOT_APPLY should only be returned by modify
- * callbacks (i.e., those registered with operation==SLAPI_OPERATION_MODIFY).
- * A return value of SLAPI_DSE_CALLBACK_DO_NOT_APPLY is treated the same as
- * SLAPI_DSE_CALLBACK_ERROR for all other operations.
- */
- #define SLAPI_DSE_CALLBACK_OK (1)
- #define SLAPI_DSE_CALLBACK_ERROR (-1)
- #define SLAPI_DSE_CALLBACK_DO_NOT_APPLY (0)
- /*
- * Flags for slapi_config_register_callback() and
- * slapi_config_remove_callback()
- */
- #define DSE_FLAG_PREOP 0x0001
- #define DSE_FLAG_POSTOP 0x0002
- /* This is the size of the returntext parameter passed to the config callback function,
- which is the "char *" argument to dseCallbackFn above */
- #define SLAPI_DSE_RETURNTEXT_SIZE 512 /* for use by callback functions */
- int slapi_config_register_callback(int operation, int flags, const char *base, int scope, const char *filter, dseCallbackFn fn, void *fn_arg);
- int slapi_config_remove_callback(int operation, int flags, const char *base, int scope, const char *filter, dseCallbackFn fn);
- /******************************************************************************
- * Online tasks interface (to support import, export, etc)
- * After some cleanup, we could consider making these public.
- */
- /* task states */
- #define SLAPI_TASK_SETUP 0
- #define SLAPI_TASK_RUNNING 1
- #define SLAPI_TASK_FINISHED 2
- #define SLAPI_TASK_CANCELLED 3
- /* task flag (pb_task_flags)*/
- #define SLAPI_TASK_RUNNING_AS_TASK 0x0
- #define SLAPI_TASK_RUNNING_FROM_COMMANDLINE 0x1
- /* task flags (set by the task-control code) */
- #define SLAPI_TASK_DESTROYING 0x01 /* queued event for destruction */
- int slapi_task_register_handler(const char *name, dseCallbackFn func);
- void slapi_task_begin(Slapi_Task *task, int total_work);
- void slapi_task_inc_progress(Slapi_Task *task);
- void slapi_task_finish(Slapi_Task *task, int rc);
- void slapi_task_cancel(Slapi_Task *task, int rc);
- int slapi_task_get_state(Slapi_Task *task);
- void slapi_task_set_data(Slapi_Task *task, void *data);
- void * slapi_task_get_data(Slapi_Task *task);
- void slapi_task_inc_refcount(Slapi_Task *task);
- void slapi_task_dec_refcount(Slapi_Task *task);
- int slapi_task_get_refcount(Slapi_Task *task);
- void slapi_task_set_destructor_fn(Slapi_Task *task, TaskCallbackFn func);
- void slapi_task_set_cancel_fn(Slapi_Task *task, TaskCallbackFn func);
- void slapi_task_status_changed(Slapi_Task *task);
- void slapi_task_log_status(Slapi_Task *task, char *format, ...)
- #ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)));
- #else
- ;
- #endif
- void slapi_task_log_notice(Slapi_Task *task, char *format, ...)
- #ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)));
- #else
- ;
- #endif
- /*
- * slapi_new_task: create new task, fill in DN, and setup modify callback
- * argument:
- * dn: task dn
- * result:
- * Success: Slapi_Task object
- * Failure: NULL
- */
- Slapi_Task *slapi_new_task(const char *dn);
- /* slapi_destroy_task: destroy a task
- * argument:
- * task: task to destroy
- * result:
- * none
- */
- void slapi_destroy_task(void *arg);
- /* End of interface to support online tasks **********************************/
- /* Slapi_Counter Interface */
- Slapi_Counter *slapi_counter_new();
- void slapi_counter_init(Slapi_Counter *counter);
- void slapi_counter_destroy(Slapi_Counter **counter);
- PRUint64 slapi_counter_increment(Slapi_Counter *counter);
- PRUint64 slapi_counter_decrement(Slapi_Counter *counter);
- PRUint64 slapi_counter_add(Slapi_Counter *counter, PRUint64 addvalue);
- PRUint64 slapi_counter_subtract(Slapi_Counter *counter, PRUint64 subvalue);
- PRUint64 slapi_counter_set_value(Slapi_Counter *counter, PRUint64 newvalue);
- PRUint64 slapi_counter_get_value(Slapi_Counter *counter);
- /* Binder-based (connection centric) resource limits */
- /*
- * Valid values for `type' parameter to slapi_reslimit_register().
- */
- #define SLAPI_RESLIMIT_TYPE_INT 0
- /*
- * Status codes returned by all functions.
- */
- #define SLAPI_RESLIMIT_STATUS_SUCCESS 0 /* goodness */
- #define SLAPI_RESLIMIT_STATUS_NOVALUE 1 /* no value is available */
- #define SLAPI_RESLIMIT_STATUS_INIT_FAILURE 2 /* initialization failed */
- #define SLAPI_RESLIMIT_STATUS_PARAM_ERROR 3 /* bad parameter */
- #define SLAPI_RESLIMIT_STATUS_UNKNOWN_HANDLE 4 /* unregistered handle */
- #define SLAPI_RESLIMIT_STATUS_INTERNAL_ERROR 5 /* unexpected error */
- /*
- * Functions.
- */
- int slapi_reslimit_register( int type, const char *attrname, int *handlep );
- int slapi_reslimit_get_integer_limit( Slapi_Connection *conn, int handle,
- int *limitp );
- /* END of Binder-based resource limits API */
- /*
- * Plugin and parameter block related macros (remainder of this file).
- */
- /*
- * Plugin version. Note that the Directory Server will load version 01
- * and 02 plugins, but some server features require 03 plugins.
- */
- #define SLAPI_PLUGIN_VERSION_01 "01"
- #define SLAPI_PLUGIN_VERSION_02 "02"
- #define SLAPI_PLUGIN_VERSION_03 "03"
- #define SLAPI_PLUGIN_CURRENT_VERSION SLAPI_PLUGIN_VERSION_03
- #define SLAPI_PLUGIN_IS_COMPAT(x) \
- ((strcmp((x), SLAPI_PLUGIN_VERSION_01) == 0) || \
- (strcmp((x), SLAPI_PLUGIN_VERSION_02) == 0) || \
- (strcmp((x), SLAPI_PLUGIN_VERSION_03) == 0))
- #define SLAPI_PLUGIN_IS_V2(x) \
- ((strcmp((x)->plg_version, SLAPI_PLUGIN_VERSION_02) == 0) || \
- (strcmp((x)->plg_version, SLAPI_PLUGIN_VERSION_03) == 0))
- #define SLAPI_PLUGIN_IS_V3(x) \
- (strcmp((x)->plg_version, SLAPI_PLUGIN_VERSION_03) == 0)
- /* this one just has to be human readable */
- #define SLAPI_PLUGIN_SUPPORTED_VERSIONS "01,02,03"
- /*
- * types of plugin interfaces
- */
- #define SLAPI_PLUGIN_EXTENDEDOP 2
- #define SLAPI_PLUGIN_PREOPERATION 3
- #define SLAPI_PLUGIN_POSTOPERATION 4
- #define SLAPI_PLUGIN_MATCHINGRULE 5
- #define SLAPI_PLUGIN_SYNTAX 6
- #define SLAPI_PLUGIN_ACL 7
- #define SLAPI_PLUGIN_BEPREOPERATION 8
- #define SLAPI_PLUGIN_BEPOSTOPERATION 9
- #define SLAPI_PLUGIN_ENTRY 10
- #define SLAPI_PLUGIN_TYPE_OBJECT 11
- #define SLAPI_PLUGIN_INTERNAL_PREOPERATION 12
- #define SLAPI_PLUGIN_INTERNAL_POSTOPERATION 13
- #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME 14
- #define SLAPI_PLUGIN_VATTR_SP 15
- #define SLAPI_PLUGIN_REVER_PWD_STORAGE_SCHEME 16
- #define SLAPI_PLUGIN_LDBM_ENTRY_FETCH_STORE 17
- #define SLAPI_PLUGIN_INDEX 18
- /*
- * special return values for extended operation plugins (zero or positive
- * return values should be LDAP error codes as defined in ldap.h)
- */
- #define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
- #define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED -2
- /*
- * the following can be used as the second argument to the
- * slapi_pblock_get() and slapi_pblock_set() calls.
- */
- /* backend, connection, operation */
- #define SLAPI_BACKEND 130
- #define SLAPI_CONNECTION 131
- #define SLAPI_OPERATION 132
- #define SLAPI_REQUESTOR_ISROOT 133
- #define SLAPI_BE_TYPE 135
- #define SLAPI_BE_READONLY 136
- #define SLAPI_BE_LASTMOD 137
- #define SLAPI_CONN_ID 139
- #define SLAPI_BACKEND_COUNT 860
- /* operation */
- #define SLAPI_OPINITIATED_TIME 140
- #define SLAPI_REQUESTOR_DN 141
- #define SLAPI_OPERATION_PARAMETERS 138
- #define SLAPI_OPERATION_TYPE 590
- #define SLAPI_OPERATION_AUTHTYPE 741
- #define SLAPI_OPERATION_ID 744
- #define SLAPI_IS_REPLICATED_OPERATION 142
- #define SLAPI_IS_MMR_REPLICATED_OPERATION 153
- #define SLAPI_IS_LEGACY_REPLICATED_OPERATION 154
- #define SLAPI_SKIP_MODIFIED_ATTRS 155
- /* connection */
- #define SLAPI_CONN_DN 143
- #define SLAPI_CONN_CLIENTNETADDR 850
- #define SLAPI_CONN_SERVERNETADDR 851
- #define SLAPI_CONN_IS_REPLICATION_SESSION 149
- #define SLAPI_CONN_IS_SSL_SESSION 747
- #define SLAPI_CONN_CERT 743
- #define SLAPI_CONN_AUTHMETHOD 746
- #define SLAPI_CONN_SASL_SSF 748
- #define SLAPI_CONN_SSL_SSF 749
- /*
- * Types of authentication for SLAPI_CONN_AUTHMETHOD
- * (and deprecated SLAPI_CONN_AUTHTYPE)
- */
- #define SLAPD_AUTH_NONE "none"
- #define SLAPD_AUTH_SIMPLE "simple"
- #define SLAPD_AUTH_SSL "SSL"
- #define SLAPD_AUTH_SASL "SASL " /* followed by the mechanism name */
- #define SLAPD_AUTH_OS "OS"
- /* Command Line Arguments */
- #define SLAPI_ARGC 147
- #define SLAPI_ARGV 148
- /* Slapd config file directory */
- #define SLAPI_CONFIG_DIRECTORY 281
- /* DSE flags */
- #define SLAPI_DSE_DONT_WRITE_WHEN_ADDING 282
- #define SLAPI_DSE_MERGE_WHEN_ADDING 283
- #define SLAPI_DSE_DONT_CHECK_DUPS 284
- #define SLAPI_DSE_REAPPLY_MODS 287
- #define SLAPI_DSE_IS_PRIMARY_FILE 289
- /* internal schema flags */
- #define SLAPI_SCHEMA_FLAGS 285
- /* urp flags */
- #define SLAPI_URP_NAMING_COLLISION_DN 286
- #define SLAPI_URP_TOMBSTONE_UNIQUEID 288
- /* common to all plugins */
- #define SLAPI_PLUGIN 3
- #define SLAPI_PLUGIN_PRIVATE 4
- #define SLAPI_PLUGIN_TYPE 5
- #define SLAPI_PLUGIN_ARGV 6
- #define SLAPI_PLUGIN_ARGC 7
- #define SLAPI_PLUGIN_VERSION 8
- #define SLAPI_PLUGIN_OPRETURN 9
- #define SLAPI_PLUGIN_OBJECT 10
- #define SLAPI_PLUGIN_DESTROY_FN 11
- #define SLAPI_PLUGIN_DESCRIPTION 12
- typedef struct slapi_plugindesc {
- char *spd_id;
- char *spd_vendor;
- char *spd_version;
- char *spd_description;
- } Slapi_PluginDesc;
- #define SLAPI_PLUGIN_IDENTITY 13
- /* common for internal plugin_ops */
- #define SLAPI_PLUGIN_INTOP_RESULT 15
- #define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES 16
- #define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS 17
- /* miscellaneous plugin functions */
- #define SLAPI_PLUGIN_CLOSE_FN 210
- #define SLAPI_PLUGIN_START_FN 212
- #define SLAPI_PLUGIN_CLEANUP_FN 232
- #define SLAPI_PLUGIN_POSTSTART_FN 233
- /* extendedop plugin functions */
- #define SLAPI_PLUGIN_EXT_OP_FN 300
- #define SLAPI_PLUGIN_EXT_OP_OIDLIST 301
- #define SLAPI_PLUGIN_EXT_OP_NAMELIST 302
- /* preoperation plugin functions */
- #define SLAPI_PLUGIN_PRE_BIND_FN 401
- #define SLAPI_PLUGIN_PRE_UNBIND_FN 402
- #define SLAPI_PLUGIN_PRE_SEARCH_FN 403
- #define SLAPI_PLUGIN_PRE_COMPARE_FN 404
- #define SLAPI_PLUGIN_PRE_MODIFY_FN 405
- #define SLAPI_PLUGIN_PRE_MODRDN_FN 406
- #define SLAPI_PLUGIN_PRE_ADD_FN 407
- #define SLAPI_PLUGIN_PRE_DELETE_FN 408
- #define SLAPI_PLUGIN_PRE_ABANDON_FN 409
- #define SLAPI_PLUGIN_PRE_ENTRY_FN 410
- #define SLAPI_PLUGIN_PRE_REFERRAL_FN 411
- #define SLAPI_PLUGIN_PRE_RESULT_FN 412
- /* internal preoperation plugin functions */
- #define SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN 420
- #define SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN 421
- #define SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN 422
- #define SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN 423
- /* preoperation plugin to the backend */
- #define SLAPI_PLUGIN_BE_PRE_ADD_FN 450
- #define SLAPI_PLUGIN_BE_PRE_MODIFY_FN 451
- #define SLAPI_PLUGIN_BE_PRE_MODRDN_FN 452
- #define SLAPI_PLUGIN_BE_PRE_DELETE_FN 453
- /* postoperation plugin functions */
- #define SLAPI_PLUGIN_POST_BIND_FN 501
- #define SLAPI_PLUGIN_POST_UNBIND_FN 502
- #define SLAPI_PLUGIN_POST_SEARCH_FN 503
- #define SLAPI_PLUGIN_POST_COMPARE_FN 504
- #define SLAPI_PLUGIN_POST_MODIFY_FN 505
- #define SLAPI_PLUGIN_POST_MODRDN_FN 506
- #define SLAPI_PLUGIN_POST_ADD_FN 507
- #define SLAPI_PLUGIN_POST_DELETE_FN 508
- #define SLAPI_PLUGIN_POST_ABANDON_FN 509
- #define SLAPI_PLUGIN_POST_ENTRY_FN 510
- #define SLAPI_PLUGIN_POST_REFERRAL_FN 511
- #define SLAPI_PLUGIN_POST_RESULT_FN 512
- #define SLAPI_PLUGIN_POST_SEARCH_FAIL_FN 513
- /* internal preoperation plugin functions */
- #define SLAPI_PLUGIN_INTERNAL_POST_ADD_FN 520
- #define SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN 521
- #define SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN 522
- #define SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN 523
- /* postoperation plugin to the backend */
- #define SLAPI_PLUGIN_BE_POST_ADD_FN 550
- #define SLAPI_PLUGIN_BE_POST_MODIFY_FN 551
- #define SLAPI_PLUGIN_BE_POST_MODRDN_FN 552
- #define SLAPI_PLUGIN_BE_POST_DELETE_FN 553
- /* matching rule plugin functions */
- #define SLAPI_PLUGIN_MR_FILTER_CREATE_FN 600
- #define SLAPI_PLUGIN_MR_INDEXER_CREATE_FN 601
- #define SLAPI_PLUGIN_MR_FILTER_MATCH_FN 602
- #define SLAPI_PLUGIN_MR_FILTER_INDEX_FN 603
- #define SLAPI_PLUGIN_MR_FILTER_RESET_FN 604
- #define SLAPI_PLUGIN_MR_INDEX_FN 605
- /* matching rule plugin arguments */
- #define SLAPI_PLUGIN_MR_OID 610
- #define SLAPI_PLUGIN_MR_TYPE 611
- #define SLAPI_PLUGIN_MR_VALUE 612
- #define SLAPI_PLUGIN_MR_VALUES 613
- #define SLAPI_PLUGIN_MR_KEYS 614
- #define SLAPI_PLUGIN_MR_FILTER_REUSABLE 615
- #define SLAPI_PLUGIN_MR_QUERY_OPERATOR 616
- #define SLAPI_PLUGIN_MR_USAGE 617
- /* Defined values of SLAPI_PLUGIN_MR_QUERY_OPERATOR: */
- #define SLAPI_OP_LESS 1
- #define SLAPI_OP_LESS_OR_EQUAL 2
- #define SLAPI_OP_EQUAL 3
- #define SLAPI_OP_GREATER_OR_EQUAL 4
- #define SLAPI_OP_GREATER 5
- #define SLAPI_OP_SUBSTRING 6
- /* Defined values of SLAPI_PLUGIN_MR_USAGE: */
- #define SLAPI_PLUGIN_MR_USAGE_INDEX 0
- #define SLAPI_PLUGIN_MR_USAGE_SORT 1
- /* Defined values for matchingRuleEntry accessor functions */
- #define SLAPI_MATCHINGRULE_NAME 1
- #define SLAPI_MATCHINGRULE_OID 2
- #define SLAPI_MATCHINGRULE_DESC 3
- #define SLAPI_MATCHINGRULE_SYNTAX 4
- #define SLAPI_MATCHINGRULE_OBSOLETE 5
- /* syntax plugin functions and arguments */
- #define SLAPI_PLUGIN_SYNTAX_FILTER_AVA 700
- #define SLAPI_PLUGIN_SYNTAX_FILTER_SUB 701
- #define SLAPI_PLUGIN_SYNTAX_VALUES2KEYS 702
- #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA 703
- #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB 704
- #define SLAPI_PLUGIN_SYNTAX_NAMES 705
- #define SLAPI_PLUGIN_SYNTAX_OID 706
- #define SLAPI_PLUGIN_SYNTAX_FLAGS 707
- #define SLAPI_PLUGIN_SYNTAX_COMPARE 708
- /* user defined substrlen; not stored in slapdplugin, but pblock itself */
- #define SLAPI_SYNTAX_SUBSTRLENS 709
- #define SLAPI_PLUGIN_SYNTAX_VALIDATE 710
- /* ACL plugin functions and arguments */
- #define SLAPI_PLUGIN_ACL_INIT 730
- #define SLAPI_PLUGIN_ACL_SYNTAX_CHECK 731
- #define SLAPI_PLUGIN_ACL_ALLOW_ACCESS 732
- #define SLAPI_PLUGIN_ACL_MODS_ALLOWED 733
- #define SLAPI_PLUGIN_ACL_MODS_UPDATE 734
- #define ACLPLUGIN_ACCESS_DEFAULT 0
- #define ACLPLUGIN_ACCESS_READ_ON_ENTRY 1
- #define ACLPLUGIN_ACCESS_READ_ON_ATTR 2
- #define ACLPLUGIN_ACCESS_READ_ON_VLV 3
- #define ACLPLUGIN_ACCESS_MODRDN 4
- #define ACLPLUGIN_ACCESS_GET_EFFECTIVE_RIGHTS 5
- /* Authorization types */
- #define SLAPI_BE_MAXNESTLEVEL 742
- #define SLAPI_CLIENT_DNS 745
- /* Password storage scheme functions and arguments */
- #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_ENC_FN 800
- #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DEC_FN 801 /* only meaningfull for reversible encryption */
- #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_CMP_FN 802
- #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_NAME 810 /* name of the method: SHA, SSHA... */
- #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_USER_PWD 811 /* value sent over LDAP */
- #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DB_PWD 812 /* value from the DB */
- /* entry fetch and entry store values */
- #define SLAPI_PLUGIN_ENTRY_FETCH_FUNC 813
- #define SLAPI_PLUGIN_ENTRY_STORE_FUNC 814
- #define SLAPI_PLUGIN_ENABLED 815
- /*
- * Defined values of SLAPI_PLUGIN_SYNTAX_FLAGS:
- */
- #define SLAPI_PLUGIN_SYNTAX_FLAG_ORKEYS 1
- #define SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING 2
- /* controls we know about */
- #define SLAPI_MANAGEDSAIT 1000
- #define SLAPI_PWPOLICY 1001
- /* arguments that are common to all operation */
- #define SLAPI_TARGET_ADDRESS 48 /* target address (dn + uniqueid) should be normalized */
- #define SLAPI_TARGET_UNIQUEID 49 /* target uniqueid of the operation */
- #define SLAPI_TARGET_DN 50 /* target dn of the operation should be normalized */
- #define SLAPI_REQCONTROLS 51 /* request controls */
- /* Copies of entry before and after add, mod, mod[r]dn operations */
- #define SLAPI_ENTRY_PRE_OP 52
- #define SLAPI_ENTRY_POST_OP 53
- /* a PRE_ENTRY_FN may alter the entry to be returned to the client -
- SLAPI_SEARCH_ORIG_ENTRY holds the original entry from
- the database - this must not be changed
- SLAPI_SEARCH_ENTRY_COPY holds a copy of the original entry that
- has been modified by the plugin - this will be NULL by default -
- if a plugin needs to modify the entry, it should first check to
- see if there is already a SLAPI_SEARCH_ENTRY_COPY - if not, the
- plugin must use slapi_entry_dup() or similar to make a copy, edit
- the copy, then store it in SLAPI_SEARCH_ENTRY_COPY - the internal
- server code will free SLAPI_SEARCH_ENTRY_COPY
- */
- #define SLAPI_SEARCH_ENTRY_ORIG SLAPI_ENTRY_PRE_OP
- #define SLAPI_SEARCH_ENTRY_COPY SLAPI_ENTRY_POST_OP
- /* LDAPv3 controls to be sent with the operation result */
- #define SLAPI_RESCONTROLS 55
- #define SLAPI_ADD_RESCONTROL 56 /* add result control */
- /* Extra notes to be logged within access log RESULT lines */
- #define SLAPI_OPERATION_NOTES 57
- #define SLAPI_OP_NOTE_UNINDEXED 0x01
- /* Allows controls to be passed before operation object is created */
- #define SLAPI_CONTROLS_ARG 58
- /* specify whether pblock content should be destroyed when the pblock is destroyed */
- #define SLAPI_DESTROY_CONTENT 59
- /* add arguments */
- #define SLAPI_ADD_TARGET SLAPI_TARGET_DN
- #define SLAPI_ADD_ENTRY 60
- #define SLAPI_ADD_EXISTING_DN_ENTRY 61
- #define SLAPI_ADD_PARENT_ENTRY 62
- #define SLAPI_ADD_PARENT_UNIQUEID 63
- #define SLAPI_ADD_EXISTING_UNIQUEID_ENTRY 64
- /* bind arguments */
- #define SLAPI_BIND_TARGET SLAPI_TARGET_DN
- #define SLAPI_BIND_METHOD 70
- #define SLAPI_BIND_CREDENTIALS 71 /* v3 only */
- #define SLAPI_BIND_SASLMECHANISM 72 /* v3 only */
- /* bind return values */
- #define SLAPI_BIND_RET_SASLCREDS 73 /* v3 only */
- /* compare arguments */
- #define SLAPI_COMPARE_TARGET SLAPI_TARGET_DN
- #define SLAPI_COMPARE_TYPE 80
- #define SLAPI_COMPARE_VALUE 81
- /* delete arguments */
- #define SLAPI_DELETE_TARGET SLAPI_TARGET_DN
- #define SLAPI_DELETE_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
- #define SLAPI_DELETE_GLUE_PARENT_ENTRY SLAPI_ADD_PARENT_ENTRY
- #define SLAPI_DELETE_BEPREOP_ENTRY SLAPI_ENTRY_PRE_OP
- /* modify arguments */
- #define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
- #define SLAPI_MODIFY_MODS 90
- #define SLAPI_MODIFY_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
- /* modrdn arguments */
- #define SLAPI_MODRDN_TARGET SLAPI_TARGET_DN
- #define SLAPI_MODRDN_NEWRDN 100
- #define SLAPI_MODRDN_DELOLDRDN 101
- #define SLAPI_MODRDN_NEWSUPERIOR 102 /* v3 only */
- #define SLAPI_MODRDN_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
- #define SLAPI_MODRDN_PARENT_ENTRY 104
- #define SLAPI_MODRDN_NEWPARENT_ENTRY 105
- #define SLAPI_MODRDN_TARGET_ENTRY 106
- #define SLAPI_MODRDN_NEWSUPERIOR_ADDRESS 107
- /*
- * unnormalized dn argument (useful for MOD, MODRDN and DEL operations to carry
- * the original non-escaped dn as introduced by the client application)
- */
- #define SLAPI_ORIGINAL_TARGET_DN 109
- #define SLAPI_ORIGINAL_TARGET SLAPI_ORIGINAL_TARGET_DN
- /* search arguments */
- #define SLAPI_SEARCH_TARGET SLAPI_TARGET_DN
- #define SLAPI_SEARCH_SCOPE 110
- #define SLAPI_SEARCH_DEREF 111
- #define SLAPI_SEARCH_SIZELIMIT 112
- #define SLAPI_SEARCH_TIMELIMIT 113
- #define SLAPI_SEARCH_FILTER 114
- #define SLAPI_SEARCH_STRFILTER 115
- #define SLAPI_SEARCH_ATTRS 116
- #define SLAPI_SEARCH_GERATTRS 1160
- #define SLAPI_SEARCH_ATTRSONLY 117
- #define SLAPI_SEARCH_IS_AND 118
- /* abandon arguments */
- #define SLAPI_ABANDON_MSGID 120
- /* seq access arguments */
- #define SLAPI_SEQ_TYPE 150
- #define SLAPI_SEQ_ATTRNAME 151
- #define SLAPI_SEQ_VAL 152
- /* extended operation arguments */
- #define SLAPI_EXT_OP_REQ_OID 160 /* v3 only */
- #define SLAPI_EXT_OP_REQ_VALUE 161 /* v3 only */
- /* extended operation return values */
- #define SLAPI_EXT_OP_RET_OID 162 /* v3 only */
- #define SLAPI_EXT_OP_RET_VALUE 163 /* v3 only */
- /* extended filter arguments */
- #define SLAPI_MR_FILTER_ENTRY 170 /* v3 only */
- #define SLAPI_MR_FILTER_TYPE 171 /* v3 only */
- #define SLAPI_MR_FILTER_VALUE 172 /* v3 only */
- #define SLAPI_MR_FILTER_OID 173 /* v3 only */
- #define SLAPI_MR_FILTER_DNATTRS 174 /* v3 only */
- /* ldif2db arguments */
- /* ldif file to convert to db */
- #define SLAPI_LDIF2DB_FILE 180
- /* check for duplicate values or not */
- #define SLAPI_LDIF2DB_REMOVEDUPVALS 185
- /* index only this attribute from existing database */
- #define SLAPI_DB2INDEX_ATTRS 186
- /* do not generate attribute indexes */
- #define SLAPI_LDIF2DB_NOATTRINDEXES 187
- /* list if DNs to include */
- #define SLAPI_LDIF2DB_INCLUDE 188
- /* list of DNs to exclude */
- #define SLAPI_LDIF2DB_EXCLUDE 189
- /* generate uniqueid */
- #define SLAPI_LDIF2DB_GENERATE_UNIQUEID 175
- #define SLAPI_LDIF2DB_NAMESPACEID 177
- #define SLAPI_LDIF2DB_ENCRYPT 303
- #define SLAPI_DB2LDIF_DECRYPT 304
- /* uniqueid generation options */
- #define SLAPI_UNIQUEID_GENERATE_NONE 0 /* do not generate */
- #define SLAPI_UNIQUEID_GENERATE_TIME_BASED 1 /* generate time based id */
- #define SLAPI_UNIQUEID_GENERATE_NAME_BASED 2 /* generate name based id */
- /* db2ldif arguments */
- /* print keys or not in ldif */
- #define SLAPI_DB2LDIF_PRINTKEY 183
- /* filename to export */
- #define SLAPI_DB2LDIF_FILE 184
- /* dump uniqueid */
- #define SLAPI_DB2LDIF_DUMP_UNIQUEID 176
- #define SLAPI_DB2LDIF_SERVER_RUNNING 197
- /* db2ldif/ldif2db/bak2db/db2bak arguments */
- #define SLAPI_BACKEND_INSTANCE_NAME 178
- #define SLAPI_BACKEND_TASK 179
- #define SLAPI_TASK_FLAGS 181
- /* bulk import (online wire import) */
- #define SLAPI_BULK_IMPORT_ENTRY 182
- #define SLAPI_BULK_IMPORT_STATE 192
- /* the actual states (these are not pblock args) */
- #define SLAPI_BI_STATE_START 1
- #define SLAPI_BI_STATE_DONE 2
- #define SLAPI_BI_STATE_ADD 3
- /* possible error codes from a bulk import */
- #define SLAPI_BI_ERR_BUSY -23 /* backend is busy; try later */
- /* transaction arguments */
- #define SLAPI_PARENT_TXN 190
- #define SLAPI_TXN 191
- /*
- * The following are used to pass information back and forth
- * between the front end and the back end. The backend
- * creates a search result set as an opaque structure and
- * passes a reference to this back to the front end. The
- * front end uses the backend's iterator entry point to
- * step through the results. The entry, nentries, and
- * referrals options, below, are set/read by both the
- * front end and back end while stepping through the
- * search results.
- */
- /* Search result set */
- #define SLAPI_SEARCH_RESULT_SET 193
- /* Search result - next entry returned from search result set */
- #define SLAPI_SEARCH_RESULT_ENTRY 194
- #define SLAPI_SEARCH_RESULT_ENTRY_EXT 1944
- /* Number of entries returned from search */
- #define SLAPI_NENTRIES 195
- /* Any referrals encountered during the search */
- #define SLAPI_SEARCH_REFERRALS 196
- /* for search operations, allows plugins to provide
- controls to pass for each entry or referral returned
- corresponds to pb_search_ctrls */
- #define SLAPI_SEARCH_CTRLS 198
- #define SLAPI_RESULT_CODE 881
- #define SLAPI_RESULT_TEXT 882
- #define SLAPI_RESULT_MATCHED 883
- #define SLAPI_PB_RESULT_TEXT 885
- /* Size of the database, in kilobytes */
- #define SLAPI_DBSIZE 199
- /* convenience macros for checking modify operation types */
- #define SLAPI_IS_MOD_ADD(x) (((x) & ~LDAP_MOD_BVALUES) == LDAP_MOD_ADD)
- #define SLAPI_IS_MOD_DELETE(x) (((x) & ~LDAP_MOD_BVALUES) == LDAP_MOD_DELETE)
- #define SLAPI_IS_MOD_REPLACE(x) (((x) & ~LDAP_MOD_BVALUES) == LDAP_MOD_REPLACE)
- /* regex.c */
- typedef struct slapi_regex_handle Slapi_Regex;
- /**
- * Compiles a regular expression pattern. A thin wrapper of pcre_compile.
- *
- * \param pat Pattern to be compiled.
- * \param error The error string is set if the compile fails.
- * \return This function returns a pointer to the regex handler which stores
- * the compiled pattern. NULL if the compile fails.
- * \warning The regex handler should be released by slapi_re_free().
- */
- Slapi_Regex *slapi_re_comp( const char *pat, const char **error );
- /**
- * Matches a compiled regular expression pattern against a given string.
- * A thin wrapper of pcre_exec.
- *
- * \param re_handle The regex handler returned from slapi_re_comp.
- * \param subject A string to be checked against the compiled pattern.
- * \param time_up If the current time is larger than the value, this function
- * returns immediately. (-1) means no time limit.
- * \return This function returns 0 if the string did not match.
- * \return This function returns 1 if the string matched.
- * \return This function returns other values if any error occurred.
- * \warning The regex handler should be released by slapi_re_free().
- */
- int slapi_re_exec( Slapi_Regex *re_handle, const char *subject, time_t time_up );
- /**
- * Substitutes '&' or '\#' in the param src with the matched string.
- *
- * \param re_handle The regex handler returned from slapi_re_comp.
- * \param subject A string checked against the compiled pattern.
- * \param src A given string which could contain the substitution symbols.
- * \param dst A pointer pointing to the memory which stores the output string.
- * \param dstlen Size of the memory dst.
- * \return This function returns 1 if the substitution was successful.
- * \return This function returns 0 if the substitution failed.
- * \warning The regex handler should be released by slapi_re_free().
- */
- int slapi_re_subs( Slapi_Regex *re_handle, const char *subject, const char *src, char **dst, unsigned long dstlen );
- /**
- * Releases the regex handler which was returned from slapi_re_comp.
- *
- * \param re_handle The regex handler to be released.
- * \return nothing
- */
- void slapi_re_free(Slapi_Regex *re_handle);
- /* wrap non-portable LDAP API functions */
- void slapi_ldap_value_free(char **vals);
- int slapi_ldap_count_values(char **vals);
- int slapi_ldap_url_parse(const char *url, LDAPURLDesc **ludpp, int require_dn, int *secure);
- const char *slapi_urlparse_err2string(int err);
- int slapi_ldap_get_lderrno(LDAP *ld, char **m, char **s);
- #ifndef LDIF_OPT_NOWRAP
- #define LDIF_OPT_NOWRAP 0x01UL
- #endif
- #ifndef LDIF_OPT_VALUE_IS_URL
- #define LDIF_OPT_VALUE_IS_URL 0x02UL
- #endif
- #ifndef LDIF_OPT_MINIMAL_ENCODING
- #define LDIF_OPT_MINIMAL_ENCODING 0x04UL
- #endif
- void slapi_ldif_put_type_and_value_with_options( char **out, const char *t, const char *val, int vlen, unsigned long options );
- #if defined(USE_OPENLDAP)
- /*
- * UTF-8 routines (should these move into libnls?)
- */
- /* number of bytes in character */
- int ldap_utf8len( const char* );
- /* find next character */
- char *ldap_utf8next( char* );
- /* find previous character */
- char *ldap_utf8prev( char* );
- /* copy one character */
- int ldap_utf8copy( char* dst, const char* src );
- /* total number of characters */
- size_t ldap_utf8characters( const char* );
- /* get one UCS-4 character, and move *src to the next character */
- unsigned long ldap_utf8getcc( const char** src );
- /* UTF-8 aware strtok_r() */
- char *ldap_utf8strtok_r( char* src, const char* brk, char** next);
- /* like isalnum(*s) in the C locale */
- int ldap_utf8isalnum( char* s );
- /* like isalpha(*s) in the C locale */
- int ldap_utf8isalpha( char* s );
- /* like isdigit(*s) in the C locale */
- int ldap_utf8isdigit( char* s );
- /* like isxdigit(*s) in the C locale */
- int ldap_utf8isxdigit(char* s );
- /* like isspace(*s) in the C locale */
- int ldap_utf8isspace( char* s );
- #define LDAP_UTF8LEN(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8len (s) : 1)
- #define LDAP_UTF8NEXT(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8next(s) : ( s)+1)
- #define LDAP_UTF8INC(s) ((0x80 & *(unsigned char*)(s)) ? s=ldap_utf8next(s) : ++s)
- #define LDAP_UTF8PREV(s) ldap_utf8prev(s)
- #define LDAP_UTF8DEC(s) (s=ldap_utf8prev(s))
- #define LDAP_UTF8COPY(d,s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8copy(d,s) : ((*(d) = *(s)), 1))
- #define LDAP_UTF8GETCC(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8getcc (&s) : *s++)
- #define LDAP_UTF8GETC(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8getcc ((const char**)&s) : *s++)
- #endif /* USE_OPENLDAP */
- /* by default will allow dups */
- char **slapi_str2charray( char *str, char *brkstr );
- /*
- * extended version of str2charray lets you disallow
- * duplicate values into the array.
- */
- char **slapi_str2charray_ext( char *str, char *brkstr, int allow_dups );
- #ifndef LDAP_PORT_MAX
- #define LDAP_PORT_MAX 65535 /* API extension */
- #endif
- #ifndef LDAP_ALL_USER_ATTRS
- #ifdef LDAP_ALL_USER_ATTRIBUTES
- #define LDAP_ALL_USER_ATTRS LDAP_ALL_USER_ATTRIBUTES
- #else
- #define LDAP_ALL_USER_ATTRS "*"
- #endif
- #endif
- #ifndef LDAP_SASL_EXTERNAL
- #define LDAP_SASL_EXTERNAL "EXTERNAL" /* TLS/SSL extension */
- #endif
- #ifndef LBER_SOCKET
- #ifdef LBER_SOCKET_T
- #define LBER_SOCKET LBER_SOCKET_T
- #else
- #define LBER_SOCKET int
- #endif
- #endif
- /**
- * Set given "type: value" to the plugin default config entry
- * (cn=plugin default config,cn=config) unless the same "type: value" pair
- * already exists in the entry.
- *
- * \param type Attribute type to add to the default config entry
- * \param value Attribute value to add to the default config entry
- * \return 0 if the operation was successful
- * \return non-0 if the operation was not successful
- */
- int slapi_set_plugin_default_config(const char *type, Slapi_Value *value);
- /**
- * Get attribute values of given type from the plugin default config entry
- * (cn=plugin default config,cn=config).
- *
- * \param type Attribute type to get from the default config entry
- * \param valueset Valueset holding the attribute values
- * \return 0 if the operation was successful
- * \return non-0 if the operation was not successful
- * \warning Caller is responsible to free attrs by slapi_ch_array_free
- * */
- int slapi_get_plugin_default_config(char *type, Slapi_ValueSet **valueset);
- #ifdef __cplusplus
- }
- #endif
- #endif /* _SLAPIPLUGIN */
|