| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511 |
- /** 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
- /*
- *
- * libglobs.c -- SLAPD library global variables
- */
- /* for windows only
- we define slapd_ldap_debug here, so we don't want to declare
- it in any header file which might conflict with our definition
- */
- #define DONT_DECLARE_SLAPD_LDAP_DEBUG /* see ldaplog.h */
- #include "ldap.h"
- #include <sslproto.h>
- #undef OFF
- #undef LITTLE_ENDIAN
- #include <stdio.h>
- #include <string.h>
- #include <sys/types.h>
- #include <time.h>
- #include <stdarg.h>
- #include <stdlib.h>
- #if defined( _WIN32 )
- #define R_OK 04
- #include "ntslapdmessages.h"
- #include "proto-ntutil.h"
- #else
- #include <sys/time.h>
- #include <sys/param.h> /* MAXPATHLEN */
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <netdb.h>
- #include <unistd.h>
- #include <pwd.h> /* pwdnam */
- #endif
- #ifdef USE_SYSCONF
- #include <unistd.h>
- #endif /* USE_SYSCONF */
- #include "slap.h"
- #include "plhash.h"
- #define REMOVE_CHANGELOG_CMD "remove"
- /* On UNIX, there's only one copy of slapd_ldap_debug */
- /* On NT, each module keeps its own module_ldap_debug, which */
- /* points to the process' slapd_ldap_debug */
- #ifdef _WIN32
- int *module_ldap_debug;
- int __declspec(dllexport) slapd_ldap_debug = LDAP_DEBUG_ANY;
- #else
- int slapd_ldap_debug = LDAP_DEBUG_ANY;
- #endif
- char *ldap_srvtab = "";
- /* Note that the 'attrname' arguments are used only for log messages */
- typedef int (*ConfigSetFunc)(const char *attrname, char *value,
- char *errorbuf, int apply);
- typedef int (*LogSetFunc)(const char *attrname, char *value, int whichlog,
- char *errorbuf, int apply);
- typedef enum {
- CONFIG_INT, /* maps to int */
- CONFIG_LONG, /* maps to long */
- CONFIG_STRING, /* maps to char* */
- CONFIG_CHARRAY, /* maps to char** */
- CONFIG_ON_OFF, /* maps 0/1 to "off"/"on" */
- CONFIG_STRING_OR_OFF, /* use "off" instead of null or an empty string */
- CONFIG_STRING_OR_UNKNOWN, /* use "unknown" instead of an empty string */
- CONFIG_CONSTANT_INT, /* for #define values, e.g. */
- CONFIG_CONSTANT_STRING, /* for #define values, e.g. */
- CONFIG_SPECIAL_REFERRALLIST, /* this is a berval list */
- CONFIG_SPECIAL_SSLCLIENTAUTH, /* maps strings to an enumeration */
- CONFIG_SPECIAL_ERRORLOGLEVEL, /* requires & with LDAP_DEBUG_ANY */
- CONFIG_STRING_OR_EMPTY, /* use an empty string */
- CONFIG_SPECIAL_ANON_ACCESS_SWITCH, /* maps strings to an enumeration */
- CONFIG_SPECIAL_VALIDATE_CERT_SWITCH, /* maps strings to an enumeration */
- CONFIG_SPECIAL_UNHASHED_PW_SWITCH /* unhashed pw: on/off/nolog */
- } ConfigVarType;
- static int config_set_onoff( const char *attrname, char *value,
- int *configvalue, char *errorbuf, int apply );
- static int config_set_schemareplace ( const char *attrname, char *value,
- char *errorbuf, int apply );
- /* Keeping the initial values */
- /* CONFIG_INT/CONFIG_LONG */
- #define DEFAULT_LOG_ROTATIONSYNCHOUR "0"
- #define DEFAULT_LOG_ROTATIONSYNCMIN "0"
- #define DEFAULT_LOG_ROTATIONTIME "1"
- #define DEFAULT_LOG_ACCESS_MAXNUMLOGS "10"
- #define DEFAULT_LOG_MAXNUMLOGS "1"
- #define DEFAULT_LOG_EXPTIME "1"
- #define DEFAULT_LOG_ACCESS_MAXDISKSPACE "500"
- #define DEFAULT_LOG_MAXDISKSPACE "100"
- #define DEFAULT_LOG_MAXLOGSIZE "100"
- #define DEFAULT_LOG_MINFREESPACE "5"
- #define DEFAULT_ACCESSLOGLEVEL "256"
- #define DEFAULT_SIZELIMIT "2000"
- #define DEFAULT_TIMELIMIT "3600"
- #define DEFAULT_PAGEDSIZELIMIT "0"
- #define DEFAULT_IDLE_TIMEOUT "0"
- #define DEFAULT_MAXDESCRIPTORS "1024"
- #define DEFAULT_RESERVE_FDS "64"
- #define DEFAULT_MAX_BERSIZE "0"
- #define DEFAULT_MAX_THREADS "30"
- #define DEFAULT_MAX_THREADS_PER_CONN "5"
- #define DEFAULT_IOBLOCK_TIMEOUT "1800000"
- #define DEFAULT_OUTBOUND_LDAP_IO_TIMEOUT "300000"
- #define DEFAULT_MAX_FILTER_NEST_LEVEL "40"
- #define DEFAULT_GROUPEVALNESTLEVEL "0"
- #define DEFAULT_SNMP_INDEX "0"
- #define DEFAULT_MAX_SASLIO_SIZE "2097152"
- #define DEFAULT_DISK_THRESHOLD "2097152"
- #define DEFAULT_DISK_GRACE_PERIOD "60"
- #define DEFAULT_LOCAL_SSF "71"
- #define DEFAULT_MIN_SSF "0"
- #define DEFAULT_PW_INHISTORY "6"
- #define DEFAULT_PW_GRACELIMIT "0"
- #define DEFAULT_PW_MINLENGTH "0"
- #define DEFAULT_PW_MINDIGITS "0"
- #define DEFAULT_PW_MINALPHAS "0"
- #define DEFAULT_PW_MINUPPERS "0"
- #define DEFAULT_PW_MINLOWERS "0"
- #define DEFAULT_PW_MINSPECIALS "0"
- #define DEFAULT_PW_MIN8BIT "0"
- #define DEFAULT_PW_MAXREPEATS "0"
- #define DEFAULT_PW_MINCATEGORIES "3"
- #define DEFAULT_PW_MINTOKENLENGTH "3"
- #define DEFAULT_PW_MAXAGE "8640000"
- #define DEFAULT_PW_MINAGE "0"
- #define DEFAULT_PW_WARNING "86400"
- #define DEFAULT_PW_MAXFAILURE "3"
- #define DEFAULT_PW_RESETFAILURECOUNT "600"
- #define DEFAULT_PW_LOCKDURATION "3600"
- #define DEFAULT_NDN_SIZE "20971520"
- #define DEFAULT_SASL_MAXBUFSIZE "65536"
- #define SLAPD_DEFAULT_SASL_MAXBUFSIZE 65536
- #ifdef MEMPOOL_EXPERIMENTAL
- #define DEFAULT_MEMPOOL_MAXFREELIST "1024"
- #endif
- /* CONFIG_STRING... */
- #define INIT_ACCESSLOG_MODE "600"
- #define INIT_ERRORLOG_MODE "600"
- #define INIT_AUDITLOG_MODE "600"
- #define INIT_ACCESSLOG_ROTATIONUNIT "day"
- #define INIT_ERRORLOG_ROTATIONUNIT "week"
- #define INIT_AUDITLOG_ROTATIONUNIT "week"
- #define INIT_ACCESSLOG_EXPTIMEUNIT "month"
- #define INIT_ERRORLOG_EXPTIMEUNIT "month"
- #define INIT_AUDITLOG_EXPTIMEUNIT "month"
- #define DEFAULT_DIRECTORY_MANAGER "cn=Directory Manager"
- #define DEFAULT_UIDNUM_TYPE "uidNumber"
- #define DEFAULT_GIDNUM_TYPE "gidNumber"
- #define DEFAULT_LDAPI_SEARCH_BASE "dc=example,dc=com"
- #define DEFAULT_LDAPI_AUTO_DN "cn=peercred,cn=external,cn=auth"
- #define ENTRYUSN_IMPORT_INIT "0"
- #define DEFAULT_ALLOWED_TO_DELETE_ATTRS "nsslapd-listenhost nsslapd-securelistenhost nsslapd-defaultnamingcontext nsslapd-snmp-index"
- #define SALTED_SHA1_SCHEME_NAME "SSHA"
- /* CONFIG_ON_OFF */
- slapi_onoff_t init_accesslog_rotationsync_enabled;
- slapi_onoff_t init_errorlog_rotationsync_enabled;
- slapi_onoff_t init_auditlog_rotationsync_enabled;
- slapi_onoff_t init_accesslog_logging_enabled;
- slapi_onoff_t init_accesslogbuffering;
- slapi_onoff_t init_errorlog_logging_enabled;
- slapi_onoff_t init_auditlog_logging_enabled;
- slapi_onoff_t init_auditlog_logging_hide_unhashed_pw;
- slapi_onoff_t init_csnlogging;
- slapi_onoff_t init_pw_unlock;
- slapi_onoff_t init_pw_must_change;
- slapi_onoff_t init_pwpolicy_local;
- slapi_onoff_t init_pw_lockout;
- slapi_onoff_t init_pw_history;
- slapi_onoff_t init_pw_is_global_policy;
- slapi_onoff_t init_pw_is_legacy;
- slapi_onoff_t init_pw_track_update_time;
- slapi_onoff_t init_pw_change;
- slapi_onoff_t init_pw_exp;
- slapi_onoff_t init_pw_syntax;
- slapi_onoff_t init_schemacheck;
- slapi_onoff_t init_schemamod;
- slapi_onoff_t init_ds4_compatible_schema;
- slapi_onoff_t init_schema_ignore_trailing_spaces;
- slapi_onoff_t init_enquote_sup_oc;
- slapi_onoff_t init_rewrite_rfc1274;
- slapi_onoff_t init_syntaxcheck;
- slapi_onoff_t init_syntaxlogging;
- slapi_onoff_t init_dn_validate_strict;
- slapi_onoff_t init_attrname_exceptions;
- slapi_onoff_t init_return_exact_case;
- slapi_onoff_t init_result_tweak;
- slapi_onoff_t init_plugin_track;
- slapi_onoff_t init_lastmod;
- slapi_onoff_t init_readonly;
- slapi_onoff_t init_accesscontrol;
- slapi_onoff_t init_nagle;
- slapi_onoff_t init_security;
- slapi_onoff_t init_ssl_check_hostname;
- slapi_onoff_t init_ldapi_switch;
- slapi_onoff_t init_ldapi_bind_switch;
- slapi_onoff_t init_ldapi_map_entries;
- slapi_onoff_t init_allow_unauth_binds;
- slapi_onoff_t init_require_secure_binds;
- slapi_onoff_t init_minssf_exclude_rootdse;
- slapi_onoff_t init_force_sasl_external;
- slapi_onoff_t init_slapi_counters;
- slapi_onoff_t init_entryusn_global;
- slapi_onoff_t init_disk_monitoring;
- slapi_onoff_t init_disk_logging_critical;
- slapi_onoff_t init_disk_preserve_logging;
- slapi_onoff_t init_ndn_cache_enabled;
- slapi_onoff_t init_sasl_mapping_fallback;
- slapi_onoff_t init_return_orig_type;
- slapi_onoff_t init_enable_turbo_mode;
- slapi_onoff_t init_connection_nocanon;
- slapi_int_t init_connection_buffer;
- #ifdef MEMPOOL_EXPERIMENTAL
- slapi_onoff_t init_mempool_switch;
- #endif
- #define DEFAULT_SSLCLIENTAPTH "off"
- #define DEFAULT_ALLOW_ANON_ACCESS "on"
- #define DEFAULT_VALIDATE_CERT "warn"
- #define DEFAULT_UNHASHED_PW_SWITCH "on"
- static int
- isInt(ConfigVarType type)
- {
- return type == CONFIG_INT || type == CONFIG_ON_OFF || type == CONFIG_SPECIAL_SSLCLIENTAUTH || type == CONFIG_SPECIAL_ERRORLOGLEVEL;
- }
- /* the caller will typically have to cast the result based on the ConfigVarType */
- typedef void *(*ConfigGetFunc)(void);
- /* static Ref_Array global_referrals; */
- static slapdFrontendConfig_t global_slapdFrontendConfig;
- static struct config_get_and_set {
- const char *attr_name; /* the name of the attribute */
- ConfigSetFunc setfunc; /* the function to call to set the value */
- LogSetFunc logsetfunc; /* log functions are special */
- int whichlog; /* ACCESS, ERROR, AUDIT, etc. */
- void** config_var_addr; /* address of member of slapdFrontendConfig struct */
- ConfigVarType config_var_type; /* cast to this type when getting */
- ConfigGetFunc getfunc; /* for special handling */
- void *initvalue;
- } ConfigList[] = {
- {CONFIG_AUDITLOG_MODE_ATTRIBUTE, NULL,
- log_set_mode, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_mode,
- CONFIG_STRING, NULL, INIT_AUDITLOG_MODE},
- {CONFIG_AUDITLOG_LOGROTATIONSYNCENABLED_ATTRIBUTE, NULL,
- log_set_rotationsync_enabled, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_rotationsync_enabled,
- CONFIG_ON_OFF, NULL, &init_auditlog_rotationsync_enabled},
- {CONFIG_AUDITLOG_LOGROTATIONSYNCHOUR_ATTRIBUTE, NULL,
- log_set_rotationsynchour, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_rotationsynchour,
- CONFIG_INT, NULL, DEFAULT_LOG_ROTATIONSYNCHOUR},
- {CONFIG_AUDITLOG_LOGROTATIONSYNCMIN_ATTRIBUTE, NULL,
- log_set_rotationsyncmin, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_rotationsyncmin,
- CONFIG_INT, NULL, DEFAULT_LOG_ROTATIONSYNCMIN},
- {CONFIG_AUDITLOG_LOGROTATIONTIME_ATTRIBUTE, NULL,
- log_set_rotationtime, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_rotationtime,
- CONFIG_INT, NULL, DEFAULT_LOG_ROTATIONTIME},
- {CONFIG_ACCESSLOG_MODE_ATTRIBUTE, NULL,
- log_set_mode, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_mode,
- CONFIG_STRING, NULL, INIT_ACCESSLOG_MODE},
- {CONFIG_ACCESSLOG_MAXNUMOFLOGSPERDIR_ATTRIBUTE, NULL,
- log_set_numlogsperdir, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_maxnumlogs,
- CONFIG_INT, NULL, DEFAULT_LOG_ACCESS_MAXNUMLOGS},
- {CONFIG_LOGLEVEL_ATTRIBUTE, config_set_errorlog_level,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.errorloglevel,
- CONFIG_SPECIAL_ERRORLOGLEVEL, NULL, NULL},
- {CONFIG_ERRORLOG_LOGGING_ENABLED_ATTRIBUTE, NULL,
- log_set_logging, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_logging_enabled,
- CONFIG_ON_OFF, NULL, &init_errorlog_logging_enabled},
- {CONFIG_ERRORLOG_MODE_ATTRIBUTE, NULL,
- log_set_mode, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_mode,
- CONFIG_STRING, NULL, INIT_ERRORLOG_MODE},
- {CONFIG_ERRORLOG_LOGEXPIRATIONTIME_ATTRIBUTE, NULL,
- log_set_expirationtime, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_exptime,
- CONFIG_INT, NULL, DEFAULT_LOG_EXPTIME},
- {CONFIG_ACCESSLOG_LOGGING_ENABLED_ATTRIBUTE, NULL,
- log_set_logging, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_logging_enabled,
- CONFIG_ON_OFF, NULL, &init_accesslog_logging_enabled},
- {CONFIG_PORT_ATTRIBUTE, config_set_port,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.port,
- CONFIG_INT, NULL, NULL/* deletion is not allowed */},
- {CONFIG_WORKINGDIR_ATTRIBUTE, config_set_workingdir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.workingdir,
- CONFIG_STRING_OR_EMPTY, NULL, NULL/* deletion is not allowed */},
- {CONFIG_MAXTHREADSPERCONN_ATTRIBUTE, config_set_maxthreadsperconn,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.maxthreadsperconn,
- CONFIG_INT, NULL, DEFAULT_MAX_THREADS_PER_CONN},
- {CONFIG_ACCESSLOG_LOGEXPIRATIONTIME_ATTRIBUTE, NULL,
- log_set_expirationtime, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_exptime,
- CONFIG_INT, NULL, DEFAULT_LOG_EXPTIME},
- #ifndef _WIN32
- {CONFIG_LOCALUSER_ATTRIBUTE, config_set_localuser,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.localuser,
- CONFIG_STRING, NULL, NULL/* deletion is not allowed */},
- #endif
- {CONFIG_ERRORLOG_LOGROTATIONSYNCENABLED_ATTRIBUTE, NULL,
- log_set_rotationsync_enabled, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_rotationsync_enabled,
- CONFIG_ON_OFF, NULL, &init_errorlog_rotationsync_enabled},
- {CONFIG_ERRORLOG_LOGROTATIONSYNCHOUR_ATTRIBUTE, NULL,
- log_set_rotationsynchour, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_rotationsynchour,
- CONFIG_INT, NULL, DEFAULT_LOG_ROTATIONSYNCHOUR},
- {CONFIG_ERRORLOG_LOGROTATIONSYNCMIN_ATTRIBUTE, NULL,
- log_set_rotationsyncmin, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_rotationsyncmin,
- CONFIG_INT, NULL, DEFAULT_LOG_ROTATIONSYNCMIN},
- {CONFIG_ERRORLOG_LOGROTATIONTIME_ATTRIBUTE, NULL,
- log_set_rotationtime, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_rotationtime,
- CONFIG_INT, NULL, DEFAULT_LOG_ROTATIONTIME},
- {CONFIG_PW_INHISTORY_ATTRIBUTE, config_set_pw_inhistory,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_inhistory,
- CONFIG_INT, NULL, DEFAULT_PW_INHISTORY},
- {CONFIG_PW_STORAGESCHEME_ATTRIBUTE, config_set_pw_storagescheme,
- NULL, 0, NULL,
- CONFIG_STRING, (ConfigGetFunc)config_get_pw_storagescheme,
- SALTED_SHA1_SCHEME_NAME},
- {CONFIG_PW_UNLOCK_ATTRIBUTE, config_set_pw_unlock,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_unlock,
- CONFIG_ON_OFF, NULL, &init_pw_unlock},
- {CONFIG_PW_GRACELIMIT_ATTRIBUTE, config_set_pw_gracelimit,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_gracelimit,
- CONFIG_INT, NULL, DEFAULT_PW_GRACELIMIT},
- {CONFIG_PW_ADMIN_DN_ATTRIBUTE, config_set_pw_admin_dn,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_admin,
- CONFIG_STRING, NULL, ""},
- {CONFIG_ACCESSLOG_LOGROTATIONSYNCENABLED_ATTRIBUTE, NULL,
- log_set_rotationsync_enabled, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_rotationsync_enabled,
- CONFIG_ON_OFF, NULL, &init_accesslog_rotationsync_enabled},
- {CONFIG_ACCESSLOG_LOGROTATIONSYNCHOUR_ATTRIBUTE, NULL,
- log_set_rotationsynchour, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_rotationsynchour,
- CONFIG_INT, NULL, DEFAULT_LOG_ROTATIONSYNCHOUR},
- {CONFIG_ACCESSLOG_LOGROTATIONSYNCMIN_ATTRIBUTE, NULL,
- log_set_rotationsyncmin, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_rotationsyncmin,
- CONFIG_INT, NULL, DEFAULT_LOG_ROTATIONSYNCMIN},
- {CONFIG_ACCESSLOG_LOGROTATIONTIME_ATTRIBUTE, NULL,
- log_set_rotationtime, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_rotationtime,
- CONFIG_INT, NULL, DEFAULT_LOG_ROTATIONTIME},
- {CONFIG_PW_MUSTCHANGE_ATTRIBUTE, config_set_pw_must_change,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_must_change,
- CONFIG_ON_OFF, NULL, &init_pw_must_change},
- {CONFIG_PWPOLICY_LOCAL_ATTRIBUTE, config_set_pwpolicy_local,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pwpolicy_local,
- CONFIG_ON_OFF, NULL, &init_pwpolicy_local},
- {CONFIG_AUDITLOG_MAXLOGDISKSPACE_ATTRIBUTE, NULL,
- log_set_maxdiskspace, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_maxdiskspace,
- CONFIG_INT, NULL, DEFAULT_LOG_MAXDISKSPACE},
- {CONFIG_SIZELIMIT_ATTRIBUTE, config_set_sizelimit,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.sizelimit,
- CONFIG_INT, NULL, DEFAULT_SIZELIMIT},
- {CONFIG_AUDITLOG_MAXLOGSIZE_ATTRIBUTE, NULL,
- log_set_logsize, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_maxlogsize,
- CONFIG_INT, NULL, DEFAULT_LOG_MAXLOGSIZE},
- {CONFIG_PW_WARNING_ATTRIBUTE, config_set_pw_warning,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_warning,
- CONFIG_LONG, NULL, DEFAULT_PW_WARNING},
- {CONFIG_READONLY_ATTRIBUTE, config_set_readonly,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.readonly,
- CONFIG_ON_OFF, NULL, &init_readonly},
- {CONFIG_SASL_MAPPING_FALLBACK, config_set_sasl_mapping_fallback,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.sasl_mapping_fallback,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_sasl_mapping_fallback,
- &init_sasl_mapping_fallback},
- {CONFIG_THREADNUMBER_ATTRIBUTE, config_set_threadnumber,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.threadnumber,
- CONFIG_INT, NULL, DEFAULT_MAX_THREADS},
- {CONFIG_PW_LOCKOUT_ATTRIBUTE, config_set_pw_lockout,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_lockout,
- CONFIG_ON_OFF, NULL, &init_pw_lockout},
- {CONFIG_ENQUOTE_SUP_OC_ATTRIBUTE, config_set_enquote_sup_oc,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.enquote_sup_oc,
- CONFIG_ON_OFF, NULL, &init_enquote_sup_oc},
- {CONFIG_LOCALHOST_ATTRIBUTE, config_set_localhost,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.localhost,
- CONFIG_STRING, NULL, NULL/* deletion is not allowed */},
- {CONFIG_IOBLOCKTIMEOUT_ATTRIBUTE, config_set_ioblocktimeout,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ioblocktimeout,
- CONFIG_INT, NULL, DEFAULT_IOBLOCK_TIMEOUT},
- {CONFIG_MAX_FILTER_NEST_LEVEL_ATTRIBUTE, config_set_max_filter_nest_level,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.max_filter_nest_level,
- CONFIG_INT, NULL, DEFAULT_MAX_FILTER_NEST_LEVEL},
- {CONFIG_ERRORLOG_MAXLOGDISKSPACE_ATTRIBUTE, NULL,
- log_set_maxdiskspace, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_maxdiskspace,
- CONFIG_INT, NULL, DEFAULT_LOG_MAXDISKSPACE},
- {CONFIG_PW_MINLENGTH_ATTRIBUTE, config_set_pw_minlength,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_minlength,
- CONFIG_INT, NULL, DEFAULT_PW_MINLENGTH},
- {CONFIG_PW_MINDIGITS_ATTRIBUTE, config_set_pw_mindigits,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_mindigits,
- CONFIG_INT, NULL, DEFAULT_PW_MINDIGITS},
- {CONFIG_PW_MINALPHAS_ATTRIBUTE, config_set_pw_minalphas,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_minalphas,
- CONFIG_INT, NULL, DEFAULT_PW_MINALPHAS},
- {CONFIG_PW_MINUPPERS_ATTRIBUTE, config_set_pw_minuppers,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_minuppers,
- CONFIG_INT, NULL, DEFAULT_PW_MINUPPERS},
- {CONFIG_PW_MINLOWERS_ATTRIBUTE, config_set_pw_minlowers,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_minlowers,
- CONFIG_INT, NULL, DEFAULT_PW_MINLOWERS},
- {CONFIG_PW_MINSPECIALS_ATTRIBUTE, config_set_pw_minspecials,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_minspecials,
- CONFIG_INT, NULL, DEFAULT_PW_MINSPECIALS},
- {CONFIG_PW_MIN8BIT_ATTRIBUTE, config_set_pw_min8bit,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_min8bit,
- CONFIG_INT, NULL, DEFAULT_PW_MIN8BIT},
- {CONFIG_PW_MAXREPEATS_ATTRIBUTE, config_set_pw_maxrepeats,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_maxrepeats,
- CONFIG_INT, NULL, DEFAULT_PW_MAXREPEATS},
- {CONFIG_PW_MINCATEGORIES_ATTRIBUTE, config_set_pw_mincategories,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_mincategories,
- CONFIG_INT, NULL, DEFAULT_PW_MINCATEGORIES},
- {CONFIG_PW_MINTOKENLENGTH_ATTRIBUTE, config_set_pw_mintokenlength,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_mintokenlength,
- CONFIG_INT, NULL, DEFAULT_PW_MINTOKENLENGTH},
- {CONFIG_ERRORLOG_ATTRIBUTE, config_set_errorlog,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.errorlog,
- CONFIG_STRING_OR_EMPTY, NULL, NULL/* deletion is not allowed */},
- {CONFIG_AUDITLOG_LOGEXPIRATIONTIME_ATTRIBUTE, NULL,
- log_set_expirationtime, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_exptime,
- CONFIG_INT, NULL, DEFAULT_LOG_EXPTIME},
- {CONFIG_SCHEMACHECK_ATTRIBUTE, config_set_schemacheck,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.schemacheck,
- CONFIG_ON_OFF, NULL, &init_schemacheck},
- {CONFIG_SCHEMAMOD_ATTRIBUTE, config_set_schemamod,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.schemamod,
- CONFIG_ON_OFF, NULL, &init_schemamod},
- {CONFIG_SYNTAXCHECK_ATTRIBUTE, config_set_syntaxcheck,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.syntaxcheck,
- CONFIG_ON_OFF, NULL, &init_syntaxcheck},
- {CONFIG_SYNTAXLOGGING_ATTRIBUTE, config_set_syntaxlogging,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.syntaxlogging,
- CONFIG_ON_OFF, NULL, &init_syntaxlogging},
- {CONFIG_DN_VALIDATE_STRICT_ATTRIBUTE, config_set_dn_validate_strict,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.dn_validate_strict,
- CONFIG_ON_OFF, NULL, &init_dn_validate_strict},
- {CONFIG_DS4_COMPATIBLE_SCHEMA_ATTRIBUTE, config_set_ds4_compatible_schema,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ds4_compatible_schema,
- CONFIG_ON_OFF, NULL, &init_ds4_compatible_schema},
- {CONFIG_SCHEMA_IGNORE_TRAILING_SPACES,
- config_set_schema_ignore_trailing_spaces, NULL, 0,
- (void**)&global_slapdFrontendConfig.schema_ignore_trailing_spaces,
- CONFIG_ON_OFF, NULL, &init_schema_ignore_trailing_spaces},
- {CONFIG_SCHEMAREPLACE_ATTRIBUTE, config_set_schemareplace, NULL, 0,
- (void**)&global_slapdFrontendConfig.schemareplace,
- CONFIG_STRING_OR_OFF, NULL, CONFIG_SCHEMAREPLACE_STR_REPLICATION_ONLY},
- {CONFIG_ACCESSLOG_MAXLOGDISKSPACE_ATTRIBUTE, NULL,
- log_set_maxdiskspace, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_maxdiskspace,
- CONFIG_INT, NULL, DEFAULT_LOG_ACCESS_MAXDISKSPACE},
- {CONFIG_REFERRAL_ATTRIBUTE, (ConfigSetFunc)config_set_defaultreferral,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.defaultreferral,
- CONFIG_SPECIAL_REFERRALLIST, NULL, NULL/* deletion is not allowed */},
- {CONFIG_PW_MAXFAILURE_ATTRIBUTE, config_set_pw_maxfailure,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_maxfailure,
- CONFIG_INT, NULL, DEFAULT_PW_MAXFAILURE},
- {CONFIG_ACCESSLOG_ATTRIBUTE, config_set_accesslog,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.accesslog,
- CONFIG_STRING_OR_EMPTY, NULL, NULL/* deletion is not allowed */},
- {CONFIG_LASTMOD_ATTRIBUTE, config_set_lastmod,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.lastmod,
- CONFIG_ON_OFF, NULL, &init_lastmod},
- {CONFIG_ROOTPWSTORAGESCHEME_ATTRIBUTE, config_set_rootpwstoragescheme,
- NULL, 0, NULL,
- CONFIG_STRING, (ConfigGetFunc)config_get_rootpwstoragescheme,
- SALTED_SHA1_SCHEME_NAME},
- {CONFIG_PW_HISTORY_ATTRIBUTE, config_set_pw_history,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_history,
- CONFIG_ON_OFF, NULL, &init_pw_history},
- {CONFIG_SECURITY_ATTRIBUTE, config_set_security,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.security,
- CONFIG_ON_OFF, NULL, &init_security},
- {CONFIG_PW_MAXAGE_ATTRIBUTE, config_set_pw_maxage,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_maxage,
- CONFIG_LONG, NULL, DEFAULT_PW_MAXAGE},
- {CONFIG_AUDITLOG_LOGROTATIONTIMEUNIT_ATTRIBUTE, NULL,
- log_set_rotationtimeunit, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_rotationunit,
- CONFIG_STRING_OR_UNKNOWN, NULL, INIT_AUDITLOG_ROTATIONUNIT},
- {CONFIG_PW_RESETFAILURECOUNT_ATTRIBUTE, config_set_pw_resetfailurecount,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_resetfailurecount,
- CONFIG_LONG, NULL, DEFAULT_PW_RESETFAILURECOUNT},
- {CONFIG_PW_ISGLOBAL_ATTRIBUTE, config_set_pw_is_global_policy,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_is_global_policy,
- CONFIG_ON_OFF, NULL, &init_pw_is_global_policy},
- {CONFIG_PW_IS_LEGACY, config_set_pw_is_legacy_policy,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_is_legacy,
- CONFIG_ON_OFF, NULL, &init_pw_is_legacy},
- {CONFIG_PW_TRACK_LAST_UPDATE_TIME, config_set_pw_track_last_update_time,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_track_update_time,
- CONFIG_ON_OFF, NULL, &init_pw_track_update_time},
- {CONFIG_AUDITLOG_MAXNUMOFLOGSPERDIR_ATTRIBUTE, NULL,
- log_set_numlogsperdir, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_maxnumlogs,
- CONFIG_INT, NULL, DEFAULT_LOG_MAXNUMLOGS},
- {CONFIG_ERRORLOG_LOGEXPIRATIONTIMEUNIT_ATTRIBUTE, NULL,
- log_set_expirationtimeunit, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_exptimeunit,
- CONFIG_STRING_OR_UNKNOWN, NULL, INIT_ERRORLOG_EXPTIMEUNIT},
- /* errorlog list is read only, so no set func and no config var addr */
- {CONFIG_ERRORLOG_LIST_ATTRIBUTE, NULL,
- NULL, 0, NULL,
- CONFIG_CHARRAY, (ConfigGetFunc)config_get_errorlog_list, NULL},
- {CONFIG_GROUPEVALNESTLEVEL_ATTRIBUTE, config_set_groupevalnestlevel,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.groupevalnestlevel,
- CONFIG_INT, NULL, DEFAULT_GROUPEVALNESTLEVEL},
- {CONFIG_ACCESSLOG_LOGEXPIRATIONTIMEUNIT_ATTRIBUTE, NULL,
- log_set_expirationtimeunit, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_exptimeunit,
- CONFIG_STRING_OR_UNKNOWN, NULL, INIT_ACCESSLOG_EXPTIMEUNIT},
- {CONFIG_ROOTPW_ATTRIBUTE, config_set_rootpw,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.rootpw,
- CONFIG_STRING, NULL, NULL/* deletion is not allowed */},
- {CONFIG_PW_CHANGE_ATTRIBUTE, config_set_pw_change,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_change,
- CONFIG_ON_OFF, NULL, &init_pw_change},
- {CONFIG_ACCESSLOGLEVEL_ATTRIBUTE, config_set_accesslog_level,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.accessloglevel,
- CONFIG_INT, NULL, DEFAULT_ACCESSLOGLEVEL},
- {CONFIG_ERRORLOG_LOGROTATIONTIMEUNIT_ATTRIBUTE, NULL,
- log_set_rotationtimeunit, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_rotationunit,
- CONFIG_STRING_OR_UNKNOWN, NULL, INIT_ERRORLOG_ROTATIONUNIT},
- {CONFIG_SECUREPORT_ATTRIBUTE, config_set_secureport,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.secureport,
- CONFIG_INT, NULL, NULL/* deletion is not allowed */},
- {CONFIG_BASEDN_ATTRIBUTE, config_set_basedn,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.certmap_basedn,
- CONFIG_STRING, NULL, NULL/* deletion is not allowed */},
- {CONFIG_TIMELIMIT_ATTRIBUTE, config_set_timelimit,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.timelimit,
- CONFIG_INT, NULL, DEFAULT_TIMELIMIT},
- {CONFIG_ERRORLOG_MAXLOGSIZE_ATTRIBUTE, NULL,
- log_set_logsize, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_maxlogsize,
- CONFIG_INT, NULL, DEFAULT_LOG_MAXLOGSIZE},
- {CONFIG_RESERVEDESCRIPTORS_ATTRIBUTE, config_set_reservedescriptors,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.reservedescriptors,
- CONFIG_INT, NULL, DEFAULT_RESERVE_FDS},
- /* access log list is read only, no set func, no config var addr */
- {CONFIG_ACCESSLOG_LIST_ATTRIBUTE, NULL,
- NULL, 0, NULL,
- CONFIG_CHARRAY, (ConfigGetFunc)config_get_accesslog_list, NULL},
- {CONFIG_SVRTAB_ATTRIBUTE, config_set_srvtab,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.srvtab,
- CONFIG_STRING, NULL, ""},
- {CONFIG_PW_EXP_ATTRIBUTE, config_set_pw_exp,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_exp,
- CONFIG_ON_OFF, NULL, &init_pw_exp},
- {CONFIG_ACCESSCONTROL_ATTRIBUTE, config_set_accesscontrol,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.accesscontrol,
- CONFIG_ON_OFF, NULL, &init_accesscontrol},
- {CONFIG_AUDITLOG_LIST_ATTRIBUTE, NULL,
- NULL, 0, NULL,
- CONFIG_CHARRAY, (ConfigGetFunc)config_get_auditlog_list, NULL},
- {CONFIG_ACCESSLOG_LOGROTATIONTIMEUNIT_ATTRIBUTE, NULL,
- log_set_rotationtimeunit, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_rotationunit,
- CONFIG_STRING, NULL, INIT_ACCESSLOG_ROTATIONUNIT},
- {CONFIG_PW_LOCKDURATION_ATTRIBUTE, config_set_pw_lockduration,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_lockduration,
- CONFIG_LONG, NULL, DEFAULT_PW_LOCKDURATION},
- {CONFIG_ACCESSLOG_MAXLOGSIZE_ATTRIBUTE, NULL,
- log_set_logsize, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_maxlogsize,
- CONFIG_INT, NULL, DEFAULT_LOG_MAXLOGSIZE},
- {CONFIG_IDLETIMEOUT_ATTRIBUTE, config_set_idletimeout,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.idletimeout,
- CONFIG_INT, NULL, DEFAULT_IDLE_TIMEOUT},
- {CONFIG_NAGLE_ATTRIBUTE, config_set_nagle,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.nagle,
- CONFIG_ON_OFF, NULL, &init_nagle},
- {CONFIG_ERRORLOG_MINFREEDISKSPACE_ATTRIBUTE, NULL,
- log_set_mindiskspace, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_minfreespace,
- CONFIG_INT, NULL, DEFAULT_LOG_MINFREESPACE},
- {CONFIG_AUDITLOG_LOGGING_ENABLED_ATTRIBUTE, NULL,
- log_set_logging, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_logging_enabled,
- CONFIG_ON_OFF, NULL, &init_auditlog_logging_enabled},
- {CONFIG_AUDITLOG_LOGGING_HIDE_UNHASHED_PW, config_set_auditlog_unhashed_pw,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.auditlog_logging_hide_unhashed_pw,
- CONFIG_ON_OFF, NULL, &init_auditlog_logging_hide_unhashed_pw},
- {CONFIG_ACCESSLOG_BUFFERING_ATTRIBUTE, config_set_accesslogbuffering,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.accesslogbuffering,
- CONFIG_ON_OFF, NULL, &init_accesslogbuffering},
- {CONFIG_CSNLOGGING_ATTRIBUTE, config_set_csnlogging,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.csnlogging,
- CONFIG_ON_OFF, NULL, &init_csnlogging},
- {CONFIG_AUDITLOG_LOGEXPIRATIONTIMEUNIT_ATTRIBUTE, NULL,
- log_set_expirationtimeunit, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_exptimeunit,
- CONFIG_STRING_OR_UNKNOWN, NULL, INIT_AUDITLOG_EXPTIMEUNIT},
- {CONFIG_PW_SYNTAX_ATTRIBUTE, config_set_pw_syntax,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_syntax,
- CONFIG_ON_OFF, NULL, &init_pw_syntax},
- {CONFIG_LISTENHOST_ATTRIBUTE, config_set_listenhost,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.listenhost,
- CONFIG_STRING, NULL, NULL/* NULL value is allowed */},
- {CONFIG_SNMP_INDEX_ATTRIBUTE, config_set_snmp_index,
- NULL, 0,
- (void**) &global_slapdFrontendConfig.snmp_index,
- CONFIG_INT, NULL, DEFAULT_SNMP_INDEX},
- {CONFIG_LDAPI_FILENAME_ATTRIBUTE, config_set_ldapi_filename,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldapi_filename,
- CONFIG_STRING, NULL, SLAPD_LDAPI_DEFAULT_FILENAME},
- {CONFIG_LDAPI_SWITCH_ATTRIBUTE, config_set_ldapi_switch,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldapi_switch,
- CONFIG_ON_OFF, NULL, &init_ldapi_switch},
- {CONFIG_LDAPI_BIND_SWITCH_ATTRIBUTE, config_set_ldapi_bind_switch,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldapi_bind_switch,
- CONFIG_ON_OFF, NULL, &init_ldapi_bind_switch},
- {CONFIG_LDAPI_ROOT_DN_ATTRIBUTE, config_set_ldapi_root_dn,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldapi_root_dn,
- CONFIG_STRING, NULL, DEFAULT_DIRECTORY_MANAGER},
- {CONFIG_LDAPI_MAP_ENTRIES_ATTRIBUTE, config_set_ldapi_map_entries,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldapi_map_entries,
- CONFIG_ON_OFF, NULL, &init_ldapi_map_entries},
- {CONFIG_LDAPI_UIDNUMBER_TYPE_ATTRIBUTE, config_set_ldapi_uidnumber_type,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldapi_uidnumber_type,
- CONFIG_STRING, NULL, DEFAULT_UIDNUM_TYPE},
- {CONFIG_LDAPI_GIDNUMBER_TYPE_ATTRIBUTE, config_set_ldapi_gidnumber_type,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldapi_gidnumber_type,
- CONFIG_STRING, NULL, DEFAULT_GIDNUM_TYPE},
- {CONFIG_LDAPI_SEARCH_BASE_DN_ATTRIBUTE, config_set_ldapi_search_base_dn,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldapi_search_base_dn,
- CONFIG_STRING, NULL, DEFAULT_LDAPI_SEARCH_BASE},
- #if defined(ENABLE_AUTO_DN_SUFFIX)
- {CONFIG_LDAPI_AUTO_DN_SUFFIX_ATTRIBUTE, config_set_ldapi_auto_dn_suffix,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldapi_auto_dn_suffix,
- CONFIG_STRING, NULL, DEFAULT_LDAPI_AUTO_DN},
- #endif
- {CONFIG_ANON_LIMITS_DN_ATTRIBUTE, config_set_anon_limits_dn,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.anon_limits_dn,
- CONFIG_STRING, NULL, ""},
- {CONFIG_SLAPI_COUNTER_ATTRIBUTE, config_set_slapi_counters,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.slapi_counters,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_slapi_counters,
- &init_slapi_counters},
- {CONFIG_ACCESSLOG_MINFREEDISKSPACE_ATTRIBUTE, NULL,
- log_set_mindiskspace, SLAPD_ACCESS_LOG,
- (void**)&global_slapdFrontendConfig.accesslog_minfreespace,
- CONFIG_INT, NULL, DEFAULT_LOG_MINFREESPACE},
- {CONFIG_ERRORLOG_MAXNUMOFLOGSPERDIR_ATTRIBUTE, NULL,
- log_set_numlogsperdir, SLAPD_ERROR_LOG,
- (void**)&global_slapdFrontendConfig.errorlog_maxnumlogs,
- CONFIG_INT, NULL, DEFAULT_LOG_MAXNUMLOGS},
- {CONFIG_SECURELISTENHOST_ATTRIBUTE, config_set_securelistenhost,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.securelistenhost,
- CONFIG_STRING, NULL, NULL/* NULL value is allowed */},
- {CONFIG_AUDITLOG_MINFREEDISKSPACE_ATTRIBUTE, NULL,
- log_set_mindiskspace, SLAPD_AUDIT_LOG,
- (void**)&global_slapdFrontendConfig.auditlog_minfreespace,
- CONFIG_INT, NULL, DEFAULT_LOG_MINFREESPACE},
- {CONFIG_ROOTDN_ATTRIBUTE, config_set_rootdn,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.rootdn,
- CONFIG_STRING, NULL, DEFAULT_DIRECTORY_MANAGER},
- {CONFIG_PW_MINAGE_ATTRIBUTE, config_set_pw_minage,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pw_policy.pw_minage,
- CONFIG_LONG, NULL, DEFAULT_PW_MINAGE},
- {CONFIG_AUDITFILE_ATTRIBUTE, config_set_auditlog,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.auditlog,
- CONFIG_STRING_OR_EMPTY, NULL, NULL/* deletion is not allowed */},
- {CONFIG_RETURN_EXACT_CASE_ATTRIBUTE, config_set_return_exact_case,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.return_exact_case,
- CONFIG_ON_OFF, NULL, &init_return_exact_case},
- {CONFIG_RESULT_TWEAK_ATTRIBUTE, config_set_result_tweak,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.result_tweak,
- CONFIG_ON_OFF, NULL, &init_result_tweak},
- {CONFIG_PLUGIN_BINDDN_TRACKING_ATTRIBUTE, config_set_plugin_tracking,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.plugin_track,
- CONFIG_ON_OFF, NULL, &init_plugin_track},
- {CONFIG_ATTRIBUTE_NAME_EXCEPTION_ATTRIBUTE, config_set_attrname_exceptions,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.attrname_exceptions,
- CONFIG_ON_OFF, NULL, &init_attrname_exceptions},
- {CONFIG_MAXBERSIZE_ATTRIBUTE, config_set_maxbersize,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.maxbersize,
- CONFIG_INT, NULL, DEFAULT_MAX_BERSIZE},
- {CONFIG_MAXSASLIOSIZE_ATTRIBUTE, config_set_maxsasliosize,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.maxsasliosize,
- CONFIG_INT, NULL, DEFAULT_MAX_SASLIO_SIZE},
- {CONFIG_VERSIONSTRING_ATTRIBUTE, config_set_versionstring,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.versionstring,
- CONFIG_STRING, NULL, SLAPD_VERSION_STR},
- {CONFIG_REFERRAL_MODE_ATTRIBUTE, config_set_referral_mode,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.refer_url,
- CONFIG_STRING, NULL, NULL/* deletion is not allowed */},
- #if !defined(_WIN32) && !defined(AIX)
- {CONFIG_MAXDESCRIPTORS_ATTRIBUTE, config_set_maxdescriptors,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.maxdescriptors,
- CONFIG_INT, NULL, DEFAULT_MAXDESCRIPTORS},
- #endif
- {CONFIG_CONNTABLESIZE_ATTRIBUTE, config_set_conntablesize,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.conntablesize,
- CONFIG_INT, NULL, NULL/* deletion is not allowed */},
- {CONFIG_SSLCLIENTAUTH_ATTRIBUTE, config_set_SSLclientAuth,
- NULL, 0,
- (void **)&global_slapdFrontendConfig.SSLclientAuth,
- CONFIG_SPECIAL_SSLCLIENTAUTH, NULL, DEFAULT_SSLCLIENTAPTH},
- {CONFIG_SSL_CHECK_HOSTNAME_ATTRIBUTE, config_set_ssl_check_hostname,
- NULL, 0, NULL,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_ssl_check_hostname,
- &init_ssl_check_hostname},
- {CONFIG_CONFIG_ATTRIBUTE, 0,
- NULL, 0, (void**)SLAPD_CONFIG_DN,
- CONFIG_CONSTANT_STRING, NULL, NULL/* deletion is not allowed */},
- {CONFIG_HASH_FILTERS_ATTRIBUTE, config_set_hash_filters,
- NULL, 0, NULL,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_hash_filters,
- NULL/* deletion is not allowed */},
- /* instance dir; used by admin tasks */
- {CONFIG_INSTDIR_ATTRIBUTE, config_set_instancedir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.instancedir,
- CONFIG_STRING, NULL, NULL/* deletion is not allowed */},
- /* parameterizing schema dir */
- {CONFIG_SCHEMADIR_ATTRIBUTE, config_set_schemadir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.schemadir,
- CONFIG_STRING, NULL, NULL/* deletion is not allowed */},
- /* parameterizing lock dir */
- {CONFIG_LOCKDIR_ATTRIBUTE, config_set_lockdir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.lockdir,
- CONFIG_STRING, (ConfigGetFunc)config_get_lockdir,
- NULL/* deletion is not allowed */},
- /* parameterizing tmp dir */
- {CONFIG_TMPDIR_ATTRIBUTE, config_set_tmpdir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.tmpdir,
- CONFIG_STRING, (ConfigGetFunc)config_get_tmpdir,
- NULL/* deletion is not allowed */},
- /* parameterizing cert dir */
- {CONFIG_CERTDIR_ATTRIBUTE, config_set_certdir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.certdir,
- CONFIG_STRING, (ConfigGetFunc)config_get_certdir,
- NULL/* deletion is not allowed */},
- /* parameterizing ldif dir */
- {CONFIG_LDIFDIR_ATTRIBUTE, config_set_ldifdir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ldifdir,
- CONFIG_STRING, (ConfigGetFunc)config_get_ldifdir,
- NULL/* deletion is not allowed */},
- /* parameterizing bak dir */
- {CONFIG_BAKDIR_ATTRIBUTE, config_set_bakdir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.bakdir,
- CONFIG_STRING, (ConfigGetFunc)config_get_bakdir,
- NULL/* deletion is not allowed */},
- /* parameterizing sasl plugin path */
- {CONFIG_SASLPATH_ATTRIBUTE, config_set_saslpath,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.saslpath,
- CONFIG_STRING, (ConfigGetFunc)config_get_saslpath,
- NULL/* deletion is not allowed */},
- /* parameterizing run dir */
- {CONFIG_RUNDIR_ATTRIBUTE, config_set_rundir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.rundir,
- CONFIG_STRING, (ConfigGetFunc)config_get_rundir,
- NULL/* deletion is not allowed */},
- {CONFIG_REWRITE_RFC1274_ATTRIBUTE, config_set_rewrite_rfc1274,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.rewrite_rfc1274,
- CONFIG_ON_OFF, NULL, &init_rewrite_rfc1274},
- {CONFIG_OUTBOUND_LDAP_IO_TIMEOUT_ATTRIBUTE,
- config_set_outbound_ldap_io_timeout,
- NULL, 0,
- (void **)&global_slapdFrontendConfig.outbound_ldap_io_timeout,
- CONFIG_INT, NULL, DEFAULT_OUTBOUND_LDAP_IO_TIMEOUT},
- {CONFIG_UNAUTH_BINDS_ATTRIBUTE, config_set_unauth_binds_switch,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.allow_unauth_binds,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_unauth_binds_switch,
- &init_allow_unauth_binds},
- {CONFIG_REQUIRE_SECURE_BINDS_ATTRIBUTE, config_set_require_secure_binds,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.require_secure_binds,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_require_secure_binds,
- &init_require_secure_binds},
- {CONFIG_ANON_ACCESS_ATTRIBUTE, config_set_anon_access_switch,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.allow_anon_access,
- CONFIG_SPECIAL_ANON_ACCESS_SWITCH,
- (ConfigGetFunc)config_get_anon_access_switch,
- DEFAULT_ALLOW_ANON_ACCESS},
- {CONFIG_LOCALSSF_ATTRIBUTE, config_set_localssf,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.localssf,
- CONFIG_INT, NULL, DEFAULT_LOCAL_SSF},
- {CONFIG_MINSSF_ATTRIBUTE, config_set_minssf,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.minssf,
- CONFIG_INT, NULL, DEFAULT_MIN_SSF},
- {CONFIG_MINSSF_EXCLUDE_ROOTDSE, config_set_minssf_exclude_rootdse,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.minssf_exclude_rootdse,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_minssf_exclude_rootdse,
- &init_minssf_exclude_rootdse},
- {CONFIG_FORCE_SASL_EXTERNAL_ATTRIBUTE, config_set_force_sasl_external,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.force_sasl_external,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_force_sasl_external,
- &init_force_sasl_external},
- {CONFIG_ENTRYUSN_GLOBAL, config_set_entryusn_global,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.entryusn_global,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_entryusn_global,
- &init_entryusn_global},
- {CONFIG_ENTRYUSN_IMPORT_INITVAL, config_set_entryusn_import_init,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.entryusn_import_init,
- CONFIG_STRING, (ConfigGetFunc)config_get_entryusn_import_init,
- ENTRYUSN_IMPORT_INIT},
- {CONFIG_ALLOWED_TO_DELETE_ATTRIBUTE, config_set_allowed_to_delete_attrs,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.allowed_to_delete_attrs,
- CONFIG_STRING, (ConfigGetFunc)config_get_allowed_to_delete_attrs,
- DEFAULT_ALLOWED_TO_DELETE_ATTRS },
- {CONFIG_VALIDATE_CERT_ATTRIBUTE, config_set_validate_cert_switch,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.validate_cert,
- CONFIG_SPECIAL_VALIDATE_CERT_SWITCH,
- (ConfigGetFunc)config_get_validate_cert_switch, DEFAULT_VALIDATE_CERT},
- {CONFIG_PAGEDSIZELIMIT_ATTRIBUTE, config_set_pagedsizelimit,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.pagedsizelimit,
- CONFIG_INT, NULL, DEFAULT_PAGEDSIZELIMIT},
- {CONFIG_DEFAULT_NAMING_CONTEXT, config_set_default_naming_context,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.default_naming_context,
- CONFIG_STRING, (ConfigGetFunc)config_get_default_naming_context, NULL},
- {CONFIG_DISK_MONITORING, config_set_disk_monitoring,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.disk_monitoring,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_disk_monitoring,
- &init_disk_monitoring},
- {CONFIG_DISK_THRESHOLD, config_set_disk_threshold,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.disk_threshold,
- CONFIG_INT, (ConfigGetFunc)config_get_disk_threshold,
- DEFAULT_DISK_THRESHOLD},
- {CONFIG_DISK_GRACE_PERIOD, config_set_disk_grace_period,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.disk_grace_period,
- CONFIG_INT, (ConfigGetFunc)config_get_disk_grace_period,
- DEFAULT_DISK_GRACE_PERIOD},
- {CONFIG_DISK_LOGGING_CRITICAL, config_set_disk_logging_critical,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.disk_logging_critical,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_disk_logging_critical,
- &init_disk_logging_critical},
- {CONFIG_DISK_PRESERVE_LOGGING, config_set_disk_preserve_logging,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.disk_preserve_logging,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_disk_preserve_logging,
- &init_disk_preserve_logging},
- {CONFIG_NDN_CACHE, config_set_ndn_cache_enabled,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ndn_cache_enabled,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_ndn_cache_enabled,
- &init_ndn_cache_enabled},
- {CONFIG_NDN_CACHE_SIZE, config_set_ndn_cache_max_size,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ndn_cache_max_size,
- CONFIG_INT, (ConfigGetFunc)config_get_ndn_cache_size, DEFAULT_NDN_SIZE},
- {CONFIG_ALLOWED_SASL_MECHS, config_set_allowed_sasl_mechs,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.allowed_sasl_mechs,
- CONFIG_STRING, (ConfigGetFunc)config_get_allowed_sasl_mechs, DEFAULT_ALLOWED_TO_DELETE_ATTRS},
- {CONFIG_IGNORE_VATTRS, config_set_ignore_vattrs,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.ignore_vattrs,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_ignore_vattrs, DEFAULT_ALLOWED_TO_DELETE_ATTRS},
- {CONFIG_UNHASHED_PW_SWITCH_ATTRIBUTE, config_set_unhashed_pw_switch,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.unhashed_pw_switch,
- CONFIG_SPECIAL_UNHASHED_PW_SWITCH,
- (ConfigGetFunc)config_get_unhashed_pw_switch,
- DEFAULT_UNHASHED_PW_SWITCH},
- {CONFIG_SASL_MAXBUFSIZE, config_set_sasl_maxbufsize,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.sasl_max_bufsize,
- CONFIG_INT, (ConfigGetFunc)config_get_sasl_maxbufsize,
- DEFAULT_SASL_MAXBUFSIZE},
- {CONFIG_SEARCH_RETURN_ORIGINAL_TYPE, config_set_return_orig_type_switch,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.return_orig_type,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_return_orig_type_switch, &init_return_orig_type},
- {CONFIG_ENABLE_TURBO_MODE, config_set_enable_turbo_mode,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.enable_turbo_mode,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_enable_turbo_mode, &init_enable_turbo_mode},
- {CONFIG_CONNECTION_BUFFER, config_set_connection_buffer,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.connection_buffer,
- CONFIG_INT, (ConfigGetFunc)config_get_connection_buffer, &init_connection_buffer},
- {CONFIG_CONNECTION_NOCANON, config_set_connection_nocanon,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.connection_nocanon,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_connection_nocanon, &init_connection_nocanon}
- #ifdef MEMPOOL_EXPERIMENTAL
- ,{CONFIG_MEMPOOL_SWITCH_ATTRIBUTE, config_set_mempool_switch,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.mempool_switch,
- CONFIG_ON_OFF, (ConfigGetFunc)config_get_mempool_switch,
- &init_mempool_switch},
- {CONFIG_MEMPOOL_MAXFREELIST_ATTRIBUTE, config_set_mempool_maxfreelist,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.mempool_maxfreelist,
- CONFIG_INT, (ConfigGetFunc)config_get_mempool_maxfreelist,
- DEFAULT_MEMPOOL_MAXFREELIST}
- #endif /* MEMPOOL_EXPERIMENTAL */
- };
- /*
- * hashNocaseString - used for case insensitive hash lookups
- */
- PLHashNumber
- hashNocaseString(const void *key)
- {
- PLHashNumber h = 0;
- const unsigned char *s;
-
- for (s = key; *s; s++)
- h = (h >> 28) ^ (h << 4) ^ (tolower(*s));
- return h;
- }
- /*
- * hashNocaseCompare - used for case insensitive hash key comparisons
- */
- PRIntn
- hashNocaseCompare(const void *v1, const void *v2)
- {
- return (strcasecmp((char *)v1, (char *)v2) == 0);
- }
- static PLHashTable *confighash = 0;
- static void
- init_config_get_and_set()
- {
- if (!confighash) {
- int ii = 0;
- int tablesize = sizeof(ConfigList)/sizeof(ConfigList[0]);
- confighash = PL_NewHashTable(tablesize+1, hashNocaseString,
- hashNocaseCompare,
- PL_CompareValues, 0, 0);
- for (ii = 0; ii < tablesize; ++ii) {
- if (PL_HashTableLookup(confighash, ConfigList[ii].attr_name))
- printf("error: %s is already in the list\n",
- ConfigList[ii].attr_name);
- if (!PL_HashTableAdd(confighash, ConfigList[ii].attr_name, &ConfigList[ii]))
- printf("error: could not add %s to the list\n",
- ConfigList[ii].attr_name);
- }
- }
- }
- #if 0
- #define GOLDEN_RATIO 0x9E3779B9U
- PR_IMPLEMENT(PLHashEntry **)
- PL_HashTableRawLookup(PLHashTable *ht, PLHashNumber keyHash, const void *key)
- {
- PLHashEntry *he, **hep, **hep0;
- PLHashNumber h;
- #ifdef HASHMETER
- ht->nlookups++;
- #endif
- h = keyHash * GOLDEN_RATIO;
- h >>= ht->shift;
- hep = hep0 = &ht->buckets[h];
- while ((he = *hep) != 0) {
- if (he->keyHash == keyHash && (*ht->keyCompare)(key, he->key)) {
- /* Move to front of chain if not already there */
- if (hep != hep0) {
- *hep = he->next;
- he->next = *hep0;
- *hep0 = he;
- }
- return hep0;
- }
- hep = &he->next;
- #ifdef HASHMETER
- ht->nsteps++;
- #endif
- }
- return hep;
- }
- static void
- debugHashTable(const char *key)
- {
- int ii = 0;
- PLHashEntry **hep = PL_HashTableRawLookup(confighash, hashNocaseString(key),
- key);
- if (!hep || !*hep)
- printf("raw lookup failed for %s\n", key);
- else if (hep && *hep)
- printf("raw lookup found %s -> %ul %s\n", key, (*hep)->keyHash, (*hep)->key);
- printf("hash table has %d entries\n", confighash->nentries);
- for (ii = 0; ii < confighash->nentries; ++ii)
- {
- PLHashEntry *he = confighash->buckets[ii];
- if (!he)
- printf("hash table entry %d is null\n", ii);
- else {
- printf("hash bucket %d:\n", ii);
- while (he) {
- int keys = !hashNocaseCompare(key, he->key);
- int hash = (hashNocaseString(key) == he->keyHash);
- printf("\thashval = %ul key = %s\n", he->keyHash, he->key);
- if (keys && hash) {
- printf("\t\tFOUND\n");
- } else if (keys) {
- printf("\t\tkeys match but hash vals do not\n");
- } else if (hash) {
- printf("\t\thash match but keys do not\n");
- }
- he = he->next;
- }
- }
- }
- }
- #endif
- static void
- bervalarray_free(struct berval **bvec)
- {
- int ii = 0;
- for(ii = 0; bvec && bvec[ii]; ++ii) {
- slapi_ch_free((void **)&bvec[ii]->bv_val);
- slapi_ch_free((void **)&bvec[ii]);
- }
- slapi_ch_free((void**)&bvec);
- }
- static struct berval **
- strarray2bervalarray(const char **strarray)
- {
- int ii = 0;
- struct berval **newlist = 0;
- /* first, count the number of items in the list */
- for (ii = 0; strarray && strarray[ii]; ++ii);
- /* if no items, return null */
- if (!ii)
- return newlist;
- /* allocate the list */
- newlist = (struct berval **)slapi_ch_malloc((ii+1) * sizeof(struct berval *));
- newlist[ii] = 0;
- for (; ii; --ii) {
- newlist[ii-1] = (struct berval *)slapi_ch_malloc(sizeof(struct berval));
- newlist[ii-1]->bv_val = slapi_ch_strdup(strarray[ii-1]);
- newlist[ii-1]->bv_len = strlen(strarray[ii-1]);
- }
- return newlist;
- }
- /*
- * counter for active threads
- */
- static PRInt32 active_threads = 0;
- void
- g_incr_active_threadcnt()
- {
- PR_AtomicIncrement(&active_threads);
- }
- void
- g_decr_active_threadcnt()
- {
- PR_AtomicDecrement(&active_threads);
- }
- int
- g_get_active_threadcnt()
- {
- return (int)active_threads;
- }
- /*
- ** Setting this flag forces the server to shutdown.
- */
- static int slapd_shutdown;
- void g_set_shutdown( int reason )
- {
- slapd_shutdown = reason;
- }
- int g_get_shutdown()
- {
- return slapd_shutdown;
- }
- int slapi_is_shutting_down()
- {
- return slapd_shutdown;
- }
- static int cmd_shutdown;
- void c_set_shutdown()
- {
- cmd_shutdown = SLAPI_SHUTDOWN_SIGNAL;
- }
- int c_get_shutdown()
- {
- return cmd_shutdown;
- }
- slapdFrontendConfig_t *
- getFrontendConfig()
- {
- return &global_slapdFrontendConfig;
- }
- /*
- * FrontendConfig_init:
- * Put all default values for config stuff here.
- * If there's no default value, the value will be NULL if it's not set in dse.ldif
- */
- void
- FrontendConfig_init () {
- slapdFrontendConfig_t *cfg = getFrontendConfig();
- #if SLAPI_CFG_USE_RWLOCK == 1
- /* initialize the read/write configuration lock */
- if ( (cfg->cfg_rwlock = slapi_new_rwlock()) == NULL ) {
- LDAPDebug ( LDAP_DEBUG_ANY, "FrontendConfig_init: "
- "failed to initialize cfg_rwlock. Exiting now.",0,0,0);
- exit(-1);
- }
- #else
- if ((cfg->cfg_lock = PR_NewLock()) == NULL){
- LDAPDebug(LDAP_DEBUG_ANY, "FrontendConfig_init: "
- "failed to initialize cfg_lock. Exiting now.",0,0,0);
- exit(-1);
- }
- #endif
- cfg->port = LDAP_PORT;
- cfg->secureport = LDAPS_PORT;
- cfg->ldapi_filename = slapi_ch_strdup(SLAPD_LDAPI_DEFAULT_FILENAME);
- init_ldapi_switch = cfg->ldapi_switch = LDAP_OFF;
- init_ldapi_bind_switch = cfg->ldapi_bind_switch = LDAP_OFF;
- cfg->ldapi_root_dn = slapi_ch_strdup(DEFAULT_DIRECTORY_MANAGER);
- init_ldapi_map_entries = cfg->ldapi_map_entries = LDAP_OFF;
- cfg->ldapi_uidnumber_type = slapi_ch_strdup(DEFAULT_UIDNUM_TYPE);
- cfg->ldapi_gidnumber_type = slapi_ch_strdup(DEFAULT_GIDNUM_TYPE);
- /* These DNs are no need to be normalized. */
- cfg->ldapi_search_base_dn = slapi_ch_strdup(DEFAULT_LDAPI_SEARCH_BASE);
- #if defined(ENABLE_AUTO_DN_SUFFIX)
- cfg->ldapi_auto_dn_suffix = slapi_ch_strdup(DEFAULT_LDAPI_AUTO_DN);
- #endif
- init_allow_unauth_binds = cfg->allow_unauth_binds = LDAP_OFF;
- init_require_secure_binds = cfg->require_secure_binds = LDAP_OFF;
- cfg->allow_anon_access = SLAPD_ANON_ACCESS_ON;
- init_slapi_counters = cfg->slapi_counters = LDAP_ON;
- cfg->threadnumber = SLAPD_DEFAULT_MAX_THREADS;
- cfg->maxthreadsperconn = SLAPD_DEFAULT_MAX_THREADS_PER_CONN;
- cfg->reservedescriptors = SLAPD_DEFAULT_RESERVE_FDS;
- cfg->idletimeout = SLAPD_DEFAULT_IDLE_TIMEOUT;
- cfg->ioblocktimeout = SLAPD_DEFAULT_IOBLOCK_TIMEOUT;
- cfg->outbound_ldap_io_timeout = SLAPD_DEFAULT_OUTBOUND_LDAP_IO_TIMEOUT;
- cfg->max_filter_nest_level = SLAPD_DEFAULT_MAX_FILTER_NEST_LEVEL;
- cfg->maxsasliosize = SLAPD_DEFAULT_MAX_SASLIO_SIZE;
- cfg->localssf = SLAPD_DEFAULT_LOCAL_SSF;
- cfg->minssf = SLAPD_DEFAULT_MIN_SSF;
- /* minssf is applied to rootdse, by default */
- init_minssf_exclude_rootdse = cfg->minssf_exclude_rootdse = LDAP_OFF;
- cfg->validate_cert = SLAPD_VALIDATE_CERT_WARN;
- #ifdef _WIN32
- cfg->conntablesize = SLAPD_DEFAULT_CONNTABLESIZE;
- #else
- #ifdef USE_SYSCONF
- cfg->conntablesize = sysconf( _SC_OPEN_MAX );
- #else /* USE_SYSCONF */
- cfg->conntablesize = getdtablesize();
- #endif /* USE_SYSCONF */
- #endif /* _WIN32 */
- init_accesscontrol = cfg->accesscontrol = LDAP_ON;
- #if defined(LINUX)
- /* On Linux, by default, we use TCP_CORK so we must enable nagle */
- init_nagle = cfg->nagle = LDAP_ON;
- #else
- init_nagle = cfg->nagle = LDAP_OFF;
- #endif
- init_security = cfg->security = LDAP_OFF;
- init_ssl_check_hostname = cfg->ssl_check_hostname = LDAP_ON;
- init_return_exact_case = cfg->return_exact_case = LDAP_ON;
- init_result_tweak = cfg->result_tweak = LDAP_OFF;
- init_attrname_exceptions = cfg->attrname_exceptions = LDAP_OFF;
- cfg->reservedescriptors = SLAPD_DEFAULT_RESERVE_FDS;
- cfg->useroc = slapi_ch_strdup ( "" );
- cfg->userat = slapi_ch_strdup ( "" );
- /* kexcoff: should not be initialized by default here
- cfg->rootpwstoragescheme = pw_name2scheme( SALTED_SHA1_SCHEME_NAME );
- cfg->pw_storagescheme = pw_name2scheme( SALTED_SHA1_SCHEME_NAME );
- */
- cfg->slapd_type = 0;
- cfg->versionstring = SLAPD_VERSION_STR;
- cfg->sizelimit = SLAPD_DEFAULT_SIZELIMIT;
- cfg->pagedsizelimit = 0;
- cfg->timelimit = SLAPD_DEFAULT_TIMELIMIT;
- cfg->anon_limits_dn = slapi_ch_strdup("");
- init_schemacheck = cfg->schemacheck = LDAP_ON;
- init_schemamod = cfg->schemamod = LDAP_ON;
- init_syntaxcheck = cfg->syntaxcheck = LDAP_OFF;
- init_plugin_track = cfg->plugin_track = LDAP_OFF;
- init_syntaxlogging = cfg->syntaxlogging = LDAP_OFF;
- init_dn_validate_strict = cfg->dn_validate_strict = LDAP_OFF;
- init_ds4_compatible_schema = cfg->ds4_compatible_schema = LDAP_OFF;
- init_enquote_sup_oc = cfg->enquote_sup_oc = LDAP_OFF;
- init_lastmod = cfg->lastmod = LDAP_ON;
- init_rewrite_rfc1274 = cfg->rewrite_rfc1274 = LDAP_OFF;
- cfg->schemareplace = slapi_ch_strdup( CONFIG_SCHEMAREPLACE_STR_REPLICATION_ONLY );
- init_schema_ignore_trailing_spaces = cfg->schema_ignore_trailing_spaces =
- SLAPD_DEFAULT_SCHEMA_IGNORE_TRAILING_SPACES;
- /* do not force sasl external by default -
- * let clients abide by the LDAP standards and send us a SASL/EXTERNAL bind
- * if that's what they want to do */
- init_force_sasl_external = cfg->force_sasl_external = LDAP_OFF;
- init_readonly = cfg->readonly = LDAP_OFF;
- init_pwpolicy_local = cfg->pwpolicy_local = LDAP_OFF;
- init_pw_change = cfg->pw_policy.pw_change = LDAP_ON;
- init_pw_must_change = cfg->pw_policy.pw_must_change = LDAP_OFF;
- init_pw_syntax = cfg->pw_policy.pw_syntax = LDAP_OFF;
- init_pw_exp = cfg->pw_policy.pw_exp = LDAP_OFF;
- cfg->pw_policy.pw_minlength = 8;
- cfg->pw_policy.pw_mindigits = 0;
- cfg->pw_policy.pw_minalphas = 0;
- cfg->pw_policy.pw_minuppers = 0;
- cfg->pw_policy.pw_minlowers = 0;
- cfg->pw_policy.pw_minspecials = 0;
- cfg->pw_policy.pw_min8bit = 0;
- cfg->pw_policy.pw_maxrepeats = 0;
- cfg->pw_policy.pw_mincategories = 3;
- cfg->pw_policy.pw_mintokenlength = 3;
- cfg->pw_policy.pw_maxage = 8640000; /* 100 days */
- cfg->pw_policy.pw_minage = 0;
- cfg->pw_policy.pw_warning = 86400; /* 1 day */
- init_pw_history = cfg->pw_policy.pw_history = LDAP_OFF;
- cfg->pw_policy.pw_inhistory = 6;
- init_pw_lockout = cfg->pw_policy.pw_lockout = LDAP_OFF;
- cfg->pw_policy.pw_maxfailure = 3;
- init_pw_unlock = cfg->pw_policy.pw_unlock = LDAP_ON;
- cfg->pw_policy.pw_lockduration = 3600; /* 60 minutes */
- cfg->pw_policy.pw_resetfailurecount = 600; /* 10 minutes */
- cfg->pw_policy.pw_gracelimit = 0;
- cfg->pw_policy.pw_admin = NULL;
- cfg->pw_policy.pw_admin_user = NULL;
- init_pw_is_legacy = cfg->pw_policy.pw_is_legacy = LDAP_ON;
- init_pw_track_update_time = cfg->pw_policy.pw_track_update_time = LDAP_OFF;
- init_pw_is_global_policy = cfg->pw_is_global_policy = LDAP_OFF;
- init_accesslog_logging_enabled = cfg->accesslog_logging_enabled = LDAP_ON;
- cfg->accesslog_mode = slapi_ch_strdup(INIT_ACCESSLOG_MODE);
- cfg->accesslog_maxnumlogs = 10;
- cfg->accesslog_maxlogsize = 100;
- cfg->accesslog_rotationtime = 1;
- cfg->accesslog_rotationunit = slapi_ch_strdup(INIT_ACCESSLOG_ROTATIONUNIT);
- init_accesslog_rotationsync_enabled =
- cfg->accesslog_rotationsync_enabled = LDAP_OFF;
- cfg->accesslog_rotationsynchour = 0;
- cfg->accesslog_rotationsyncmin = 0;
- cfg->accesslog_maxdiskspace = 500;
- cfg->accesslog_minfreespace = 5;
- cfg->accesslog_exptime = 1;
- cfg->accesslog_exptimeunit = slapi_ch_strdup(INIT_ACCESSLOG_EXPTIMEUNIT);
- cfg->accessloglevel = 256;
- init_accesslogbuffering = cfg->accesslogbuffering = LDAP_ON;
- init_csnlogging = cfg->csnlogging = LDAP_ON;
- init_errorlog_logging_enabled = cfg->errorlog_logging_enabled = LDAP_ON;
- cfg->errorlog_mode = slapi_ch_strdup(INIT_ERRORLOG_MODE);
- cfg->errorlog_maxnumlogs = 1;
- cfg->errorlog_maxlogsize = 100;
- cfg->errorlog_rotationtime = 1;
- cfg->errorlog_rotationunit = slapi_ch_strdup (INIT_ERRORLOG_ROTATIONUNIT);
- init_errorlog_rotationsync_enabled =
- cfg->errorlog_rotationsync_enabled = LDAP_OFF;
- cfg->errorlog_rotationsynchour = 0;
- cfg->errorlog_rotationsyncmin = 0;
- cfg->errorlog_maxdiskspace = 100;
- cfg->errorlog_minfreespace = 5;
- cfg->errorlog_exptime = 1;
- cfg->errorlog_exptimeunit = slapi_ch_strdup(INIT_ERRORLOG_EXPTIMEUNIT);
- cfg->errorloglevel = 0;
- init_auditlog_logging_enabled = cfg->auditlog_logging_enabled = LDAP_OFF;
- cfg->auditlog_mode = slapi_ch_strdup(INIT_AUDITLOG_MODE);
- cfg->auditlog_maxnumlogs = 1;
- cfg->auditlog_maxlogsize = 100;
- cfg->auditlog_rotationtime = 1;
- cfg->auditlog_rotationunit = slapi_ch_strdup(INIT_AUDITLOG_ROTATIONUNIT);
- init_auditlog_rotationsync_enabled =
- cfg->auditlog_rotationsync_enabled = LDAP_OFF;
- cfg->auditlog_rotationsynchour = 0;
- cfg->auditlog_rotationsyncmin = 0;
- cfg->auditlog_maxdiskspace = 100;
- cfg->auditlog_minfreespace = 5;
- cfg->auditlog_exptime = 1;
- cfg->auditlog_exptimeunit = slapi_ch_strdup(INIT_AUDITLOG_EXPTIMEUNIT);
- init_auditlog_logging_hide_unhashed_pw =
- cfg->auditlog_logging_hide_unhashed_pw = LDAP_ON;
- init_entryusn_global = cfg->entryusn_global = LDAP_OFF;
- cfg->entryusn_import_init = slapi_ch_strdup(ENTRYUSN_IMPORT_INIT);
- cfg->allowed_to_delete_attrs = slapi_ch_strdup("nsslapd-listenhost nsslapd-securelistenhost nsslapd-defaultnamingcontext");
- cfg->default_naming_context = NULL; /* store normalized dn */
- cfg->allowed_sasl_mechs = NULL;
- init_disk_monitoring = cfg->disk_monitoring = LDAP_OFF;
- cfg->disk_threshold = 2097152; /* 2 mb */
- cfg->disk_grace_period = 60; /* 1 hour */
- init_disk_preserve_logging = cfg->disk_preserve_logging = LDAP_OFF;
- init_disk_logging_critical = cfg->disk_logging_critical = LDAP_OFF;
- init_ndn_cache_enabled = cfg->ndn_cache_enabled = LDAP_OFF;
- cfg->ndn_cache_max_size = NDN_DEFAULT_SIZE;
- init_sasl_mapping_fallback = cfg->sasl_mapping_fallback = LDAP_OFF;
- cfg->ignore_vattrs = LDAP_OFF;
- cfg->sasl_max_bufsize = SLAPD_DEFAULT_SASL_MAXBUFSIZE;
- cfg->unhashed_pw_switch = SLAPD_UNHASHED_PW_ON;
- init_return_orig_type = cfg->return_orig_type = LDAP_OFF;
- init_enable_turbo_mode = cfg->enable_turbo_mode = LDAP_ON;
- init_connection_buffer = cfg->connection_buffer = CONNECTION_BUFFER_ON;
- init_connection_nocanon = cfg->connection_nocanon = LDAP_ON;
- #ifdef MEMPOOL_EXPERIMENTAL
- init_mempool_switch = cfg->mempool_switch = LDAP_ON;
- cfg->mempool_maxfreelist = 1024;
- cfg->system_page_size = sysconf(_SC_PAGE_SIZE); /* not to get every time; no set, get only */
- {
- long sc_size = cfg->system_page_size;
- cfg->system_page_bits = 0;
- while ((sc_size >>= 1) > 0) {
- cfg->system_page_bits++; /* to calculate once; no set, get only */
- }
- }
- #endif /* MEMPOOL_EXPERIMENTAL */
- init_config_get_and_set();
- }
- int
- g_get_global_lastmod()
- {
- return config_get_lastmod();
- }
- int g_get_slapd_security_on(){
- return config_get_security();
- }
- #ifdef _WIN32
- void libldap_init_debug_level(int *val_ptr)
- {
- module_ldap_debug = val_ptr;
- }
- #endif
- struct snmp_vars_t global_snmp_vars;
- struct snmp_vars_t * g_get_global_snmp_vars(){
- return &global_snmp_vars;
- }
- static slapdEntryPoints *sep = NULL;
- void
- set_dll_entry_points( slapdEntryPoints *p )
- {
- if ( NULL == sep )
- {
- sep = p;
- }
- }
- int
- get_entry_point( int ep_name, caddr_t *ep_addr )
- {
- int rc = 0;
- if(sep!=NULL)
- {
- switch ( ep_name ) {
- case ENTRY_POINT_PS_WAKEUP_ALL:
- *ep_addr = sep->sep_ps_wakeup_all;
- break;
- case ENTRY_POINT_PS_SERVICE:
- *ep_addr = sep->sep_ps_service;
- break;
- case ENTRY_POINT_DISCONNECT_SERVER:
- *ep_addr = sep->sep_disconnect_server;
- break;
- case ENTRY_POINT_SLAPD_SSL_INIT:
- *ep_addr = sep->sep_slapd_ssl_init;
- break;
- case ENTRY_POINT_SLAPD_SSL_INIT2:
- *ep_addr = sep->sep_slapd_ssl_init2;
- break;
- default:
- rc = -1;
- }
- }
- else
- {
- rc= -1;
- }
- return rc;
- }
- int
- config_set_auditlog_unhashed_pw(const char *attrname, char *value, char *errorbuf, int apply)
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- retVal = config_set_onoff ( attrname, value, &(slapdFrontendConfig->auditlog_logging_hide_unhashed_pw),
- errorbuf, apply);
- if(strcasecmp(value,"on") == 0){
- auditlog_hide_unhashed_pw();
- } else {
- auditlog_expose_unhashed_pw();
- }
- return retVal;
- }
- /*
- * Utility function called by many of the config_set_XXX() functions.
- * Returns a non-zero value if 'value' is NULL and zero if not.
- * Also constructs an error message in 'errorbuf' if value is NULL.
- * If or_zero_length is non-zero, zero length values are treated as
- * equivalent to NULL (i.e., they will cause a non-zero value to be
- * returned by this function).
- */
- static int
- config_value_is_null( const char *attrname, const char *value, char *errorbuf,
- int or_zero_length )
- {
- if ( NULL == value || ( or_zero_length && *value == '\0' )) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: deleting the value is not allowed.", attrname );
- return 1;
- }
- return 0;
- }
- int
- config_set_ignore_vattrs (const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- retVal = config_set_onoff ( attrname, value, &(slapdFrontendConfig->ignore_vattrs), errorbuf, apply);
- return retVal;
- }
- int
- config_set_sasl_mapping_fallback (const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- retVal = config_set_onoff ( attrname, value, &(slapdFrontendConfig->sasl_mapping_fallback), errorbuf, apply);
- return retVal;
- }
- int
- config_set_disk_monitoring( const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- retVal = config_set_onoff ( attrname, value, &(slapdFrontendConfig->disk_monitoring),
- errorbuf, apply);
- return retVal;
- }
- int
- config_set_disk_threshold( const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- long threshold = 0;
- char *endp = NULL;
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- threshold = strtol(value, &endp, 10);
- if ( *endp != '\0' || threshold < 2048 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, threshold must be greater than 2048 and less then %ld",
- attrname, value, LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->disk_threshold = threshold;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_disk_preserve_logging( const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- retVal = config_set_onoff ( attrname, value, &(slapdFrontendConfig->disk_preserve_logging),
- errorbuf, apply);
- return retVal;
- }
- int
- config_set_disk_logging_critical( const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- retVal = config_set_onoff ( attrname, value, &(slapdFrontendConfig->disk_logging_critical),
- errorbuf, apply);
- return retVal;
- }
- int
- config_set_disk_grace_period( const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- int period = 0;
- char *endp = NULL;
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- period = strtol(value, &endp, 10);
- if ( *endp != '\0' || period < 1 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, grace period must be at least 1 minute",
- attrname, value);
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->disk_grace_period = period;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_ndn_cache_enabled(const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- retVal = config_set_onoff ( attrname, value, &(slapdFrontendConfig->ndn_cache_enabled), errorbuf, apply);
- return retVal;
- }
- int
- config_set_ndn_cache_max_size(const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- long size;
- size = atol(value);
- if(size < 0){
- size = 0; /* same as -1 */
- }
- if(size > 0 && size < 1024000){
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "ndn_cache_max_size too low(%d), changing to "
- "%d bytes.\n",(int)size, NDN_DEFAULT_SIZE);
- size = NDN_DEFAULT_SIZE;
- }
- if(apply){
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->ndn_cache_max_size = size;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_sasl_maxbufsize(const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- int default_size = atoi(DEFAULT_SASL_MAXBUFSIZE);
- int size;
- size = atoi(value);
- if(size < default_size){
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "nsslapd-sasl-max-buffer-size is too low (%d), "
- "setting to default value (%d).\n",size, default_size);
- size = default_size;
- }
- if(apply){
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->sasl_max_bufsize = size;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_return_orig_type_switch(const char *attrname, char *value, char *errorbuf, int apply)
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- retVal = config_set_onoff(attrname, value, &(slapdFrontendConfig->return_orig_type), errorbuf, apply);
- return retVal;
- }
- int
- config_set_port( const char *attrname, char *port, char *errorbuf, int apply ) {
- long nPort;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
-
- if ( config_value_is_null( attrname, port, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- nPort = strtol(port, &endp, 10);
-
- if ( *endp != '\0' || errno == ERANGE || nPort > LDAP_PORT_MAX || nPort < 0 ) {
- retVal = LDAP_OPERATIONS_ERROR;
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid, ports must range from 0 to %d",
- attrname, port, LDAP_PORT_MAX );
- return retVal;
- }
- if ( nPort == 0 ) {
- LDAPDebug( LDAP_DEBUG_ANY,
- "Information: Non-Secure Port Disabled\n", 0, 0, 0 );
- }
-
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->port = nPort;
- /* n_port = nPort; */
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_secureport( const char *attrname, char *port, char *errorbuf, int apply ) {
- long nPort;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal = LDAP_SUCCESS;
- if ( config_value_is_null( attrname, port, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- nPort = strtol(port, &endp, 10);
-
- if (*endp != '\0' || errno == ERANGE || nPort > LDAP_PORT_MAX || nPort <= 0 ) {
- retVal = LDAP_OPERATIONS_ERROR;
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid, ports must range from 1 to %d",
- attrname, port, LDAP_PORT_MAX );
- }
-
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
-
- slapdFrontendConfig->secureport = nPort;
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
-
- int
- config_set_SSLclientAuth( const char *attrname, char *value, char *errorbuf, int apply ) {
-
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- /* first check the value, return an error if it's invalid */
- else if ( strcasecmp (value, "off") != 0 &&
- strcasecmp (value, "allowed") != 0 &&
- strcasecmp (value, "required")!= 0 ) {
- retVal = LDAP_OPERATIONS_ERROR;
- if( errorbuf )
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: unsupported value: %s", attrname, value );
- return retVal;
- }
- else if ( !apply ) {
- /* return success now, if we aren't supposed to apply the change */
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- if ( !strcasecmp( value, "off" )) {
- slapdFrontendConfig->SSLclientAuth = SLAPD_SSLCLIENTAUTH_OFF;
- }
- else if ( !strcasecmp( value, "allowed" )) {
- slapdFrontendConfig->SSLclientAuth = SLAPD_SSLCLIENTAUTH_ALLOWED;
- }
- else if ( !strcasecmp( value, "required" )) {
- slapdFrontendConfig->SSLclientAuth = SLAPD_SSLCLIENTAUTH_REQUIRED;
- }
- else {
- retVal = LDAP_OPERATIONS_ERROR;
- if( errorbuf )
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: unsupported value: %s", attrname, value );
- }
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_set_ssl_check_hostname(const char *attrname, char *value,
- char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->ssl_check_hostname),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_localhost( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->localhost) );
- slapdFrontendConfig->localhost = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_listenhost( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
-
- slapi_ch_free ( (void **) &(slapdFrontendConfig->listenhost) );
- slapdFrontendConfig->listenhost = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_snmp_index(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- long snmp_index;
- long snmp_index_disable;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- snmp_index_disable = atol(DEFAULT_SNMP_INDEX); /* if snmp index is disabled, use the nsslapd-port instead */;
-
- if (config_value_is_null(attrname, value, errorbuf, 0)) {
- snmp_index = snmp_index_disable;
- } else {
- errno = 0;
- snmp_index = strtol(value, &endp, 10);
- if (*endp != '\0' || errno == ERANGE || snmp_index < snmp_index_disable) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", %s must be greater or equal to %lu (%lu means disabled)",
- attrname, value, CONFIG_SNMP_INDEX_ATTRIBUTE, snmp_index_disable, snmp_index_disable);
- retVal = LDAP_OPERATIONS_ERROR;
- }
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->snmp_index = snmp_index;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_ldapi_filename( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->ldapi_filename) );
- slapdFrontendConfig->ldapi_filename = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_ldapi_switch( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->ldapi_switch),
- errorbuf,
- apply);
- return retVal;
- }
- int config_set_ldapi_bind_switch( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->ldapi_bind_switch),
- errorbuf,
- apply);
- return retVal;
- }
- int config_set_ldapi_root_dn( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->ldapi_root_dn) );
- slapdFrontendConfig->ldapi_root_dn = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int config_set_ldapi_map_entries( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->ldapi_map_entries),
- errorbuf,
- apply);
- return retVal;
- }
- int config_set_ldapi_uidnumber_type( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->ldapi_uidnumber_type) );
- slapdFrontendConfig->ldapi_uidnumber_type = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int config_set_ldapi_gidnumber_type( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->ldapi_gidnumber_type) );
- slapdFrontendConfig->ldapi_gidnumber_type = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int config_set_ldapi_search_base_dn( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->ldapi_search_base_dn) );
- slapdFrontendConfig->ldapi_search_base_dn = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- #if defined(ENABLE_AUTO_DN_SUFFIX)
- int config_set_ldapi_auto_dn_suffix( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->ldapi_auto_dn_suffix) );
- slapdFrontendConfig->ldapi_auto_dn_suffix = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- #endif
- int config_set_anon_limits_dn( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->anon_limits_dn) );
- slapdFrontendConfig->anon_limits_dn =
- slapi_create_dn_string("%s", value);
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- /*
- * Set nsslapd-counters: on | off to the internal config variable slapi_counters.
- * If set to off, slapi_counters is not initialized and the counters are not
- * incremented. Note: counters which are necessary for the server's running
- * are not disabled.
- */
- int config_set_slapi_counters( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname, value,
- &(slapdFrontendConfig->slapi_counters), errorbuf, apply);
- return retVal;
- }
- int
- config_set_securelistenhost( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
-
- slapi_ch_free ( (void **) &(slapdFrontendConfig->securelistenhost) );
- slapdFrontendConfig->securelistenhost = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_srvtab( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
-
- slapi_ch_free ( (void **) &(slapdFrontendConfig->srvtab) );
- ldap_srvtab = slapi_ch_strdup ( value );
- slapdFrontendConfig->srvtab = slapi_ch_strdup ( value );
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_sizelimit( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long sizelimit;
- char *endp = NULL;
- Slapi_Backend *be;
- char *cookie;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- sizelimit = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || sizelimit < -1 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, sizelimit must range from -1 to %ld",
- attrname, value, LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if (apply) {
-
- CFG_LOCK_WRITE(slapdFrontendConfig);
-
- slapdFrontendConfig->sizelimit= sizelimit;
- g_set_defsize (sizelimit);
- cookie = NULL;
- be = slapi_get_first_backend(&cookie);
- while (be) {
- be->be_sizelimit = slapdFrontendConfig->sizelimit;
- be = slapi_get_next_backend(cookie);
- }
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ((void **)&cookie);
- }
- return retVal;
- }
- int
- config_set_pagedsizelimit( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long pagedsizelimit;
- char *endp = NULL;
- Slapi_Backend *be;
- char *cookie;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- pagedsizelimit = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || pagedsizelimit < -1 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, pagedsizelimit must range from -1 to %ld",
- attrname, value, LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if (apply) {
-
- CFG_LOCK_WRITE(slapdFrontendConfig);
-
- slapdFrontendConfig->pagedsizelimit= pagedsizelimit;
- cookie = NULL;
- be = slapi_get_first_backend(&cookie);
- while (be) {
- be->be_pagedsizelimit = slapdFrontendConfig->pagedsizelimit;
- be = slapi_get_next_backend(cookie);
- }
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ((void **)&cookie);
- }
- return retVal;
- }
- int
- config_set_pw_storagescheme( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- struct pw_scheme *new_scheme = NULL;
- char * scheme_list = NULL;
-
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- scheme_list = plugin_get_pwd_storage_scheme_list(PLUGIN_LIST_PWD_STORAGE_SCHEME);
-
- new_scheme = pw_name2scheme(value);
- if ( new_scheme == NULL) {
- if ( scheme_list != NULL ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid scheme - %s. Valid schemes are: %s",
- attrname, value, scheme_list );
- } else {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid scheme - %s (no pwdstorage scheme"
- " plugin loaded)",
- attrname, value);
- }
- retVal = LDAP_OPERATIONS_ERROR;
- slapi_ch_free_string(&scheme_list);
- return retVal;
- }
- else if ( new_scheme->pws_enc == NULL )
- {
- /* For example: the NS-MTA-MD5 password scheme is for comparision only and for backward
- compatibility with an Old Messaging Server that was setting passwords in the
- directory already encrypted. The scheme cannot and don't encrypt password if
- they are in clear. We don't take it */
- if ( scheme_list != NULL ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "pw_storagescheme: invalid encoding scheme - %s\nValid values are: %s\n", value, scheme_list );
- }
- retVal = LDAP_UNWILLING_TO_PERFORM;
- slapi_ch_free_string(&scheme_list);
- free_pw_scheme(new_scheme);
- return retVal;
- }
-
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- free_pw_scheme(slapdFrontendConfig->pw_storagescheme);
- slapdFrontendConfig->pw_storagescheme = new_scheme;
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- } else {
- free_pw_scheme(new_scheme);
- }
- slapi_ch_free_string(&scheme_list);
- return retVal;
- }
-
- int
- config_set_pw_change( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_policy.pw_change),
- errorbuf,
- apply);
-
- if (retVal == LDAP_SUCCESS) {
- /* LP: Update ACI to reflect the value ! */
- if (apply)
- pw_mod_allowchange_aci(!slapdFrontendConfig->pw_policy.pw_change &&
- !slapdFrontendConfig->pw_policy.pw_must_change);
- }
-
- return retVal;
- }
- int
- config_set_pw_history( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_policy.pw_history),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_pw_must_change( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_policy.pw_must_change),
- errorbuf,
- apply);
-
- if (retVal == LDAP_SUCCESS) {
- /* LP: Update ACI to reflect the value ! */
- if (apply)
- pw_mod_allowchange_aci(!slapdFrontendConfig->pw_policy.pw_change &&
- !slapdFrontendConfig->pw_policy.pw_must_change);
- }
-
- return retVal;
- }
- int
- config_set_pwpolicy_local( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pwpolicy_local),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_pw_syntax( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_policy.pw_syntax),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_pw_minlength( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long minLength = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- errno = 0;
- minLength = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || minLength < 2 || minLength > 512 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum length \"%s\" is invalid. "
- "The minimum length must range from 2 to 512.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_minlength = minLength;
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
-
- return retVal;
- }
- int
- config_set_pw_mindigits( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long minDigits = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- minDigits = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || minDigits < 0 || minDigits > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of digits \"%s\" is invalid. "
- "The minimum number of digits must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_mindigits = minDigits;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_minalphas( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long minAlphas = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- minAlphas = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || minAlphas < 0 || minAlphas > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of alphas \"%s\" is invalid. "
- "The minimum number of alphas must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_minalphas = minAlphas;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_minuppers( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long minUppers = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- minUppers = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || minUppers < 0 || minUppers > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of uppercase characters \"%s\" is invalid. "
- "The minimum number of uppercase characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_minuppers = minUppers;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_minlowers( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long minLowers = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- minLowers = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || minLowers < 0 || minLowers > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of lowercase characters \"%s\" is invalid. "
- "The minimum number of lowercase characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_minlowers = minLowers;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_minspecials( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long minSpecials = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- minSpecials = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || minSpecials < 0 || minSpecials > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of special characters \"%s\" is invalid. "
- "The minimum number of special characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_minspecials = minSpecials;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_min8bit( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long min8bit = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- min8bit = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || min8bit < 0 || min8bit > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of 8-bit characters \"%s\" is invalid. "
- "The minimum number of 8-bit characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_min8bit = min8bit;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_maxrepeats( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long maxRepeats = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- maxRepeats = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || maxRepeats < 0 || maxRepeats > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password maximum number of repeated characters \"%s\" is invalid. "
- "The maximum number of repeated characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_maxrepeats = maxRepeats;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_mincategories( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long minCategories = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- minCategories = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || minCategories < 1 || minCategories > 5 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of categories \"%s\" is invalid. "
- "The minimum number of categories must range from 1 to 5.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_mincategories = minCategories;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_mintokenlength( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long minTokenLength = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- minTokenLength = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || minTokenLength < 1 || minTokenLength > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum token length \"%s\" is invalid. "
- "The minimum token length must range from 1 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_mintokenlength = minTokenLength;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_maxfailure( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long maxFailure = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- errno = 0;
- maxFailure = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || maxFailure <= 0 || maxFailure > 32767 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password maximum retry \"%s\" is invalid. "
- "Password maximum failure must range from 1 to 32767",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_maxfailure = maxFailure;
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
-
- return retVal;
- }
- int
- config_set_pw_inhistory( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long history = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- errno = 0;
- history = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || history < 2 || history > 24 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password history length \"%s\" is invalid. "
- "The password history must range from 2 to 24",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_inhistory = history;
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
-
- return retVal;
- }
- int
- config_set_pw_lockduration( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long duration = 0; /* in minutes */
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- /* in seconds */
- duration = parse_duration(value);
- if ( errno == ERANGE || duration <= 0 || duration > (MAX_ALLOWED_TIME_IN_SECS - current_time()) ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password lockout duration \"%s\" is invalid. ",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- slapdFrontendConfig->pw_policy.pw_lockduration = duration;
- }
-
- return retVal;
- }
- int
- config_set_pw_resetfailurecount( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long duration = 0; /* in minutes */
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- /* in seconds */
- duration = parse_duration(value);
- if ( errno == ERANGE || duration < 0 || duration > (MAX_ALLOWED_TIME_IN_SECS - current_time()) ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password reset count duration \"%s\" is invalid. ",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- slapdFrontendConfig->pw_policy.pw_resetfailurecount = duration;
- }
-
- return retVal;
- }
- int
- config_set_pw_is_global_policy( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_is_global_policy),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_pw_is_legacy_policy( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_policy.pw_is_legacy),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_set_pw_admin_dn( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_sdn_free(&slapdFrontendConfig->pw_policy.pw_admin);
- slapdFrontendConfig->pw_policy.pw_admin = slapi_sdn_new_dn_byval(value);
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_track_last_update_time( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_policy.pw_track_update_time),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_set_pw_exp( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_policy.pw_exp),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_pw_unlock( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_policy.pw_unlock),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_pw_lockout( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->pw_policy.pw_lockout),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_pw_gracelimit( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long gracelimit = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- gracelimit = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || gracelimit < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password grace limit \"%s\" is invalid, password grace limit must range from 0 to %ld",
- value , LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->pw_policy.pw_gracelimit = gracelimit;
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
-
- return retVal;
- }
- int
- config_set_lastmod( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- Slapi_Backend *be = NULL;
- char *cookie;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->lastmod),
- errorbuf,
- apply);
-
- if ( retVal == LDAP_SUCCESS && apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- cookie = NULL;
- be = slapi_get_first_backend (&cookie);
- while (be) {
- be->be_lastmod = slapdFrontendConfig->lastmod;
- be = slapi_get_next_backend (cookie);
- }
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ((void **)&cookie);
- }
-
- return retVal;
- }
- int
- config_set_nagle( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->nagle),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_set_accesscontrol( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->accesscontrol),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_return_exact_case( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->return_exact_case),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_result_tweak( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->result_tweak),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_plugin_tracking( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->plugin_track),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_set_security( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->security),
- errorbuf,
- apply);
-
- return retVal;
- }
- static int
- config_set_onoff ( const char *attrname, char *value, int *configvalue,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapi_onoff_t newval = -1;
- #ifndef ATOMIC_GETSET_ONOFF
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- #endif
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- CFG_ONOFF_LOCK_WRITE(slapdFrontendConfig);
- if ( strcasecmp ( value, "on" ) != 0 &&
- strcasecmp ( value, "off") != 0 &&
- /* initializing the value */
- (*(int *)value != LDAP_ON) &&
- (*(int *)value != LDAP_OFF)) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"on\" or \"off\".",
- attrname, value );
- retVal = LDAP_OPERATIONS_ERROR;
- }
-
- if ( !apply ) {
- /* we can return now if we aren't applying the changes */
- return retVal;
- }
-
- if ( strcasecmp ( value, "on" ) == 0 ) {
- newval = LDAP_ON;
- } else if ( strcasecmp ( value, "off" ) == 0 ) {
- newval = LDAP_OFF;
- } else { /* assume it is an integer */
- newval = *(slapi_onoff_t *)value;
- }
-
- #ifdef ATOMIC_GETSET_ONOFF
- PR_AtomicSet(configvalue, newval);
- #else
- *configvalue = newval;
- #endif
- CFG_ONOFF_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
-
- int
- config_set_readonly( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->readonly),
- errorbuf,
- apply );
-
- return retVal;
- }
- int
- config_set_schemacheck( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->schemacheck),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_schemamod( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->schemamod),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_syntaxcheck( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->syntaxcheck),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_set_syntaxlogging( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->syntaxlogging),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_set_dn_validate_strict( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->dn_validate_strict),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_set_ds4_compatible_schema( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->ds4_compatible_schema),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_schema_ignore_trailing_spaces( const char *attrname, char *value,
- char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->schema_ignore_trailing_spaces),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_enquote_sup_oc( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->enquote_sup_oc),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_set_rootdn( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->rootdn) );
- slapdFrontendConfig->rootdn = slapi_dn_normalize (slapi_ch_strdup ( value ) );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_rootpw( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- struct pw_scheme *is_hashed = NULL;
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->rootpw) );
-
- is_hashed = pw_val2scheme ( value, NULL, 0 );
-
- if ( is_hashed ) {
- slapdFrontendConfig->rootpw = slapi_ch_strdup ( value );
- free_pw_scheme(is_hashed);
- } else if (slapd_nss_is_initialized() ||
- (strcasecmp(slapdFrontendConfig->rootpwstoragescheme->pws_name,
- "clear") == 0)) {
- /* to hash, security library should have been initialized, by now */
- /* pwd enc func returns slapi_ch_malloc memory */
- slapdFrontendConfig->rootpw = (slapdFrontendConfig->rootpwstoragescheme->pws_enc)(value);
- } else {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: password scheme mismatch (passwd scheme is %s; "
- "password is clear text)", attrname,
- slapdFrontendConfig->rootpwstoragescheme->pws_name);
- retVal = LDAP_PARAM_ERROR;
- }
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_rootpwstoragescheme( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- struct pw_scheme *new_scheme = NULL;
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- new_scheme = pw_name2scheme ( value );
- if (new_scheme == NULL ) {
- char * scheme_list = plugin_get_pwd_storage_scheme_list(PLUGIN_LIST_PWD_STORAGE_SCHEME);
- if ( scheme_list != NULL ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid scheme - %s. Valid schemes are: %s",
- attrname, value, scheme_list );
- } else {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid scheme - %s (no pwdstorage scheme"
- " plugin loaded)", attrname, value);
- }
- slapi_ch_free_string(&scheme_list);
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
-
- CFG_LOCK_WRITE(slapdFrontendConfig);
- free_pw_scheme(slapdFrontendConfig->rootpwstoragescheme);
- slapdFrontendConfig->rootpwstoragescheme = new_scheme;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
-
- return retVal;
- }
-
- /*
- * kexcoff: to replace default initialization in FrontendConfig_init()
- */
- int config_set_storagescheme() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- struct pw_scheme *new_scheme = NULL;
- CFG_LOCK_WRITE(slapdFrontendConfig);
- new_scheme = pw_name2scheme("SSHA");
- free_pw_scheme(slapdFrontendConfig->pw_storagescheme);
- slapdFrontendConfig->pw_storagescheme = new_scheme;
- new_scheme = pw_name2scheme("SSHA");
- slapdFrontendConfig->rootpwstoragescheme = new_scheme;
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return ( new_scheme == NULL );
- }
- #ifndef _WIN32
- int
- config_set_localuser( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if (apply) {
- struct passwd *pw = NULL;
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &slapdFrontendConfig->localuser );
- slapdFrontendConfig->localuser = slapi_ch_strdup ( value );
- if (slapdFrontendConfig->localuserinfo != NULL) {
- slapi_ch_free ( (void **) &(slapdFrontendConfig->localuserinfo) );
- }
- pw = getpwnam( value );
- if ( pw ) {
- slapdFrontendConfig->localuserinfo =
- (struct passwd *)slapi_ch_malloc(sizeof(struct passwd));
- memcpy(slapdFrontendConfig->localuserinfo, pw, sizeof(struct passwd));
- }
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- #endif /* _WIN32 */
- int
- config_set_workingdir( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( PR_Access ( value, PR_ACCESS_EXISTS ) != 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Working directory \"%s\" does not exist.", value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( PR_Access ( value, PR_ACCESS_WRITE_OK ) != 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Working directory \"%s\" is not writeable.", value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->workingdir = slapi_ch_strdup ( value );
- #ifdef _WIN32
- dostounixpath(slapdFrontendConfig->workingdir);
- #endif /* _WIN32 */
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- /* alias of encryption key and certificate files is now retrieved through */
- /* calls to psetFullCreate() and psetGetAttrSingleValue(). See ssl.c, */
- /* where this function is still used to set the global variable */
- int
- config_set_encryptionalias( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->encryptionalias) );
-
- slapdFrontendConfig->encryptionalias = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_threadnumber( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long threadnum = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- threadnum = strtol(value, &endp, 10);
-
- if ( *endp != '\0' || errno == ERANGE || threadnum < 1 || threadnum > 65535 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", maximum thread number must range from 1 to 65535", attrname, value );
- retVal = LDAP_OPERATIONS_ERROR;
- }
-
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- /* max_threads = threadnum; */
- slapdFrontendConfig->threadnumber = threadnum;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_maxthreadsperconn( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long maxthreadnum = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- maxthreadnum = strtol(value, &endp, 10);
-
- if ( *endp != '\0' || errno == ERANGE || maxthreadnum < 1 || maxthreadnum > 65535 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", maximum thread number per connection must range from 1 to 65535", attrname, value );
- retVal = LDAP_OPERATIONS_ERROR;
- }
-
- if (apply) {
- #ifdef ATOMIC_GETSET_MAXTHREADSPERCONN
- PR_AtomicSet(&slapdFrontendConfig->maxthreadsperconn, (slapi_int_t)maxthreadnum);
- #else
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->maxthreadsperconn = maxthreadnum;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- #endif
- }
- return retVal;
- }
- #if !defined(_WIN32) && !defined(AIX)
- #include <sys/resource.h>
- int
- config_set_maxdescriptors( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long nValue = 0;
- int maxVal = 65535;
- struct rlimit rlp;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( 0 == getrlimit( RLIMIT_NOFILE, &rlp ) ) {
- maxVal = (int)rlp.rlim_max;
- }
- errno = 0;
- nValue = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", maximum "
- "file descriptors must range from 1 to %d (the current process limit). "
- "Server will use a setting of %d.", attrname, value, maxVal, maxVal);
- if ( nValue > maxVal ) {
- nValue = maxVal;
- retVal = LDAP_UNWILLING_TO_PERFORM;
- } else {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- }
-
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->maxdescriptors = nValue;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- #endif /* !_WIN32 && !AIX */
- int
- config_set_conntablesize( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long nValue = 0;
- int maxVal = 65535;
- char *endp = NULL;
- #ifndef _WIN32
- struct rlimit rlp;
- #endif
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- #ifndef _WIN32
- if ( 0 == getrlimit( RLIMIT_NOFILE, &rlp ) ) {
- maxVal = (int)rlp.rlim_max;
- }
- #endif
- errno = 0;
- nValue = strtol(value, &endp, 0);
-
- #ifdef _WIN32
- if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > 0xfffffe ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", connection table size must range from 1 to 0xfffffe", attrname, value );
- retVal = LDAP_OPERATIONS_ERROR;
- }
- #elif !defined(AIX)
- if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", connection table "
- "size must range from 1 to %d (the current process maxdescriptors limit). "
- "Server will use a setting of %d.", attrname, value, maxVal, maxVal );
- if ( nValue > maxVal) {
- nValue = maxVal;
- retVal = LDAP_UNWILLING_TO_PERFORM;
- } else {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- }
- #endif
-
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->conntablesize = nValue;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_reservedescriptors( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- int maxVal = 65535;
- long nValue = 0;
- char *endp = NULL;
- #ifndef _WIN32
- struct rlimit rlp;
- #endif
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- #ifndef _WIN32
- if ( 0 == getrlimit( RLIMIT_NOFILE, &rlp ) ) {
- maxVal = (int)rlp.rlim_max;
- }
- #endif
- errno = 0;
- nValue = strtol(value, &endp, 10);
-
- if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", reserved file "
- "descriptors must range from 1 to %d (the current process maxdescriptors limit). "
- "Server will use a setting of %d.", attrname, value, maxVal, maxVal );
- if ( nValue > maxVal) {
- nValue = maxVal;
- retVal = LDAP_UNWILLING_TO_PERFORM;
- } else {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- }
-
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->reservedescriptors = nValue;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_ioblocktimeout( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long nValue = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- nValue = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || nValue < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", I/O block timeout must range from 0 to %ld",
- attrname, value, LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- #if defined(IRIX)
- /* on IRIX poll can only handle timeouts up to
- 2147483 without failing, cap it at 30 minutes */
- if ( nValue > SLAPD_DEFAULT_IOBLOCK_TIMEOUT ) {
- nValue = SLAPD_DEFAULT_IOBLOCK_TIMEOUT;
- }
- #endif /* IRIX */
- if ( apply ) {
- #ifdef ATOMIC_GETSET_IOBLOCKTIMEOUT
- PR_AtomicSet(&slapdFrontendConfig->ioblocktimeout, (PRInt32)nValue);
- #else
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->ioblocktimeout = nValue;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- #endif
- }
- return retVal;
- }
- int
- config_set_idletimeout( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long nValue = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- nValue = strtol(value, &endp, 10);
- if (*endp != '\0' || errno == ERANGE || nValue < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", idle timeout must range from 0 to %ld",
- attrname, value, LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->idletimeout = nValue;
- /* g_idle_timeout= nValue; */
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_groupevalnestlevel( const char *attrname, char * value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long nValue = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- nValue = strtol(value, &endp, 10);
-
- if ( *endp != '\0' || errno == ERANGE || nValue < 0 || nValue > 5 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\", group eval nest level must range from 0 to 5",
- attrname, value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->groupevalnestlevel = nValue;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_defaultreferral( const char *attrname, struct berval **value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, (char *)value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- g_set_default_referral( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_userat( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free( (void **) &(slapdFrontendConfig->userat) );
- slapdFrontendConfig->userat = slapi_ch_strdup(value);
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_timelimit( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long nVal = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- Slapi_Backend *be = NULL;
- char *cookie;
-
- *errorbuf = 0;
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- errno = 0;
- nVal = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || nVal < -1 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\", time limit must range from -1 to %ld",
- attrname, value, LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- g_set_deftime ( nVal );
- slapdFrontendConfig->timelimit = nVal;
- be = slapi_get_first_backend (&cookie);
- while (be) {
- be->be_timelimit = slapdFrontendConfig->timelimit;
- be = slapi_get_next_backend (cookie);
- }
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ((void **)&cookie);
- }
- return retVal;
- }
- int
- config_set_useroc( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->useroc) );
- slapdFrontendConfig->useroc = slapi_ch_strdup( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_accesslog( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- retVal = log_update_accesslogdir ( value, apply );
-
- if ( retVal != LDAP_SUCCESS ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Cannot open accesslog directory \"%s\", client accesses will "
- "not be logged.", value );
- }
-
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->accesslog) );
- slapdFrontendConfig->accesslog = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_errorlog( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- retVal = log_update_errorlogdir ( value, apply );
-
- if ( retVal != LDAP_SUCCESS ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Cannot open errorlog file \"%s\", errors cannot be logged. Exiting...",
- value );
- syslog(LOG_ERR,
- "Cannot open errorlog file \"%s\", errors cannot be logged. Exiting...",
- value );
- g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
- }
-
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->errorlog) );
- slapdFrontendConfig->errorlog = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_auditlog( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- retVal = log_update_auditlogdir ( value, apply );
-
- if ( retVal != LDAP_SUCCESS ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Cannot open auditlog directory \"%s\"", value );
- }
-
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &(slapdFrontendConfig->auditlog) );
- slapdFrontendConfig->auditlog = slapi_ch_strdup ( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_pw_maxage( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long age;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- errno = 0;
- /* age in seconds */
- age = parse_duration(value);
- if ( age <= 0 || age > (MAX_ALLOWED_TIME_IN_SECS - current_time()) ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: password maximum age \"%s\" is invalid. ",
- attrname, value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
-
- if ( apply ) {
- slapdFrontendConfig->pw_policy.pw_maxage = age;
- }
- return retVal;
- }
- int
- config_set_pw_minage( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long age;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- errno = 0;
- /* age in seconds */
- age = parse_duration(value);
- if ( age < 0 || age > (MAX_ALLOWED_TIME_IN_SECS - current_time()) ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: password minimum age \"%s\" is invalid. ",
- attrname, value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- if ( apply ) {
- slapdFrontendConfig->pw_policy.pw_minage = age;
- }
- return retVal;
- }
- int
- config_set_pw_warning( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long sec;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- errno = 0;
- /* in seconds */
- sec = parse_duration(value);
- if (errno == ERANGE || sec < 0) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: password warning age \"%s\" is invalid, password warning "
- "age must range from 0 to %ld seconds",
- attrname, value, LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
- /* translate to seconds */
- if ( apply ) {
- slapdFrontendConfig->pw_policy.pw_warning = sec;
- }
- return retVal;
- }
- int
- config_set_errorlog_level( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- long level = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- level = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || level < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: error log level \"%s\" is invalid,"
- " error log level must range from 0 to %ld", attrname, value, LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
-
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- level |= LDAP_DEBUG_ANY;
- #ifdef _WIN32
- *module_ldap_debug = level;
- #else
- slapd_ldap_debug = level;
- #endif
- slapdFrontendConfig->errorloglevel = level;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_accesslog_level( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- long level = 0;
- char *endp = NULL;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- level = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || level < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: access log level \"%s\" is invalid,"
- " access log level must range from 0 to %ld", attrname, value, LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
- }
-
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- g_set_accesslog_level ( level );
- slapdFrontendConfig->accessloglevel = level;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- /* set the referral-mode url (which puts us into referral mode) */
- int config_set_referral_mode(const char *attrname, char *url, char *errorbuf, int apply)
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- slapdFrontendConfig->refer_mode=REFER_MODE_OFF;
- if ((!url) || (!url[0])) {
- strcpy(errorbuf, "referral url must have a value");
- return LDAP_OPERATIONS_ERROR;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->refer_url = slapi_ch_strdup(url);
- slapdFrontendConfig->refer_mode = REFER_MODE_ON;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return LDAP_SUCCESS;
- }
- int
- config_set_versionstring( const char *attrname, char *version, char *errorbuf, int apply ) {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ((!version) || (!version[0])) {
- PL_strncpyz(errorbuf, "versionstring must have a value", SLAPI_DSE_RETURNTEXT_SIZE);
- return LDAP_OPERATIONS_ERROR;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->versionstring = slapi_ch_strdup(version);
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return LDAP_SUCCESS;
- }
- #define config_copy_strval( s ) s ? slapi_ch_strdup (s) : NULL;
- int
- config_get_port(){
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->port;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_sasl_maxbufsize()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->sasl_max_bufsize;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_ignore_vattrs()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- return (int)slapdFrontendConfig->ignore_vattrs;
- }
- int
- config_get_sasl_mapping_fallback()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->sasl_mapping_fallback;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_disk_monitoring(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->disk_monitoring;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_disk_preserve_logging(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->disk_preserve_logging;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_disk_logging_critical(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->disk_logging_critical;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_disk_grace_period(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->disk_grace_period;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- long
- config_get_disk_threshold(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- long retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->disk_threshold;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_ldapi_filename(){
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->ldapi_filename);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int config_get_ldapi_switch(){
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->ldapi_switch;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int config_get_ldapi_bind_switch(){
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->ldapi_bind_switch;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *config_get_ldapi_root_dn(){
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->ldapi_root_dn);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int config_get_ldapi_map_entries(){
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->ldapi_map_entries;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *config_get_ldapi_uidnumber_type(){
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->ldapi_uidnumber_type);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *config_get_ldapi_gidnumber_type(){
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->ldapi_gidnumber_type);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *config_get_ldapi_search_base_dn(){
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->ldapi_search_base_dn);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- #if defined(ENABLE_AUTO_DN_SUFFIX)
- char *config_get_ldapi_auto_dn_suffix(){
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->ldapi_auto_dn_suffix);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- #endif
- char *config_get_anon_limits_dn(){
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->anon_limits_dn);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int config_get_slapi_counters()
- {
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->slapi_counters;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_workingdir() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->workingdir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_versionstring() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->versionstring);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
-
- }
-
- char *
- config_get_buildnum(void)
- {
- return slapi_ch_strdup(BUILD_NUM);
- }
- int
- config_get_secureport() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->secureport;
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
-
- int
- config_get_SSLclientAuth() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->SSLclientAuth;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_ssl_check_hostname()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- return (int)slapdFrontendConfig->ssl_check_hostname;
- }
- char *
- config_get_localhost() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval ( slapdFrontendConfig->localhost );
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- char *
- config_get_listenhost() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval ( slapdFrontendConfig->listenhost );
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- char *
- config_get_securelistenhost() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval( slapdFrontendConfig->securelistenhost );
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- char *
- config_get_srvtab() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->srvtab);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_sizelimit() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->sizelimit;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pagedsizelimit() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pagedsizelimit;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_pw_storagescheme() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal = 0;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->pw_storagescheme->pws_name);
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
-
- int
- config_get_pw_change() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->pw_policy.pw_change;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_history() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->pw_policy.pw_history;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_must_change() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->pw_policy.pw_must_change;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_syntax() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->pw_policy.pw_syntax;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_minlength() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_minlength;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_mindigits() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_mindigits;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_minalphas() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_minalphas;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_minuppers() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_minuppers;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_minlowers() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_minlowers;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_minspecials() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_minspecials;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_min8bit() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_min8bit;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_maxrepeats() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_maxrepeats;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_mincategories() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_mincategories;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_mintokenlength() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_mintokenlength;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_maxfailure() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_maxfailure;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_inhistory() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_inhistory;
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- long
- config_get_pw_lockduration() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- long retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_lockduration;
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- long
- config_get_pw_resetfailurecount() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- long retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_resetfailurecount;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_is_global_policy() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->pw_is_global_policy;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_is_legacy_policy() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->pw_policy.pw_is_legacy;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_exp() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->pw_policy.pw_exp;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_unlock() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->pw_policy.pw_unlock;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_get_pw_lockout(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->pw_policy.pw_lockout;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_pw_gracelimit() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal=0;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_gracelimit;
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_get_lastmod(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->lastmod;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_enquote_sup_oc(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->enquote_sup_oc;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_nagle() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->nagle;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_accesscontrol() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->accesscontrol;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_get_return_exact_case() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- retVal = (int)slapdFrontendConfig->return_exact_case;
- return retVal;
- }
- int
- config_get_result_tweak() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->result_tweak;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_security() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->security;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
-
- int
- slapi_config_get_readonly() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->readonly;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_schemacheck() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->schemacheck;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_get_schemamod() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->schemamod;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_get_syntaxcheck() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->syntaxcheck;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_syntaxlogging() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->syntaxlogging;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_dn_validate_strict() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->dn_validate_strict;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_ds4_compatible_schema() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->ds4_compatible_schema;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_get_schema_ignore_trailing_spaces() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->schema_ignore_trailing_spaces;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- char *
- config_get_rootdn() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval (slapdFrontendConfig->rootdn);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char * slapi_get_rootdn() {
- return config_get_rootdn();
- }
- char *
- config_get_rootpw() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval (slapdFrontendConfig->rootpw);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_rootpwstoragescheme() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->rootpwstoragescheme->pws_name);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- #ifndef _WIN32
- char *
- config_get_localuser() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->localuser);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- #endif /* _WIN32 */
- /* alias of encryption key and certificate files is now retrieved through */
- /* calls to psetFullCreate() and psetGetAttrSingleValue(). See ssl.c, */
- /* where this function is still used to set the global variable */
- char *
- config_get_encryptionalias() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->encryptionalias);
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_get_threadnumber() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->threadnumber;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_maxthreadsperconn(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- #ifdef ATOMIC_GETSET_MAXTHREADSPERCONN
- retVal = (int)slapdFrontendConfig->maxthreadsperconn;
- #else
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->maxthreadsperconn;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- #endif
- return retVal;
- }
- #if !defined(_WIN32) && !defined(AIX)
- int
- config_get_maxdescriptors() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->maxdescriptors;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- #endif /* !_WIN32 && !AIX */
- int
- config_get_reservedescriptors(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->reservedescriptors;
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_get_ioblocktimeout(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- #ifndef ATOMIC_GETSET_IOBLOCKTIMEOUT
- CFG_LOCK_READ(slapdFrontendConfig);
- #endif
- retVal = (int)slapdFrontendConfig->ioblocktimeout;
- #ifndef ATOMIC_GETSET_IOBLOCKTIMEOUT
- CFG_UNLOCK_READ(slapdFrontendConfig);
- #endif
- return retVal;
- }
- int
- config_get_idletimeout(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->idletimeout;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_groupevalnestlevel(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->groupevalnestlevel;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- struct berval **
- config_get_defaultreferral() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- struct berval **refs;
- int nReferrals = 0;
- CFG_LOCK_READ(slapdFrontendConfig);
- /* count the number of referrals */
- for ( nReferrals = 0;
- slapdFrontendConfig->defaultreferral &&
- slapdFrontendConfig->defaultreferral[nReferrals];
- nReferrals++)
- ;
-
- refs = (struct berval **)
- slapi_ch_malloc( (nReferrals + 1) * sizeof(struct berval *) );
-
- /*terminate the end, and add the referrals backwards */
- refs [nReferrals--] = NULL;
- while ( nReferrals >= 0 ) {
- refs[nReferrals] = (struct berval *) slapi_ch_malloc( sizeof(struct berval) );
- refs[nReferrals]->bv_val =
- config_copy_strval( slapdFrontendConfig->defaultreferral[nReferrals]->bv_val );
- refs[nReferrals]->bv_len = slapdFrontendConfig->defaultreferral[nReferrals]->bv_len;
- nReferrals--;
- }
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return refs;
- }
- char *
- config_get_userat ( ){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval( slapdFrontendConfig->userat );
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_timelimit(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal= slapdFrontendConfig->timelimit;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char*
- config_get_useroc(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_WRITE(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->useroc );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_accesslog(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->accesslog);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_errorlog(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->errorlog);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_auditlog( ){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->auditlog);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- long
- config_get_pw_maxage() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- long retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_maxage;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- long
- config_get_pw_minage(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- long retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_minage;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- long
- config_get_pw_warning() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- long retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->pw_policy.pw_warning;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_errorlog_level(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->errorloglevel;
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- /* return integer -- don't worry about locking similar to config_check_referral_mode
- below */
- int
- config_get_accesslog_level(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- retVal = slapdFrontendConfig->accessloglevel;
- return retVal;
- }
- /* return integer -- don't worry about locking similar to config_check_referral_mode
- below */
- int
- config_get_auditlog_logging_enabled(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- retVal = (int)slapdFrontendConfig->auditlog_logging_enabled;
- return retVal;
- }
- int
- config_get_accesslog_logging_enabled(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- retVal = (int)slapdFrontendConfig->accesslog_logging_enabled;
- return retVal;
- }
- char *config_get_referral_mode(void)
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *ret;
- CFG_LOCK_READ(slapdFrontendConfig);
- ret = config_copy_strval(slapdFrontendConfig->refer_url);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return ret;
- }
- int
- config_get_conntablesize(void){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->conntablesize;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- /* return yes/no without actually copying the referral url
- we don't worry about another thread changing this value
- since we now return an integer */
- int config_check_referral_mode(void)
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- return(slapdFrontendConfig->refer_mode & REFER_MODE_ON);
- }
- int
- config_get_outbound_ldap_io_timeout(void)
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->outbound_ldap_io_timeout;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_unauth_binds_switch(void)
- {
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->allow_unauth_binds;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_require_secure_binds(void)
- {
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->require_secure_binds;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_anon_access_switch(void)
- {
- int retVal = 0;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->allow_anon_access;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_validate_cert_switch(void)
- {
- int retVal = 0;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->validate_cert;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_maxbersize( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if ( !apply ) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->maxbersize = atoi(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- ber_len_t
- config_get_maxbersize()
- {
- ber_len_t maxbersize;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- maxbersize = slapdFrontendConfig->maxbersize;
- if(maxbersize==0)
- maxbersize= 2 * 1024 * 1024; /* Default: 2Mb */
- return maxbersize;
- }
- int
- config_set_maxsasliosize( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- long maxsasliosize;
- char *endptr;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- maxsasliosize = strtol(value, &endptr, 10);
- /* Check for non-numeric garbage in the value */
- if (*endptr != '\0') {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- /* Check for a value overflow */
- if (((maxsasliosize == LONG_MAX) || (maxsasliosize == LONG_MIN)) && (errno == ERANGE)){
- retVal = LDAP_OPERATIONS_ERROR;
- }
- /* A setting of -1 means unlimited. Don't allow other negative values. */
- if ((maxsasliosize < 0) && (maxsasliosize != -1)) {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- if (retVal != LDAP_SUCCESS) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid. Value must range from -1 to %ld",
- attrname, value, LONG_MAX );
- } else if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->maxsasliosize = maxsasliosize;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- size_t
- config_get_maxsasliosize()
- {
- size_t maxsasliosize;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- maxsasliosize = slapdFrontendConfig->maxsasliosize;
- return maxsasliosize;
- }
- int
- config_set_localssf( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- int localssf;
- char *endptr;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- localssf = (int) strtol(value, &endptr, 10);
- /* Check for non-numeric garbage in the value */
- if (*endptr != '\0') {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- /* Check for a value overflow */
- if (((localssf == INT_MAX) || (localssf == INT_MIN)) && (errno == ERANGE)){
- retVal = LDAP_OPERATIONS_ERROR;
- }
- /* Don't allow negative values. */
- if (localssf < 0) {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- if (retVal != LDAP_SUCCESS) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid. Value must range from 0 to %d",
- attrname, value, INT_MAX );
- } else if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->localssf = localssf;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_minssf( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- int minssf;
- char *endptr;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- minssf = (int) strtol(value, &endptr, 10);
- /* Check for non-numeric garbage in the value */
- if (*endptr != '\0') {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- /* Check for a value overflow */
- if (((minssf == INT_MAX) || (minssf == INT_MIN)) && (errno == ERANGE)){
- retVal = LDAP_OPERATIONS_ERROR;
- }
- /* Don't allow negative values. */
- if (minssf < 0) {
- retVal = LDAP_OPERATIONS_ERROR;
- }
- if (retVal != LDAP_SUCCESS) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid. Value must range from 0 to %d",
- attrname, value, INT_MAX );
- } else if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->minssf = minssf;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- int
- config_set_minssf_exclude_rootdse( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff ( attrname,
- value,
- &(slapdFrontendConfig->minssf_exclude_rootdse),
- errorbuf,
- apply );
-
- return retVal;
- }
- int
- config_get_localssf()
- {
- int localssf;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- localssf = slapdFrontendConfig->localssf;
- return localssf;
- }
- int
- config_get_minssf()
- {
- int minssf;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- minssf = slapdFrontendConfig->minssf;
- return minssf;
- }
- int
- config_get_minssf_exclude_rootdse()
- {
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->minssf_exclude_rootdse;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_max_filter_nest_level( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if ( !apply ) {
- return retVal;
- }
- #ifdef ATOMIC_GETSET_FILTER_NEST_LEVEL
- PR_AtomicSet(&slapdFrontendConfig->max_filter_nest_level, atoi(value));
- #else
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->max_filter_nest_level = atoi(value);
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- #endif
- return retVal;
- }
- int
- config_get_max_filter_nest_level()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- #ifndef ATOMIC_GETSET_FILTER_NEST_LEVEL
- CFG_LOCK_READ(slapdFrontendConfig);
- #endif
- retVal = (int)slapdFrontendConfig->max_filter_nest_level;
- #ifndef ATOMIC_GETSET_FILTER_NEST_LEVEL
- CFG_UNLOCK_READ(slapdFrontendConfig);
- #endif
- return retVal;
- }
- size_t
- config_get_ndn_cache_size(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- size_t retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->ndn_cache_max_size;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_ndn_cache_enabled(){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->ndn_cache_enabled;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_return_orig_type_switch()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->return_orig_type;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_basedn() {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval ( slapdFrontendConfig->certmap_basedn );
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_basedn ( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if ( !apply ) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free ( (void **) &slapdFrontendConfig->certmap_basedn );
- slapdFrontendConfig->certmap_basedn = slapi_dn_normalize( slapi_ch_strdup(value) );
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_configdir()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->configdir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_configdir(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->configdir);
- slapdFrontendConfig->configdir = slapi_ch_strdup(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_instancedir()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->instancedir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_instancedir(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
-
- CFG_LOCK_WRITE(slapdFrontendConfig);
- /* We don't want to allow users to modify instance dir.
- * Set it once when the server starts. */
- if (NULL == slapdFrontendConfig->instancedir) {
- slapdFrontendConfig->instancedir = slapi_ch_strdup(value);
- }
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_schemadir()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->schemadir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_schemadir(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->schemadir);
- slapdFrontendConfig->schemadir = slapi_ch_strdup(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_lockdir()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->lockdir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_lockdir(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->lockdir);
- slapdFrontendConfig->lockdir = slapi_ch_strdup(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_tmpdir()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->tmpdir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_tmpdir(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->tmpdir);
- slapdFrontendConfig->tmpdir = slapi_ch_strdup(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_certdir()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->certdir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_certdir(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->certdir);
- slapdFrontendConfig->certdir = slapi_ch_strdup(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_ldifdir()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->ldifdir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_ldifdir(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->ldifdir);
- slapdFrontendConfig->ldifdir = slapi_ch_strdup(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_bakdir()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->bakdir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_bakdir(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->bakdir);
- slapdFrontendConfig->bakdir = slapi_ch_strdup(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_rundir()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->rundir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_rundir(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->rundir);
- slapdFrontendConfig->rundir = slapi_ch_strdup(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char *
- config_get_saslpath()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->saslpath);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_saslpath(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if (!apply) {
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->saslpath);
- slapdFrontendConfig->saslpath = slapi_ch_strdup(value);
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- char **
- config_get_errorlog_list()
- {
- return log_get_loglist(SLAPD_ERROR_LOG);
- }
- char **
- config_get_accesslog_list()
- {
- return log_get_loglist(SLAPD_ACCESS_LOG);
- }
- char **
- config_get_auditlog_list()
- {
- return log_get_loglist(SLAPD_AUDIT_LOG);
- }
- int
- config_set_accesslogbuffering(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->accesslogbuffering),
- errorbuf,
- apply);
-
- return retVal;
- }
- #ifdef MEMPOOL_EXPERIMENTAL
- int
- config_set_mempool_switch( const char *attrname, char *value, char *errorbuf, int apply ) {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->mempool_switch),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_get_mempool_switch()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- return (int)slapdFrontendConfig->mempool_switch;
- }
- int
- config_set_mempool_maxfreelist( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- char *endp = NULL;
- int maxfreelist;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- errno = 0;
- maxfreelist = strtol(value, &endp, 10);
- if (0 != errno ) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->mempool_maxfreelist = maxfreelist;
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
-
- return retVal;
- }
- int
- config_get_mempool_maxfreelist()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- return slapdFrontendConfig->mempool_maxfreelist;
- }
- long
- config_get_system_page_size()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- return slapdFrontendConfig->system_page_size;
- }
- int
- config_get_system_page_bits()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- return slapdFrontendConfig->system_page_bits;
- }
- #endif /* MEMPOOL_EXPERIMENTAL */
- int
- config_set_csnlogging(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->csnlogging),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_get_csnlogging()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- return (int)slapdFrontendConfig->csnlogging;
- }
- int
- config_set_attrname_exceptions(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->attrname_exceptions),
- errorbuf,
- apply);
-
- return retVal;
- }
- int
- config_get_attrname_exceptions()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- return (int)slapdFrontendConfig->attrname_exceptions;
- }
- int
- config_set_hash_filters(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int val = 0;
- int retVal = LDAP_SUCCESS;
-
- retVal = config_set_onoff(attrname,
- value,
- &val,
- errorbuf,
- apply);
-
- if (retVal == LDAP_SUCCESS) {
- set_hash_filters(val);
- }
- return retVal;
- }
- int
- config_get_hash_filters()
- {
- return 0; /* for now */
- }
- int
- config_set_rewrite_rfc1274(const char *attrname, char *value, char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->rewrite_rfc1274),
- errorbuf,
- apply);
-
- return retVal;
- }
- /* we don't worry about another thread changing this flag since it is an
- integer */
- int
- config_get_rewrite_rfc1274()
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- int retVal;
- retVal = (int)slapdFrontendConfig->rewrite_rfc1274;
- return retVal;
- }
- static int
- config_set_schemareplace( const char *attrname, char *value, char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- retVal = LDAP_OPERATIONS_ERROR;
- } else {
- /*
- * check that the value is one we allow.
- */
- if ( 0 != strcasecmp( value, CONFIG_SCHEMAREPLACE_STR_OFF ) &&
- 0 != strcasecmp( value, CONFIG_SCHEMAREPLACE_STR_ON ) &&
- 0 != strcasecmp( value, CONFIG_SCHEMAREPLACE_STR_REPLICATION_ONLY )) {
- retVal = LDAP_OPERATIONS_ERROR;
- if( errorbuf ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "unsupported value: %s", value );
- }
- }
- }
- if ( LDAP_SUCCESS == retVal && apply ) {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free( (void **)&slapdFrontendConfig->schemareplace );
- slapdFrontendConfig->schemareplace = slapi_ch_strdup( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
-
- return retVal;
- }
- int
- config_set_outbound_ldap_io_timeout( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->outbound_ldap_io_timeout = atoi( value );
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return LDAP_SUCCESS;
- }
- int
- config_set_unauth_binds_switch( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->allow_unauth_binds),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_set_require_secure_binds( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->require_secure_binds),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_set_anon_access_switch( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if (config_value_is_null(attrname, value, errorbuf, 0)) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ((strcasecmp(value, "on") != 0) && (strcasecmp(value, "off") != 0) &&
- (strcasecmp(value, "rootdse") != 0)) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"on\", "
- "\"off\", or \"rootdse\".", attrname, value);
- retVal = LDAP_OPERATIONS_ERROR;
- }
- if (!apply) {
- /* we can return now if we aren't applying the changes */
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- if (strcasecmp(value, "on") == 0 ) {
- slapdFrontendConfig->allow_anon_access = SLAPD_ANON_ACCESS_ON;
- } else if (strcasecmp(value, "off") == 0 ) {
- slapdFrontendConfig->allow_anon_access = SLAPD_ANON_ACCESS_OFF;
- } else if (strcasecmp(value, "rootdse") == 0) {
- slapdFrontendConfig->allow_anon_access = SLAPD_ANON_ACCESS_ROOTDSE;
- }
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_validate_cert_switch( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if (config_value_is_null(attrname, value, errorbuf, 0)) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ((strcasecmp(value, "on") != 0) && (strcasecmp(value, "off") != 0) &&
- (strcasecmp(value, "warn") != 0)) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"on\", "
- "\"off\", or \"warn\".", attrname, value);
- retVal = LDAP_OPERATIONS_ERROR;
- }
- if (!apply) {
- /* we can return now if we aren't applying the changes */
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- if (strcasecmp(value, "on") == 0 ) {
- slapdFrontendConfig->validate_cert = SLAPD_VALIDATE_CERT_ON;
- } else if (strcasecmp(value, "off") == 0 ) {
- slapdFrontendConfig->validate_cert = SLAPD_VALIDATE_CERT_OFF;
- } else if (strcasecmp(value, "warn") == 0) {
- slapdFrontendConfig->validate_cert = SLAPD_VALIDATE_CERT_WARN;
- }
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_force_sasl_external(void)
- {
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->force_sasl_external;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_force_sasl_external( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->force_sasl_external),
- errorbuf,
- apply);
- return retVal;
- }
- int
- config_get_entryusn_global(void)
- {
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->entryusn_global;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_entryusn_global( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname, value,
- &(slapdFrontendConfig->entryusn_global),
- errorbuf, apply);
- return retVal;
- }
- char *
- config_get_entryusn_import_init(void)
- {
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->entryusn_import_init);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_entryusn_import_init( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free_string(&(slapdFrontendConfig->entryusn_import_init));
- slapdFrontendConfig->entryusn_import_init = slapi_ch_strdup(value);
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- char *
- config_get_allowed_to_delete_attrs(void)
- {
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapi_ch_strdup(slapdFrontendConfig->allowed_to_delete_attrs);
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_allowed_to_delete_attrs( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if (apply) {
- char *vcopy = slapi_ch_strdup(value);
- char **allowed = NULL, **s, *d;
- struct config_get_and_set *cgas = 0;
- int needcopy = 0;
- allowed = slapi_str2charray_ext(vcopy, " ", 0);
- for (s = allowed; s && *s; s++) ;
- for (--s; s && *s && (s >= allowed); s--) {
- cgas = (struct config_get_and_set *)PL_HashTableLookup(confighash,
- *s);
- if (!cgas && PL_strcasecmp(*s, "aci") /* aci is an exception */) {
- slapi_log_error(SLAPI_LOG_FATAL, "config",
- "%s: Unknown attribute %s will be ignored\n",
- CONFIG_ALLOWED_TO_DELETE_ATTRIBUTE, *s);
- charray_remove(allowed, *s, 1);
- needcopy = 1;
- s--;
- }
- }
- if (needcopy) {
- /* given value included unknown attribute,
- * we need to re-create a value. */
- /* reuse the duplicated string for the new attr value. */
- for (s = allowed, d = vcopy; s && *s; s++) {
- size_t slen = strlen(*s);
- memmove(d, *s, slen);
- d += slen;
- memmove(d, " ", 1);
- d++;
- }
- *(d-1) = '\0';
- strcpy(value, vcopy); /* original value needs to be refreshed */
- } else {
- slapi_ch_free_string(&vcopy);
- vcopy = slapi_ch_strdup(value);
- }
- slapi_ch_array_free(allowed);
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free_string(&(slapdFrontendConfig->allowed_to_delete_attrs));
- slapdFrontendConfig->allowed_to_delete_attrs = vcopy;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return retVal;
- }
- char *
- config_get_allowed_sasl_mechs()
- {
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->allowed_sasl_mechs;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- /* separated list of sasl mechs to allow */
- int
- config_set_allowed_sasl_mechs(const char *attrname, char *value, char *errorbuf, int apply )
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if(!apply || slapdFrontendConfig->allowed_sasl_mechs){
- /* we only set this at startup, if we try again just return SUCCESS */
- return LDAP_SUCCESS;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->allowed_sasl_mechs = slapi_ch_strdup(value);
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return LDAP_SUCCESS;
- }
- char *
- config_get_default_naming_context(void)
- {
- char *retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->default_naming_context;
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
- }
- int
- config_set_default_naming_context(const char *attrname,
- char *value, char *errorbuf, int apply)
- {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- void *node;
- Slapi_DN *sdn;
- char *suffix = NULL;
- if (value && *value) {
- int in_init = 0;
- suffix = slapi_create_dn_string("%s", value);
- if (NULL == suffix) {
- if (errorbuf) {
- PR_snprintf (errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s is not a valid suffix.", value);
- }
- return LDAP_INVALID_DN_SYNTAX;
- }
- sdn = slapi_get_first_suffix(&node, 0);
- if (NULL == sdn) {
- in_init = 1; /* at the startup time, no suffix is set yet */
- }
- while (sdn) {
- if (0 == strcasecmp(suffix, slapi_sdn_get_dn(sdn))) {
- /* matched */
- break;
- }
- sdn = slapi_get_next_suffix(&node, 0);
- }
- if (!in_init && (NULL == sdn)) { /* not in startup && no match */
- if (errorbuf) {
- PR_snprintf (errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s is not an existing suffix.", value);
- }
- slapi_ch_free_string(&suffix);
- return LDAP_NO_SUCH_OBJECT;
- }
- } else {
- /* reset */
- suffix = NULL;
- }
- if (!apply) {
- slapi_ch_free_string(&suffix);
- return LDAP_SUCCESS;
- }
- if (errorbuf) {
- *errorbuf = '\0';
- }
- if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free_string(&slapdFrontendConfig->default_naming_context);
- /* normalized suffix*/
- slapdFrontendConfig->default_naming_context = suffix;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- }
- return LDAP_SUCCESS;
- }
- int
- config_set_unhashed_pw_switch(const char *attrname, char *value,
- char *errorbuf, int apply)
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if (config_value_is_null(attrname, value, errorbuf, 0)) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ((strcasecmp(value, "on") != 0) && (strcasecmp(value, "off") != 0) &&
- (strcasecmp(value, "nolog") != 0)) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"on\", "
- "\"off\", or \"nolog\".", attrname, value);
- retVal = LDAP_OPERATIONS_ERROR;
- }
- if (!apply) {
- /* we can return now if we aren't applying the changes */
- return retVal;
- }
- CFG_LOCK_WRITE(slapdFrontendConfig);
- if (strcasecmp(value, "on") == 0 ) {
- slapdFrontendConfig->unhashed_pw_switch = SLAPD_UNHASHED_PW_ON;
- } else if (strcasecmp(value, "off") == 0 ) {
- slapdFrontendConfig->unhashed_pw_switch = SLAPD_UNHASHED_PW_OFF;
- } else if (strcasecmp(value, "nolog") == 0) {
- slapdFrontendConfig->unhashed_pw_switch = SLAPD_UNHASHED_PW_NOLOG;
- }
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_enable_turbo_mode(void)
- {
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->enable_turbo_mode;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_get_connection_nocanon(void)
- {
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_ONOFF_LOCK_READ(slapdFrontendConfig);
- retVal = (int)slapdFrontendConfig->connection_nocanon;
- CFG_ONOFF_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- slapi_config_get_unhashed_pw_switch()
- {
- return config_get_unhashed_pw_switch();
- }
- int
- config_get_unhashed_pw_switch()
- {
- int retVal = 0;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->unhashed_pw_switch;
- CFG_UNLOCK_READ(slapdFrontendConfig);
- return retVal;
- }
- int
- config_set_enable_turbo_mode( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname, value,
- &(slapdFrontendConfig->enable_turbo_mode),
- errorbuf, apply);
- return retVal;
- }
- int
- config_set_connection_nocanon( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname, value,
- &(slapdFrontendConfig->connection_nocanon),
- errorbuf, apply);
- return retVal;
- }
- int
- config_get_connection_buffer(void)
- {
- int retVal;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = (int)slapdFrontendConfig->connection_buffer;
- return retVal;
- }
- int
- config_set_connection_buffer( const char *attrname, char *value,
- char *errorbuf, int apply )
- {
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
- if ((strcasecmp(value, "0") != 0) && (strcasecmp(value, "1") != 0) &&
- (strcasecmp(value, "2") != 0)) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"0\", "
- "\"1\", or \"2\".", attrname, value);
- retVal = LDAP_OPERATIONS_ERROR;
- }
- if ( !apply ) {
- return retVal;
- }
- PR_AtomicSet(&slapdFrontendConfig->connection_buffer, atoi(value));
- return retVal;
- }
- /*
- * This function is intended to be used from the dse code modify callback. It
- * is "optimized" for that case because it takes a berval** of values, which is
- * currently what is used by ldapmod to hold the values. We could easily switch
- * this to take a Slapi_Value array or even a Slapi_Attr. Most config params
- * have simple config_set_XXX functions which take a char* argument holding the
- * value. The log_set_XXX functions have an additional parameter which
- * discriminates the log to use. The config parameters with types CONFIG_SPECIAL_XXX
- * require special handling to set their values.
- */
- int
- config_set(const char *attr, struct berval **values, char *errorbuf, int apply)
- {
- int ii = 0;
- int retval = LDAP_SUCCESS;
- struct config_get_and_set *cgas = 0;
- cgas = (struct config_get_and_set *)PL_HashTableLookup(confighash, attr);
- if (!cgas)
- {
- #if 0
- debugHashTable(attr);
- #endif
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Unknown attribute %s will be ignored", attr);
- slapi_log_error(SLAPI_LOG_FATAL, "config", "%s\n", errorbuf);
- return LDAP_NO_SUCH_ATTRIBUTE;
- }
- switch (cgas->config_var_type)
- {
- case CONFIG_SPECIAL_REFERRALLIST:
- if (NULL == values) /* special token which means to remove referrals */
- {
- struct berval val;
- struct berval *vals[2] = {0, 0};
- vals[0] = &val;
- val.bv_val = REFERRAL_REMOVE_CMD;
- val.bv_len = strlen(REFERRAL_REMOVE_CMD);
- retval = config_set_defaultreferral(attr, vals, errorbuf, apply);
- }
- else
- {
- retval = config_set_defaultreferral(attr, values, errorbuf, apply);
- }
- break;
- default:
- if ((NULL == values) &&
- config_allowed_to_delete_attrs(cgas->attr_name)) {
- if (cgas->setfunc) {
- retval = (cgas->setfunc)(cgas->attr_name, cgas->initvalue,
- errorbuf, apply);
- } else if (cgas->logsetfunc) {
- retval = (cgas->logsetfunc)(cgas->attr_name, cgas->initvalue,
- cgas->whichlog, errorbuf, apply);
- } else {
- LDAPDebug1Arg(LDAP_DEBUG_ANY,
- "config_set: the attribute %s is read only; "
- "ignoring setting NULL value\n", attr);
- }
- }
- for (ii = 0; !retval && values && values[ii]; ++ii)
- {
- if (cgas->setfunc) {
- retval = (cgas->setfunc)(cgas->attr_name,
- (char *)values[ii]->bv_val, errorbuf, apply);
- } else if (cgas->logsetfunc) {
- retval = (cgas->logsetfunc)(cgas->attr_name,
- (char *)values[ii]->bv_val, cgas->whichlog,
- errorbuf, apply);
- } else {
- LDAPDebug(LDAP_DEBUG_ANY,
- "config_set: the attribute %s is read only; ignoring new value %s\n",
- attr, values[ii]->bv_val, 0);
- }
- values[ii]->bv_len = strlen((char *)values[ii]->bv_val);
- }
- break;
- }
- return retval;
- }
- static void
- config_set_value(
- Slapi_Entry *e,
- struct config_get_and_set *cgas,
- void **value
- )
- {
- struct berval **values = 0;
- char *sval = 0;
- int ival = 0;
- uintptr_t pval;
- switch (cgas->config_var_type) {
- case CONFIG_ON_OFF: /* convert 0,1 to "off","on" */
- slapi_entry_attr_set_charptr(e, cgas->attr_name,
- (value && *((int *)value)) ? "on" : "off");
- break;
- case CONFIG_INT:
- if (value)
- slapi_entry_attr_set_int(e, cgas->attr_name, *((int *)value));
- else
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
- break;
- case CONFIG_LONG:
- if (value)
- slapi_entry_attr_set_long(e, cgas->attr_name, *((long *)value));
- else
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
- break;
- case CONFIG_STRING:
- slapi_entry_attr_set_charptr(e, cgas->attr_name,
- (value && *((char **)value)) ?
- *((char **)value) : "");
- break;
- case CONFIG_CHARRAY:
- if (value) {
- values = strarray2bervalarray((const char **)*((char ***)value));
- if (!values) {
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
- } else {
- slapi_entry_attr_replace(e, cgas->attr_name, values);
- bervalarray_free(values);
- }
- } else {
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
- }
- break;
- case CONFIG_SPECIAL_REFERRALLIST:
- /* referral list is already an array of berval* */
- if (value)
- slapi_entry_attr_replace(e, cgas->attr_name, (struct berval**)*value);
- else
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
- break;
- case CONFIG_CONSTANT_STRING:
- PR_ASSERT(value); /* should be a constant value */
- slapi_entry_attr_set_charptr(e, cgas->attr_name, (char*)value);
- break;
- case CONFIG_CONSTANT_INT:
- PR_ASSERT(value); /* should be a constant value */
- pval = (uintptr_t)value;
- ival = (int)pval;
- slapi_entry_attr_set_int(e, cgas->attr_name, ival);
- break;
- case CONFIG_SPECIAL_SSLCLIENTAUTH:
- if (!value) {
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "off");
- break;
- }
- if (*((int *)value) == SLAPD_SSLCLIENTAUTH_ALLOWED) {
- sval = "allowed";
- } else if (*((int *)value) == SLAPD_SSLCLIENTAUTH_REQUIRED) {
- sval = "required";
- } else {
- sval = "off";
- }
- slapi_entry_attr_set_charptr(e, cgas->attr_name, sval);
- break;
- case CONFIG_STRING_OR_OFF:
- slapi_entry_attr_set_charptr(e, cgas->attr_name,
- (value && *((char **)value)) ?
- *((char **)value) : "off");
- break;
- case CONFIG_STRING_OR_EMPTY:
- slapi_entry_attr_set_charptr(e, cgas->attr_name,
- (value && *((char **)value)) ?
- *((char **)value) : "");
- break;
- case CONFIG_STRING_OR_UNKNOWN:
- slapi_entry_attr_set_charptr(e, cgas->attr_name,
- (value && *((char **)value)) ?
- *((char **)value) : "unknown");
- break;
- case CONFIG_SPECIAL_ERRORLOGLEVEL:
- if (value) {
- int ival = *(int *)value;
- ival &= ~LDAP_DEBUG_ANY;
- slapi_entry_attr_set_int(e, cgas->attr_name, ival);
- }
- else
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
- break;
- case CONFIG_SPECIAL_ANON_ACCESS_SWITCH:
- if (!value) {
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "off");
- break;
- }
- if (*((int *)value) == SLAPD_ANON_ACCESS_ON) {
- sval = "on";
- } else if (*((int *)value) == SLAPD_ANON_ACCESS_ROOTDSE) {
- sval = "rootdse";
- } else {
- sval = "off";
- }
- slapi_entry_attr_set_charptr(e, cgas->attr_name, sval);
- break;
- case CONFIG_SPECIAL_UNHASHED_PW_SWITCH:
- if (!value) {
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "on");
- break;
- }
- if (*((int *)value) == SLAPD_UNHASHED_PW_OFF) {
- sval = "off";
- } else if (*((int *)value) == SLAPD_UNHASHED_PW_NOLOG) {
- sval = "nolog";
- } else {
- sval = "on";
- }
- slapi_entry_attr_set_charptr(e, cgas->attr_name, sval);
- break;
- case CONFIG_SPECIAL_VALIDATE_CERT_SWITCH:
- if (!value) {
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "off");
- break;
- }
- if (*((int *)value) == SLAPD_VALIDATE_CERT_ON) {
- sval = "on";
- } else if (*((int *)value) == SLAPD_VALIDATE_CERT_WARN) {
- sval = "warn";
- } else {
- sval = "off";
- }
- slapi_entry_attr_set_charptr(e, cgas->attr_name, sval);
- break;
- default:
- PR_ASSERT(0); /* something went horribly wrong . . . */
- break;
- }
- return;
- }
- /*
- * Fill in the given slapi_entry with the config attributes and values
- */
- int
- config_set_entry(Slapi_Entry *e)
- {
- int ii = 0;
- int tablesize = sizeof(ConfigList)/sizeof(ConfigList[0]);
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- /*
- * Avoid recursive calls to the readers/writer
- * lock as it causes deadlock under stress. Each
- * individual config get function acquires a read
- * lock where necessary.
- */
- /*
- * Pass 1: Values which do not have a get function.
- */
- CFG_LOCK_READ(slapdFrontendConfig);
- for (ii = 0; ii < tablesize; ++ii) {
- struct config_get_and_set *cgas = &ConfigList[ii];
- void **value = 0;
- PR_ASSERT(cgas);
- value = cgas->config_var_addr;
- PR_ASSERT(cgas->attr_name);
- /* Skip values handled in pass 2 */
- if (NULL == value && cgas->getfunc) {
- continue;
- }
- config_set_value(e, cgas, value);
- }
- CFG_UNLOCK_READ(slapdFrontendConfig);
- /*
- * Pass 2: Values which do have a get function.
- */
- for (ii = 0; ii < tablesize; ++ii) {
- struct config_get_and_set *cgas = &ConfigList[ii];
- int ival = 0;
- long lval = 0;
- void **value = NULL;
- void *alloc_val = NULL;
- int needs_free = 0;
- PR_ASSERT(cgas);
- value = cgas->config_var_addr;
- PR_ASSERT(cgas->attr_name);
- /* Skip values handled in pass 1 */
- if (NULL != value || cgas->getfunc == NULL) {
- continue;
- }
- /* must cast return of getfunc and store in variable of correct sized type */
- /* otherwise endianness problems will ensue */
- if (isInt(cgas->config_var_type)) {
- ival = (int)(intptr_t)(cgas->getfunc)();
- value = (void **)&ival; /* value must be address of int */
- } else if (cgas->config_var_type == CONFIG_LONG) {
- lval = (long)(intptr_t)(cgas->getfunc)();
- value = (void **)&lval; /* value must be address of long */
- } else {
- alloc_val = (cgas->getfunc)();
- value = &alloc_val; /* value must be address of pointer */
- needs_free = 1; /* get funcs must return alloc'd memory except for get
- funcs which return a simple integral type e.g. int */
- }
- config_set_value(e, cgas, value);
- if (needs_free && value) { /* assumes memory allocated by slapi_ch_Xalloc */
- if (CONFIG_CHARRAY == cgas->config_var_type) {
- charray_free((char **)*value);
- } else if (CONFIG_SPECIAL_REFERRALLIST == cgas->config_var_type) {
- ber_bvecfree((struct berval **)*value);
- } else if ((CONFIG_CONSTANT_INT != cgas->config_var_type) && /* do not free constants */
- (CONFIG_CONSTANT_STRING != cgas->config_var_type)) {
- slapi_ch_free(value);
- }
- }
- }
- return 1;
- }
- /* these attr types are allowed to delete */
- int
- config_allowed_to_delete_attrs(const char *attr_type)
- {
- int rc = 0;
- if (attr_type) {
- char *delattrs = config_get_allowed_to_delete_attrs();
- char **allowed = slapi_str2charray_ext(delattrs, " ", 0);
- char **ap;
- for (ap = allowed; ap && *ap; ap++) {
- if (strcasecmp (attr_type, *ap) == 0) {
- rc = 1;
- break;
- }
- }
- slapi_ch_array_free(allowed);
- slapi_ch_free_string(&delattrs);
- }
- return rc;
- }
- void
- config_set_accesslog_enabled(int value){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char errorbuf[BUFSIZ];
- CFG_ONOFF_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->accesslog_logging_enabled = (int)value;
- if(value){
- log_set_logging(CONFIG_ACCESSLOG_LOGGING_ENABLED_ATTRIBUTE, "on", SLAPD_ACCESS_LOG, errorbuf, CONFIG_APPLY);
- } else {
- log_set_logging(CONFIG_ACCESSLOG_LOGGING_ENABLED_ATTRIBUTE, "off", SLAPD_ACCESS_LOG, errorbuf, CONFIG_APPLY);
- }
- CFG_ONOFF_UNLOCK_WRITE(slapdFrontendConfig);
- }
- void
- config_set_auditlog_enabled(int value){
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char errorbuf[BUFSIZ];
- CFG_ONOFF_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->auditlog_logging_enabled = (int)value;
- if(value){
- log_set_logging(CONFIG_AUDITLOG_LOGGING_ENABLED_ATTRIBUTE, "on", SLAPD_AUDIT_LOG, errorbuf, CONFIG_APPLY);
- } else {
- log_set_logging(CONFIG_AUDITLOG_LOGGING_ENABLED_ATTRIBUTE, "off", SLAPD_AUDIT_LOG, errorbuf, CONFIG_APPLY);
- }
- CFG_ONOFF_UNLOCK_WRITE(slapdFrontendConfig);
- }
- char *
- slapi_err2string(int result)
- {
- /*
- * If we are using openldap, then we can safely use ldap_err2string with
- * positive and negative result codes. MozLDAP's ldap_err2string can
- * only handle positive result codes.
- */
- #if defined (USE_OPENLDAP)
- return ldap_err2string(result);
- #else
- if(result >= 0){
- return ldap_err2string(result);
- }
- switch (result)
- {
- case -1:
- return ("Can't contact LDAP server");
- case -2:
- return ("Local error");
- case -3:
- return ("Encoding error");
- case -4:
- return ("Decoding error");
- case -5:
- return ("Timed out");
- case -6:
- return ("Unknown authentication method");
- case -7:
- return ("Bad search filter");
- case -8:
- return ("User canceled operation");
- case -9:
- return ("Bad parameter to an ldap routine");
- case -10:
- return ("Out of memory");
- case -11:
- return ("Connect error");
- case -12:
- return ("Not Supported");
- case -13:
- return ("Control not found");
- case -14:
- return ("No results returned");
- case -15:
- return ("More results to return");
- case -16:
- return ("Client Loop");
- case -17:
- return ("Referral Limit Exceeded");
- default:
- return ("Unknown system error");
- }
- #endif
- }
|