020-CVE-preparation-v3-6.patch 228 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824
  1. From 39a3fa39967faaf216be8e108ca57d07de1aa95a Mon Sep 17 00:00:00 2001
  2. From: Vadim Zhukov <persgray@gmail.com>
  3. Date: Sat, 25 May 2013 15:19:24 +0100
  4. Subject: [PATCH 01/41] pidl: Recent Perl warns about "defined(@var)"
  5. constructs.
  6. Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
  7. Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org>
  8. Autobuild-Date(master): Sat May 25 18:10:53 CEST 2013 on sn-devel-104
  9. (cherry picked from commit 92254d09e0ee5a7d9d0cd91fe1803f54e64d9a5f)
  10. ---
  11. pidl/lib/Parse/Pidl/ODL.pm | 2 +-
  12. pidl/pidl | 2 +-
  13. 2 files changed, 2 insertions(+), 2 deletions(-)
  14. --- a/pidl/lib/Parse/Pidl/ODL.pm
  15. +++ b/pidl/lib/Parse/Pidl/ODL.pm
  16. @@ -70,7 +70,7 @@ sub ODL2IDL
  17. next;
  18. }
  19. my $podl = Parse::Pidl::IDL::parse_file($idl_path, $opt_incdirs);
  20. - if (defined(@$podl)) {
  21. + if (defined($podl)) {
  22. require Parse::Pidl::Typelist;
  23. my $basename = basename($idl_path, ".idl");
  24. --- a/pidl/pidl
  25. +++ b/pidl/pidl
  26. @@ -605,7 +605,7 @@ sub process_file($)
  27. require Parse::Pidl::IDL;
  28. $pidl = Parse::Pidl::IDL::parse_file($idl_file, \@opt_incdirs);
  29. - defined @$pidl || die "Failed to parse $idl_file";
  30. + defined $pidl || die "Failed to parse $idl_file";
  31. }
  32. require Parse::Pidl::Typelist;
  33. --- a/source4/heimdal/cf/make-proto.pl
  34. +++ b/source4/heimdal/cf/make-proto.pl
  35. @@ -1,8 +1,8 @@
  36. # Make prototypes from .c files
  37. # $Id$
  38. -##use Getopt::Std;
  39. -require 'getopts.pl';
  40. +use Getopt::Std;
  41. +#require 'getopts.pl';
  42. my $comment = 0;
  43. my $if_0 = 0;
  44. @@ -12,7 +12,7 @@ my $debug = 0;
  45. my $oproto = 1;
  46. my $private_func_re = "^_";
  47. -Getopts('x:m:o:p:dqE:R:P:') || die "foo";
  48. +getopts('x:m:o:p:dqE:R:P:') || die "foo";
  49. if($opt_d) {
  50. $debug = 1;
  51. --- a/source3/Makefile-smbtorture4
  52. +++ b/source3/Makefile-smbtorture4
  53. @@ -6,7 +6,7 @@ SAMBA4_BINARIES="smbtorture,ndrdump"
  54. samba4-configure:
  55. @(cd .. && \
  56. CFLAGS='' $(WAF) reconfigure || \
  57. - CFLAGS='' $(WAF) configure --enable-socket-wrapper --enable-nss-wrapper --enable-uid-wrapper --nonshared-binary=$(SAMBA4_BINARIES) --enable-auto-reconfigure )
  58. + CFLAGS='' $(WAF) configure --enable-socket-wrapper --enable-nss-wrapper --enable-uid-wrapper --nonshared-binary=$(SAMBA4_BINARIES) --enable-auto-reconfigure --bundled-libraries=ALL --disable-gnutls )
  59. .PHONY: samba4-configure
  60. --- a/source4/lib/ldb/wscript
  61. +++ b/source4/lib/ldb/wscript
  62. @@ -135,9 +135,7 @@ def build(bld):
  63. pc_files=ldb_pc_files,
  64. vnum=VERSION,
  65. private_library=private_library,
  66. - manpages='man/ldb.3',
  67. - abi_directory = 'ABI',
  68. - abi_match = abi_match)
  69. + manpages='man/ldb.3')
  70. # generate a include/ldb_version.h
  71. t = bld.SAMBA_GENERATOR('ldb_version.h',
  72. --- a/source3/selftest/skip
  73. +++ b/source3/selftest/skip
  74. @@ -22,3 +22,8 @@ samba3.*raw.ioctl
  75. samba3.*raw.qfileinfo
  76. samba3.*raw.qfsinfo
  77. samba3.*raw.sfileinfo.base
  78. +# skip, don't work for badlock backports
  79. +samba3.posix_s3.raw.eas
  80. +samba3.posix_s3.raw.rename
  81. +samba3.posix_s3.raw.search
  82. +samba3.posix_s3.raw.streams
  83. --- a/librpc/ndr/ndr_ntlmssp.c
  84. +++ b/librpc/ndr/ndr_ntlmssp.c
  85. @@ -176,4 +176,20 @@ _PUBLIC_ void ndr_print_ntlmssp_Version(
  86. }
  87. }
  88. +_PUBLIC_ struct AV_PAIR *ndr_ntlmssp_find_av(const struct AV_PAIR_LIST *av_list,
  89. + enum ntlmssp_AvId AvId)
  90. +{
  91. + struct AV_PAIR *res = NULL;
  92. + uint32_t i = 0;
  93. + for (i = 0; i < av_list->count; i++) {
  94. + if (av_list->pair[i].AvId != AvId) {
  95. + continue;
  96. + }
  97. +
  98. + res = discard_const_p(struct AV_PAIR, &av_list->pair[i]);
  99. + break;
  100. + }
  101. +
  102. + return res;
  103. +}
  104. --- a/librpc/ndr/ndr_ntlmssp.h
  105. +++ b/librpc/ndr/ndr_ntlmssp.h
  106. @@ -31,3 +31,5 @@ _PUBLIC_ void ndr_print_ntlmssp_lm_respo
  107. bool ntlmv2);
  108. _PUBLIC_ void ndr_print_ntlmssp_Version(struct ndr_print *ndr, const char *name, const union ntlmssp_Version *r);
  109. +_PUBLIC_ struct AV_PAIR *ndr_ntlmssp_find_av(const struct AV_PAIR_LIST *av_list,
  110. + enum ntlmssp_AvId AvId);
  111. --- /dev/null
  112. +++ b/librpc/ABI/ndr-0.0.2.sigs
  113. @@ -0,0 +1,247 @@
  114. +GUID_all_zero: bool (const struct GUID *)
  115. +GUID_compare: int (const struct GUID *, const struct GUID *)
  116. +GUID_equal: bool (const struct GUID *, const struct GUID *)
  117. +GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
  118. +GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
  119. +GUID_from_string: NTSTATUS (const char *, struct GUID *)
  120. +GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
  121. +GUID_random: struct GUID (void)
  122. +GUID_string: char *(TALLOC_CTX *, const struct GUID *)
  123. +GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
  124. +GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
  125. +GUID_zero: struct GUID (void)
  126. +ndr_align_size: size_t (uint32_t, size_t)
  127. +ndr_charset_length: uint32_t (const void *, charset_t)
  128. +ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
  129. +ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
  130. +ndr_check_padding: void (struct ndr_pull *, size_t)
  131. +ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
  132. +ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
  133. +ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
  134. +ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
  135. +ndr_map_error2errno: int (enum ndr_err_code)
  136. +ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
  137. +ndr_map_error2string: const char *(enum ndr_err_code)
  138. +ndr_policy_handle_empty: bool (const struct policy_handle *)
  139. +ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
  140. +ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
  141. +ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
  142. +ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
  143. +ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
  144. +ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
  145. +ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
  146. +ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
  147. +ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
  148. +ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
  149. +ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
  150. +ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
  151. +ndr_print_bool: void (struct ndr_print *, const char *, const bool)
  152. +ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
  153. +ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
  154. +ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
  155. +ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
  156. +ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
  157. +ndr_print_double: void (struct ndr_print *, const char *, double)
  158. +ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
  159. +ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
  160. +ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
  161. +ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
  162. +ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
  163. +ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
  164. +ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
  165. +ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
  166. +ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
  167. +ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
  168. +ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
  169. +ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
  170. +ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
  171. +ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
  172. +ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
  173. +ndr_print_null: void (struct ndr_print *)
  174. +ndr_print_pointer: void (struct ndr_print *, const char *, void *)
  175. +ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
  176. +ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
  177. +ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
  178. +ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
  179. +ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
  180. +ndr_print_string: void (struct ndr_print *, const char *, const char *)
  181. +ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
  182. +ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
  183. +ndr_print_struct: void (struct ndr_print *, const char *, const char *)
  184. +ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
  185. +ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
  186. +ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
  187. +ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
  188. +ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
  189. +ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
  190. +ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
  191. +ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
  192. +ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
  193. +ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
  194. +ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
  195. +ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
  196. +ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
  197. +ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
  198. +ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
  199. +ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
  200. +ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
  201. +ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
  202. +ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
  203. +ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
  204. +ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
  205. +ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
  206. +ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
  207. +ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
  208. +ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
  209. +ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
  210. +ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
  211. +ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
  212. +ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
  213. +ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
  214. +ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
  215. +ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
  216. +ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
  217. +ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
  218. +ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
  219. +ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
  220. +ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
  221. +ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
  222. +ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
  223. +ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
  224. +ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
  225. +ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
  226. +ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
  227. +ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
  228. +ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
  229. +ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
  230. +ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
  231. +ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
  232. +ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
  233. +ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
  234. +ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
  235. +ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
  236. +ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
  237. +ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
  238. +ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
  239. +ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
  240. +ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
  241. +ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
  242. +ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
  243. +ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
  244. +ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
  245. +ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
  246. +ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
  247. +ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
  248. +ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
  249. +ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
  250. +ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
  251. +ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
  252. +ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
  253. +ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
  254. +ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
  255. +ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
  256. +ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
  257. +ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
  258. +ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
  259. +ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
  260. +ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
  261. +ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
  262. +ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
  263. +ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
  264. +ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
  265. +ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
  266. +ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
  267. +ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
  268. +ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
  269. +ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
  270. +ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
  271. +ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
  272. +ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
  273. +ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
  274. +ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
  275. +ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
  276. +ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
  277. +ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
  278. +ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
  279. +ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
  280. +ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
  281. +ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
  282. +ndr_push_blob: DATA_BLOB (struct ndr_push *)
  283. +ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
  284. +ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
  285. +ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
  286. +ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
  287. +ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
  288. +ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
  289. +ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  290. +ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
  291. +ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
  292. +ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
  293. +ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
  294. +ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
  295. +ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
  296. +ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
  297. +ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
  298. +ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
  299. +ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
  300. +ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
  301. +ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
  302. +ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
  303. +ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
  304. +ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
  305. +ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
  306. +ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
  307. +ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  308. +ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
  309. +ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
  310. +ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
  311. +ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
  312. +ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
  313. +ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
  314. +ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
  315. +ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
  316. +ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
  317. +ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
  318. +ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
  319. +ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
  320. +ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
  321. +ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
  322. +ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
  323. +ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
  324. +ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
  325. +ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  326. +ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
  327. +ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
  328. +ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
  329. +ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
  330. +ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
  331. +ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
  332. +ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
  333. +ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
  334. +ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
  335. +ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  336. +ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  337. +ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
  338. +ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
  339. +ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
  340. +ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
  341. +ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
  342. +ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
  343. +ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
  344. +ndr_set_flags: void (uint32_t *, uint32_t)
  345. +ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
  346. +ndr_size_GUID: size_t (const struct GUID *, int)
  347. +ndr_size_string: uint32_t (int, const char * const *, int)
  348. +ndr_size_string_array: size_t (const char **, uint32_t, int)
  349. +ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
  350. +ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
  351. +ndr_string_array_size: size_t (struct ndr_push *, const char *)
  352. +ndr_string_length: uint32_t (const void *, uint32_t)
  353. +ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
  354. +ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
  355. +ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
  356. +ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
  357. +ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
  358. +ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
  359. +ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
  360. +ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
  361. --- a/librpc/ndr/libndr.h
  362. +++ b/librpc/ndr/libndr.h
  363. @@ -124,6 +124,20 @@ struct ndr_print {
  364. #define LIBNDR_FLAG_STR_UTF8 (1<<12)
  365. #define LIBNDR_STRING_FLAGS (0x7FFC)
  366. +/*
  367. + * don't debug NDR_ERR_BUFSIZE failures,
  368. + * as the available buffer might be incomplete.
  369. + *
  370. + * return NDR_ERR_INCOMPLETE_BUFFER instead.
  371. + */
  372. +#define LIBNDR_FLAG_INCOMPLETE_BUFFER (1<<16)
  373. +
  374. +/*
  375. + * This lets ndr_pull_subcontext_end() return
  376. + * NDR_ERR_UNREAD_BYTES.
  377. + */
  378. +#define LIBNDR_FLAG_SUBCONTEXT_NO_UNREAD_BYTES (1<<17)
  379. +
  380. /* set if relative pointers should *not* be marshalled in reverse order */
  381. #define LIBNDR_FLAG_NO_RELATIVE_REVERSE (1<<18)
  382. @@ -163,6 +177,7 @@ struct ndr_print {
  383. /* useful macro for debugging */
  384. #define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
  385. +#define NDR_PRINT_DEBUGC(dbgc_class, type, p) ndr_print_debugc(dbgc_class, (ndr_print_fn_t)ndr_print_ ##type, #p, p)
  386. #define NDR_PRINT_UNION_DEBUG(type, level, p) ndr_print_union_debug((ndr_print_fn_t)ndr_print_ ##type, #p, level, p)
  387. #define NDR_PRINT_FUNCTION_DEBUG(type, flags, p) ndr_print_function_debug((ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
  388. #define NDR_PRINT_BOTH_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_BOTH, p)
  389. @@ -199,7 +214,9 @@ enum ndr_err_code {
  390. NDR_ERR_IPV6ADDRESS,
  391. NDR_ERR_INVALID_POINTER,
  392. NDR_ERR_UNREAD_BYTES,
  393. - NDR_ERR_NDR64
  394. + NDR_ERR_NDR64,
  395. + NDR_ERR_FLAGS,
  396. + NDR_ERR_INCOMPLETE_BUFFER
  397. };
  398. #define NDR_ERR_CODE_IS_SUCCESS(x) (x == NDR_ERR_SUCCESS)
  399. @@ -217,20 +234,52 @@ enum ndr_compression_alg {
  400. /*
  401. flags passed to control parse flow
  402. + These are deliberately in a different range to the NDR_IN/NDR_OUT
  403. + flags to catch mixups
  404. */
  405. -#define NDR_SCALARS 1
  406. -#define NDR_BUFFERS 2
  407. +#define NDR_SCALARS 0x100
  408. +#define NDR_BUFFERS 0x200
  409. /*
  410. - flags passed to ndr_print_*()
  411. + flags passed to ndr_print_*() and ndr pull/push for functions
  412. + These are deliberately in a different range to the NDR_SCALARS/NDR_BUFFERS
  413. + flags to catch mixups
  414. */
  415. -#define NDR_IN 1
  416. -#define NDR_OUT 2
  417. -#define NDR_BOTH 3
  418. -#define NDR_SET_VALUES 4
  419. +#define NDR_IN 0x10
  420. +#define NDR_OUT 0x20
  421. +#define NDR_BOTH 0x30
  422. +#define NDR_SET_VALUES 0x40
  423. +
  424. +
  425. +#define NDR_PULL_CHECK_FLAGS(ndr, ndr_flags) do { \
  426. + if ((ndr_flags) & ~(NDR_SCALARS|NDR_BUFFERS)) { \
  427. + return ndr_pull_error(ndr, NDR_ERR_FLAGS, "Invalid pull struct ndr_flags 0x%x", ndr_flags); \
  428. + } \
  429. +} while (0)
  430. +
  431. +#define NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags) do { \
  432. + if ((ndr_flags) & ~(NDR_SCALARS|NDR_BUFFERS)) \
  433. + return ndr_push_error(ndr, NDR_ERR_FLAGS, "Invalid push struct ndr_flags 0x%x", ndr_flags); \
  434. +} while (0)
  435. +
  436. +#define NDR_PULL_CHECK_FN_FLAGS(ndr, flags) do { \
  437. + if ((flags) & ~(NDR_BOTH|NDR_SET_VALUES)) { \
  438. + return ndr_pull_error(ndr, NDR_ERR_FLAGS, "Invalid fn pull flags 0x%x", flags); \
  439. + } \
  440. +} while (0)
  441. +
  442. +#define NDR_PUSH_CHECK_FN_FLAGS(ndr, flags) do { \
  443. + if ((flags) & ~(NDR_BOTH|NDR_SET_VALUES)) \
  444. + return ndr_push_error(ndr, NDR_ERR_FLAGS, "Invalid fn push flags 0x%x", flags); \
  445. +} while (0)
  446. #define NDR_PULL_NEED_BYTES(ndr, n) do { \
  447. if (unlikely((n) > ndr->data_size || ndr->offset + (n) > ndr->data_size)) { \
  448. + if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) { \
  449. + uint32_t _available = ndr->data_size - ndr->offset; \
  450. + uint32_t _missing = n - _available; \
  451. + ndr->relative_highest_offset = _missing; \
  452. + } \
  453. return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull bytes %u (%s)", (unsigned)n, __location__); \
  454. } \
  455. } while(0)
  456. @@ -247,6 +296,10 @@ enum ndr_compression_alg {
  457. ndr->offset = (ndr->offset + (n-1)) & ~(n-1); \
  458. } \
  459. if (unlikely(ndr->offset > ndr->data_size)) { \
  460. + if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) { \
  461. + uint32_t _missing = ndr->offset - ndr->data_size; \
  462. + ndr->relative_highest_offset = _missing; \
  463. + } \
  464. return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull align %u", (unsigned)n); \
  465. } \
  466. } while(0)
  467. @@ -402,6 +455,8 @@ void ndr_print_dom_sid0(struct ndr_print
  468. size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags);
  469. void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
  470. bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, const struct ndr_syntax_id *i2);
  471. +char *ndr_syntax_id_to_string(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *id);
  472. +bool ndr_syntax_id_from_string(const char *s, struct ndr_syntax_id *id);
  473. enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn);
  474. enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn);
  475. size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push);
  476. @@ -424,14 +479,18 @@ enum ndr_err_code ndr_pull_relative_ptr2
  477. enum ndr_err_code ndr_pull_relative_ptr_short(struct ndr_pull *ndr, uint16_t *v);
  478. size_t ndr_align_size(uint32_t offset, size_t n);
  479. struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
  480. +enum ndr_err_code ndr_pull_append(struct ndr_pull *ndr, DATA_BLOB *blob);
  481. +enum ndr_err_code ndr_pull_pop(struct ndr_pull *ndr);
  482. enum ndr_err_code ndr_pull_advance(struct ndr_pull *ndr, uint32_t size);
  483. struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx);
  484. DATA_BLOB ndr_push_blob(struct ndr_push *ndr);
  485. enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size);
  486. void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
  487. +void ndr_print_debugc_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
  488. void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
  489. void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
  490. void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr);
  491. +void ndr_print_debugc(int dbgc_class, ndr_print_fn_t fn, const char *name, void *ptr);
  492. void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr);
  493. void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr);
  494. char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, void *ptr);
  495. --- a/librpc/ndr/ndr.c
  496. +++ b/librpc/ndr/ndr.c
  497. @@ -77,6 +77,111 @@ _PUBLIC_ struct ndr_pull *ndr_pull_init_
  498. return ndr;
  499. }
  500. +_PUBLIC_ enum ndr_err_code ndr_pull_append(struct ndr_pull *ndr, DATA_BLOB *blob)
  501. +{
  502. + enum ndr_err_code ndr_err;
  503. + DATA_BLOB b;
  504. + uint32_t append = 0;
  505. + bool ok;
  506. +
  507. + if (blob->length == 0) {
  508. + return NDR_ERR_SUCCESS;
  509. + }
  510. +
  511. + ndr_err = ndr_token_retrieve(&ndr->array_size_list, ndr, &append);
  512. + if (ndr_err == NDR_ERR_TOKEN) {
  513. + append = 0;
  514. + ndr_err = NDR_ERR_SUCCESS;
  515. + }
  516. + NDR_CHECK(ndr_err);
  517. +
  518. + if (ndr->data_size == 0) {
  519. + ndr->data = NULL;
  520. + append = UINT32_MAX;
  521. + }
  522. +
  523. + if (append == UINT32_MAX) {
  524. + /*
  525. + * append == UINT32_MAX means that
  526. + * ndr->data is either NULL or a valid
  527. + * talloc child of ndr, which means
  528. + * we can use data_blob_append() without
  529. + * data_blob_talloc() of the existing callers data
  530. + */
  531. + b = data_blob_const(ndr->data, ndr->data_size);
  532. + } else {
  533. + b = data_blob_talloc(ndr, ndr->data, ndr->data_size);
  534. + if (b.data == NULL) {
  535. + return ndr_pull_error(ndr, NDR_ERR_ALLOC, "%s", __location__);
  536. + }
  537. + }
  538. +
  539. + ok = data_blob_append(ndr, &b, blob->data, blob->length);
  540. + if (!ok) {
  541. + return ndr_pull_error(ndr, NDR_ERR_ALLOC, "%s", __location__);
  542. + }
  543. +
  544. + ndr->data = b.data;
  545. + ndr->data_size = b.length;
  546. +
  547. + return ndr_token_store(ndr, &ndr->array_size_list, ndr, UINT32_MAX);
  548. +}
  549. +
  550. +_PUBLIC_ enum ndr_err_code ndr_pull_pop(struct ndr_pull *ndr)
  551. +{
  552. + uint32_t skip = 0;
  553. + uint32_t append = 0;
  554. +
  555. + if (ndr->relative_base_offset != 0) {
  556. + return ndr_pull_error(ndr, NDR_ERR_RELATIVE,
  557. + "%s", __location__);
  558. + }
  559. + if (ndr->relative_highest_offset != 0) {
  560. + return ndr_pull_error(ndr, NDR_ERR_RELATIVE,
  561. + "%s", __location__);
  562. + }
  563. + if (ndr->relative_list != NULL) {
  564. + return ndr_pull_error(ndr, NDR_ERR_RELATIVE,
  565. + "%s", __location__);
  566. + }
  567. + if (ndr->relative_base_list != NULL) {
  568. + return ndr_pull_error(ndr, NDR_ERR_RELATIVE,
  569. + "%s", __location__);
  570. + }
  571. +
  572. + /*
  573. + * we need to keep up to 7 bytes
  574. + * in order to get the aligment right.
  575. + */
  576. + skip = ndr->offset & 0xFFFFFFF8;
  577. +
  578. + if (skip == 0) {
  579. + return NDR_ERR_SUCCESS;
  580. + }
  581. +
  582. + ndr->offset -= skip;
  583. + ndr->data_size -= skip;
  584. +
  585. + append = ndr_token_peek(&ndr->array_size_list, ndr);
  586. + if (append != UINT32_MAX) {
  587. + /*
  588. + * here we assume, that ndr->data is not a
  589. + * talloc child of ndr.
  590. + */
  591. + ndr->data += skip;
  592. + return NDR_ERR_SUCCESS;
  593. + }
  594. +
  595. + memmove(ndr->data, ndr->data + skip, ndr->data_size);
  596. +
  597. + ndr->data = talloc_realloc(ndr, ndr->data, uint8_t, ndr->data_size);
  598. + if (ndr->data_size != 0 && ndr->data == NULL) {
  599. + return ndr_pull_error(ndr, NDR_ERR_ALLOC, "%s", __location__);
  600. + }
  601. +
  602. + return NDR_ERR_SUCCESS;
  603. +}
  604. +
  605. /*
  606. advance by 'size' bytes
  607. */
  608. @@ -167,6 +272,38 @@ _PUBLIC_ enum ndr_err_code ndr_push_expa
  609. return NDR_ERR_SUCCESS;
  610. }
  611. +_PUBLIC_ void ndr_print_debugc_helper(struct ndr_print *ndr, const char *format, ...)
  612. +{
  613. + va_list ap;
  614. + char *s = NULL;
  615. + uint32_t i;
  616. + int ret;
  617. + int dbgc_class;
  618. +
  619. + va_start(ap, format);
  620. + ret = vasprintf(&s, format, ap);
  621. + va_end(ap);
  622. +
  623. + if (ret == -1) {
  624. + return;
  625. + }
  626. +
  627. + dbgc_class = *(int *)ndr->private_data;
  628. +
  629. + if (ndr->no_newline) {
  630. + DEBUGADDC(dbgc_class, 1,("%s", s));
  631. + free(s);
  632. + return;
  633. + }
  634. +
  635. + for (i=0;i<ndr->depth;i++) {
  636. + DEBUGADDC(dbgc_class, 1,(" "));
  637. + }
  638. +
  639. + DEBUGADDC(dbgc_class, 1,("%s\n", s));
  640. + free(s);
  641. +}
  642. +
  643. _PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...)
  644. {
  645. va_list ap;
  646. @@ -238,6 +375,25 @@ _PUBLIC_ void ndr_print_string_helper(st
  647. }
  648. /*
  649. + a useful helper function for printing idl structures via DEBUGC()
  650. +*/
  651. +_PUBLIC_ void ndr_print_debugc(int dbgc_class, ndr_print_fn_t fn, const char *name, void *ptr)
  652. +{
  653. + struct ndr_print *ndr;
  654. +
  655. + DEBUGC(dbgc_class, 1,(" "));
  656. +
  657. + ndr = talloc_zero(NULL, struct ndr_print);
  658. + if (!ndr) return;
  659. + ndr->private_data = &dbgc_class;
  660. + ndr->print = ndr_print_debugc_helper;
  661. + ndr->depth = 1;
  662. + ndr->flags = 0;
  663. + fn(ndr, name, ptr);
  664. + talloc_free(ndr);
  665. +}
  666. +
  667. +/*
  668. a useful helper function for printing idl structures via DEBUG()
  669. */
  670. _PUBLIC_ void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr)
  671. @@ -403,6 +559,15 @@ _PUBLIC_ enum ndr_err_code ndr_pull_erro
  672. va_list ap;
  673. int ret;
  674. + if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) {
  675. + switch (ndr_err) {
  676. + case NDR_ERR_BUFSIZE:
  677. + return NDR_ERR_INCOMPLETE_BUFFER;
  678. + default:
  679. + break;
  680. + }
  681. + }
  682. +
  683. va_start(ap, format);
  684. ret = vasprintf(&s, format, ap);
  685. va_end(ap);
  686. @@ -557,6 +722,23 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subc
  687. NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &reserved));
  688. break;
  689. }
  690. + case 0xFFFFFFFF:
  691. + /*
  692. + * a shallow copy like subcontext
  693. + * useful for DCERPC pipe chunks.
  694. + */
  695. + subndr = talloc_zero(ndr, struct ndr_pull);
  696. + NDR_ERR_HAVE_NO_MEMORY(subndr);
  697. +
  698. + subndr->flags = ndr->flags;
  699. + subndr->current_mem_ctx = ndr->current_mem_ctx;
  700. + subndr->data = ndr->data;
  701. + subndr->offset = ndr->offset;
  702. + subndr->data_size = ndr->data_size;
  703. +
  704. + *_subndr = subndr;
  705. + return NDR_ERR_SUCCESS;
  706. +
  707. default:
  708. return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) header_size %d",
  709. (int)header_size);
  710. @@ -589,13 +771,35 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subc
  711. ssize_t size_is)
  712. {
  713. uint32_t advance;
  714. - if (size_is >= 0) {
  715. + uint32_t highest_ofs;
  716. +
  717. + if (header_size == 0xFFFFFFFF) {
  718. + advance = subndr->offset - ndr->offset;
  719. + } else if (size_is >= 0) {
  720. advance = size_is;
  721. } else if (header_size > 0) {
  722. advance = subndr->data_size;
  723. } else {
  724. advance = subndr->offset;
  725. }
  726. +
  727. + if (subndr->offset > ndr->relative_highest_offset) {
  728. + highest_ofs = subndr->offset;
  729. + } else {
  730. + highest_ofs = subndr->relative_highest_offset;
  731. + }
  732. + if (!(subndr->flags & LIBNDR_FLAG_SUBCONTEXT_NO_UNREAD_BYTES)) {
  733. + /*
  734. + * avoid an error unless SUBCONTEXT_NO_UNREAD_BYTES is specified
  735. + */
  736. + highest_ofs = advance;
  737. + }
  738. + if (highest_ofs < advance) {
  739. + return ndr_pull_error(subndr, NDR_ERR_UNREAD_BYTES,
  740. + "not all bytes consumed ofs[%u] advance[%u]",
  741. + highest_ofs, advance);
  742. + }
  743. +
  744. NDR_CHECK(ndr_pull_advance(ndr, advance));
  745. return NDR_ERR_SUCCESS;
  746. }
  747. @@ -1440,6 +1644,7 @@ const static struct {
  748. { NDR_ERR_INVALID_POINTER, "Invalid Pointer" },
  749. { NDR_ERR_UNREAD_BYTES, "Unread Bytes" },
  750. { NDR_ERR_NDR64, "NDR64 assertion error" },
  751. + { NDR_ERR_INCOMPLETE_BUFFER, "Incomplete Buffer" },
  752. { 0, NULL }
  753. };
  754. --- a/librpc/idl/idl_types.h
  755. +++ b/librpc/idl/idl_types.h
  756. @@ -47,3 +47,5 @@
  757. #define NDR_RELATIVE_REVERSE LIBNDR_FLAG_RELATIVE_REVERSE
  758. #define NDR_NO_RELATIVE_REVERSE LIBNDR_FLAG_NO_RELATIVE_REVERSE
  759. +
  760. +#define NDR_SUBCONTEXT_NO_UNREAD_BYTES LIBNDR_FLAG_SUBCONTEXT_NO_UNREAD_BYTES
  761. --- a/librpc/idl/dcerpc.idl
  762. +++ b/librpc/idl/dcerpc.idl
  763. @@ -10,6 +10,8 @@
  764. */
  765. import "misc.idl";
  766. +cpp_quote("extern const uint8_t DCERPC_SEC_VT_MAGIC[8];")
  767. +
  768. interface dcerpc
  769. {
  770. typedef struct {
  771. @@ -453,14 +455,21 @@ interface dcerpc
  772. } dcerpc_payload;
  773. /* pfc_flags values */
  774. - const uint8 DCERPC_PFC_FLAG_FIRST = 0x01; /* First fragment */
  775. - const uint8 DCERPC_PFC_FLAG_LAST = 0x02; /* Last fragment */
  776. - const uint8 DCERPC_PFC_FLAG_PENDING_CANCEL = 0x04; /* Cancel was pending at sender */
  777. - const uint8 DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN = DCERPC_PFC_FLAG_PENDING_CANCEL; /* depends on the pdu type */
  778. - const uint8 DCERPC_PFC_FLAG_CONC_MPX = 0x10; /* supports concurrent multiplexing of a single connection. */
  779. - const uint8 DCERPC_PFC_FLAG_DID_NOT_EXECUTE = 0x20; /* on a fault it means the server hasn't done anything */
  780. - const uint8 DCERPC_PFC_FLAG_MAYBE = 0x40; /* `maybe' call semantics requested */
  781. - const uint8 DCERPC_PFC_FLAG_OBJECT_UUID = 0x80; /* on valid guid is in the optional object field */
  782. + typedef [bitmap8bit] bitmap {
  783. + DCERPC_PFC_FLAG_FIRST = 0x01, /* First fragment */
  784. + DCERPC_PFC_FLAG_LAST = 0x02, /* Last fragment */
  785. + DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING = 0x04, /* depends on the pdu type */
  786. + DCERPC_PFC_FLAG_CONC_MPX = 0x10, /* supports concurrent multiplexing of a single connection. */
  787. + DCERPC_PFC_FLAG_DID_NOT_EXECUTE = 0x20, /* on a fault it means the server hasn't done anything */
  788. + DCERPC_PFC_FLAG_MAYBE = 0x40, /* `maybe' call semantics requested */
  789. + DCERPC_PFC_FLAG_OBJECT_UUID = 0x80 /* on valid guid is in the optional object field */
  790. + } dcerpc_pfc_flags;
  791. +
  792. + /* Cancel was pending at sender */
  793. + const int DCERPC_PFC_FLAG_PENDING_CANCEL =
  794. + DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING;
  795. + const ist DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN =
  796. + DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING;
  797. /* these offsets are needed by the signing code */
  798. const uint8 DCERPC_PFC_OFFSET = 3;
  799. @@ -468,6 +477,7 @@ interface dcerpc
  800. const uint8 DCERPC_FRAG_LEN_OFFSET = 8;
  801. const uint8 DCERPC_AUTH_LEN_OFFSET = 10;
  802. const uint8 DCERPC_CALL_ID_OFFSET = 12;
  803. + const uint8 DCERPC_NCACN_PAYLOAD_OFFSET = 16;
  804. /* little-endian flag */
  805. const uint8 DCERPC_DREP_LE = 0x10;
  806. @@ -476,7 +486,7 @@ interface dcerpc
  807. uint8 rpc_vers; /* RPC version */
  808. uint8 rpc_vers_minor; /* Minor version */
  809. dcerpc_pkt_type ptype; /* Packet type */
  810. - uint8 pfc_flags; /* Fragmentation flags */
  811. + dcerpc_pfc_flags pfc_flags; /* Fragmentation flags */
  812. uint8 drep[4]; /* NDR data representation */
  813. uint16 frag_length; /* Total length of fragment */
  814. uint16 auth_length; /* authenticator length */
  815. @@ -506,4 +516,69 @@ interface dcerpc
  816. uint8 serial_low;
  817. [switch_is(ptype)] dcerpc_payload u;
  818. } ncadg_packet;
  819. +
  820. + typedef [bitmap16bit] bitmap {
  821. + DCERPC_SEC_VT_COMMAND_ENUM = 0x3FFF,
  822. + DCERPC_SEC_VT_COMMAND_END = 0x4000,
  823. + DCERPC_SEC_VT_MUST_PROCESS = 0x8000
  824. + } dcerpc_sec_vt_command;
  825. +
  826. + typedef [enum16bit] enum {
  827. + DCERPC_SEC_VT_COMMAND_BITMASK1 = 0x0001,
  828. + DCERPC_SEC_VT_COMMAND_PCONTEXT = 0x0002,
  829. + DCERPC_SEC_VT_COMMAND_HEADER2 = 0x0003
  830. + } dcerpc_sec_vt_command_enum;
  831. +
  832. + typedef [bitmap32bit] bitmap {
  833. + DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING = 0x00000001
  834. + } dcerpc_sec_vt_bitmask1;
  835. +
  836. + typedef struct {
  837. + ndr_syntax_id abstract_syntax;
  838. + ndr_syntax_id transfer_syntax;
  839. + } dcerpc_sec_vt_pcontext;
  840. +
  841. + typedef struct {
  842. + dcerpc_pkt_type ptype; /* Packet type */
  843. + [value(0)] uint8 reserved1;
  844. + [value(0)] uint16 reserved2;
  845. + uint8 drep[4]; /* NDR data representation */
  846. + uint32 call_id; /* Call identifier */
  847. + uint16 context_id;
  848. + uint16 opnum;
  849. + } dcerpc_sec_vt_header2;
  850. +
  851. + typedef [switch_type(dcerpc_sec_vt_command_enum),nodiscriminant] union {
  852. + [case(DCERPC_SEC_VT_COMMAND_BITMASK1)] dcerpc_sec_vt_bitmask1 bitmask1;
  853. + [case(DCERPC_SEC_VT_COMMAND_PCONTEXT)] dcerpc_sec_vt_pcontext pcontext;
  854. + [case(DCERPC_SEC_VT_COMMAND_HEADER2)] dcerpc_sec_vt_header2 header2;
  855. + [default,flag(NDR_REMAINING)] DATA_BLOB _unknown;
  856. + } dcerpc_sec_vt_union;
  857. +
  858. + typedef struct {
  859. + dcerpc_sec_vt_command command;
  860. + [switch_is(command & DCERPC_SEC_VT_COMMAND_ENUM)]
  861. + [subcontext(2),flag(NDR_SUBCONTEXT_NO_UNREAD_BYTES)]
  862. + dcerpc_sec_vt_union u;
  863. + } dcerpc_sec_vt;
  864. +
  865. + typedef [public,nopush,nopull] struct {
  866. + uint16 count;
  867. + } dcerpc_sec_vt_count;
  868. +
  869. + /*
  870. + * We assume that the whole verification trailer fits into
  871. + * the last 1024 bytes after the stub data.
  872. + *
  873. + * There're currently only 3 commands defined and each should
  874. + * only be used once.
  875. + */
  876. + const uint16 DCERPC_SEC_VT_MAX_SIZE = 1024;
  877. +
  878. + typedef [public,flag(NDR_PAHEX)] struct {
  879. + [flag(NDR_ALIGN4)] DATA_BLOB _pad;
  880. + [value(DCERPC_SEC_VT_MAGIC)] uint8 magic[8];
  881. + dcerpc_sec_vt_count count;
  882. + dcerpc_sec_vt commands[count.count];
  883. + } dcerpc_sec_verification_trailer;
  884. }
  885. --- /dev/null
  886. +++ b/librpc/ndr/ndr_dcerpc.c
  887. @@ -0,0 +1,187 @@
  888. +/*
  889. + Unix SMB/CIFS implementation.
  890. +
  891. + Manually parsed structures found in the DCERPC protocol
  892. +
  893. + Copyright (C) Stefan Metzmacher 2014
  894. + Copyright (C) Gregor Beck 2014
  895. +
  896. + This program is free software; you can redistribute it and/or modify
  897. + it under the terms of the GNU General Public License as published by
  898. + the Free Software Foundation; either version 3 of the License, or
  899. + (at your option) any later version.
  900. +
  901. + This program is distributed in the hope that it will be useful,
  902. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  903. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  904. + GNU General Public License for more details.
  905. +
  906. + You should have received a copy of the GNU General Public License
  907. + along with this program. If not, see <http://www.gnu.org/licenses/>.
  908. +*/
  909. +
  910. +#include "includes.h"
  911. +#include "librpc/gen_ndr/ndr_dcerpc.h"
  912. +
  913. +#include "librpc/gen_ndr/ndr_misc.h"
  914. +#include "lib/util/bitmap.h"
  915. +
  916. +const uint8_t DCERPC_SEC_VT_MAGIC[] = {0x8a,0xe3,0x13,0x71,0x02,0xf4,0x36,0x71};
  917. +
  918. +_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_sec_vt_count(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_sec_vt_count *r)
  919. +{
  920. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  921. + /* nothing */
  922. + return NDR_ERR_SUCCESS;
  923. +}
  924. +
  925. +_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_sec_vt_count(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_sec_vt_count *r)
  926. +{
  927. + uint32_t _saved_ofs = ndr->offset;
  928. +
  929. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  930. +
  931. + if (!(ndr_flags & NDR_SCALARS)) {
  932. + return NDR_ERR_SUCCESS;
  933. + }
  934. +
  935. + r->count = 0;
  936. +
  937. + while (true) {
  938. + uint16_t command;
  939. + uint16_t length;
  940. +
  941. + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &command));
  942. + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &length));
  943. + NDR_CHECK(ndr_pull_advance(ndr, length));
  944. +
  945. + r->count += 1;
  946. +
  947. + if (command & DCERPC_SEC_VT_COMMAND_END) {
  948. + break;
  949. + }
  950. + }
  951. +
  952. + ndr->offset = _saved_ofs;
  953. + return NDR_ERR_SUCCESS;
  954. +}
  955. +
  956. +_PUBLIC_ enum ndr_err_code ndr_pop_dcerpc_sec_verification_trailer(
  957. + struct ndr_pull *ndr, TALLOC_CTX *mem_ctx,
  958. + struct dcerpc_sec_verification_trailer **_r)
  959. +{
  960. + enum ndr_err_code ndr_err;
  961. + uint32_t ofs;
  962. + uint32_t min_ofs = 0;
  963. + struct dcerpc_sec_verification_trailer *r;
  964. + DATA_BLOB sub_blob = data_blob_null;
  965. + struct ndr_pull *sub_ndr = NULL;
  966. + uint32_t remaining;
  967. +
  968. + *_r = NULL;
  969. +
  970. + r = talloc_zero(mem_ctx, struct dcerpc_sec_verification_trailer);
  971. + if (r == NULL) {
  972. + return NDR_ERR_ALLOC;
  973. + }
  974. +
  975. + if (ndr->data_size < sizeof(DCERPC_SEC_VT_MAGIC)) {
  976. + /*
  977. + * we return with r->count = 0
  978. + */
  979. + *_r = r;
  980. + return NDR_ERR_SUCCESS;
  981. + }
  982. +
  983. + ofs = ndr->data_size - sizeof(DCERPC_SEC_VT_MAGIC);
  984. + /* the magic is 4 byte aligned */
  985. + ofs &= ~3;
  986. +
  987. + if (ofs > DCERPC_SEC_VT_MAX_SIZE) {
  988. + /*
  989. + * We just scan the last 1024 bytes.
  990. + */
  991. + min_ofs = ofs - DCERPC_SEC_VT_MAX_SIZE;
  992. + } else {
  993. + min_ofs = 0;
  994. + }
  995. +
  996. + while (true) {
  997. + int ret;
  998. +
  999. + ret = memcmp(&ndr->data[ofs],
  1000. + DCERPC_SEC_VT_MAGIC,
  1001. + sizeof(DCERPC_SEC_VT_MAGIC));
  1002. + if (ret == 0) {
  1003. + sub_blob = data_blob_const(&ndr->data[ofs],
  1004. + ndr->data_size - ofs);
  1005. + break;
  1006. + }
  1007. +
  1008. + if (ofs <= min_ofs) {
  1009. + break;
  1010. + }
  1011. +
  1012. + ofs -= 4;
  1013. + }
  1014. +
  1015. + if (sub_blob.length == 0) {
  1016. + /*
  1017. + * we return with r->count = 0
  1018. + */
  1019. + *_r = r;
  1020. + return NDR_ERR_SUCCESS;
  1021. + }
  1022. +
  1023. + sub_ndr = ndr_pull_init_blob(&sub_blob, r);
  1024. + if (sub_ndr == NULL) {
  1025. + TALLOC_FREE(r);
  1026. + return NDR_ERR_ALLOC;
  1027. + }
  1028. +
  1029. + ndr_err = ndr_pull_dcerpc_sec_verification_trailer(sub_ndr,
  1030. + NDR_SCALARS | NDR_BUFFERS,
  1031. + r);
  1032. + if (ndr_err == NDR_ERR_ALLOC) {
  1033. + TALLOC_FREE(r);
  1034. + return NDR_ERR_ALLOC;
  1035. + }
  1036. +
  1037. + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
  1038. + goto ignore_error;
  1039. + }
  1040. +
  1041. + remaining = sub_ndr->data_size - sub_ndr->offset;
  1042. + if (remaining > 16) {
  1043. + /*
  1044. + * we expect not more than 16 byte of additional
  1045. + * padding after the verification trailer.
  1046. + */
  1047. + goto ignore_error;
  1048. + }
  1049. +
  1050. + /*
  1051. + * We assume that we got a real verification trailer.
  1052. + *
  1053. + * We remove it from the available stub data.
  1054. + */
  1055. + ndr->data_size = ofs;
  1056. +
  1057. + TALLOC_FREE(sub_ndr);
  1058. +
  1059. + *_r = r;
  1060. + return NDR_ERR_SUCCESS;
  1061. +
  1062. +ignore_error:
  1063. + TALLOC_FREE(sub_ndr);
  1064. + /*
  1065. + * just ignore the error, it's likely
  1066. + * that the magic we found belongs to
  1067. + * the stub data.
  1068. + *
  1069. + * we return with r->count = 0
  1070. + */
  1071. + ZERO_STRUCTP(r);
  1072. + *_r = r;
  1073. + return NDR_ERR_SUCCESS;
  1074. +}
  1075. --- a/librpc/wscript_build
  1076. +++ b/librpc/wscript_build
  1077. @@ -274,8 +274,9 @@ bld.SAMBA_SUBSYSTEM('NDR_COMPRESSION',
  1078. )
  1079. bld.SAMBA_SUBSYSTEM('NDR_DCERPC',
  1080. - source='gen_ndr/ndr_dcerpc.c',
  1081. + source='gen_ndr/ndr_dcerpc.c ndr/ndr_dcerpc.c',
  1082. public_deps='ndr',
  1083. + deps='bitmap',
  1084. public_headers='gen_ndr/ndr_dcerpc.h gen_ndr/dcerpc.h',
  1085. header_path= [ ('*gen_ndr*', 'gen_ndr') ],
  1086. )
  1087. --- a/source3/Makefile.in
  1088. +++ b/source3/Makefile.in
  1089. @@ -323,7 +323,8 @@ LIBNDR_OBJ = ../librpc/ndr/ndr_basic.o \
  1090. ../librpc/ndr/uuid.o \
  1091. librpc/ndr/util.o \
  1092. librpc/gen_ndr/ndr_server_id.o \
  1093. - librpc/gen_ndr/ndr_dcerpc.o
  1094. + librpc/gen_ndr/ndr_dcerpc.o \
  1095. + ../librpc/ndr/ndr_dcerpc.o
  1096. LIBNDR_GEN_OBJ0 = librpc/gen_ndr/ndr_samr.o \
  1097. librpc/gen_ndr/ndr_lsa.o
  1098. @@ -454,7 +455,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ
  1099. lib/username.o \
  1100. ../libds/common/flag_mapping.o \
  1101. lib/access.o lib/smbrun.o \
  1102. - lib/bitmap.o lib/dprintf.o $(UTIL_REG_OBJ) \
  1103. + ../lib/util/bitmap.o lib/dprintf.o $(UTIL_REG_OBJ) \
  1104. lib/wins_srv.o \
  1105. lib/util_str.o lib/clobber.o lib/util_sid.o \
  1106. lib/util_unistr.o ../lib/util/charset/codepoints.o lib/util_file.o \
  1107. @@ -987,7 +988,9 @@ SWAT_OBJ = $(SWAT_OBJ1) $(PARAM_OBJ) $(P
  1108. $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \
  1109. $(PASSCHANGE_OBJ) $(FNAME_UTIL_OBJ) \
  1110. $(LIBCLI_SAMR_OBJ) \
  1111. - rpc_client/init_lsa.o
  1112. + $(LIBCLI_NETLOGON_OBJ) \
  1113. + rpc_client/init_lsa.o \
  1114. + rpc_client/init_netlogon.o
  1115. STATUS_OBJ = utils/status.o utils/status_profile.o \
  1116. $(LOCKING_OBJ) $(PARAM_OBJ) \
  1117. @@ -1003,7 +1006,9 @@ SMBTREE_OBJ = utils/smbtree.o $(PARAM_OB
  1118. $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) \
  1119. $(LIBMSRPC_GEN_OBJ) \
  1120. $(LIBMSRPC_OBJ) \
  1121. - $(LIBCLI_SRVSVC_OBJ)
  1122. + $(LIBCLI_SRVSVC_OBJ) \
  1123. + $(LIBCLI_NETLOGON_OBJ) \
  1124. + rpc_client/init_netlogon.o
  1125. TESTPARM_OBJ = utils/testparm.o \
  1126. $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
  1127. @@ -1025,7 +1030,9 @@ SMBPASSWD_OBJ = utils/smbpasswd.o $(PASS
  1128. $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) \
  1129. $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \
  1130. $(LIBCLI_SAMR_OBJ) \
  1131. - rpc_client/init_lsa.o
  1132. + $(LIBCLI_NETLOGON_OBJ) \
  1133. + rpc_client/init_lsa.o \
  1134. + rpc_client/init_netlogon.o
  1135. PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) \
  1136. $(LIBSAMBA_OBJ) $(LIBTSOCKET_OBJ) \
  1137. @@ -1098,7 +1105,9 @@ LIBSMBCLIENT_OBJ1 = $(LIBSMBCLIENT_OBJ0)
  1138. $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \
  1139. $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) \
  1140. $(LIBCLI_SRVSVC_OBJ) \
  1141. - $(LIBCLI_LSA_OBJ)
  1142. + $(LIBCLI_LSA_OBJ) \
  1143. + $(LIBCLI_NETLOGON_OBJ) \
  1144. + rpc_client/init_netlogon.o
  1145. LIBSMBCLIENT_OBJ = $(LIBSMBCLIENT_OBJ1)
  1146. @@ -1121,7 +1130,9 @@ CLIENT_OBJ = $(CLIENT_OBJ1) $(PARAM_OBJ)
  1147. $(READLINE_OBJ) $(POPT_LIB_OBJ) \
  1148. $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) \
  1149. $(DISPLAY_SEC_OBJ) \
  1150. - $(LIBCLI_SRVSVC_OBJ)
  1151. + $(LIBCLI_SRVSVC_OBJ) \
  1152. + $(LIBCLI_NETLOGON_OBJ) \
  1153. + rpc_client/init_netlogon.o
  1154. LIBSMBCONF_OBJ = ../lib/smbconf/smbconf.o \
  1155. ../lib/smbconf/smbconf_util.o \
  1156. @@ -1233,7 +1244,9 @@ SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PA
  1157. @LIBWBCLIENT_STATIC@ \
  1158. torture/wbc_async.o \
  1159. ../nsswitch/wb_reqtrans.o \
  1160. - $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBCLI_ECHO_OBJ)
  1161. + $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBCLI_ECHO_OBJ) \
  1162. + $(LIBCLI_NETLOGON_OBJ) rpc_client/init_netlogon.o
  1163. +
  1164. MASKTEST_OBJ = torture/masktest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
  1165. $(LIB_NONSMBD_OBJ) \
  1166. @@ -1268,14 +1281,18 @@ SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_
  1167. $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \
  1168. $(PASSDB_OBJ) $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \
  1169. $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) \
  1170. - $(LIBCLI_LSA_OBJ)
  1171. + $(LIBCLI_LSA_OBJ) \
  1172. + $(LIBCLI_NETLOGON_OBJ) \
  1173. + rpc_client/init_netlogon.o
  1174. SMBCQUOTAS_OBJ = utils/smbcquotas.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
  1175. $(PARAM_OBJ) \
  1176. $(LIB_NONSMBD_OBJ) \
  1177. $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(POPT_LIB_OBJ) \
  1178. $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) \
  1179. - $(LIBCLI_LSA_OBJ)
  1180. + $(LIBCLI_LSA_OBJ) \
  1181. + $(LIBCLI_NETLOGON_OBJ) \
  1182. + rpc_client/init_netlogon.o
  1183. EVTLOGADM_OBJ0 = utils/eventlogadm.o
  1184. --- a/librpc/ndr/ndr_basic.c
  1185. +++ b/librpc/ndr/ndr_basic.c
  1186. @@ -61,6 +61,7 @@ _PUBLIC_ void ndr_check_padding(struct n
  1187. */
  1188. _PUBLIC_ enum ndr_err_code ndr_pull_int8(struct ndr_pull *ndr, int ndr_flags, int8_t *v)
  1189. {
  1190. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1191. NDR_PULL_NEED_BYTES(ndr, 1);
  1192. *v = (int8_t)CVAL(ndr->data, ndr->offset);
  1193. ndr->offset += 1;
  1194. @@ -72,6 +73,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_int8
  1195. */
  1196. _PUBLIC_ enum ndr_err_code ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v)
  1197. {
  1198. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1199. NDR_PULL_NEED_BYTES(ndr, 1);
  1200. *v = CVAL(ndr->data, ndr->offset);
  1201. ndr->offset += 1;
  1202. @@ -83,6 +85,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint
  1203. */
  1204. _PUBLIC_ enum ndr_err_code ndr_pull_int16(struct ndr_pull *ndr, int ndr_flags, int16_t *v)
  1205. {
  1206. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1207. NDR_PULL_ALIGN(ndr, 2);
  1208. NDR_PULL_NEED_BYTES(ndr, 2);
  1209. *v = (uint16_t)NDR_SVAL(ndr, ndr->offset);
  1210. @@ -95,6 +98,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_int1
  1211. */
  1212. _PUBLIC_ enum ndr_err_code ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v)
  1213. {
  1214. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1215. NDR_PULL_ALIGN(ndr, 2);
  1216. NDR_PULL_NEED_BYTES(ndr, 2);
  1217. *v = NDR_SVAL(ndr, ndr->offset);
  1218. @@ -107,6 +111,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint
  1219. */
  1220. _PUBLIC_ enum ndr_err_code ndr_pull_uint1632(struct ndr_pull *ndr, int ndr_flags, uint16_t *v)
  1221. {
  1222. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1223. if (unlikely(ndr->flags & LIBNDR_FLAG_NDR64)) {
  1224. uint32_t v32 = 0;
  1225. enum ndr_err_code err = ndr_pull_uint32(ndr, ndr_flags, &v32);
  1226. @@ -125,6 +130,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint
  1227. */
  1228. _PUBLIC_ enum ndr_err_code ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v)
  1229. {
  1230. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1231. NDR_PULL_ALIGN(ndr, 4);
  1232. NDR_PULL_NEED_BYTES(ndr, 4);
  1233. *v = NDR_IVALS(ndr, ndr->offset);
  1234. @@ -137,6 +143,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_int3
  1235. */
  1236. _PUBLIC_ enum ndr_err_code ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
  1237. {
  1238. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1239. NDR_PULL_ALIGN(ndr, 4);
  1240. NDR_PULL_NEED_BYTES(ndr, 4);
  1241. *v = NDR_IVAL(ndr, ndr->offset);
  1242. @@ -151,6 +158,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint
  1243. {
  1244. uint64_t v64;
  1245. enum ndr_err_code err;
  1246. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1247. if (likely(!(ndr->flags & LIBNDR_FLAG_NDR64))) {
  1248. return ndr_pull_uint32(ndr, ndr_flags, v);
  1249. }
  1250. @@ -169,6 +177,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint
  1251. */
  1252. _PUBLIC_ enum ndr_err_code ndr_pull_double(struct ndr_pull *ndr, int ndr_flags, double *v)
  1253. {
  1254. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1255. NDR_PULL_ALIGN(ndr, 8);
  1256. NDR_PULL_NEED_BYTES(ndr, 8);
  1257. memcpy(v, ndr->data+ndr->offset, 8);
  1258. @@ -217,6 +226,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ref_
  1259. */
  1260. _PUBLIC_ enum ndr_err_code ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
  1261. {
  1262. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1263. NDR_PULL_ALIGN(ndr, 4);
  1264. NDR_PULL_NEED_BYTES(ndr, 8);
  1265. *v = NDR_IVAL(ndr, ndr->offset);
  1266. @@ -230,6 +240,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_udlo
  1267. */
  1268. _PUBLIC_ enum ndr_err_code ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
  1269. {
  1270. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1271. NDR_PULL_ALIGN(ndr, 4);
  1272. NDR_PULL_NEED_BYTES(ndr, 8);
  1273. *v = ((uint64_t)NDR_IVAL(ndr, ndr->offset)) << 32;
  1274. @@ -264,6 +275,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_hype
  1275. _PUBLIC_ enum ndr_err_code ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v)
  1276. {
  1277. uintptr_t h;
  1278. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1279. NDR_PULL_ALIGN(ndr, sizeof(h));
  1280. NDR_PULL_NEED_BYTES(ndr, sizeof(h));
  1281. memcpy(&h, ndr->data+ndr->offset, sizeof(h));
  1282. @@ -278,6 +290,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_poin
  1283. _PUBLIC_ enum ndr_err_code ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status)
  1284. {
  1285. uint32_t v;
  1286. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1287. NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
  1288. *status = NT_STATUS(v);
  1289. return NDR_ERR_SUCCESS;
  1290. @@ -302,6 +315,7 @@ _PUBLIC_ void ndr_print_NTSTATUS(struct
  1291. _PUBLIC_ enum ndr_err_code ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status)
  1292. {
  1293. uint32_t v;
  1294. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1295. NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
  1296. *status = W_ERROR(v);
  1297. return NDR_ERR_SUCCESS;
  1298. @@ -414,6 +428,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_byte
  1299. */
  1300. _PUBLIC_ enum ndr_err_code ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n)
  1301. {
  1302. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1303. if (!(ndr_flags & NDR_SCALARS)) {
  1304. return NDR_ERR_SUCCESS;
  1305. }
  1306. @@ -425,6 +440,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_arra
  1307. */
  1308. _PUBLIC_ enum ndr_err_code ndr_push_int8(struct ndr_push *ndr, int ndr_flags, int8_t v)
  1309. {
  1310. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1311. NDR_PUSH_NEED_BYTES(ndr, 1);
  1312. SCVAL(ndr->data, ndr->offset, (uint8_t)v);
  1313. ndr->offset += 1;
  1314. @@ -436,6 +452,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_int8
  1315. */
  1316. _PUBLIC_ enum ndr_err_code ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v)
  1317. {
  1318. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1319. NDR_PUSH_NEED_BYTES(ndr, 1);
  1320. SCVAL(ndr->data, ndr->offset, v);
  1321. ndr->offset += 1;
  1322. @@ -447,6 +464,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_uint
  1323. */
  1324. _PUBLIC_ enum ndr_err_code ndr_push_int16(struct ndr_push *ndr, int ndr_flags, int16_t v)
  1325. {
  1326. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1327. NDR_PUSH_ALIGN(ndr, 2);
  1328. NDR_PUSH_NEED_BYTES(ndr, 2);
  1329. NDR_SSVAL(ndr, ndr->offset, (uint16_t)v);
  1330. @@ -459,6 +477,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_int1
  1331. */
  1332. _PUBLIC_ enum ndr_err_code ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v)
  1333. {
  1334. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1335. NDR_PUSH_ALIGN(ndr, 2);
  1336. NDR_PUSH_NEED_BYTES(ndr, 2);
  1337. NDR_SSVAL(ndr, ndr->offset, v);
  1338. @@ -482,6 +501,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_uint
  1339. */
  1340. _PUBLIC_ enum ndr_err_code ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v)
  1341. {
  1342. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1343. NDR_PUSH_ALIGN(ndr, 4);
  1344. NDR_PUSH_NEED_BYTES(ndr, 4);
  1345. NDR_SIVALS(ndr, ndr->offset, v);
  1346. @@ -494,6 +514,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_int3
  1347. */
  1348. _PUBLIC_ enum ndr_err_code ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v)
  1349. {
  1350. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1351. NDR_PUSH_ALIGN(ndr, 4);
  1352. NDR_PUSH_NEED_BYTES(ndr, 4);
  1353. NDR_SIVAL(ndr, ndr->offset, v);
  1354. @@ -517,6 +538,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_uint
  1355. */
  1356. _PUBLIC_ enum ndr_err_code ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v)
  1357. {
  1358. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1359. NDR_PUSH_ALIGN(ndr, 4);
  1360. NDR_PUSH_NEED_BYTES(ndr, 8);
  1361. NDR_SIVAL(ndr, ndr->offset, (v & 0xFFFFFFFF));
  1362. @@ -530,6 +552,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_udlo
  1363. */
  1364. _PUBLIC_ enum ndr_err_code ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v)
  1365. {
  1366. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1367. NDR_PUSH_ALIGN(ndr, 4);
  1368. NDR_PUSH_NEED_BYTES(ndr, 8);
  1369. NDR_SIVAL(ndr, ndr->offset, (v>>32));
  1370. @@ -563,6 +586,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_hype
  1371. */
  1372. _PUBLIC_ enum ndr_err_code ndr_push_double(struct ndr_push *ndr, int ndr_flags, double v)
  1373. {
  1374. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1375. NDR_PUSH_ALIGN(ndr, 8);
  1376. NDR_PUSH_NEED_BYTES(ndr, 8);
  1377. memcpy(ndr->data+ndr->offset, &v, 8);
  1378. @@ -576,6 +600,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_doub
  1379. _PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v)
  1380. {
  1381. uintptr_t h = (intptr_t)v;
  1382. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1383. NDR_PUSH_ALIGN(ndr, sizeof(h));
  1384. NDR_PUSH_NEED_BYTES(ndr, sizeof(h));
  1385. memcpy(ndr->data+ndr->offset, &h, sizeof(h));
  1386. @@ -686,6 +711,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_zero
  1387. */
  1388. _PUBLIC_ enum ndr_err_code ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n)
  1389. {
  1390. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1391. if (!(ndr_flags & NDR_SCALARS)) {
  1392. return NDR_ERR_SUCCESS;
  1393. }
  1394. @@ -738,6 +764,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_ref_
  1395. */
  1396. _PUBLIC_ enum ndr_err_code ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t)
  1397. {
  1398. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1399. NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, t));
  1400. return NDR_ERR_SUCCESS;
  1401. }
  1402. @@ -747,6 +774,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_NTTI
  1403. */
  1404. _PUBLIC_ enum ndr_err_code ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
  1405. {
  1406. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1407. NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, t));
  1408. return NDR_ERR_SUCCESS;
  1409. }
  1410. @@ -756,6 +784,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_NTTI
  1411. */
  1412. _PUBLIC_ enum ndr_err_code ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
  1413. {
  1414. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1415. t /= 10000000;
  1416. NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
  1417. return NDR_ERR_SUCCESS;
  1418. @@ -766,6 +795,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_NTTI
  1419. */
  1420. _PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
  1421. {
  1422. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1423. NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
  1424. (*t) *= 10000000;
  1425. return NDR_ERR_SUCCESS;
  1426. @@ -776,6 +806,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_NTTI
  1427. */
  1428. _PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
  1429. {
  1430. + NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
  1431. NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
  1432. return NDR_ERR_SUCCESS;
  1433. }
  1434. @@ -785,6 +816,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_NTTI
  1435. */
  1436. _PUBLIC_ enum ndr_err_code ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t)
  1437. {
  1438. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1439. NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
  1440. return NDR_ERR_SUCCESS;
  1441. }
  1442. @@ -814,6 +846,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_time
  1443. */
  1444. _PUBLIC_ enum ndr_err_code ndr_push_uid_t(struct ndr_push *ndr, int ndr_flags, uid_t u)
  1445. {
  1446. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1447. return ndr_push_hyper(ndr, NDR_SCALARS, (uint64_t)u);
  1448. }
  1449. @@ -839,6 +872,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uid_
  1450. */
  1451. _PUBLIC_ enum ndr_err_code ndr_push_gid_t(struct ndr_push *ndr, int ndr_flags, gid_t g)
  1452. {
  1453. + NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
  1454. return ndr_push_hyper(ndr, NDR_SCALARS, (uint64_t)g);
  1455. }
  1456. --- a/source3/lib/bitmap.c
  1457. +++ /dev/null
  1458. @@ -1,136 +0,0 @@
  1459. -/*
  1460. - Unix SMB/CIFS implementation.
  1461. - simple bitmap functions
  1462. - Copyright (C) Andrew Tridgell 1992-1998
  1463. -
  1464. - This program is free software; you can redistribute it and/or modify
  1465. - it under the terms of the GNU General Public License as published by
  1466. - the Free Software Foundation; either version 3 of the License, or
  1467. - (at your option) any later version.
  1468. -
  1469. - This program is distributed in the hope that it will be useful,
  1470. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  1471. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1472. - GNU General Public License for more details.
  1473. -
  1474. - You should have received a copy of the GNU General Public License
  1475. - along with this program. If not, see <http://www.gnu.org/licenses/>.
  1476. -*/
  1477. -
  1478. -#include "includes.h"
  1479. -
  1480. -/* these functions provide a simple way to allocate integers from a
  1481. - pool without repetition */
  1482. -
  1483. -/****************************************************************************
  1484. -talloc a bitmap
  1485. -****************************************************************************/
  1486. -struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n)
  1487. -{
  1488. - struct bitmap *bm;
  1489. -
  1490. - bm = TALLOC_P(mem_ctx, struct bitmap);
  1491. -
  1492. - if (!bm) return NULL;
  1493. -
  1494. - bm->n = n;
  1495. - bm->b = TALLOC_ZERO_ARRAY(bm, uint32, (n+31)/32);
  1496. - if (!bm->b) {
  1497. - TALLOC_FREE(bm);
  1498. - return NULL;
  1499. - }
  1500. - return bm;
  1501. -}
  1502. -
  1503. -/****************************************************************************
  1504. -copy as much of the source bitmap as will fit in the destination bitmap.
  1505. -****************************************************************************/
  1506. -
  1507. -int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src)
  1508. -{
  1509. - int count = MIN(dst->n, src->n);
  1510. -
  1511. - SMB_ASSERT(dst->b != src->b);
  1512. - memcpy(dst->b, src->b, sizeof(uint32)*((count+31)/32));
  1513. -
  1514. - return count;
  1515. -}
  1516. -
  1517. -/****************************************************************************
  1518. -set a bit in a bitmap
  1519. -****************************************************************************/
  1520. -bool bitmap_set(struct bitmap *bm, unsigned i)
  1521. -{
  1522. - if (i >= bm->n) {
  1523. - DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n",
  1524. - i, bm->n));
  1525. - return False;
  1526. - }
  1527. - bm->b[i/32] |= (1<<(i%32));
  1528. - return True;
  1529. -}
  1530. -
  1531. -/****************************************************************************
  1532. -clear a bit in a bitmap
  1533. -****************************************************************************/
  1534. -bool bitmap_clear(struct bitmap *bm, unsigned i)
  1535. -{
  1536. - if (i >= bm->n) {
  1537. - DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n",
  1538. - i, bm->n));
  1539. - return False;
  1540. - }
  1541. - bm->b[i/32] &= ~(1<<(i%32));
  1542. - return True;
  1543. -}
  1544. -
  1545. -/****************************************************************************
  1546. -query a bit in a bitmap
  1547. -****************************************************************************/
  1548. -bool bitmap_query(struct bitmap *bm, unsigned i)
  1549. -{
  1550. - if (i >= bm->n) return False;
  1551. - if (bm->b[i/32] & (1<<(i%32))) {
  1552. - return True;
  1553. - }
  1554. - return False;
  1555. -}
  1556. -
  1557. -/****************************************************************************
  1558. -find a zero bit in a bitmap starting at the specified offset, with
  1559. -wraparound
  1560. -****************************************************************************/
  1561. -int bitmap_find(struct bitmap *bm, unsigned ofs)
  1562. -{
  1563. - unsigned int i, j;
  1564. -
  1565. - if (ofs > bm->n) ofs = 0;
  1566. -
  1567. - i = ofs;
  1568. - while (i < bm->n) {
  1569. - if (~(bm->b[i/32])) {
  1570. - j = i;
  1571. - do {
  1572. - if (!bitmap_query(bm, j)) return j;
  1573. - j++;
  1574. - } while (j & 31 && j < bm->n);
  1575. - }
  1576. - i += 32;
  1577. - i &= ~31;
  1578. - }
  1579. -
  1580. - i = 0;
  1581. - while (i < ofs) {
  1582. - if (~(bm->b[i/32])) {
  1583. - j = i;
  1584. - do {
  1585. - if (!bitmap_query(bm, j)) return j;
  1586. - j++;
  1587. - } while (j & 31 && j < bm->n);
  1588. - }
  1589. - i += 32;
  1590. - i &= ~31;
  1591. - }
  1592. -
  1593. - return -1;
  1594. -}
  1595. --- /dev/null
  1596. +++ b/lib/util/bitmap.c
  1597. @@ -0,0 +1,137 @@
  1598. +/*
  1599. + Unix SMB/CIFS implementation.
  1600. + simple bitmap functions
  1601. + Copyright (C) Andrew Tridgell 1992-1998
  1602. +
  1603. + This program is free software; you can redistribute it and/or modify
  1604. + it under the terms of the GNU General Public License as published by
  1605. + the Free Software Foundation; either version 3 of the License, or
  1606. + (at your option) any later version.
  1607. +
  1608. + This program is distributed in the hope that it will be useful,
  1609. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  1610. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1611. + GNU General Public License for more details.
  1612. +
  1613. + You should have received a copy of the GNU General Public License
  1614. + along with this program. If not, see <http://www.gnu.org/licenses/>.
  1615. +*/
  1616. +
  1617. +#include "includes.h"
  1618. +#include "lib/util/bitmap.h"
  1619. +
  1620. +/* these functions provide a simple way to allocate integers from a
  1621. + pool without repetition */
  1622. +
  1623. +/****************************************************************************
  1624. +talloc a bitmap
  1625. +****************************************************************************/
  1626. +struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n)
  1627. +{
  1628. + struct bitmap *bm;
  1629. +
  1630. + bm = talloc_zero(mem_ctx, struct bitmap);
  1631. +
  1632. + if (!bm) return NULL;
  1633. +
  1634. + bm->n = n;
  1635. + bm->b = talloc_zero_array(bm, uint32_t, (n+31)/32);
  1636. + if (!bm->b) {
  1637. + TALLOC_FREE(bm);
  1638. + return NULL;
  1639. + }
  1640. + return bm;
  1641. +}
  1642. +
  1643. +/****************************************************************************
  1644. +copy as much of the source bitmap as will fit in the destination bitmap.
  1645. +****************************************************************************/
  1646. +
  1647. +int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src)
  1648. +{
  1649. + int count = MIN(dst->n, src->n);
  1650. +
  1651. + SMB_ASSERT(dst->b != src->b);
  1652. + memcpy(dst->b, src->b, sizeof(uint32_t)*((count+31)/32));
  1653. +
  1654. + return count;
  1655. +}
  1656. +
  1657. +/****************************************************************************
  1658. +set a bit in a bitmap
  1659. +****************************************************************************/
  1660. +bool bitmap_set(struct bitmap *bm, unsigned i)
  1661. +{
  1662. + if (i >= bm->n) {
  1663. + DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n",
  1664. + i, bm->n));
  1665. + return false;
  1666. + }
  1667. + bm->b[i/32] |= (1<<(i%32));
  1668. + return true;
  1669. +}
  1670. +
  1671. +/****************************************************************************
  1672. +clear a bit in a bitmap
  1673. +****************************************************************************/
  1674. +bool bitmap_clear(struct bitmap *bm, unsigned i)
  1675. +{
  1676. + if (i >= bm->n) {
  1677. + DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n",
  1678. + i, bm->n));
  1679. + return false;
  1680. + }
  1681. + bm->b[i/32] &= ~(1<<(i%32));
  1682. + return true;
  1683. +}
  1684. +
  1685. +/****************************************************************************
  1686. +query a bit in a bitmap
  1687. +****************************************************************************/
  1688. +bool bitmap_query(struct bitmap *bm, unsigned i)
  1689. +{
  1690. + if (i >= bm->n) return false;
  1691. + if (bm->b[i/32] & (1<<(i%32))) {
  1692. + return true;
  1693. + }
  1694. + return false;
  1695. +}
  1696. +
  1697. +/****************************************************************************
  1698. +find a zero bit in a bitmap starting at the specified offset, with
  1699. +wraparound
  1700. +****************************************************************************/
  1701. +int bitmap_find(struct bitmap *bm, unsigned ofs)
  1702. +{
  1703. + unsigned int i, j;
  1704. +
  1705. + if (ofs > bm->n) ofs = 0;
  1706. +
  1707. + i = ofs;
  1708. + while (i < bm->n) {
  1709. + if (~(bm->b[i/32])) {
  1710. + j = i;
  1711. + do {
  1712. + if (!bitmap_query(bm, j)) return j;
  1713. + j++;
  1714. + } while (j & 31 && j < bm->n);
  1715. + }
  1716. + i += 32;
  1717. + i &= ~31;
  1718. + }
  1719. +
  1720. + i = 0;
  1721. + while (i < ofs) {
  1722. + if (~(bm->b[i/32])) {
  1723. + j = i;
  1724. + do {
  1725. + if (!bitmap_query(bm, j)) return j;
  1726. + j++;
  1727. + } while (j & 31 && j < bm->n);
  1728. + }
  1729. + i += 32;
  1730. + i &= ~31;
  1731. + }
  1732. +
  1733. + return -1;
  1734. +}
  1735. --- /dev/null
  1736. +++ b/lib/util/bitmap.h
  1737. @@ -0,0 +1,32 @@
  1738. +/*
  1739. + Unix SMB/CIFS implementation.
  1740. + simple bitmap functions
  1741. + Copyright (C) Andrew Tridgell 1992-1998
  1742. +
  1743. + This program is free software; you can redistribute it and/or modify
  1744. + it under the terms of the GNU General Public License as published by
  1745. + the Free Software Foundation; either version 3 of the License, or
  1746. + (at your option) any later version.
  1747. +
  1748. + This program is distributed in the hope that it will be useful,
  1749. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  1750. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1751. + GNU General Public License for more details.
  1752. +
  1753. + You should have received a copy of the GNU General Public License
  1754. + along with this program. If not, see <http://www.gnu.org/licenses/>.
  1755. +*/
  1756. +
  1757. +/* The following definitions come from lib/bitmap.c */
  1758. +
  1759. +struct bitmap {
  1760. + uint32_t *b;
  1761. + unsigned int n;
  1762. +};
  1763. +
  1764. +struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
  1765. +int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
  1766. +bool bitmap_set(struct bitmap *bm, unsigned i);
  1767. +bool bitmap_clear(struct bitmap *bm, unsigned i);
  1768. +bool bitmap_query(struct bitmap *bm, unsigned i);
  1769. +int bitmap_find(struct bitmap *bm, unsigned ofs);
  1770. --- a/lib/util/wscript_build
  1771. +++ b/lib/util/wscript_build
  1772. @@ -99,5 +99,11 @@ bld.SAMBA_LIBRARY('tdb-wrap',
  1773. public_headers='tdb_wrap.h',
  1774. private_library=True,
  1775. local_include=False
  1776. - )
  1777. + )
  1778. +
  1779. +bld.SAMBA_LIBRARY('bitmap',
  1780. + source='bitmap.c',
  1781. + deps='talloc samba-util',
  1782. + local_include=False,
  1783. + private_library=True)
  1784. --- a/source3/include/proto.h
  1785. +++ b/source3/include/proto.h
  1786. @@ -61,15 +61,6 @@ const char *audit_description_str(uint32
  1787. bool get_audit_category_from_param(const char *param, uint32 *audit_category);
  1788. const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
  1789. -/* The following definitions come from lib/bitmap.c */
  1790. -
  1791. -struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
  1792. -int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
  1793. -bool bitmap_set(struct bitmap *bm, unsigned i);
  1794. -bool bitmap_clear(struct bitmap *bm, unsigned i);
  1795. -bool bitmap_query(struct bitmap *bm, unsigned i);
  1796. -int bitmap_find(struct bitmap *bm, unsigned ofs);
  1797. -
  1798. /* The following definitions come from lib/charcnv.c */
  1799. char lp_failed_convert_char(void);
  1800. --- a/source3/include/smb.h
  1801. +++ b/source3/include/smb.h
  1802. @@ -712,7 +712,6 @@ struct connections_data {
  1803. uint32 unused_compatitibility_field;
  1804. };
  1805. -
  1806. /* the following are used by loadparm for option lists */
  1807. typedef enum {
  1808. P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
  1809. @@ -759,11 +758,6 @@ struct parm_struct {
  1810. #define FLAG_META 0x8000 /* A meta directive - not a real parameter */
  1811. #define FLAG_CMDLINE 0x10000 /* option has been overridden */
  1812. -struct bitmap {
  1813. - uint32 *b;
  1814. - unsigned int n;
  1815. -};
  1816. -
  1817. /* offsets into message for common items */
  1818. #define smb_com 8
  1819. #define smb_rcls 9
  1820. --- a/source3/modules/vfs_acl_common.c
  1821. +++ b/source3/modules/vfs_acl_common.c
  1822. @@ -23,6 +23,7 @@
  1823. #include "system/filesys.h"
  1824. #include "../libcli/security/security.h"
  1825. #include "../librpc/gen_ndr/ndr_security.h"
  1826. +#include "../lib/util/bitmap.h"
  1827. static NTSTATUS create_acl_blob(const struct security_descriptor *psd,
  1828. DATA_BLOB *pblob,
  1829. --- a/source3/modules/vfs_full_audit.c
  1830. +++ b/source3/modules/vfs_full_audit.c
  1831. @@ -64,6 +64,7 @@
  1832. #include "../librpc/gen_ndr/ndr_netlogon.h"
  1833. #include "auth.h"
  1834. #include "ntioctl.h"
  1835. +#include "lib/util/bitmap.h"
  1836. static int vfs_full_audit_debug_level = DBGC_VFS;
  1837. --- a/source3/param/loadparm.c
  1838. +++ b/source3/param/loadparm.c
  1839. @@ -64,6 +64,7 @@
  1840. #include "smb_signing.h"
  1841. #include "dbwrap.h"
  1842. #include "smbldap.h"
  1843. +#include "../lib/util/bitmap.h"
  1844. #ifdef HAVE_SYS_SYSCTL_H
  1845. #include <sys/sysctl.h>
  1846. --- a/source3/passdb/pdb_get_set.c
  1847. +++ b/source3/passdb/pdb_get_set.c
  1848. @@ -25,6 +25,7 @@
  1849. #include "passdb.h"
  1850. #include "../libcli/auth/libcli_auth.h"
  1851. #include "../libcli/security/security.h"
  1852. +#include "../lib/util/bitmap.h"
  1853. #undef DBGC_CLASS
  1854. #define DBGC_CLASS DBGC_PASSDB
  1855. --- a/source3/smbd/conn.c
  1856. +++ b/source3/smbd/conn.c
  1857. @@ -23,6 +23,7 @@
  1858. #include "smbd/smbd.h"
  1859. #include "smbd/globals.h"
  1860. #include "rpc_server/rpc_ncacn_np.h"
  1861. +#include "lib/util/bitmap.h"
  1862. /* The connections bitmap is expanded in increments of BITMAP_BLOCK_SZ. The
  1863. * maximum size of the bitmap is the largest positive integer, but you will hit
  1864. --- a/source3/smbd/dir.c
  1865. +++ b/source3/smbd/dir.c
  1866. @@ -23,6 +23,7 @@
  1867. #include "smbd/smbd.h"
  1868. #include "smbd/globals.h"
  1869. #include "libcli/security/security.h"
  1870. +#include "lib/util/bitmap.h"
  1871. /*
  1872. This module implements directory related functions for Samba.
  1873. --- a/source3/smbd/files.c
  1874. +++ b/source3/smbd/files.c
  1875. @@ -22,6 +22,7 @@
  1876. #include "smbd/globals.h"
  1877. #include "libcli/security/security.h"
  1878. #include "util_tdb.h"
  1879. +#include "lib/util/bitmap.h"
  1880. #define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < real_max_open_files))
  1881. --- a/source3/smbd/smb2_server.c
  1882. +++ b/source3/smbd/smb2_server.c
  1883. @@ -26,6 +26,7 @@
  1884. #include "../lib/tsocket/tsocket.h"
  1885. #include "../lib/util/tevent_ntstatus.h"
  1886. #include "smbprofile.h"
  1887. +#include "../lib/util/bitmap.h"
  1888. #define OUTVEC_ALLOC_SIZE (SMB2_HDR_BODY + 9)
  1889. --- a/source3/rpc_client/cli_pipe.c
  1890. +++ b/source3/rpc_client/cli_pipe.c
  1891. @@ -28,6 +28,7 @@
  1892. #include "../libcli/auth/ntlmssp.h"
  1893. #include "ntlmssp_wrap.h"
  1894. #include "librpc/gen_ndr/ndr_dcerpc.h"
  1895. +#include "librpc/gen_ndr/ndr_netlogon_c.h"
  1896. #include "librpc/rpc/dcerpc.h"
  1897. #include "librpc/crypto/gse.h"
  1898. #include "librpc/crypto/spnego.h"
  1899. @@ -399,6 +400,7 @@ static NTSTATUS cli_pipe_validate_curren
  1900. struct ncacn_packet *pkt,
  1901. DATA_BLOB *pdu,
  1902. uint8_t expected_pkt_type,
  1903. + uint32_t call_id,
  1904. DATA_BLOB *rdata,
  1905. DATA_BLOB *reply_pdu)
  1906. {
  1907. @@ -497,7 +499,7 @@ static NTSTATUS cli_pipe_validate_curren
  1908. "from %s!\n",
  1909. (unsigned int)pkt->ptype,
  1910. rpccli_pipe_txt(talloc_tos(), cli)));
  1911. - return NT_STATUS_INVALID_INFO_CLASS;
  1912. + return NT_STATUS_RPC_PROTOCOL_ERROR;
  1913. }
  1914. if (pkt->ptype != expected_pkt_type) {
  1915. @@ -505,7 +507,15 @@ static NTSTATUS cli_pipe_validate_curren
  1916. "RPC packet type - %u, not %u\n",
  1917. rpccli_pipe_txt(talloc_tos(), cli),
  1918. pkt->ptype, expected_pkt_type));
  1919. - return NT_STATUS_INVALID_INFO_CLASS;
  1920. + return NT_STATUS_RPC_PROTOCOL_ERROR;
  1921. + }
  1922. +
  1923. + if (pkt->call_id != call_id) {
  1924. + DEBUG(3, (__location__ ": Connection to %s got an unexpected "
  1925. + "RPC call_id - %u, not %u\n",
  1926. + rpccli_pipe_txt(talloc_tos(), cli),
  1927. + pkt->call_id, call_id));
  1928. + return NT_STATUS_RPC_PROTOCOL_ERROR;
  1929. }
  1930. /* Do this just before return - we don't want to modify any rpc header
  1931. @@ -898,6 +908,7 @@ static void rpc_api_pipe_got_pdu(struct
  1932. state->cli, state->pkt,
  1933. &state->incoming_frag,
  1934. state->expected_pkt_type,
  1935. + state->call_id,
  1936. &rdata,
  1937. &state->reply_pdu);
  1938. @@ -1269,12 +1280,17 @@ struct rpc_api_pipe_req_state {
  1939. uint32_t call_id;
  1940. DATA_BLOB *req_data;
  1941. uint32_t req_data_sent;
  1942. + DATA_BLOB req_trailer;
  1943. + uint32_t req_trailer_sent;
  1944. + bool verify_bitmask1;
  1945. + bool verify_pcontext;
  1946. DATA_BLOB rpc_out;
  1947. DATA_BLOB reply_pdu;
  1948. };
  1949. static void rpc_api_pipe_req_write_done(struct tevent_req *subreq);
  1950. static void rpc_api_pipe_req_done(struct tevent_req *subreq);
  1951. +static NTSTATUS prepare_verification_trailer(struct rpc_api_pipe_req_state *state);
  1952. static NTSTATUS prepare_next_frag(struct rpc_api_pipe_req_state *state,
  1953. bool *is_last_frag);
  1954. @@ -1310,6 +1326,11 @@ struct tevent_req *rpc_api_pipe_req_send
  1955. goto post_status;
  1956. }
  1957. + status = prepare_verification_trailer(state);
  1958. + if (!NT_STATUS_IS_OK(status)) {
  1959. + goto post_status;
  1960. + }
  1961. +
  1962. status = prepare_next_frag(state, &is_last_frag);
  1963. if (!NT_STATUS_IS_OK(status)) {
  1964. goto post_status;
  1965. @@ -1344,25 +1365,161 @@ struct tevent_req *rpc_api_pipe_req_send
  1966. return NULL;
  1967. }
  1968. +static NTSTATUS prepare_verification_trailer(struct rpc_api_pipe_req_state *state)
  1969. +{
  1970. + struct pipe_auth_data *a = state->cli->auth;
  1971. + struct dcerpc_sec_verification_trailer *t;
  1972. + struct dcerpc_sec_vt *c = NULL;
  1973. + struct ndr_push *ndr = NULL;
  1974. + enum ndr_err_code ndr_err;
  1975. + size_t align = 0;
  1976. + size_t pad = 0;
  1977. +
  1978. + if (a == NULL) {
  1979. + return NT_STATUS_OK;
  1980. + }
  1981. +
  1982. + if (a->auth_level < DCERPC_AUTH_LEVEL_INTEGRITY) {
  1983. + return NT_STATUS_OK;
  1984. + }
  1985. +
  1986. + t = talloc_zero(state, struct dcerpc_sec_verification_trailer);
  1987. + if (t == NULL) {
  1988. + return NT_STATUS_NO_MEMORY;
  1989. + }
  1990. +
  1991. + if (!a->verified_bitmask1) {
  1992. + t->commands = talloc_realloc(t, t->commands,
  1993. + struct dcerpc_sec_vt,
  1994. + t->count.count + 1);
  1995. + if (t->commands == NULL) {
  1996. + return NT_STATUS_NO_MEMORY;
  1997. + }
  1998. + c = &t->commands[t->count.count++];
  1999. + ZERO_STRUCTP(c);
  2000. +
  2001. + c->command = DCERPC_SEC_VT_COMMAND_BITMASK1;
  2002. + state->verify_bitmask1 = true;
  2003. + }
  2004. +
  2005. + if (!state->cli->verified_pcontext) {
  2006. + t->commands = talloc_realloc(t, t->commands,
  2007. + struct dcerpc_sec_vt,
  2008. + t->count.count + 1);
  2009. + if (t->commands == NULL) {
  2010. + return NT_STATUS_NO_MEMORY;
  2011. + }
  2012. + c = &t->commands[t->count.count++];
  2013. + ZERO_STRUCTP(c);
  2014. +
  2015. + c->command = DCERPC_SEC_VT_COMMAND_PCONTEXT;
  2016. + c->u.pcontext.abstract_syntax = state->cli->abstract_syntax;
  2017. + c->u.pcontext.transfer_syntax = state->cli->transfer_syntax;
  2018. +
  2019. + state->verify_pcontext = true;
  2020. + }
  2021. +
  2022. + if (true) { /* We do not support header signing */
  2023. + t->commands = talloc_realloc(t, t->commands,
  2024. + struct dcerpc_sec_vt,
  2025. + t->count.count + 1);
  2026. + if (t->commands == NULL) {
  2027. + return NT_STATUS_NO_MEMORY;
  2028. + }
  2029. + c = &t->commands[t->count.count++];
  2030. + ZERO_STRUCTP(c);
  2031. +
  2032. + c->command = DCERPC_SEC_VT_COMMAND_HEADER2;
  2033. + c->u.header2.ptype = DCERPC_PKT_REQUEST;
  2034. + c->u.header2.drep[0] = DCERPC_DREP_LE;
  2035. + c->u.header2.drep[1] = 0;
  2036. + c->u.header2.drep[2] = 0;
  2037. + c->u.header2.drep[3] = 0;
  2038. + c->u.header2.call_id = state->call_id;
  2039. + c->u.header2.context_id = 0;
  2040. + c->u.header2.opnum = state->op_num;
  2041. + }
  2042. +
  2043. + if (t->count.count == 0) {
  2044. + TALLOC_FREE(t);
  2045. + return NT_STATUS_OK;
  2046. + }
  2047. +
  2048. + c = &t->commands[t->count.count - 1];
  2049. + c->command |= DCERPC_SEC_VT_COMMAND_END;
  2050. +
  2051. + if (DEBUGLEVEL >= 10) {
  2052. + NDR_PRINT_DEBUG(dcerpc_sec_verification_trailer, t);
  2053. + }
  2054. +
  2055. + ndr = ndr_push_init_ctx(state);
  2056. + if (ndr == NULL) {
  2057. + return NT_STATUS_NO_MEMORY;
  2058. + }
  2059. +
  2060. + ndr_err = ndr_push_dcerpc_sec_verification_trailer(ndr,
  2061. + NDR_SCALARS | NDR_BUFFERS,
  2062. + t);
  2063. + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
  2064. + return ndr_map_error2ntstatus(ndr_err);
  2065. + }
  2066. + state->req_trailer = ndr_push_blob(ndr);
  2067. +
  2068. + align = state->req_data->length & 0x3;
  2069. + if (align > 0) {
  2070. + pad = 4 - align;
  2071. + }
  2072. + if (pad > 0) {
  2073. + bool ok;
  2074. + uint8_t *p;
  2075. + const uint8_t zeros[4] = { 0, };
  2076. +
  2077. + ok = data_blob_append(ndr, &state->req_trailer, zeros, pad);
  2078. + if (!ok) {
  2079. + return NT_STATUS_NO_MEMORY;
  2080. + }
  2081. +
  2082. + /* move the padding to the start */
  2083. + p = state->req_trailer.data;
  2084. + memmove(p + pad, p, state->req_trailer.length - pad);
  2085. + memset(p, 0, pad);
  2086. + }
  2087. +
  2088. + return NT_STATUS_OK;
  2089. +}
  2090. +
  2091. static NTSTATUS prepare_next_frag(struct rpc_api_pipe_req_state *state,
  2092. bool *is_last_frag)
  2093. {
  2094. - size_t data_sent_thistime;
  2095. size_t auth_len;
  2096. size_t frag_len;
  2097. uint8_t flags = 0;
  2098. size_t pad_len;
  2099. size_t data_left;
  2100. + size_t data_thistime;
  2101. + size_t trailer_left;
  2102. + size_t trailer_thistime = 0;
  2103. + size_t total_left;
  2104. + size_t total_thistime;
  2105. NTSTATUS status;
  2106. + bool ok;
  2107. union dcerpc_payload u;
  2108. data_left = state->req_data->length - state->req_data_sent;
  2109. + trailer_left = state->req_trailer.length - state->req_trailer_sent;
  2110. + total_left = data_left + trailer_left;
  2111. + if ((total_left < data_left) || (total_left < trailer_left)) {
  2112. + /*
  2113. + * overflow
  2114. + */
  2115. + return NT_STATUS_INVALID_PARAMETER_MIX;
  2116. + }
  2117. status = dcerpc_guess_sizes(state->cli->auth,
  2118. - DCERPC_REQUEST_LENGTH, data_left,
  2119. + DCERPC_REQUEST_LENGTH, total_left,
  2120. state->cli->max_xmit_frag,
  2121. CLIENT_NDR_PADDING_SIZE,
  2122. - &data_sent_thistime,
  2123. + &total_thistime,
  2124. &frag_len, &auth_len, &pad_len);
  2125. if (!NT_STATUS_IS_OK(status)) {
  2126. return status;
  2127. @@ -1372,15 +1529,20 @@ static NTSTATUS prepare_next_frag(struct
  2128. flags = DCERPC_PFC_FLAG_FIRST;
  2129. }
  2130. - if (data_sent_thistime == data_left) {
  2131. + if (total_thistime == total_left) {
  2132. flags |= DCERPC_PFC_FLAG_LAST;
  2133. }
  2134. + data_thistime = MIN(total_thistime, data_left);
  2135. + if (data_thistime < total_thistime) {
  2136. + trailer_thistime = total_thistime - data_thistime;
  2137. + }
  2138. +
  2139. data_blob_free(&state->rpc_out);
  2140. ZERO_STRUCT(u.request);
  2141. - u.request.alloc_hint = state->req_data->length;
  2142. + u.request.alloc_hint = total_left;
  2143. u.request.context_id = 0;
  2144. u.request.opnum = state->op_num;
  2145. @@ -1400,11 +1562,26 @@ static NTSTATUS prepare_next_frag(struct
  2146. * at this stage */
  2147. dcerpc_set_frag_length(&state->rpc_out, frag_len);
  2148. - /* Copy in the data. */
  2149. - if (!data_blob_append(NULL, &state->rpc_out,
  2150. + if (data_thistime > 0) {
  2151. + /* Copy in the data. */
  2152. + ok = data_blob_append(NULL, &state->rpc_out,
  2153. state->req_data->data + state->req_data_sent,
  2154. - data_sent_thistime)) {
  2155. - return NT_STATUS_NO_MEMORY;
  2156. + data_thistime);
  2157. + if (!ok) {
  2158. + return NT_STATUS_NO_MEMORY;
  2159. + }
  2160. + state->req_data_sent += data_thistime;
  2161. + }
  2162. +
  2163. + if (trailer_thistime > 0) {
  2164. + /* Copy in the verification trailer. */
  2165. + ok = data_blob_append(NULL, &state->rpc_out,
  2166. + state->req_trailer.data + state->req_trailer_sent,
  2167. + trailer_thistime);
  2168. + if (!ok) {
  2169. + return NT_STATUS_NO_MEMORY;
  2170. + }
  2171. + state->req_trailer_sent += trailer_thistime;
  2172. }
  2173. switch (state->cli->auth->auth_level) {
  2174. @@ -1424,7 +1601,6 @@ static NTSTATUS prepare_next_frag(struct
  2175. return NT_STATUS_INVALID_PARAMETER;
  2176. }
  2177. - state->req_data_sent += data_sent_thistime;
  2178. *is_last_frag = ((flags & DCERPC_PFC_FLAG_LAST) != 0);
  2179. return status;
  2180. @@ -1488,6 +1664,20 @@ static void rpc_api_pipe_req_done(struct
  2181. tevent_req_nterror(req, status);
  2182. return;
  2183. }
  2184. +
  2185. + if (state->cli->auth == NULL) {
  2186. + tevent_req_done(req);
  2187. + return;
  2188. + }
  2189. +
  2190. + if (state->verify_bitmask1) {
  2191. + state->cli->auth->verified_bitmask1 = true;
  2192. + }
  2193. +
  2194. + if (state->verify_pcontext) {
  2195. + state->cli->verified_pcontext = true;
  2196. + }
  2197. +
  2198. tevent_req_done(req);
  2199. }
  2200. @@ -1647,9 +1837,15 @@ struct rpc_pipe_bind_state {
  2201. DATA_BLOB rpc_out;
  2202. bool auth3;
  2203. uint32_t rpc_call_id;
  2204. + struct netr_Authenticator auth;
  2205. + struct netr_Authenticator return_auth;
  2206. + struct netlogon_creds_CredentialState *creds;
  2207. + union netr_Capabilities capabilities;
  2208. + struct netr_LogonGetCapabilities r;
  2209. };
  2210. static void rpc_pipe_bind_step_one_done(struct tevent_req *subreq);
  2211. +static void rpc_pipe_bind_step_two_trigger(struct tevent_req *req);
  2212. static NTSTATUS rpc_bind_next_send(struct tevent_req *req,
  2213. struct rpc_pipe_bind_state *state,
  2214. DATA_BLOB *credentials);
  2215. @@ -1753,11 +1949,14 @@ static void rpc_pipe_bind_step_one_done(
  2216. case DCERPC_AUTH_TYPE_NONE:
  2217. case DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM:
  2218. - case DCERPC_AUTH_TYPE_SCHANNEL:
  2219. /* Bind complete. */
  2220. tevent_req_done(req);
  2221. return;
  2222. + case DCERPC_AUTH_TYPE_SCHANNEL:
  2223. + rpc_pipe_bind_step_two_trigger(req);
  2224. + return;
  2225. +
  2226. case DCERPC_AUTH_TYPE_NTLMSSP:
  2227. case DCERPC_AUTH_TYPE_SPNEGO:
  2228. case DCERPC_AUTH_TYPE_KRB5:
  2229. @@ -1869,6 +2068,153 @@ err_out:
  2230. tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
  2231. }
  2232. +static void rpc_pipe_bind_step_two_done(struct tevent_req *subreq);
  2233. +
  2234. +static void rpc_pipe_bind_step_two_trigger(struct tevent_req *req)
  2235. +{
  2236. + struct rpc_pipe_bind_state *state =
  2237. + tevent_req_data(req,
  2238. + struct rpc_pipe_bind_state);
  2239. + struct dcerpc_binding_handle *b = state->cli->binding_handle;
  2240. + struct schannel_state *schannel_auth =
  2241. + talloc_get_type_abort(state->cli->auth->auth_ctx,
  2242. + struct schannel_state);
  2243. + struct tevent_req *subreq;
  2244. +
  2245. + if (schannel_auth == NULL ||
  2246. + !ndr_syntax_id_equal(&state->cli->abstract_syntax,
  2247. + &ndr_table_netlogon.syntax_id)) {
  2248. + tevent_req_done(req);
  2249. + return;
  2250. + }
  2251. +
  2252. + ZERO_STRUCT(state->return_auth);
  2253. +
  2254. + state->creds = netlogon_creds_copy(state, schannel_auth->creds);
  2255. + if (state->creds == NULL) {
  2256. + tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
  2257. + return;
  2258. + }
  2259. +
  2260. + netlogon_creds_client_authenticator(state->creds, &state->auth);
  2261. +
  2262. + state->r.in.server_name = state->cli->srv_name_slash;
  2263. + state->r.in.computer_name = state->creds->computer_name;
  2264. + state->r.in.credential = &state->auth;
  2265. + state->r.in.query_level = 1;
  2266. + state->r.in.return_authenticator = &state->return_auth;
  2267. +
  2268. + state->r.out.capabilities = &state->capabilities;
  2269. + state->r.out.return_authenticator = &state->return_auth;
  2270. +
  2271. + subreq = dcerpc_netr_LogonGetCapabilities_r_send(talloc_tos(),
  2272. + state->ev,
  2273. + b,
  2274. + &state->r);
  2275. + if (subreq == NULL) {
  2276. + tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
  2277. + return;
  2278. + }
  2279. +
  2280. + tevent_req_set_callback(subreq, rpc_pipe_bind_step_two_done, req);
  2281. + return;
  2282. +}
  2283. +
  2284. +static void rpc_pipe_bind_step_two_done(struct tevent_req *subreq)
  2285. +{
  2286. + struct tevent_req *req =
  2287. + tevent_req_callback_data(subreq,
  2288. + struct tevent_req);
  2289. + struct rpc_pipe_bind_state *state =
  2290. + tevent_req_data(req,
  2291. + struct rpc_pipe_bind_state);
  2292. + struct schannel_state *schannel_auth =
  2293. + talloc_get_type_abort(state->cli->auth->auth_ctx,
  2294. + struct schannel_state);
  2295. + NTSTATUS status;
  2296. +
  2297. + status = dcerpc_netr_LogonGetCapabilities_r_recv(subreq, talloc_tos());
  2298. + TALLOC_FREE(subreq);
  2299. + if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE)) {
  2300. + if (state->cli->dc->negotiate_flags &
  2301. + NETLOGON_NEG_SUPPORTS_AES) {
  2302. + DEBUG(5, ("AES is not supported and the error was %s\n",
  2303. + nt_errstr(status)));
  2304. + tevent_req_nterror(req,
  2305. + NT_STATUS_INVALID_NETWORK_RESPONSE);
  2306. + return;
  2307. + }
  2308. +
  2309. + /* This is probably NT */
  2310. + DEBUG(5, ("We are checking against an NT - %s\n",
  2311. + nt_errstr(status)));
  2312. + tevent_req_done(req);
  2313. + return;
  2314. + } else if (!NT_STATUS_IS_OK(status)) {
  2315. + DEBUG(0, ("dcerpc_netr_LogonGetCapabilities_r_recv failed with %s\n",
  2316. + nt_errstr(status)));
  2317. + tevent_req_nterror(req, status);
  2318. + return;
  2319. + }
  2320. +
  2321. + if (NT_STATUS_EQUAL(state->r.out.result, NT_STATUS_NOT_IMPLEMENTED)) {
  2322. + if (state->creds->negotiate_flags & NETLOGON_NEG_SUPPORTS_AES) {
  2323. + /* This means AES isn't supported. */
  2324. + DEBUG(5, ("AES is not supported and the error was %s\n",
  2325. + nt_errstr(state->r.out.result)));
  2326. + tevent_req_nterror(req,
  2327. + NT_STATUS_INVALID_NETWORK_RESPONSE);
  2328. + return;
  2329. + }
  2330. +
  2331. + /* This is probably an old Samba version */
  2332. + DEBUG(5, ("We are checking against an old Samba version - %s\n",
  2333. + nt_errstr(state->r.out.result)));
  2334. + tevent_req_done(req);
  2335. + return;
  2336. + }
  2337. +
  2338. + /* We need to check the credential state here, cause win2k3 and earlier
  2339. + * returns NT_STATUS_NOT_IMPLEMENTED */
  2340. + if (!netlogon_creds_client_check(state->creds,
  2341. + &state->r.out.return_authenticator->cred)) {
  2342. + /*
  2343. + * Server replied with bad credential. Fail.
  2344. + */
  2345. + DEBUG(0,("rpc_pipe_bind_step_two_done: server %s "
  2346. + "replied with bad credential\n",
  2347. + state->cli->desthost));
  2348. + tevent_req_nterror(req, NT_STATUS_UNSUCCESSFUL);
  2349. + return;
  2350. + }
  2351. +
  2352. + TALLOC_FREE(schannel_auth->creds);
  2353. + schannel_auth->creds = talloc_steal(state->cli, state->creds);
  2354. +
  2355. + if (!NT_STATUS_IS_OK(state->r.out.result)) {
  2356. + DEBUG(0, ("dcerpc_netr_LogonGetCapabilities_r_recv failed with %s\n",
  2357. + nt_errstr(state->r.out.result)));
  2358. + tevent_req_nterror(req, state->r.out.result);
  2359. + return;
  2360. + }
  2361. +
  2362. + if (state->creds->negotiate_flags !=
  2363. + state->r.out.capabilities->server_capabilities) {
  2364. + DEBUG(0, ("The client capabilities don't match the server "
  2365. + "capabilities: local[0x%08X] remote[0x%08X]\n",
  2366. + state->creds->negotiate_flags,
  2367. + state->capabilities.server_capabilities));
  2368. + tevent_req_nterror(req,
  2369. + NT_STATUS_INVALID_NETWORK_RESPONSE);
  2370. + return;
  2371. + }
  2372. +
  2373. + /* TODO: Add downgrade dectection. */
  2374. +
  2375. + tevent_req_done(req);
  2376. + return;
  2377. +}
  2378. +
  2379. static NTSTATUS rpc_bind_next_send(struct tevent_req *req,
  2380. struct rpc_pipe_bind_state *state,
  2381. DATA_BLOB *auth_token)
  2382. --- a/source3/librpc/rpc/dcerpc.h
  2383. +++ b/source3/librpc/rpc/dcerpc.h
  2384. @@ -39,6 +39,7 @@ struct NL_AUTH_MESSAGE;
  2385. struct pipe_auth_data {
  2386. enum dcerpc_AuthType auth_type;
  2387. enum dcerpc_AuthLevel auth_level;
  2388. + bool verified_bitmask1;
  2389. void *auth_ctx;
  2390. --- a/source3/rpc_client/rpc_client.h
  2391. +++ b/source3/rpc_client/rpc_client.h
  2392. @@ -39,6 +39,7 @@ struct rpc_pipe_client {
  2393. struct ndr_syntax_id abstract_syntax;
  2394. struct ndr_syntax_id transfer_syntax;
  2395. + bool verified_pcontext;
  2396. char *desthost;
  2397. char *srv_name_slash;
  2398. --- /dev/null
  2399. +++ b/librpc/ndr/ndr_dcerpc.h
  2400. @@ -0,0 +1,25 @@
  2401. +/*
  2402. + Unix SMB/CIFS implementation.
  2403. +
  2404. + Manually parsed structures found in the DCERPC protocol
  2405. +
  2406. + Copyright (C) Stefan Metzmacher 2014
  2407. + Copyright (C) Gregor Beck 2014
  2408. +
  2409. + This program is free software; you can redistribute it and/or modify
  2410. + it under the terms of the GNU General Public License as published by
  2411. + the Free Software Foundation; either version 3 of the License, or
  2412. + (at your option) any later version.
  2413. +
  2414. + This program is distributed in the hope that it will be useful,
  2415. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  2416. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2417. + GNU General Public License for more details.
  2418. +
  2419. + You should have received a copy of the GNU General Public License
  2420. + along with this program. If not, see <http://www.gnu.org/licenses/>.
  2421. +*/
  2422. +
  2423. +enum ndr_err_code ndr_pop_dcerpc_sec_verification_trailer(
  2424. + struct ndr_pull *ndr, TALLOC_CTX *mem_ctx,
  2425. + struct dcerpc_sec_verification_trailer **_r);
  2426. --- /dev/null
  2427. +++ b/librpc/ABI/ndr-0.0.3.sigs
  2428. @@ -0,0 +1,251 @@
  2429. +GUID_all_zero: bool (const struct GUID *)
  2430. +GUID_compare: int (const struct GUID *, const struct GUID *)
  2431. +GUID_equal: bool (const struct GUID *, const struct GUID *)
  2432. +GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
  2433. +GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
  2434. +GUID_from_string: NTSTATUS (const char *, struct GUID *)
  2435. +GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
  2436. +GUID_random: struct GUID (void)
  2437. +GUID_string: char *(TALLOC_CTX *, const struct GUID *)
  2438. +GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
  2439. +GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
  2440. +GUID_zero: struct GUID (void)
  2441. +ndr_align_size: size_t (uint32_t, size_t)
  2442. +ndr_charset_length: uint32_t (const void *, charset_t)
  2443. +ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
  2444. +ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
  2445. +ndr_check_padding: void (struct ndr_pull *, size_t)
  2446. +ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
  2447. +ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
  2448. +ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
  2449. +ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
  2450. +ndr_map_error2errno: int (enum ndr_err_code)
  2451. +ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
  2452. +ndr_map_error2string: const char *(enum ndr_err_code)
  2453. +ndr_policy_handle_empty: bool (const struct policy_handle *)
  2454. +ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
  2455. +ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
  2456. +ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
  2457. +ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
  2458. +ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
  2459. +ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
  2460. +ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
  2461. +ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
  2462. +ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
  2463. +ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
  2464. +ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
  2465. +ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
  2466. +ndr_print_bool: void (struct ndr_print *, const char *, const bool)
  2467. +ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
  2468. +ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
  2469. +ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
  2470. +ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
  2471. +ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
  2472. +ndr_print_double: void (struct ndr_print *, const char *, double)
  2473. +ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
  2474. +ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
  2475. +ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
  2476. +ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
  2477. +ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
  2478. +ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
  2479. +ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
  2480. +ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
  2481. +ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
  2482. +ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
  2483. +ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
  2484. +ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
  2485. +ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
  2486. +ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
  2487. +ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
  2488. +ndr_print_null: void (struct ndr_print *)
  2489. +ndr_print_pointer: void (struct ndr_print *, const char *, void *)
  2490. +ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
  2491. +ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
  2492. +ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
  2493. +ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
  2494. +ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
  2495. +ndr_print_string: void (struct ndr_print *, const char *, const char *)
  2496. +ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
  2497. +ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
  2498. +ndr_print_struct: void (struct ndr_print *, const char *, const char *)
  2499. +ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
  2500. +ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
  2501. +ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
  2502. +ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
  2503. +ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
  2504. +ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
  2505. +ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
  2506. +ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
  2507. +ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
  2508. +ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
  2509. +ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
  2510. +ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
  2511. +ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
  2512. +ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
  2513. +ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
  2514. +ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
  2515. +ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
  2516. +ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
  2517. +ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
  2518. +ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
  2519. +ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
  2520. +ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
  2521. +ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
  2522. +ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
  2523. +ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
  2524. +ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
  2525. +ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
  2526. +ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
  2527. +ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
  2528. +ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
  2529. +ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
  2530. +ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
  2531. +ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
  2532. +ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
  2533. +ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
  2534. +ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
  2535. +ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
  2536. +ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
  2537. +ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
  2538. +ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
  2539. +ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
  2540. +ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
  2541. +ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
  2542. +ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
  2543. +ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
  2544. +ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
  2545. +ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
  2546. +ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
  2547. +ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
  2548. +ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
  2549. +ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
  2550. +ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
  2551. +ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
  2552. +ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
  2553. +ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
  2554. +ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
  2555. +ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
  2556. +ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
  2557. +ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
  2558. +ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
  2559. +ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
  2560. +ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
  2561. +ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
  2562. +ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
  2563. +ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
  2564. +ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
  2565. +ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
  2566. +ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
  2567. +ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
  2568. +ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
  2569. +ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
  2570. +ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
  2571. +ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
  2572. +ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
  2573. +ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
  2574. +ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
  2575. +ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
  2576. +ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
  2577. +ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
  2578. +ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
  2579. +ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
  2580. +ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
  2581. +ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
  2582. +ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
  2583. +ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
  2584. +ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
  2585. +ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
  2586. +ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
  2587. +ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
  2588. +ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
  2589. +ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
  2590. +ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
  2591. +ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
  2592. +ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
  2593. +ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
  2594. +ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
  2595. +ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
  2596. +ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
  2597. +ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
  2598. +ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
  2599. +ndr_push_blob: DATA_BLOB (struct ndr_push *)
  2600. +ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
  2601. +ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
  2602. +ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
  2603. +ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
  2604. +ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
  2605. +ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
  2606. +ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  2607. +ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
  2608. +ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
  2609. +ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
  2610. +ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
  2611. +ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
  2612. +ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
  2613. +ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
  2614. +ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
  2615. +ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
  2616. +ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
  2617. +ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
  2618. +ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
  2619. +ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
  2620. +ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
  2621. +ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
  2622. +ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
  2623. +ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
  2624. +ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  2625. +ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
  2626. +ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
  2627. +ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
  2628. +ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
  2629. +ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
  2630. +ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
  2631. +ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
  2632. +ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
  2633. +ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
  2634. +ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
  2635. +ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
  2636. +ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
  2637. +ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
  2638. +ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
  2639. +ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
  2640. +ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
  2641. +ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
  2642. +ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  2643. +ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
  2644. +ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
  2645. +ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
  2646. +ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
  2647. +ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
  2648. +ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
  2649. +ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
  2650. +ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
  2651. +ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
  2652. +ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  2653. +ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
  2654. +ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
  2655. +ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
  2656. +ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
  2657. +ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
  2658. +ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
  2659. +ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
  2660. +ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
  2661. +ndr_set_flags: void (uint32_t *, uint32_t)
  2662. +ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
  2663. +ndr_size_GUID: size_t (const struct GUID *, int)
  2664. +ndr_size_string: uint32_t (int, const char * const *, int)
  2665. +ndr_size_string_array: size_t (const char **, uint32_t, int)
  2666. +ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
  2667. +ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
  2668. +ndr_string_array_size: size_t (struct ndr_push *, const char *)
  2669. +ndr_string_length: uint32_t (const void *, uint32_t)
  2670. +ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
  2671. +ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
  2672. +ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
  2673. +ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
  2674. +ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
  2675. +ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
  2676. +ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
  2677. +ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
  2678. +ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
  2679. +ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
  2680. --- a/librpc/ndr/ndr_misc.c
  2681. +++ b/librpc/ndr/ndr_misc.c
  2682. @@ -35,3 +35,50 @@ bool ndr_syntax_id_equal(const struct nd
  2683. return GUID_equal(&i1->uuid, &i2->uuid)
  2684. && (i1->if_version == i2->if_version);
  2685. }
  2686. +
  2687. +_PUBLIC_ char *ndr_syntax_id_to_string(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *id)
  2688. +{
  2689. + return talloc_asprintf(mem_ctx,
  2690. + "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x/0x%08x",
  2691. + id->uuid.time_low, id->uuid.time_mid,
  2692. + id->uuid.time_hi_and_version,
  2693. + id->uuid.clock_seq[0],
  2694. + id->uuid.clock_seq[1],
  2695. + id->uuid.node[0], id->uuid.node[1],
  2696. + id->uuid.node[2], id->uuid.node[3],
  2697. + id->uuid.node[4], id->uuid.node[5],
  2698. + (unsigned)id->if_version);
  2699. +}
  2700. +
  2701. +_PUBLIC_ bool ndr_syntax_id_from_string(const char *s, struct ndr_syntax_id *id)
  2702. +{
  2703. + int ret;
  2704. + size_t i;
  2705. + uint32_t time_low;
  2706. + uint32_t time_mid, time_hi_and_version;
  2707. + uint32_t clock_seq[2];
  2708. + uint32_t node[6];
  2709. + uint32_t if_version;
  2710. +
  2711. + ret = sscanf(s,
  2712. + "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x/0x%08x",
  2713. + &time_low, &time_mid, &time_hi_and_version,
  2714. + &clock_seq[0], &clock_seq[1],
  2715. + &node[0], &node[1], &node[2], &node[3], &node[4], &node[5],
  2716. + &if_version);
  2717. + if (ret != 12) {
  2718. + return false;
  2719. + }
  2720. +
  2721. + id->uuid.time_low = time_low;
  2722. + id->uuid.time_mid = time_mid;
  2723. + id->uuid.time_hi_and_version = time_hi_and_version;
  2724. + id->uuid.clock_seq[0] = clock_seq[0];
  2725. + id->uuid.clock_seq[1] = clock_seq[1];
  2726. + for (i=0; i<6; i++) {
  2727. + id->uuid.node[i] = node[i];
  2728. + }
  2729. + id->if_version = if_version;
  2730. +
  2731. + return true;
  2732. +}
  2733. --- a/librpc/rpc/dcerpc_util.c
  2734. +++ b/librpc/rpc/dcerpc_util.c
  2735. @@ -27,6 +27,7 @@
  2736. #include "librpc/rpc/dcerpc.h"
  2737. #include "librpc/gen_ndr/ndr_dcerpc.h"
  2738. #include "rpc_common.h"
  2739. +#include "lib/util/bitmap.h"
  2740. /* we need to be able to get/set the fragment length without doing a full
  2741. decode */
  2742. @@ -341,3 +342,194 @@ NTSTATUS dcerpc_read_ncacn_packet_recv(s
  2743. tevent_req_received(req);
  2744. return NT_STATUS_OK;
  2745. }
  2746. +
  2747. +struct dcerpc_sec_vt_header2 dcerpc_sec_vt_header2_from_ncacn_packet(const struct ncacn_packet *pkt)
  2748. +{
  2749. + struct dcerpc_sec_vt_header2 ret;
  2750. +
  2751. + ZERO_STRUCT(ret);
  2752. + ret.ptype = pkt->ptype;
  2753. + memcpy(&ret.drep, pkt->drep, sizeof(ret.drep));
  2754. + ret.call_id = pkt->call_id;
  2755. +
  2756. + switch (pkt->ptype) {
  2757. + case DCERPC_PKT_REQUEST:
  2758. + ret.context_id = pkt->u.request.context_id;
  2759. + ret.opnum = pkt->u.request.opnum;
  2760. + break;
  2761. +
  2762. + case DCERPC_PKT_RESPONSE:
  2763. + ret.context_id = pkt->u.response.context_id;
  2764. + break;
  2765. +
  2766. + case DCERPC_PKT_FAULT:
  2767. + ret.context_id = pkt->u.fault.context_id;
  2768. + break;
  2769. +
  2770. + default:
  2771. + break;
  2772. + }
  2773. +
  2774. + return ret;
  2775. +}
  2776. +
  2777. +bool dcerpc_sec_vt_header2_equal(const struct dcerpc_sec_vt_header2 *v1,
  2778. + const struct dcerpc_sec_vt_header2 *v2)
  2779. +{
  2780. + if (v1->ptype != v2->ptype) {
  2781. + return false;
  2782. + }
  2783. +
  2784. + if (memcmp(v1->drep, v2->drep, sizeof(v1->drep)) != 0) {
  2785. + return false;
  2786. + }
  2787. +
  2788. + if (v1->call_id != v2->call_id) {
  2789. + return false;
  2790. + }
  2791. +
  2792. + if (v1->context_id != v2->context_id) {
  2793. + return false;
  2794. + }
  2795. +
  2796. + if (v1->opnum != v2->opnum) {
  2797. + return false;
  2798. + }
  2799. +
  2800. + return true;
  2801. +}
  2802. +
  2803. +static bool dcerpc_sec_vt_is_valid(const struct dcerpc_sec_verification_trailer *r)
  2804. +{
  2805. + bool ret = false;
  2806. + TALLOC_CTX *frame = talloc_stackframe();
  2807. + struct bitmap *commands_seen;
  2808. + int i;
  2809. +
  2810. + if (r->count.count == 0) {
  2811. + ret = true;
  2812. + goto done;
  2813. + }
  2814. +
  2815. + if (memcmp(r->magic, DCERPC_SEC_VT_MAGIC, sizeof(r->magic)) != 0) {
  2816. + goto done;
  2817. + }
  2818. +
  2819. + commands_seen = bitmap_talloc(frame, DCERPC_SEC_VT_COMMAND_ENUM + 1);
  2820. + if (commands_seen == NULL) {
  2821. + goto done;
  2822. + }
  2823. +
  2824. + for (i=0; i < r->count.count; i++) {
  2825. + enum dcerpc_sec_vt_command_enum cmd =
  2826. + r->commands[i].command & DCERPC_SEC_VT_COMMAND_ENUM;
  2827. +
  2828. + if (bitmap_query(commands_seen, cmd)) {
  2829. + /* Each command must appear at most once. */
  2830. + goto done;
  2831. + }
  2832. + bitmap_set(commands_seen, cmd);
  2833. +
  2834. + switch (cmd) {
  2835. + case DCERPC_SEC_VT_COMMAND_BITMASK1:
  2836. + case DCERPC_SEC_VT_COMMAND_PCONTEXT:
  2837. + case DCERPC_SEC_VT_COMMAND_HEADER2:
  2838. + break;
  2839. + default:
  2840. + if ((r->commands[i].u._unknown.length % 4) != 0) {
  2841. + goto done;
  2842. + }
  2843. + break;
  2844. + }
  2845. + }
  2846. + ret = true;
  2847. +done:
  2848. + TALLOC_FREE(frame);
  2849. + return ret;
  2850. +}
  2851. +
  2852. +#define CHECK(msg, ok) \
  2853. +do { \
  2854. + if (!ok) { \
  2855. + DEBUG(10, ("SEC_VT check %s failed\n", msg)); \
  2856. + return false; \
  2857. + } \
  2858. +} while(0)
  2859. +
  2860. +#define CHECK_SYNTAX(msg, s1, s2) \
  2861. +do { \
  2862. + if (!ndr_syntax_id_equal(&s1, &s2)) { \
  2863. + TALLOC_CTX *frame = talloc_stackframe(); \
  2864. + DEBUG(10, ("SEC_VT check %s failed: %s vs. %s\n", msg, \
  2865. + ndr_syntax_id_to_string(frame, &s1), \
  2866. + ndr_syntax_id_to_string(frame, &s1))); \
  2867. + TALLOC_FREE(frame); \
  2868. + return false; \
  2869. + } \
  2870. +} while(0)
  2871. +
  2872. +
  2873. +bool dcerpc_sec_verification_trailer_check(
  2874. + const struct dcerpc_sec_verification_trailer *vt,
  2875. + const uint32_t *bitmask1,
  2876. + const struct dcerpc_sec_vt_pcontext *pcontext,
  2877. + const struct dcerpc_sec_vt_header2 *header2)
  2878. +{
  2879. + size_t i;
  2880. +
  2881. + if (!dcerpc_sec_vt_is_valid(vt)) {
  2882. + return false;
  2883. + }
  2884. +
  2885. + for (i=0; i < vt->count.count; i++) {
  2886. + struct dcerpc_sec_vt *c = &vt->commands[i];
  2887. +
  2888. + switch (c->command & DCERPC_SEC_VT_COMMAND_ENUM) {
  2889. + case DCERPC_SEC_VT_COMMAND_BITMASK1:
  2890. + if (bitmask1 == NULL) {
  2891. + CHECK("Bitmask1 must_process_command",
  2892. + !(c->command & DCERPC_SEC_VT_MUST_PROCESS));
  2893. + break;
  2894. + }
  2895. +
  2896. + if (c->u.bitmask1 & DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING) {
  2897. + CHECK("Bitmask1 client_header_signing",
  2898. + *bitmask1 & DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING);
  2899. + }
  2900. + break;
  2901. +
  2902. + case DCERPC_SEC_VT_COMMAND_PCONTEXT:
  2903. + if (pcontext == NULL) {
  2904. + CHECK("Pcontext must_process_command",
  2905. + !(c->command & DCERPC_SEC_VT_MUST_PROCESS));
  2906. + break;
  2907. + }
  2908. +
  2909. + CHECK_SYNTAX("Pcontect abstract_syntax",
  2910. + pcontext->abstract_syntax,
  2911. + c->u.pcontext.abstract_syntax);
  2912. + CHECK_SYNTAX("Pcontext transfer_syntax",
  2913. + pcontext->transfer_syntax,
  2914. + c->u.pcontext.transfer_syntax);
  2915. + break;
  2916. +
  2917. + case DCERPC_SEC_VT_COMMAND_HEADER2: {
  2918. + if (header2 == NULL) {
  2919. + CHECK("Header2 must_process_command",
  2920. + !(c->command & DCERPC_SEC_VT_MUST_PROCESS));
  2921. + break;
  2922. + }
  2923. +
  2924. + CHECK("Header2", dcerpc_sec_vt_header2_equal(header2, &c->u.header2));
  2925. + break;
  2926. + }
  2927. +
  2928. + default:
  2929. + CHECK("Unknown must_process_command",
  2930. + !(c->command & DCERPC_SEC_VT_MUST_PROCESS));
  2931. + break;
  2932. + }
  2933. + }
  2934. +
  2935. + return true;
  2936. +}
  2937. --- a/librpc/rpc/rpc_common.h
  2938. +++ b/librpc/rpc/rpc_common.h
  2939. @@ -296,4 +296,45 @@ NTSTATUS dcerpc_binding_handle_call(stru
  2940. TALLOC_CTX *r_mem,
  2941. void *r_ptr);
  2942. +/**
  2943. + * Extract header information from a ncacn_packet
  2944. + * as a dcerpc_sec_vt_header2 as used by the security verification trailer.
  2945. + *
  2946. + * @param[in] pkt a packet
  2947. + *
  2948. + * @return a dcerpc_sec_vt_header2
  2949. + */
  2950. +struct dcerpc_sec_vt_header2 dcerpc_sec_vt_header2_from_ncacn_packet(const struct ncacn_packet *pkt);
  2951. +
  2952. +
  2953. +/**
  2954. + * Test if two dcerpc_sec_vt_header2 structures are equal
  2955. + * without consideration of reserved fields.
  2956. + *
  2957. + * @param v1 a pointer to a dcerpc_sec_vt_header2 structure
  2958. + * @param v2 a pointer to a dcerpc_sec_vt_header2 structure
  2959. + *
  2960. + * @retval true if *v1 equals *v2
  2961. + */
  2962. +bool dcerpc_sec_vt_header2_equal(const struct dcerpc_sec_vt_header2 *v1,
  2963. + const struct dcerpc_sec_vt_header2 *v2);
  2964. +
  2965. +/**
  2966. + * Check for consistency of the security verification trailer with the PDU header.
  2967. + * See <a href="http://msdn.microsoft.com/en-us/library/cc243559.aspx">MS-RPCE 2.2.2.13</a>.
  2968. + * A check with an empty trailer succeeds.
  2969. + *
  2970. + * @param[in] vt a pointer to the security verification trailer.
  2971. + * @param[in] bitmask1 which flags were negotiated on the connection.
  2972. + * @param[in] pcontext the syntaxes negotiatied for the presentation context.
  2973. + * @param[in] header2 some fields from the PDU header.
  2974. + *
  2975. + * @retval true on success.
  2976. + */
  2977. +bool dcerpc_sec_verification_trailer_check(
  2978. + const struct dcerpc_sec_verification_trailer *vt,
  2979. + const uint32_t *bitmask1,
  2980. + const struct dcerpc_sec_vt_pcontext *pcontext,
  2981. + const struct dcerpc_sec_vt_header2 *header2);
  2982. +
  2983. #endif /* __DEFAULT_LIBRPC_RPCCOMMON_H__ */
  2984. --- a/source4/torture/ndr/ndr.c
  2985. +++ b/source4/torture/ndr/ndr.c
  2986. @@ -29,40 +29,65 @@ struct ndr_pull_test_data {
  2987. DATA_BLOB data_context;
  2988. size_t struct_size;
  2989. ndr_pull_flags_fn_t pull_fn;
  2990. + ndr_push_flags_fn_t push_fn;
  2991. int ndr_flags;
  2992. + int flags;
  2993. };
  2994. -static bool wrap_ndr_pull_test(struct torture_context *tctx,
  2995. - struct torture_tcase *tcase,
  2996. - struct torture_test *test)
  2997. +static bool wrap_ndr_pullpush_test(struct torture_context *tctx,
  2998. + struct torture_tcase *tcase,
  2999. + struct torture_test *test)
  3000. {
  3001. bool (*check_fn) (struct torture_context *ctx, void *data) = test->fn;
  3002. const struct ndr_pull_test_data *data = (const struct ndr_pull_test_data *)test->data;
  3003. - void *ds = talloc_zero_size(tctx, data->struct_size);
  3004. struct ndr_pull *ndr = ndr_pull_init_blob(&(data->data), tctx);
  3005. + void *ds = talloc_zero_size(ndr, data->struct_size);
  3006. + bool ret;
  3007. + uint32_t highest_ofs;
  3008. +
  3009. + ndr->flags |= data->flags;
  3010. ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
  3011. torture_assert_ndr_success(tctx, data->pull_fn(ndr, data->ndr_flags, ds),
  3012. "pulling");
  3013. - torture_assert(tctx, ndr->offset == ndr->data_size,
  3014. + if (ndr->offset > ndr->relative_highest_offset) {
  3015. + highest_ofs = ndr->offset;
  3016. + } else {
  3017. + highest_ofs = ndr->relative_highest_offset;
  3018. + }
  3019. +
  3020. + torture_assert(tctx, highest_ofs == ndr->data_size,
  3021. talloc_asprintf(tctx,
  3022. - "%d unread bytes", ndr->data_size - ndr->offset));
  3023. + "%d unread bytes", ndr->data_size - highest_ofs));
  3024. - if (check_fn != NULL)
  3025. - return check_fn(tctx, ds);
  3026. - else
  3027. - return true;
  3028. + if (check_fn != NULL) {
  3029. + ret = check_fn(tctx, ds);
  3030. + } else {
  3031. + ret = true;
  3032. + }
  3033. +
  3034. + if (data->push_fn != NULL) {
  3035. + DATA_BLOB outblob;
  3036. + torture_assert_ndr_success(tctx, ndr_push_struct_blob(&outblob, ndr, ds, data->push_fn), "pushing");
  3037. + torture_assert_data_blob_equal(tctx, outblob, data->data, "ndr push compare");
  3038. + }
  3039. +
  3040. + talloc_free(ndr);
  3041. + return ret;
  3042. }
  3043. -_PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_test(
  3044. - struct torture_suite *suite,
  3045. - const char *name, ndr_pull_flags_fn_t pull_fn,
  3046. - DATA_BLOB db,
  3047. - size_t struct_size,
  3048. - int ndr_flags,
  3049. - bool (*check_fn) (struct torture_context *ctx, void *data))
  3050. +_PUBLIC_ struct torture_test *_torture_suite_add_ndr_pullpush_test(
  3051. + struct torture_suite *suite,
  3052. + const char *name,
  3053. + ndr_pull_flags_fn_t pull_fn,
  3054. + ndr_push_flags_fn_t push_fn,
  3055. + DATA_BLOB db,
  3056. + size_t struct_size,
  3057. + int ndr_flags,
  3058. + int flags,
  3059. + bool (*check_fn) (struct torture_context *ctx, void *data))
  3060. {
  3061. struct torture_test *test;
  3062. struct torture_tcase *tcase;
  3063. @@ -74,12 +99,16 @@ _PUBLIC_ struct torture_test *_torture_s
  3064. test->name = talloc_strdup(test, name);
  3065. test->description = NULL;
  3066. - test->run = wrap_ndr_pull_test;
  3067. + test->run = wrap_ndr_pullpush_test;
  3068. +
  3069. data = talloc(test, struct ndr_pull_test_data);
  3070. data->data = db;
  3071. data->ndr_flags = ndr_flags;
  3072. + data->flags = flags;
  3073. data->struct_size = struct_size;
  3074. data->pull_fn = pull_fn;
  3075. + data->push_fn = push_fn;
  3076. +
  3077. test->data = data;
  3078. test->fn = check_fn;
  3079. test->dangerous = false;
  3080. @@ -89,6 +118,7 @@ _PUBLIC_ struct torture_test *_torture_s
  3081. return test;
  3082. }
  3083. +
  3084. static bool wrap_ndr_inout_pull_test(struct torture_context *tctx,
  3085. struct torture_tcase *tcase,
  3086. struct torture_test *test)
  3087. @@ -97,6 +127,7 @@ static bool wrap_ndr_inout_pull_test(str
  3088. const struct ndr_pull_test_data *data = (const struct ndr_pull_test_data *)test->data;
  3089. void *ds = talloc_zero_size(tctx, data->struct_size);
  3090. struct ndr_pull *ndr;
  3091. + uint32_t highest_ofs;
  3092. /* handle NDR_IN context */
  3093. @@ -109,8 +140,14 @@ static bool wrap_ndr_inout_pull_test(str
  3094. data->pull_fn(ndr, NDR_IN, ds),
  3095. "ndr pull of context failed");
  3096. - torture_assert(tctx, ndr->offset == ndr->data_size,
  3097. - talloc_asprintf(tctx, "%d unread bytes", ndr->data_size - ndr->offset));
  3098. + if (ndr->offset > ndr->relative_highest_offset) {
  3099. + highest_ofs = ndr->offset;
  3100. + } else {
  3101. + highest_ofs = ndr->relative_highest_offset;
  3102. + }
  3103. +
  3104. + torture_assert(tctx, highest_ofs == ndr->data_size,
  3105. + talloc_asprintf(tctx, "%d unread bytes", ndr->data_size - highest_ofs));
  3106. talloc_free(ndr);
  3107. @@ -125,8 +162,14 @@ static bool wrap_ndr_inout_pull_test(str
  3108. data->pull_fn(ndr, NDR_OUT, ds),
  3109. "ndr pull failed");
  3110. - torture_assert(tctx, ndr->offset == ndr->data_size,
  3111. - talloc_asprintf(tctx, "%d unread bytes", ndr->data_size - ndr->offset));
  3112. + if (ndr->offset > ndr->relative_highest_offset) {
  3113. + highest_ofs = ndr->offset;
  3114. + } else {
  3115. + highest_ofs = ndr->relative_highest_offset;
  3116. + }
  3117. +
  3118. + torture_assert(tctx, highest_ofs == ndr->data_size,
  3119. + talloc_asprintf(tctx, "%d unread bytes", ndr->data_size - highest_ofs));
  3120. talloc_free(ndr);
  3121. --- a/source4/torture/ndr/ndr.h
  3122. +++ b/source4/torture/ndr/ndr.h
  3123. @@ -24,12 +24,15 @@
  3124. #include "librpc/ndr/libndr.h"
  3125. #include "libcli/security/security.h"
  3126. -_PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_test(
  3127. +_PUBLIC_ struct torture_test *_torture_suite_add_ndr_pullpush_test(
  3128. struct torture_suite *suite,
  3129. - const char *name, ndr_pull_flags_fn_t fn,
  3130. + const char *name,
  3131. + ndr_pull_flags_fn_t pull_fn,
  3132. + ndr_push_flags_fn_t push_fn,
  3133. DATA_BLOB db,
  3134. size_t struct_size,
  3135. int ndr_flags,
  3136. + int flags,
  3137. bool (*check_fn) (struct torture_context *, void *data));
  3138. _PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_inout_test(
  3139. @@ -41,20 +44,32 @@ _PUBLIC_ struct torture_test *_torture_s
  3140. bool (*check_fn) (struct torture_context *ctx, void *data));
  3141. #define torture_suite_add_ndr_pull_test(suite,name,data,check_fn) \
  3142. - _torture_suite_add_ndr_pull_test(suite, #name, \
  3143. - (ndr_pull_flags_fn_t)ndr_pull_ ## name, data_blob_talloc(suite, data, sizeof(data)), \
  3144. - sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, (bool (*) (struct torture_context *, void *)) check_fn);
  3145. + _torture_suite_add_ndr_pullpush_test(suite, #name, \
  3146. + (ndr_pull_flags_fn_t)ndr_pull_ ## name, NULL, data_blob_const(data, sizeof(data)), \
  3147. + sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, 0, (bool (*) (struct torture_context *, void *)) check_fn);
  3148. #define torture_suite_add_ndr_pull_fn_test(suite,name,data,flags,check_fn) \
  3149. - _torture_suite_add_ndr_pull_test(suite, #name "_" #flags, \
  3150. - (ndr_pull_flags_fn_t)ndr_pull_ ## name, data_blob_talloc(suite, data, sizeof(data)), \
  3151. - sizeof(struct name), flags, (bool (*) (struct torture_context *, void *)) check_fn);
  3152. + _torture_suite_add_ndr_pullpush_test(suite, #name "_" #flags, \
  3153. + (ndr_pull_flags_fn_t)ndr_pull_ ## name, NULL, data_blob_const(data, sizeof(data)), \
  3154. + sizeof(struct name), flags, 0, (bool (*) (struct torture_context *, void *)) check_fn);
  3155. +
  3156. +#define torture_suite_add_ndr_pull_fn_test_flags(suite,name,data,flags,flags2,check_fn) \
  3157. + _torture_suite_add_ndr_pullpush_test(suite, #name "_" #flags "_" #flags2, \
  3158. + (ndr_pull_flags_fn_t)ndr_pull_ ## name, NULL, data_blob_const(data, sizeof(data)), \
  3159. + sizeof(struct name), flags, flags2, (bool (*) (struct torture_context *, void *)) check_fn);
  3160. +
  3161. +#define torture_suite_add_ndr_pullpush_test(suite,name,data_blob,check_fn) \
  3162. + _torture_suite_add_ndr_pullpush_test(suite, #name, \
  3163. + (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
  3164. + (ndr_push_flags_fn_t)ndr_push_ ## name, \
  3165. + data_blob, \
  3166. + sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, 0, (bool (*) (struct torture_context *, void *)) check_fn);
  3167. #define torture_suite_add_ndr_pull_io_test(suite,name,data_in,data_out,check_fn_out) \
  3168. _torture_suite_add_ndr_pull_inout_test(suite, #name "_INOUT", \
  3169. (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
  3170. - data_blob_talloc(suite, data_in, sizeof(data_in)), \
  3171. - data_blob_talloc(suite, data_out, sizeof(data_out)), \
  3172. + data_blob_const(data_in, sizeof(data_in)), \
  3173. + data_blob_const(data_out, sizeof(data_out)), \
  3174. sizeof(struct name), \
  3175. (bool (*) (struct torture_context *, void *)) check_fn_out);
  3176. --- a/source4/torture/ndr/dfsblob.c
  3177. +++ b/source4/torture/ndr/dfsblob.c
  3178. @@ -74,11 +74,11 @@ struct torture_suite *ndr_dfsblob_suite(
  3179. {
  3180. struct torture_suite *suite = torture_suite_create(ctx, "dfsblob");
  3181. - torture_suite_add_ndr_pull_fn_test(suite, dfs_GetDFSReferral_in, dfs_get_ref_in, NDR_IN, NULL);
  3182. + torture_suite_add_ndr_pull_test(suite, dfs_GetDFSReferral_in, dfs_get_ref_in, NULL);
  3183. - torture_suite_add_ndr_pull_fn_test(suite, dfs_referral_resp, dfs_get_ref_out2, NDR_BUFFERS|NDR_SCALARS, NULL);
  3184. + torture_suite_add_ndr_pull_test(suite, dfs_referral_resp, dfs_get_ref_out2, NULL);
  3185. - torture_suite_add_ndr_pull_fn_test(suite, dfs_referral_resp, dfs_get_ref_out, NDR_BUFFERS|NDR_SCALARS,dfs_referral_out_check);
  3186. + torture_suite_add_ndr_pull_test(suite, dfs_referral_resp, dfs_get_ref_out,dfs_referral_out_check);
  3187. return suite;
  3188. }
  3189. --- a/source4/torture/ndr/nbt.c
  3190. +++ b/source4/torture/ndr/nbt.c
  3191. @@ -62,9 +62,9 @@ struct torture_suite *ndr_nbt_suite(TALL
  3192. {
  3193. struct torture_suite *suite = torture_suite_create(ctx, "nbt");
  3194. - torture_suite_add_ndr_pull_fn_test(suite, nbt_netlogon_packet, netlogon_logon_request_req_data, NDR_IN, netlogon_logon_request_req_check);
  3195. + torture_suite_add_ndr_pull_test(suite, nbt_netlogon_packet, netlogon_logon_request_req_data, netlogon_logon_request_req_check);
  3196. - torture_suite_add_ndr_pull_fn_test(suite, nbt_netlogon_response2, netlogon_logon_request_resp_data, NDR_IN, netlogon_logon_request_resp_check);
  3197. + torture_suite_add_ndr_pull_test(suite, nbt_netlogon_response2, netlogon_logon_request_resp_data, netlogon_logon_request_resp_check);
  3198. return suite;
  3199. }
  3200. --- a/source4/torture/ndr/ntlmssp.c
  3201. +++ b/source4/torture/ndr/ntlmssp.c
  3202. @@ -111,9 +111,10 @@ struct torture_suite *ndr_ntlmssp_suite(
  3203. {
  3204. struct torture_suite *suite = torture_suite_create(ctx, "ntlmssp");
  3205. - torture_suite_add_ndr_pull_fn_test(suite, NEGOTIATE_MESSAGE, ntlmssp_NEGOTIATE_MESSAGE_data, NDR_IN, ntlmssp_NEGOTIATE_MESSAGE_check);
  3206. - /* torture_suite_add_ndr_pull_fn_test(suite, CHALLENGE_MESSAGE, ntlmssp_CHALLENGE_MESSAGE_data, NDR_IN, ntlmssp_CHALLENGE_MESSAGE_check);
  3207. - torture_suite_add_ndr_pull_fn_test(suite, AUTHENTICATE_MESSAGE, ntlmssp_AUTHENTICATE_MESSAGE_data, NDR_IN, ntlmssp_AUTHENTICATE_MESSAGE_check); */
  3208. -
  3209. + torture_suite_add_ndr_pull_test(suite, NEGOTIATE_MESSAGE, ntlmssp_NEGOTIATE_MESSAGE_data, ntlmssp_NEGOTIATE_MESSAGE_check);
  3210. +#if 0
  3211. + torture_suite_add_ndr_pull_test(suite, CHALLENGE_MESSAGE, ntlmssp_CHALLENGE_MESSAGE_data, ntlmssp_CHALLENGE_MESSAGE_check);
  3212. + torture_suite_add_ndr_pull_test(suite, AUTHENTICATE_MESSAGE, ntlmssp_AUTHENTICATE_MESSAGE_data, ntlmssp_AUTHENTICATE_MESSAGE_check);
  3213. +#endif
  3214. return suite;
  3215. }
  3216. --- a/source4/torture/ndr/drsblobs.c
  3217. +++ b/source4/torture/ndr/drsblobs.c
  3218. @@ -115,6 +115,34 @@ static const uint8_t trust_domain_passwo
  3219. 0x38, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00
  3220. };
  3221. +/* these are taken from the trust objects of a w2k8r2 forest, with a
  3222. + * trust relationship between the forest parent and a child domain
  3223. + */
  3224. +static const char *trustAuthIncoming =
  3225. +"AQAAAAwAAAAcAQAASuQ+RXJdzAECAAAAAAEAAMOWL6UVfVKiJOUsGcT03H"
  3226. +"jHxr2ACsMMOV5ynM617Tp7idNC+c4egdqk4S9YEpvR2YvHmdZdymL6F7QKm8OkXazYZF2r/gZ/bI+"
  3227. +"jkWbsn4O8qyAc3OUKQRZwBbf+lxBW+vM4O3ZpUjz5BSKCcFQgM+MY91yVU8Nji3HNnvGnDquobFAZ"
  3228. +"hxjL+S1l5+QZgkfyfv5mQScGRbU1Lar1xg9G3JznUb7S6pvrBO2nwK8g+KZBfJy5UeULigDH4IWo/"
  3229. +"JmtaEGkKE2uiKIjdsEQd/uwnkouW26XzRc0ulfJnPFftGnT9KIcShPf7DLj/tstmQAAceRMFHJTY3"
  3230. +"PmxoowoK8HUyBK5D5Fcl3MAQIAAAAAAQAAw5YvpRV9UqIk5SwZxPTceMfGvYAKwww5XnKczrXtOnu"
  3231. +"J00L5zh6B2qThL1gSm9HZi8eZ1l3KYvoXtAqbw6RdrNhkXav+Bn9sj6ORZuyfg7yrIBzc5QpBFnAF"
  3232. +"t/6XEFb68zg7dmlSPPkFIoJwVCAz4xj3XJVTw2OLcc2e8acOq6hsUBmHGMv5LWXn5BmCR/J+/mZBJ"
  3233. +"wZFtTUtqvXGD0bcnOdRvtLqm+sE7afAryD4pkF8nLlR5QuKAMfghaj8ma1oQaQoTa6IoiN2wRB3+7"
  3234. +"CeSi5bbpfNFzS6V8mc8V+0adP0ohxKE9/sMuP+2y2ZAABx5EwUclNjc+bGijCgrwdTIA==";
  3235. +
  3236. +static const char *trustAuthOutgoing =
  3237. +"AQAAAAwAAAAcAQAASuQ+RXJdzAECAAAAAAEAAMOWL6UVfVKiJOUsGcT03H"
  3238. +"jHxr2ACsMMOV5ynM617Tp7idNC+c4egdqk4S9YEpvR2YvHmdZdymL6F7QKm8OkXazYZF2r/gZ/bI+"
  3239. +"jkWbsn4O8qyAc3OUKQRZwBbf+lxBW+vM4O3ZpUjz5BSKCcFQgM+MY91yVU8Nji3HNnvGnDquobFAZ"
  3240. +"hxjL+S1l5+QZgkfyfv5mQScGRbU1Lar1xg9G3JznUb7S6pvrBO2nwK8g+KZBfJy5UeULigDH4IWo/"
  3241. +"JmtaEGkKE2uiKIjdsEQd/uwnkouW26XzRc0ulfJnPFftGnT9KIcShPf7DLj/tstmQAAceRMFHJTY3"
  3242. +"PmxoowoK8HUyBK5D5Fcl3MAQIAAAAAAQAAw5YvpRV9UqIk5SwZxPTceMfGvYAKwww5XnKczrXtOnu"
  3243. +"J00L5zh6B2qThL1gSm9HZi8eZ1l3KYvoXtAqbw6RdrNhkXav+Bn9sj6ORZuyfg7yrIBzc5QpBFnAF"
  3244. +"t/6XEFb68zg7dmlSPPkFIoJwVCAz4xj3XJVTw2OLcc2e8acOq6hsUBmHGMv5LWXn5BmCR/J+/mZBJ"
  3245. +"wZFtTUtqvXGD0bcnOdRvtLqm+sE7afAryD4pkF8nLlR5QuKAMfghaj8ma1oQaQoTa6IoiN2wRB3+7"
  3246. +"CeSi5bbpfNFzS6V8mc8V+0adP0ohxKE9/sMuP+2y2ZAABx5EwUclNjc+bGijCgrwdTIA==";
  3247. +
  3248. +
  3249. static bool trust_domain_passwords_check_in(struct torture_context *tctx,
  3250. struct trustDomainPasswords *r)
  3251. {
  3252. @@ -154,8 +182,20 @@ struct torture_suite *ndr_drsblobs_suite
  3253. {
  3254. struct torture_suite *suite = torture_suite_create(ctx, "drsblobs");
  3255. - torture_suite_add_ndr_pull_fn_test(suite, ForestTrustInfo, forest_trust_info_data_out, NDR_IN, forest_trust_info_check_out);
  3256. - torture_suite_add_ndr_pull_fn_test(suite, trustDomainPasswords, trust_domain_passwords_in, NDR_IN, trust_domain_passwords_check_in);
  3257. + torture_suite_add_ndr_pull_test(suite, ForestTrustInfo, forest_trust_info_data_out, forest_trust_info_check_out);
  3258. + torture_suite_add_ndr_pull_test(suite, trustDomainPasswords, trust_domain_passwords_in, trust_domain_passwords_check_in);
  3259. +
  3260. +#if 0
  3261. + torture_suite_add_ndr_pullpush_test(suite,
  3262. + trustAuthInOutBlob,
  3263. + base64_decode_data_blob_talloc(suite, trustAuthIncoming),
  3264. + NULL);
  3265. +
  3266. + torture_suite_add_ndr_pullpush_test(suite,
  3267. + trustAuthInOutBlob,
  3268. + base64_decode_data_blob_talloc(suite, trustAuthOutgoing),
  3269. + NULL);
  3270. +#endif
  3271. return suite;
  3272. }
  3273. --- a/source3/rpcclient/rpcclient.c
  3274. +++ b/source3/rpcclient/rpcclient.c
  3275. @@ -1031,6 +1031,10 @@ out_free:
  3276. binding->transport = NCACN_NP;
  3277. }
  3278. + if (binding->flags & DCERPC_CONNECT) {
  3279. + pipe_default_auth_level = DCERPC_AUTH_LEVEL_CONNECT;
  3280. + pipe_default_auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
  3281. + }
  3282. if (binding->flags & DCERPC_SIGN) {
  3283. pipe_default_auth_level = DCERPC_AUTH_LEVEL_INTEGRITY;
  3284. pipe_default_auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
  3285. @@ -1044,12 +1048,6 @@ out_free:
  3286. pipe_default_auth_spnego_type = PIPE_AUTH_TYPE_SPNEGO_NTLMSSP;
  3287. }
  3288. if (binding->flags & DCERPC_AUTH_NTLM) {
  3289. - /* If neither Integrity or Privacy are requested then
  3290. - * Use just Connect level */
  3291. - if (pipe_default_auth_level == DCERPC_AUTH_LEVEL_NONE) {
  3292. - pipe_default_auth_level = DCERPC_AUTH_LEVEL_CONNECT;
  3293. - }
  3294. -
  3295. if (pipe_default_auth_type == DCERPC_AUTH_TYPE_SPNEGO) {
  3296. pipe_default_auth_spnego_type = PIPE_AUTH_TYPE_SPNEGO_NTLMSSP;
  3297. } else {
  3298. @@ -1057,18 +1055,19 @@ out_free:
  3299. }
  3300. }
  3301. if (binding->flags & DCERPC_AUTH_KRB5) {
  3302. - /* If neither Integrity or Privacy are requested then
  3303. - * Use just Connect level */
  3304. - if (pipe_default_auth_level == DCERPC_AUTH_LEVEL_NONE) {
  3305. - pipe_default_auth_level = DCERPC_AUTH_LEVEL_CONNECT;
  3306. - }
  3307. -
  3308. if (pipe_default_auth_type == DCERPC_AUTH_TYPE_SPNEGO) {
  3309. pipe_default_auth_spnego_type = PIPE_AUTH_TYPE_SPNEGO_KRB5;
  3310. } else {
  3311. pipe_default_auth_type = DCERPC_AUTH_TYPE_KRB5;
  3312. }
  3313. }
  3314. + if (pipe_default_auth_type != DCERPC_AUTH_TYPE_NONE) {
  3315. + /* If neither Integrity or Privacy are requested then
  3316. + * Use just Connect level */
  3317. + if (pipe_default_auth_level == DCERPC_AUTH_LEVEL_NONE) {
  3318. + pipe_default_auth_level = DCERPC_AUTH_LEVEL_CONNECT;
  3319. + }
  3320. + }
  3321. if (get_cmdline_auth_info_use_kerberos(rpcclient_auth_info)) {
  3322. flags |= CLI_FULL_CONNECTION_USE_KERBEROS |
  3323. --- /dev/null
  3324. +++ b/source3/script/tests/test_rpcclient.sh
  3325. @@ -0,0 +1,19 @@
  3326. +#!/bin/sh
  3327. +
  3328. +if [ $# -lt 1 ]; then
  3329. +cat <<EOF
  3330. +Usage: test_rpcclient.sh ccache binding <rpcclient commands>
  3331. +EOF
  3332. +exit 1;
  3333. +fi
  3334. +
  3335. +KRB5CCNAME=$1
  3336. +shift 1
  3337. +export KRB5CCNAME
  3338. +ADDARGS="$*"
  3339. +
  3340. +incdir=`dirname $0`/../../../testprogs/blackbox
  3341. +. $incdir/subunit.sh
  3342. +testit "rpcclient" $VALGRIND $BINDIR/rpcclient -c 'getusername' $ADDARGS || failed=`expr $failed + 1`
  3343. +
  3344. +testok $0 $failed
  3345. --- a/source3/selftest/tests.py
  3346. +++ b/source3/selftest/tests.py
  3347. @@ -208,7 +208,7 @@ if sub.returncode == 0:
  3348. plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmpcase -U$USERNAME%$PASSWORD')
  3349. test = 'rpc.lsa.lookupsids'
  3350. - auth_options = ["", "ntlm", "spnego" ]
  3351. + auth_options = ["", "ntlm", "spnego", "spnego,ntlm" ]
  3352. signseal_options = ["", ",connect", ",sign", ",seal"]
  3353. smb_options = ["", ",smb2"]
  3354. endianness_options = ["", ",bigendian"]
  3355. @@ -219,6 +219,9 @@ if sub.returncode == 0:
  3356. binding_string = "ncacn_np:$SERVER_IP[%s%s%s%s]" % (a, s, z, e)
  3357. options = binding_string + " -U$USERNAME%$PASSWORD"
  3358. plansmbtorturetestsuite(test, "s3dc", options, 'over ncacn_np with [%s%s%s%s] ' % (a, s, z, e))
  3359. + plantestsuite("samba3.blackbox.rpcclient over ncacn_np with [%s%s%s%s] " % (a, s, z, e), "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient.sh"),
  3360. + "none", options, configuration])
  3361. +
  3362. for e in endianness_options:
  3363. for a in auth_options:
  3364. for s in signseal_options:
  3365. --- a/source4/torture/rpc/rpc.c
  3366. +++ b/source4/torture/rpc/rpc.c
  3367. @@ -501,6 +501,7 @@ NTSTATUS torture_rpc_init(void)
  3368. torture_suite_add_suite(suite, torture_rpc_samr_passwords_pwdlastset(suite));
  3369. torture_suite_add_suite(suite, torture_rpc_samr_passwords_badpwdcount(suite));
  3370. torture_suite_add_suite(suite, torture_rpc_samr_passwords_lockout(suite));
  3371. + torture_suite_add_suite(suite, torture_rpc_samr_passwords_validate(suite));
  3372. torture_suite_add_suite(suite, torture_rpc_samr_user_privileges(suite));
  3373. torture_suite_add_suite(suite, torture_rpc_samr_large_dc(suite));
  3374. torture_suite_add_suite(suite, torture_rpc_epmapper(suite));
  3375. --- a/source4/torture/rpc/samr.c
  3376. +++ b/source4/torture/rpc/samr.c
  3377. @@ -7938,8 +7938,8 @@ static bool test_Connect(struct dcerpc_b
  3378. }
  3379. -static bool test_samr_ValidatePassword(struct dcerpc_pipe *p,
  3380. - struct torture_context *tctx)
  3381. +static bool test_samr_ValidatePassword(struct torture_context *tctx,
  3382. + struct dcerpc_pipe *p)
  3383. {
  3384. struct samr_ValidatePassword r;
  3385. union samr_ValidatePasswordReq req;
  3386. @@ -7951,6 +7951,10 @@ static bool test_samr_ValidatePassword(s
  3387. torture_comment(tctx, "Testing samr_ValidatePassword\n");
  3388. + if (p->conn->transport.transport != NCACN_IP_TCP) {
  3389. + torture_comment(tctx, "samr_ValidatePassword only should succeed over NCACN_IP_TCP!\n");
  3390. + }
  3391. +
  3392. ZERO_STRUCT(r);
  3393. r.in.level = NetValidatePasswordReset;
  3394. r.in.req = &req;
  3395. @@ -8074,8 +8078,6 @@ bool torture_rpc_samr_passwords(struct t
  3396. ret &= test_samr_handle_Close(b, torture, &ctx->handle);
  3397. - ret &= test_samr_ValidatePassword(p, torture);
  3398. -
  3399. return ret;
  3400. }
  3401. @@ -8370,4 +8372,15 @@ struct torture_suite *torture_rpc_samr_p
  3402. return suite;
  3403. }
  3404. +struct torture_suite *torture_rpc_samr_passwords_validate(TALLOC_CTX *mem_ctx)
  3405. +{
  3406. + struct torture_suite *suite = torture_suite_create(mem_ctx, "samr.passwords.validate");
  3407. + struct torture_rpc_tcase *tcase;
  3408. +
  3409. + tcase = torture_suite_add_rpc_iface_tcase(suite, "samr",
  3410. + &ndr_table_samr);
  3411. + torture_rpc_tcase_add_test(tcase, "validate",
  3412. + test_samr_ValidatePassword);
  3413. + return suite;
  3414. +}
  3415. --- a/source3/rpc_server/srv_pipe.c
  3416. +++ b/source3/rpc_server/srv_pipe.c
  3417. @@ -42,6 +42,7 @@
  3418. #include "auth.h"
  3419. #include "ntdomain.h"
  3420. #include "rpc_server/srv_pipe.h"
  3421. +#include "../librpc/ndr/ndr_dcerpc.h"
  3422. #undef DBGC_CLASS
  3423. #define DBGC_CLASS DBGC_RPC_SRV
  3424. @@ -202,7 +203,7 @@ bool create_next_pdu(struct pipes_struct
  3425. * the pipe gets closed. JRA.
  3426. */
  3427. if (p->fault_state) {
  3428. - setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR));
  3429. + setup_fault_pdu(p, NT_STATUS(p->fault_state));
  3430. return true;
  3431. }
  3432. @@ -336,7 +337,7 @@ static bool check_bind_req(struct pipes_
  3433. struct pipe_rpc_fns *context_fns;
  3434. DEBUG(3,("check_bind_req for %s\n",
  3435. - get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
  3436. + get_pipe_name_from_syntax(talloc_tos(), abstract)));
  3437. /* we have to check all now since win2k introduced a new UUID on the lsaprpc pipe */
  3438. if (rpc_srv_pipe_exists_by_id(abstract) &&
  3439. @@ -358,6 +359,7 @@ static bool check_bind_req(struct pipes_
  3440. context_fns->n_cmds = rpc_srv_get_pipe_num_cmds(abstract);
  3441. context_fns->cmds = rpc_srv_get_pipe_cmds(abstract);
  3442. context_fns->context_id = context_id;
  3443. + context_fns->syntax = *abstract;
  3444. /* add to the list of open contexts */
  3445. @@ -1541,7 +1543,42 @@ static PIPE_RPC_FNS* find_pipe_fns_by_co
  3446. }
  3447. static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt,
  3448. - const struct api_struct *api_rpc_cmds, int n_cmds);
  3449. + const struct api_struct *api_rpc_cmds, int n_cmds,
  3450. + const struct ndr_syntax_id *syntax);
  3451. +
  3452. +static bool srv_pipe_check_verification_trailer(struct pipes_struct *p,
  3453. + struct ncacn_packet *pkt,
  3454. + struct pipe_rpc_fns *pipe_fns)
  3455. +{
  3456. + TALLOC_CTX *frame = talloc_stackframe();
  3457. + struct dcerpc_sec_verification_trailer *vt = NULL;
  3458. + const uint32_t bitmask1 = 0;
  3459. + const struct dcerpc_sec_vt_pcontext pcontext = {
  3460. + .abstract_syntax = pipe_fns->syntax,
  3461. + .transfer_syntax = ndr_transfer_syntax,
  3462. + };
  3463. + const struct dcerpc_sec_vt_header2 header2 =
  3464. + dcerpc_sec_vt_header2_from_ncacn_packet(pkt);
  3465. + struct ndr_pull *ndr;
  3466. + enum ndr_err_code ndr_err;
  3467. + bool ret = false;
  3468. +
  3469. + ndr = ndr_pull_init_blob(&p->in_data.data, frame);
  3470. + if (ndr == NULL) {
  3471. + goto done;
  3472. + }
  3473. +
  3474. + ndr_err = ndr_pop_dcerpc_sec_verification_trailer(ndr, frame, &vt);
  3475. + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
  3476. + goto done;
  3477. + }
  3478. +
  3479. + ret = dcerpc_sec_verification_trailer_check(vt, &bitmask1,
  3480. + &pcontext, &header2);
  3481. +done:
  3482. + TALLOC_FREE(frame);
  3483. + return ret;
  3484. +}
  3485. /****************************************************************************
  3486. Find the correct RPC function to call for this request.
  3487. @@ -1552,46 +1589,53 @@ static bool api_rpcTNP(struct pipes_stru
  3488. static bool api_pipe_request(struct pipes_struct *p,
  3489. struct ncacn_packet *pkt)
  3490. {
  3491. + TALLOC_CTX *frame = talloc_stackframe();
  3492. bool ret = False;
  3493. - bool changed_user = False;
  3494. PIPE_RPC_FNS *pipe_fns;
  3495. - if (p->pipe_bound &&
  3496. - ((p->auth.auth_type == DCERPC_AUTH_TYPE_NTLMSSP) ||
  3497. - (p->auth.auth_type == DCERPC_AUTH_TYPE_KRB5) ||
  3498. - (p->auth.auth_type == DCERPC_AUTH_TYPE_SPNEGO))) {
  3499. - if(!become_authenticated_pipe_user(p->session_info)) {
  3500. - data_blob_free(&p->out_data.rdata);
  3501. - return False;
  3502. - }
  3503. - changed_user = True;
  3504. + if (!p->pipe_bound) {
  3505. + DEBUG(1, ("Pipe not bound!\n"));
  3506. + data_blob_free(&p->out_data.rdata);
  3507. + TALLOC_FREE(frame);
  3508. + return false;
  3509. }
  3510. - DEBUG(5, ("Requested \\PIPE\\%s\n",
  3511. - get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
  3512. -
  3513. /* get the set of RPC functions for this context */
  3514. pipe_fns = find_pipe_fns_by_context(p->contexts,
  3515. pkt->u.request.context_id);
  3516. -
  3517. - if ( pipe_fns ) {
  3518. - TALLOC_CTX *frame = talloc_stackframe();
  3519. - ret = api_rpcTNP(p, pkt, pipe_fns->cmds, pipe_fns->n_cmds);
  3520. + if (pipe_fns == NULL) {
  3521. + DEBUG(0, ("No rpc function table associated with context "
  3522. + "[%d]\n",
  3523. + pkt->u.request.context_id));
  3524. + data_blob_free(&p->out_data.rdata);
  3525. TALLOC_FREE(frame);
  3526. + return false;
  3527. }
  3528. - else {
  3529. - DEBUG(0, ("No rpc function table associated with context "
  3530. - "[%d] on pipe [%s]\n",
  3531. - pkt->u.request.context_id,
  3532. - get_pipe_name_from_syntax(talloc_tos(),
  3533. - &p->syntax)));
  3534. +
  3535. + DEBUG(5, ("Requested \\PIPE\\%s\n",
  3536. + get_pipe_name_from_syntax(talloc_tos(), &pipe_fns->syntax)));
  3537. +
  3538. + if (!srv_pipe_check_verification_trailer(p, pkt, pipe_fns)) {
  3539. + DEBUG(1, ("srv_pipe_check_verification_trailer: failed\n"));
  3540. + setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_ACCESS_DENIED));
  3541. + data_blob_free(&p->out_data.rdata);
  3542. + TALLOC_FREE(frame);
  3543. + return true;
  3544. }
  3545. - if (changed_user) {
  3546. - unbecome_authenticated_pipe_user();
  3547. + if (!become_authenticated_pipe_user(p->session_info)) {
  3548. + DEBUG(1, ("Failed to become pipe user!\n"));
  3549. + data_blob_free(&p->out_data.rdata);
  3550. + TALLOC_FREE(frame);
  3551. + return false;
  3552. }
  3553. + ret = api_rpcTNP(p, pkt, pipe_fns->cmds, pipe_fns->n_cmds,
  3554. + &pipe_fns->syntax);
  3555. + unbecome_authenticated_pipe_user();
  3556. +
  3557. + TALLOC_FREE(frame);
  3558. return ret;
  3559. }
  3560. @@ -1600,20 +1644,21 @@ static bool api_pipe_request(struct pipe
  3561. ********************************************************************/
  3562. static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt,
  3563. - const struct api_struct *api_rpc_cmds, int n_cmds)
  3564. + const struct api_struct *api_rpc_cmds, int n_cmds,
  3565. + const struct ndr_syntax_id *syntax)
  3566. {
  3567. int fn_num;
  3568. uint32_t offset1;
  3569. /* interpret the command */
  3570. DEBUG(4,("api_rpcTNP: %s op 0x%x - ",
  3571. - get_pipe_name_from_syntax(talloc_tos(), &p->syntax),
  3572. + get_pipe_name_from_syntax(talloc_tos(), syntax),
  3573. pkt->u.request.opnum));
  3574. if (DEBUGLEVEL >= 50) {
  3575. fstring name;
  3576. slprintf(name, sizeof(name)-1, "in_%s",
  3577. - get_pipe_name_from_syntax(talloc_tos(), &p->syntax));
  3578. + get_pipe_name_from_syntax(talloc_tos(), syntax));
  3579. dump_pdu_region(name, pkt->u.request.opnum,
  3580. &p->in_data.data, 0,
  3581. p->in_data.data.length);
  3582. @@ -1646,37 +1691,30 @@ static bool api_rpcTNP(struct pipes_stru
  3583. /* do the actual command */
  3584. if(!api_rpc_cmds[fn_num].fn(p)) {
  3585. DEBUG(0,("api_rpcTNP: %s: %s failed.\n",
  3586. - get_pipe_name_from_syntax(talloc_tos(), &p->syntax),
  3587. + get_pipe_name_from_syntax(talloc_tos(), syntax),
  3588. api_rpc_cmds[fn_num].name));
  3589. data_blob_free(&p->out_data.rdata);
  3590. return False;
  3591. }
  3592. - if (p->bad_handle_fault_state) {
  3593. - DEBUG(4,("api_rpcTNP: bad handle fault return.\n"));
  3594. - p->bad_handle_fault_state = False;
  3595. - setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_CONTEXT_MISMATCH));
  3596. - return True;
  3597. - }
  3598. -
  3599. - if (p->rng_fault_state) {
  3600. - DEBUG(4, ("api_rpcTNP: rng fault return\n"));
  3601. - p->rng_fault_state = False;
  3602. - setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR));
  3603. - return True;
  3604. + if (p->fault_state) {
  3605. + DEBUG(4,("api_rpcTNP: fault(%d) return.\n", p->fault_state));
  3606. + setup_fault_pdu(p, NT_STATUS(p->fault_state));
  3607. + p->fault_state = 0;
  3608. + return true;
  3609. }
  3610. if (DEBUGLEVEL >= 50) {
  3611. fstring name;
  3612. slprintf(name, sizeof(name)-1, "out_%s",
  3613. - get_pipe_name_from_syntax(talloc_tos(), &p->syntax));
  3614. + get_pipe_name_from_syntax(talloc_tos(), syntax));
  3615. dump_pdu_region(name, pkt->u.request.opnum,
  3616. &p->out_data.rdata, offset1,
  3617. p->out_data.rdata.length);
  3618. }
  3619. DEBUG(5,("api_rpcTNP: called %s successfully\n",
  3620. - get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
  3621. + get_pipe_name_from_syntax(talloc_tos(), syntax)));
  3622. /* Check for buffer underflow in rpc parsing */
  3623. if ((DEBUGLEVEL >= 10) &&
  3624. @@ -1718,9 +1756,9 @@ void set_incoming_fault(struct pipes_str
  3625. data_blob_free(&p->in_data.data);
  3626. p->in_data.pdu_needed_len = 0;
  3627. p->in_data.pdu.length = 0;
  3628. - p->fault_state = True;
  3629. - DEBUG(10, ("set_incoming_fault: Setting fault state on pipe %s\n",
  3630. - get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
  3631. + p->fault_state = DCERPC_FAULT_CANT_PERFORM;
  3632. +
  3633. + DEBUG(10, ("Setting fault state\n"));
  3634. }
  3635. static NTSTATUS dcesrv_auth_request(struct pipe_auth_data *auth,
  3636. --- a/source3/include/ntdomain.h
  3637. +++ b/source3/include/ntdomain.h
  3638. @@ -87,6 +87,7 @@ typedef struct pipe_rpc_fns {
  3639. const struct api_struct *cmds;
  3640. int n_cmds;
  3641. uint32 context_id;
  3642. + struct ndr_syntax_id syntax;
  3643. } PIPE_RPC_FNS;
  3644. @@ -134,22 +135,10 @@ struct pipes_struct {
  3645. bool pipe_bound;
  3646. /*
  3647. - * Set to true when we should return fault PDU's for everything.
  3648. - */
  3649. -
  3650. - bool fault_state;
  3651. -
  3652. - /*
  3653. - * Set to true when we should return fault PDU's for a bad handle.
  3654. - */
  3655. -
  3656. - bool bad_handle_fault_state;
  3657. -
  3658. - /*
  3659. - * Set to true when the backend does not support a call.
  3660. + * Set the DCERPC_FAULT to return.
  3661. */
  3662. - bool rng_fault_state;
  3663. + int fault_state;
  3664. /*
  3665. * Set to RPC_BIG_ENDIAN when dealing with big-endian PDU's
  3666. --- a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
  3667. +++ b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
  3668. @@ -183,7 +183,7 @@ sub ParseFunction($$)
  3669. );
  3670. pidl "";
  3671. - pidl "if (p->rng_fault_state) {";
  3672. + pidl "if (p->fault_state) {";
  3673. pidl "\ttalloc_free(r);";
  3674. pidl "\t/* Return true here, srv_pipe_hnd.c will take care */";
  3675. pidl "\treturn true;";
  3676. --- a/source3/rpc_server/dfs/srv_dfs_nt.c
  3677. +++ b/source3/rpc_server/dfs/srv_dfs_nt.c
  3678. @@ -411,125 +411,125 @@ WERROR _dfs_GetInfo(struct pipes_struct
  3679. WERROR _dfs_SetInfo(struct pipes_struct *p, struct dfs_SetInfo *r)
  3680. {
  3681. /* FIXME: Implement your code here */
  3682. - p->rng_fault_state = True;
  3683. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3684. return WERR_NOT_SUPPORTED;
  3685. }
  3686. WERROR _dfs_Rename(struct pipes_struct *p, struct dfs_Rename *r)
  3687. {
  3688. /* FIXME: Implement your code here */
  3689. - p->rng_fault_state = True;
  3690. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3691. return WERR_NOT_SUPPORTED;
  3692. }
  3693. WERROR _dfs_Move(struct pipes_struct *p, struct dfs_Move *r)
  3694. {
  3695. /* FIXME: Implement your code here */
  3696. - p->rng_fault_state = True;
  3697. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3698. return WERR_NOT_SUPPORTED;
  3699. }
  3700. WERROR _dfs_ManagerGetConfigInfo(struct pipes_struct *p, struct dfs_ManagerGetConfigInfo *r)
  3701. {
  3702. /* FIXME: Implement your code here */
  3703. - p->rng_fault_state = True;
  3704. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3705. return WERR_NOT_SUPPORTED;
  3706. }
  3707. WERROR _dfs_ManagerSendSiteInfo(struct pipes_struct *p, struct dfs_ManagerSendSiteInfo *r)
  3708. {
  3709. /* FIXME: Implement your code here */
  3710. - p->rng_fault_state = True;
  3711. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3712. return WERR_NOT_SUPPORTED;
  3713. }
  3714. WERROR _dfs_AddFtRoot(struct pipes_struct *p, struct dfs_AddFtRoot *r)
  3715. {
  3716. /* FIXME: Implement your code here */
  3717. - p->rng_fault_state = True;
  3718. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3719. return WERR_NOT_SUPPORTED;
  3720. }
  3721. WERROR _dfs_RemoveFtRoot(struct pipes_struct *p, struct dfs_RemoveFtRoot *r)
  3722. {
  3723. /* FIXME: Implement your code here */
  3724. - p->rng_fault_state = True;
  3725. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3726. return WERR_NOT_SUPPORTED;
  3727. }
  3728. WERROR _dfs_AddStdRoot(struct pipes_struct *p, struct dfs_AddStdRoot *r)
  3729. {
  3730. /* FIXME: Implement your code here */
  3731. - p->rng_fault_state = True;
  3732. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3733. return WERR_NOT_SUPPORTED;
  3734. }
  3735. WERROR _dfs_RemoveStdRoot(struct pipes_struct *p, struct dfs_RemoveStdRoot *r)
  3736. {
  3737. /* FIXME: Implement your code here */
  3738. - p->rng_fault_state = True;
  3739. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3740. return WERR_NOT_SUPPORTED;
  3741. }
  3742. WERROR _dfs_ManagerInitialize(struct pipes_struct *p, struct dfs_ManagerInitialize *r)
  3743. {
  3744. /* FIXME: Implement your code here */
  3745. - p->rng_fault_state = True;
  3746. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3747. return WERR_NOT_SUPPORTED;
  3748. }
  3749. WERROR _dfs_AddStdRootForced(struct pipes_struct *p, struct dfs_AddStdRootForced *r)
  3750. {
  3751. /* FIXME: Implement your code here */
  3752. - p->rng_fault_state = True;
  3753. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3754. return WERR_NOT_SUPPORTED;
  3755. }
  3756. WERROR _dfs_GetDcAddress(struct pipes_struct *p, struct dfs_GetDcAddress *r)
  3757. {
  3758. /* FIXME: Implement your code here */
  3759. - p->rng_fault_state = True;
  3760. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3761. return WERR_NOT_SUPPORTED;
  3762. }
  3763. WERROR _dfs_SetDcAddress(struct pipes_struct *p, struct dfs_SetDcAddress *r)
  3764. {
  3765. /* FIXME: Implement your code here */
  3766. - p->rng_fault_state = True;
  3767. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3768. return WERR_NOT_SUPPORTED;
  3769. }
  3770. WERROR _dfs_FlushFtTable(struct pipes_struct *p, struct dfs_FlushFtTable *r)
  3771. {
  3772. /* FIXME: Implement your code here */
  3773. - p->rng_fault_state = True;
  3774. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3775. return WERR_NOT_SUPPORTED;
  3776. }
  3777. WERROR _dfs_Add2(struct pipes_struct *p, struct dfs_Add2 *r)
  3778. {
  3779. /* FIXME: Implement your code here */
  3780. - p->rng_fault_state = True;
  3781. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3782. return WERR_NOT_SUPPORTED;
  3783. }
  3784. WERROR _dfs_Remove2(struct pipes_struct *p, struct dfs_Remove2 *r)
  3785. {
  3786. /* FIXME: Implement your code here */
  3787. - p->rng_fault_state = True;
  3788. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3789. return WERR_NOT_SUPPORTED;
  3790. }
  3791. WERROR _dfs_EnumEx(struct pipes_struct *p, struct dfs_EnumEx *r)
  3792. {
  3793. /* FIXME: Implement your code here */
  3794. - p->rng_fault_state = True;
  3795. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3796. return WERR_NOT_SUPPORTED;
  3797. }
  3798. WERROR _dfs_SetInfo2(struct pipes_struct *p, struct dfs_SetInfo2 *r)
  3799. {
  3800. /* FIXME: Implement your code here */
  3801. - p->rng_fault_state = True;
  3802. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3803. return WERR_NOT_SUPPORTED;
  3804. }
  3805. --- a/source3/rpc_server/dssetup/srv_dssetup_nt.c
  3806. +++ b/source3/rpc_server/dssetup/srv_dssetup_nt.c
  3807. @@ -130,7 +130,7 @@ WERROR _dssetup_DsRoleGetPrimaryDomainIn
  3808. WERROR _dssetup_DsRoleDnsNameToFlatName(struct pipes_struct *p,
  3809. struct dssetup_DsRoleDnsNameToFlatName *r)
  3810. {
  3811. - p->rng_fault_state = true;
  3812. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3813. return WERR_NOT_SUPPORTED;
  3814. }
  3815. @@ -140,7 +140,7 @@ WERROR _dssetup_DsRoleDnsNameToFlatName(
  3816. WERROR _dssetup_DsRoleDcAsDc(struct pipes_struct *p,
  3817. struct dssetup_DsRoleDcAsDc *r)
  3818. {
  3819. - p->rng_fault_state = true;
  3820. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3821. return WERR_NOT_SUPPORTED;
  3822. }
  3823. @@ -150,7 +150,7 @@ WERROR _dssetup_DsRoleDcAsDc(struct pipe
  3824. WERROR _dssetup_DsRoleDcAsReplica(struct pipes_struct *p,
  3825. struct dssetup_DsRoleDcAsReplica *r)
  3826. {
  3827. - p->rng_fault_state = true;
  3828. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3829. return WERR_NOT_SUPPORTED;
  3830. }
  3831. @@ -160,7 +160,7 @@ WERROR _dssetup_DsRoleDcAsReplica(struct
  3832. WERROR _dssetup_DsRoleDemoteDc(struct pipes_struct *p,
  3833. struct dssetup_DsRoleDemoteDc *r)
  3834. {
  3835. - p->rng_fault_state = true;
  3836. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3837. return WERR_NOT_SUPPORTED;
  3838. }
  3839. @@ -170,7 +170,7 @@ WERROR _dssetup_DsRoleDemoteDc(struct pi
  3840. WERROR _dssetup_DsRoleGetDcOperationProgress(struct pipes_struct *p,
  3841. struct dssetup_DsRoleGetDcOperationProgress *r)
  3842. {
  3843. - p->rng_fault_state = true;
  3844. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3845. return WERR_NOT_SUPPORTED;
  3846. }
  3847. @@ -180,7 +180,7 @@ WERROR _dssetup_DsRoleGetDcOperationProg
  3848. WERROR _dssetup_DsRoleGetDcOperationResults(struct pipes_struct *p,
  3849. struct dssetup_DsRoleGetDcOperationResults *r)
  3850. {
  3851. - p->rng_fault_state = true;
  3852. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3853. return WERR_NOT_SUPPORTED;
  3854. }
  3855. @@ -190,7 +190,7 @@ WERROR _dssetup_DsRoleGetDcOperationResu
  3856. WERROR _dssetup_DsRoleCancel(struct pipes_struct *p,
  3857. struct dssetup_DsRoleCancel *r)
  3858. {
  3859. - p->rng_fault_state = true;
  3860. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3861. return WERR_NOT_SUPPORTED;
  3862. }
  3863. @@ -200,7 +200,7 @@ WERROR _dssetup_DsRoleCancel(struct pipe
  3864. WERROR _dssetup_DsRoleServerSaveStateForUpgrade(struct pipes_struct *p,
  3865. struct dssetup_DsRoleServerSaveStateForUpgrade *r)
  3866. {
  3867. - p->rng_fault_state = true;
  3868. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3869. return WERR_NOT_SUPPORTED;
  3870. }
  3871. @@ -210,7 +210,7 @@ WERROR _dssetup_DsRoleServerSaveStateFor
  3872. WERROR _dssetup_DsRoleUpgradeDownlevelServer(struct pipes_struct *p,
  3873. struct dssetup_DsRoleUpgradeDownlevelServer *r)
  3874. {
  3875. - p->rng_fault_state = true;
  3876. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3877. return WERR_NOT_SUPPORTED;
  3878. }
  3879. @@ -220,6 +220,6 @@ WERROR _dssetup_DsRoleUpgradeDownlevelSe
  3880. WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(struct pipes_struct *p,
  3881. struct dssetup_DsRoleAbortDownlevelServerUpgrade *r)
  3882. {
  3883. - p->rng_fault_state = true;
  3884. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3885. return WERR_NOT_SUPPORTED;
  3886. }
  3887. --- a/source3/rpc_server/echo/srv_echo_nt.c
  3888. +++ b/source3/rpc_server/echo/srv_echo_nt.c
  3889. @@ -87,13 +87,13 @@ void _echo_SourceData(struct pipes_struc
  3890. void _echo_TestCall(struct pipes_struct *p, struct echo_TestCall *r)
  3891. {
  3892. - p->rng_fault_state = True;
  3893. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3894. return;
  3895. }
  3896. NTSTATUS _echo_TestCall2(struct pipes_struct *p, struct echo_TestCall2 *r)
  3897. {
  3898. - p->rng_fault_state = True;
  3899. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3900. return NT_STATUS_OK;
  3901. }
  3902. @@ -105,18 +105,18 @@ uint32 _echo_TestSleep(struct pipes_stru
  3903. void _echo_TestEnum(struct pipes_struct *p, struct echo_TestEnum *r)
  3904. {
  3905. - p->rng_fault_state = True;
  3906. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3907. return;
  3908. }
  3909. void _echo_TestSurrounding(struct pipes_struct *p, struct echo_TestSurrounding *r)
  3910. {
  3911. - p->rng_fault_state = True;
  3912. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3913. return;
  3914. }
  3915. uint16 _echo_TestDoublePointer(struct pipes_struct *p, struct echo_TestDoublePointer *r)
  3916. {
  3917. - p->rng_fault_state = True;
  3918. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3919. return 0;
  3920. }
  3921. --- a/source3/rpc_server/epmapper/srv_epmapper.c
  3922. +++ b/source3/rpc_server/epmapper/srv_epmapper.c
  3923. @@ -297,6 +297,7 @@ error_status_t _epm_Insert(struct pipes_
  3924. /* If this is not a priviledged users, return */
  3925. if (p->transport != NCALRPC ||
  3926. !is_priviledged_pipe(p->session_info)) {
  3927. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3928. return EPMAPPER_STATUS_CANT_PERFORM_OP;
  3929. }
  3930. @@ -433,6 +434,7 @@ error_status_t _epm_Delete(struct pipes_
  3931. /* If this is not a priviledged users, return */
  3932. if (p->transport != NCALRPC ||
  3933. !is_priviledged_pipe(p->session_info)) {
  3934. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3935. return EPMAPPER_STATUS_CANT_PERFORM_OP;
  3936. }
  3937. @@ -1096,7 +1098,7 @@ error_status_t _epm_LookupHandleFree(str
  3938. error_status_t _epm_InqObject(struct pipes_struct *p,
  3939. struct epm_InqObject *r)
  3940. {
  3941. - p->rng_fault_state = true;
  3942. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3943. return EPMAPPER_STATUS_CANT_PERFORM_OP;
  3944. }
  3945. @@ -1110,7 +1112,7 @@ error_status_t _epm_InqObject(struct pip
  3946. error_status_t _epm_MgmtDelete(struct pipes_struct *p,
  3947. struct epm_MgmtDelete *r)
  3948. {
  3949. - p->rng_fault_state = true;
  3950. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3951. return EPMAPPER_STATUS_CANT_PERFORM_OP;
  3952. }
  3953. @@ -1121,7 +1123,7 @@ error_status_t _epm_MgmtDelete(struct pi
  3954. error_status_t _epm_MapAuth(struct pipes_struct *p,
  3955. struct epm_MapAuth *r)
  3956. {
  3957. - p->rng_fault_state = true;
  3958. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3959. return EPMAPPER_STATUS_CANT_PERFORM_OP;
  3960. }
  3961. --- a/source3/rpc_server/eventlog/srv_eventlog_nt.c
  3962. +++ b/source3/rpc_server/eventlog/srv_eventlog_nt.c
  3963. @@ -695,7 +695,7 @@ NTSTATUS _eventlog_GetNumRecords(struct
  3964. NTSTATUS _eventlog_BackupEventLogW(struct pipes_struct *p, struct eventlog_BackupEventLogW *r)
  3965. {
  3966. - p->rng_fault_state = True;
  3967. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3968. return NT_STATUS_NOT_IMPLEMENTED;
  3969. }
  3970. @@ -838,104 +838,104 @@ NTSTATUS _eventlog_ReportEventW(struct p
  3971. NTSTATUS _eventlog_DeregisterEventSource(struct pipes_struct *p,
  3972. struct eventlog_DeregisterEventSource *r)
  3973. {
  3974. - p->rng_fault_state = True;
  3975. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3976. return NT_STATUS_NOT_IMPLEMENTED;
  3977. }
  3978. NTSTATUS _eventlog_ChangeNotify(struct pipes_struct *p,
  3979. struct eventlog_ChangeNotify *r)
  3980. {
  3981. - p->rng_fault_state = True;
  3982. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3983. return NT_STATUS_NOT_IMPLEMENTED;
  3984. }
  3985. NTSTATUS _eventlog_RegisterEventSourceW(struct pipes_struct *p,
  3986. struct eventlog_RegisterEventSourceW *r)
  3987. {
  3988. - p->rng_fault_state = True;
  3989. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3990. return NT_STATUS_NOT_IMPLEMENTED;
  3991. }
  3992. NTSTATUS _eventlog_OpenBackupEventLogW(struct pipes_struct *p,
  3993. struct eventlog_OpenBackupEventLogW *r)
  3994. {
  3995. - p->rng_fault_state = True;
  3996. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  3997. return NT_STATUS_NOT_IMPLEMENTED;
  3998. }
  3999. NTSTATUS _eventlog_ClearEventLogA(struct pipes_struct *p,
  4000. struct eventlog_ClearEventLogA *r)
  4001. {
  4002. - p->rng_fault_state = True;
  4003. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4004. return NT_STATUS_NOT_IMPLEMENTED;
  4005. }
  4006. NTSTATUS _eventlog_BackupEventLogA(struct pipes_struct *p,
  4007. struct eventlog_BackupEventLogA *r)
  4008. {
  4009. - p->rng_fault_state = True;
  4010. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4011. return NT_STATUS_NOT_IMPLEMENTED;
  4012. }
  4013. NTSTATUS _eventlog_OpenEventLogA(struct pipes_struct *p,
  4014. struct eventlog_OpenEventLogA *r)
  4015. {
  4016. - p->rng_fault_state = True;
  4017. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4018. return NT_STATUS_NOT_IMPLEMENTED;
  4019. }
  4020. NTSTATUS _eventlog_RegisterEventSourceA(struct pipes_struct *p,
  4021. struct eventlog_RegisterEventSourceA *r)
  4022. {
  4023. - p->rng_fault_state = True;
  4024. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4025. return NT_STATUS_NOT_IMPLEMENTED;
  4026. }
  4027. NTSTATUS _eventlog_OpenBackupEventLogA(struct pipes_struct *p,
  4028. struct eventlog_OpenBackupEventLogA *r)
  4029. {
  4030. - p->rng_fault_state = True;
  4031. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4032. return NT_STATUS_NOT_IMPLEMENTED;
  4033. }
  4034. NTSTATUS _eventlog_ReadEventLogA(struct pipes_struct *p,
  4035. struct eventlog_ReadEventLogA *r)
  4036. {
  4037. - p->rng_fault_state = True;
  4038. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4039. return NT_STATUS_NOT_IMPLEMENTED;
  4040. }
  4041. NTSTATUS _eventlog_ReportEventA(struct pipes_struct *p,
  4042. struct eventlog_ReportEventA *r)
  4043. {
  4044. - p->rng_fault_state = True;
  4045. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4046. return NT_STATUS_NOT_IMPLEMENTED;
  4047. }
  4048. NTSTATUS _eventlog_RegisterClusterSvc(struct pipes_struct *p,
  4049. struct eventlog_RegisterClusterSvc *r)
  4050. {
  4051. - p->rng_fault_state = True;
  4052. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4053. return NT_STATUS_NOT_IMPLEMENTED;
  4054. }
  4055. NTSTATUS _eventlog_DeregisterClusterSvc(struct pipes_struct *p,
  4056. struct eventlog_DeregisterClusterSvc *r)
  4057. {
  4058. - p->rng_fault_state = True;
  4059. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4060. return NT_STATUS_NOT_IMPLEMENTED;
  4061. }
  4062. NTSTATUS _eventlog_WriteClusterEvents(struct pipes_struct *p,
  4063. struct eventlog_WriteClusterEvents *r)
  4064. {
  4065. - p->rng_fault_state = True;
  4066. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4067. return NT_STATUS_NOT_IMPLEMENTED;
  4068. }
  4069. NTSTATUS _eventlog_ReportEventAndSourceW(struct pipes_struct *p,
  4070. struct eventlog_ReportEventAndSourceW *r)
  4071. {
  4072. - p->rng_fault_state = True;
  4073. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4074. return NT_STATUS_NOT_IMPLEMENTED;
  4075. }
  4076. --- a/source3/rpc_server/lsa/srv_lsa_nt.c
  4077. +++ b/source3/rpc_server/lsa/srv_lsa_nt.c
  4078. @@ -817,7 +817,7 @@ NTSTATUS _lsa_QueryInfoPolicy2(struct pi
  4079. struct lsa_QueryInfoPolicy r;
  4080. if ((pdb_capabilities() & PDB_CAP_ADS) == 0) {
  4081. - p->rng_fault_state = True;
  4082. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4083. return NT_STATUS_NOT_IMPLEMENTED;
  4084. }
  4085. @@ -3210,88 +3210,88 @@ NTSTATUS _lsa_Delete(struct pipes_struct
  4086. NTSTATUS _lsa_SetSecObj(struct pipes_struct *p, struct lsa_SetSecObj *r)
  4087. {
  4088. - p->rng_fault_state = True;
  4089. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4090. return NT_STATUS_NOT_IMPLEMENTED;
  4091. }
  4092. NTSTATUS _lsa_ChangePassword(struct pipes_struct *p,
  4093. struct lsa_ChangePassword *r)
  4094. {
  4095. - p->rng_fault_state = True;
  4096. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4097. return NT_STATUS_NOT_IMPLEMENTED;
  4098. }
  4099. NTSTATUS _lsa_SetInfoPolicy(struct pipes_struct *p, struct lsa_SetInfoPolicy *r)
  4100. {
  4101. - p->rng_fault_state = True;
  4102. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4103. return NT_STATUS_NOT_IMPLEMENTED;
  4104. }
  4105. NTSTATUS _lsa_ClearAuditLog(struct pipes_struct *p, struct lsa_ClearAuditLog *r)
  4106. {
  4107. - p->rng_fault_state = True;
  4108. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4109. return NT_STATUS_NOT_IMPLEMENTED;
  4110. }
  4111. NTSTATUS _lsa_GetQuotasForAccount(struct pipes_struct *p,
  4112. struct lsa_GetQuotasForAccount *r)
  4113. {
  4114. - p->rng_fault_state = True;
  4115. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4116. return NT_STATUS_NOT_IMPLEMENTED;
  4117. }
  4118. NTSTATUS _lsa_SetQuotasForAccount(struct pipes_struct *p,
  4119. struct lsa_SetQuotasForAccount *r)
  4120. {
  4121. - p->rng_fault_state = True;
  4122. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4123. return NT_STATUS_NOT_IMPLEMENTED;
  4124. }
  4125. NTSTATUS _lsa_SetInformationTrustedDomain(struct pipes_struct *p,
  4126. struct lsa_SetInformationTrustedDomain *r)
  4127. {
  4128. - p->rng_fault_state = True;
  4129. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4130. return NT_STATUS_NOT_IMPLEMENTED;
  4131. }
  4132. NTSTATUS _lsa_QuerySecret(struct pipes_struct *p, struct lsa_QuerySecret *r)
  4133. {
  4134. - p->rng_fault_state = True;
  4135. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4136. return NT_STATUS_NOT_IMPLEMENTED;
  4137. }
  4138. NTSTATUS _lsa_SetTrustedDomainInfo(struct pipes_struct *p,
  4139. struct lsa_SetTrustedDomainInfo *r)
  4140. {
  4141. - p->rng_fault_state = True;
  4142. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4143. return NT_STATUS_NOT_IMPLEMENTED;
  4144. }
  4145. NTSTATUS _lsa_StorePrivateData(struct pipes_struct *p,
  4146. struct lsa_StorePrivateData *r)
  4147. {
  4148. - p->rng_fault_state = True;
  4149. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4150. return NT_STATUS_NOT_IMPLEMENTED;
  4151. }
  4152. NTSTATUS _lsa_RetrievePrivateData(struct pipes_struct *p,
  4153. struct lsa_RetrievePrivateData *r)
  4154. {
  4155. - p->rng_fault_state = True;
  4156. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4157. return NT_STATUS_NOT_IMPLEMENTED;
  4158. }
  4159. NTSTATUS _lsa_SetInfoPolicy2(struct pipes_struct *p,
  4160. struct lsa_SetInfoPolicy2 *r)
  4161. {
  4162. - p->rng_fault_state = True;
  4163. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4164. return NT_STATUS_NOT_IMPLEMENTED;
  4165. }
  4166. NTSTATUS _lsa_SetTrustedDomainInfoByName(struct pipes_struct *p,
  4167. struct lsa_SetTrustedDomainInfoByName *r)
  4168. {
  4169. - p->rng_fault_state = True;
  4170. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4171. return NT_STATUS_NOT_IMPLEMENTED;
  4172. }
  4173. @@ -3310,7 +3310,7 @@ NTSTATUS _lsa_EnumTrustedDomainsEx(struc
  4174. * _lsa_EnumTrustedDomains() afterwards - gd */
  4175. if (!(pdb_capabilities() & PDB_CAP_TRUSTED_DOMAINS_EX)) {
  4176. - p->rng_fault_state = True;
  4177. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4178. return NT_STATUS_NOT_IMPLEMENTED;
  4179. }
  4180. @@ -3379,107 +3379,107 @@ NTSTATUS _lsa_EnumTrustedDomainsEx(struc
  4181. NTSTATUS _lsa_QueryDomainInformationPolicy(struct pipes_struct *p,
  4182. struct lsa_QueryDomainInformationPolicy *r)
  4183. {
  4184. - p->rng_fault_state = True;
  4185. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4186. return NT_STATUS_NOT_IMPLEMENTED;
  4187. }
  4188. NTSTATUS _lsa_SetDomainInformationPolicy(struct pipes_struct *p,
  4189. struct lsa_SetDomainInformationPolicy *r)
  4190. {
  4191. - p->rng_fault_state = True;
  4192. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4193. return NT_STATUS_NOT_IMPLEMENTED;
  4194. }
  4195. NTSTATUS _lsa_TestCall(struct pipes_struct *p, struct lsa_TestCall *r)
  4196. {
  4197. - p->rng_fault_state = True;
  4198. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4199. return NT_STATUS_NOT_IMPLEMENTED;
  4200. }
  4201. NTSTATUS _lsa_CREDRWRITE(struct pipes_struct *p, struct lsa_CREDRWRITE *r)
  4202. {
  4203. - p->rng_fault_state = True;
  4204. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4205. return NT_STATUS_NOT_IMPLEMENTED;
  4206. }
  4207. NTSTATUS _lsa_CREDRREAD(struct pipes_struct *p, struct lsa_CREDRREAD *r)
  4208. {
  4209. - p->rng_fault_state = True;
  4210. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4211. return NT_STATUS_NOT_IMPLEMENTED;
  4212. }
  4213. NTSTATUS _lsa_CREDRENUMERATE(struct pipes_struct *p, struct lsa_CREDRENUMERATE *r)
  4214. {
  4215. - p->rng_fault_state = True;
  4216. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4217. return NT_STATUS_NOT_IMPLEMENTED;
  4218. }
  4219. NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(struct pipes_struct *p,
  4220. struct lsa_CREDRWRITEDOMAINCREDENTIALS *r)
  4221. {
  4222. - p->rng_fault_state = True;
  4223. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4224. return NT_STATUS_NOT_IMPLEMENTED;
  4225. }
  4226. NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(struct pipes_struct *p,
  4227. struct lsa_CREDRREADDOMAINCREDENTIALS *r)
  4228. {
  4229. - p->rng_fault_state = True;
  4230. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4231. return NT_STATUS_NOT_IMPLEMENTED;
  4232. }
  4233. NTSTATUS _lsa_CREDRDELETE(struct pipes_struct *p, struct lsa_CREDRDELETE *r)
  4234. {
  4235. - p->rng_fault_state = True;
  4236. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4237. return NT_STATUS_NOT_IMPLEMENTED;
  4238. }
  4239. NTSTATUS _lsa_CREDRGETTARGETINFO(struct pipes_struct *p,
  4240. struct lsa_CREDRGETTARGETINFO *r)
  4241. {
  4242. - p->rng_fault_state = True;
  4243. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4244. return NT_STATUS_NOT_IMPLEMENTED;
  4245. }
  4246. NTSTATUS _lsa_CREDRPROFILELOADED(struct pipes_struct *p,
  4247. struct lsa_CREDRPROFILELOADED *r)
  4248. {
  4249. - p->rng_fault_state = True;
  4250. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4251. return NT_STATUS_NOT_IMPLEMENTED;
  4252. }
  4253. NTSTATUS _lsa_CREDRGETSESSIONTYPES(struct pipes_struct *p,
  4254. struct lsa_CREDRGETSESSIONTYPES *r)
  4255. {
  4256. - p->rng_fault_state = True;
  4257. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4258. return NT_STATUS_NOT_IMPLEMENTED;
  4259. }
  4260. NTSTATUS _lsa_LSARREGISTERAUDITEVENT(struct pipes_struct *p,
  4261. struct lsa_LSARREGISTERAUDITEVENT *r)
  4262. {
  4263. - p->rng_fault_state = True;
  4264. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4265. return NT_STATUS_NOT_IMPLEMENTED;
  4266. }
  4267. NTSTATUS _lsa_LSARGENAUDITEVENT(struct pipes_struct *p,
  4268. struct lsa_LSARGENAUDITEVENT *r)
  4269. {
  4270. - p->rng_fault_state = True;
  4271. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4272. return NT_STATUS_NOT_IMPLEMENTED;
  4273. }
  4274. NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(struct pipes_struct *p,
  4275. struct lsa_LSARUNREGISTERAUDITEVENT *r)
  4276. {
  4277. - p->rng_fault_state = True;
  4278. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4279. return NT_STATUS_NOT_IMPLEMENTED;
  4280. }
  4281. NTSTATUS _lsa_lsaRQueryForestTrustInformation(struct pipes_struct *p,
  4282. struct lsa_lsaRQueryForestTrustInformation *r)
  4283. {
  4284. - p->rng_fault_state = True;
  4285. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4286. return NT_STATUS_NOT_IMPLEMENTED;
  4287. }
  4288. @@ -3992,34 +3992,34 @@ NTSTATUS _lsa_lsaRSetForestTrustInformat
  4289. NTSTATUS _lsa_CREDRRENAME(struct pipes_struct *p,
  4290. struct lsa_CREDRRENAME *r)
  4291. {
  4292. - p->rng_fault_state = True;
  4293. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4294. return NT_STATUS_NOT_IMPLEMENTED;
  4295. }
  4296. NTSTATUS _lsa_LSAROPENPOLICYSCE(struct pipes_struct *p,
  4297. struct lsa_LSAROPENPOLICYSCE *r)
  4298. {
  4299. - p->rng_fault_state = True;
  4300. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4301. return NT_STATUS_NOT_IMPLEMENTED;
  4302. }
  4303. NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct pipes_struct *p,
  4304. struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r)
  4305. {
  4306. - p->rng_fault_state = True;
  4307. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4308. return NT_STATUS_NOT_IMPLEMENTED;
  4309. }
  4310. NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct pipes_struct *p,
  4311. struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r)
  4312. {
  4313. - p->rng_fault_state = True;
  4314. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4315. return NT_STATUS_NOT_IMPLEMENTED;
  4316. }
  4317. NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(struct pipes_struct *p,
  4318. struct lsa_LSARADTREPORTSECURITYEVENT *r)
  4319. {
  4320. - p->rng_fault_state = True;
  4321. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4322. return NT_STATUS_NOT_IMPLEMENTED;
  4323. }
  4324. --- a/source3/rpc_server/netlogon/srv_netlog_nt.c
  4325. +++ b/source3/rpc_server/netlogon/srv_netlog_nt.c
  4326. @@ -1787,7 +1787,7 @@ NTSTATUS _netr_LogonSamLogonEx(struct pi
  4327. WERROR _netr_LogonUasLogon(struct pipes_struct *p,
  4328. struct netr_LogonUasLogon *r)
  4329. {
  4330. - p->rng_fault_state = true;
  4331. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4332. return WERR_NOT_SUPPORTED;
  4333. }
  4334. @@ -1797,7 +1797,7 @@ WERROR _netr_LogonUasLogon(struct pipes_
  4335. WERROR _netr_LogonUasLogoff(struct pipes_struct *p,
  4336. struct netr_LogonUasLogoff *r)
  4337. {
  4338. - p->rng_fault_state = true;
  4339. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4340. return WERR_NOT_SUPPORTED;
  4341. }
  4342. @@ -1807,7 +1807,7 @@ WERROR _netr_LogonUasLogoff(struct pipes
  4343. NTSTATUS _netr_DatabaseDeltas(struct pipes_struct *p,
  4344. struct netr_DatabaseDeltas *r)
  4345. {
  4346. - p->rng_fault_state = true;
  4347. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4348. return NT_STATUS_NOT_IMPLEMENTED;
  4349. }
  4350. @@ -1817,7 +1817,7 @@ NTSTATUS _netr_DatabaseDeltas(struct pip
  4351. NTSTATUS _netr_DatabaseSync(struct pipes_struct *p,
  4352. struct netr_DatabaseSync *r)
  4353. {
  4354. - p->rng_fault_state = true;
  4355. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4356. return NT_STATUS_NOT_IMPLEMENTED;
  4357. }
  4358. @@ -1827,7 +1827,7 @@ NTSTATUS _netr_DatabaseSync(struct pipes
  4359. NTSTATUS _netr_AccountDeltas(struct pipes_struct *p,
  4360. struct netr_AccountDeltas *r)
  4361. {
  4362. - p->rng_fault_state = true;
  4363. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4364. return NT_STATUS_NOT_IMPLEMENTED;
  4365. }
  4366. @@ -1837,7 +1837,7 @@ NTSTATUS _netr_AccountDeltas(struct pipe
  4367. NTSTATUS _netr_AccountSync(struct pipes_struct *p,
  4368. struct netr_AccountSync *r)
  4369. {
  4370. - p->rng_fault_state = true;
  4371. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4372. return NT_STATUS_NOT_IMPLEMENTED;
  4373. }
  4374. @@ -1978,7 +1978,7 @@ WERROR _netr_GetAnyDCName(struct pipes_s
  4375. NTSTATUS _netr_DatabaseSync2(struct pipes_struct *p,
  4376. struct netr_DatabaseSync2 *r)
  4377. {
  4378. - p->rng_fault_state = true;
  4379. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4380. return NT_STATUS_NOT_IMPLEMENTED;
  4381. }
  4382. @@ -1988,7 +1988,7 @@ NTSTATUS _netr_DatabaseSync2(struct pipe
  4383. NTSTATUS _netr_DatabaseRedo(struct pipes_struct *p,
  4384. struct netr_DatabaseRedo *r)
  4385. {
  4386. - p->rng_fault_state = true;
  4387. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4388. return NT_STATUS_NOT_IMPLEMENTED;
  4389. }
  4390. @@ -1998,7 +1998,7 @@ NTSTATUS _netr_DatabaseRedo(struct pipes
  4391. WERROR _netr_DsRGetDCName(struct pipes_struct *p,
  4392. struct netr_DsRGetDCName *r)
  4393. {
  4394. - p->rng_fault_state = true;
  4395. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4396. return WERR_NOT_SUPPORTED;
  4397. }
  4398. @@ -2017,7 +2017,7 @@ NTSTATUS _netr_LogonGetCapabilities(stru
  4399. WERROR _netr_NETRLOGONSETSERVICEBITS(struct pipes_struct *p,
  4400. struct netr_NETRLOGONSETSERVICEBITS *r)
  4401. {
  4402. - p->rng_fault_state = true;
  4403. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4404. return WERR_NOT_SUPPORTED;
  4405. }
  4406. @@ -2027,7 +2027,7 @@ WERROR _netr_NETRLOGONSETSERVICEBITS(str
  4407. WERROR _netr_LogonGetTrustRid(struct pipes_struct *p,
  4408. struct netr_LogonGetTrustRid *r)
  4409. {
  4410. - p->rng_fault_state = true;
  4411. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4412. return WERR_NOT_SUPPORTED;
  4413. }
  4414. @@ -2037,7 +2037,7 @@ WERROR _netr_LogonGetTrustRid(struct pip
  4415. WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(struct pipes_struct *p,
  4416. struct netr_NETRLOGONCOMPUTESERVERDIGEST *r)
  4417. {
  4418. - p->rng_fault_state = true;
  4419. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4420. return WERR_NOT_SUPPORTED;
  4421. }
  4422. @@ -2047,7 +2047,7 @@ WERROR _netr_NETRLOGONCOMPUTESERVERDIGES
  4423. WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(struct pipes_struct *p,
  4424. struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r)
  4425. {
  4426. - p->rng_fault_state = true;
  4427. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4428. return WERR_NOT_SUPPORTED;
  4429. }
  4430. @@ -2057,7 +2057,7 @@ WERROR _netr_NETRLOGONCOMPUTECLIENTDIGES
  4431. WERROR _netr_DsRGetDCNameEx(struct pipes_struct *p,
  4432. struct netr_DsRGetDCNameEx *r)
  4433. {
  4434. - p->rng_fault_state = true;
  4435. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4436. return WERR_NOT_SUPPORTED;
  4437. }
  4438. @@ -2067,7 +2067,7 @@ WERROR _netr_DsRGetDCNameEx(struct pipes
  4439. WERROR _netr_DsRGetSiteName(struct pipes_struct *p,
  4440. struct netr_DsRGetSiteName *r)
  4441. {
  4442. - p->rng_fault_state = true;
  4443. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4444. return WERR_NOT_SUPPORTED;
  4445. }
  4446. @@ -2077,7 +2077,7 @@ WERROR _netr_DsRGetSiteName(struct pipes
  4447. NTSTATUS _netr_LogonGetDomainInfo(struct pipes_struct *p,
  4448. struct netr_LogonGetDomainInfo *r)
  4449. {
  4450. - p->rng_fault_state = true;
  4451. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4452. return NT_STATUS_NOT_IMPLEMENTED;
  4453. }
  4454. @@ -2087,7 +2087,7 @@ NTSTATUS _netr_LogonGetDomainInfo(struct
  4455. WERROR _netr_ServerPasswordGet(struct pipes_struct *p,
  4456. struct netr_ServerPasswordGet *r)
  4457. {
  4458. - p->rng_fault_state = true;
  4459. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4460. return WERR_NOT_SUPPORTED;
  4461. }
  4462. @@ -2097,7 +2097,7 @@ WERROR _netr_ServerPasswordGet(struct pi
  4463. WERROR _netr_NETRLOGONSENDTOSAM(struct pipes_struct *p,
  4464. struct netr_NETRLOGONSENDTOSAM *r)
  4465. {
  4466. - p->rng_fault_state = true;
  4467. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4468. return WERR_NOT_SUPPORTED;
  4469. }
  4470. @@ -2107,7 +2107,7 @@ WERROR _netr_NETRLOGONSENDTOSAM(struct p
  4471. WERROR _netr_DsRAddressToSitenamesW(struct pipes_struct *p,
  4472. struct netr_DsRAddressToSitenamesW *r)
  4473. {
  4474. - p->rng_fault_state = true;
  4475. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4476. return WERR_NOT_SUPPORTED;
  4477. }
  4478. @@ -2117,7 +2117,7 @@ WERROR _netr_DsRAddressToSitenamesW(stru
  4479. WERROR _netr_DsRGetDCNameEx2(struct pipes_struct *p,
  4480. struct netr_DsRGetDCNameEx2 *r)
  4481. {
  4482. - p->rng_fault_state = true;
  4483. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4484. return WERR_NOT_SUPPORTED;
  4485. }
  4486. @@ -2127,7 +2127,7 @@ WERROR _netr_DsRGetDCNameEx2(struct pipe
  4487. WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct pipes_struct *p,
  4488. struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r)
  4489. {
  4490. - p->rng_fault_state = true;
  4491. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4492. return WERR_NOT_SUPPORTED;
  4493. }
  4494. @@ -2137,7 +2137,7 @@ WERROR _netr_NETRLOGONGETTIMESERVICEPARE
  4495. WERROR _netr_NetrEnumerateTrustedDomainsEx(struct pipes_struct *p,
  4496. struct netr_NetrEnumerateTrustedDomainsEx *r)
  4497. {
  4498. - p->rng_fault_state = true;
  4499. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4500. return WERR_NOT_SUPPORTED;
  4501. }
  4502. @@ -2147,7 +2147,7 @@ WERROR _netr_NetrEnumerateTrustedDomains
  4503. WERROR _netr_DsRAddressToSitenamesExW(struct pipes_struct *p,
  4504. struct netr_DsRAddressToSitenamesExW *r)
  4505. {
  4506. - p->rng_fault_state = true;
  4507. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4508. return WERR_NOT_SUPPORTED;
  4509. }
  4510. @@ -2157,7 +2157,7 @@ WERROR _netr_DsRAddressToSitenamesExW(st
  4511. WERROR _netr_DsrGetDcSiteCoverageW(struct pipes_struct *p,
  4512. struct netr_DsrGetDcSiteCoverageW *r)
  4513. {
  4514. - p->rng_fault_state = true;
  4515. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4516. return WERR_NOT_SUPPORTED;
  4517. }
  4518. @@ -2167,7 +2167,7 @@ WERROR _netr_DsrGetDcSiteCoverageW(struc
  4519. WERROR _netr_DsrEnumerateDomainTrusts(struct pipes_struct *p,
  4520. struct netr_DsrEnumerateDomainTrusts *r)
  4521. {
  4522. - p->rng_fault_state = true;
  4523. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4524. return WERR_NOT_SUPPORTED;
  4525. }
  4526. @@ -2177,7 +2177,7 @@ WERROR _netr_DsrEnumerateDomainTrusts(st
  4527. WERROR _netr_DsrDeregisterDNSHostRecords(struct pipes_struct *p,
  4528. struct netr_DsrDeregisterDNSHostRecords *r)
  4529. {
  4530. - p->rng_fault_state = true;
  4531. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4532. return WERR_NOT_SUPPORTED;
  4533. }
  4534. @@ -2187,7 +2187,7 @@ WERROR _netr_DsrDeregisterDNSHostRecords
  4535. NTSTATUS _netr_ServerTrustPasswordsGet(struct pipes_struct *p,
  4536. struct netr_ServerTrustPasswordsGet *r)
  4537. {
  4538. - p->rng_fault_state = true;
  4539. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4540. return NT_STATUS_NOT_IMPLEMENTED;
  4541. }
  4542. @@ -2197,7 +2197,7 @@ NTSTATUS _netr_ServerTrustPasswordsGet(s
  4543. WERROR _netr_DsRGetForestTrustInformation(struct pipes_struct *p,
  4544. struct netr_DsRGetForestTrustInformation *r)
  4545. {
  4546. - p->rng_fault_state = true;
  4547. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4548. return WERR_NOT_SUPPORTED;
  4549. }
  4550. @@ -2476,7 +2476,7 @@ NTSTATUS _netr_ServerGetTrustInfo(struct
  4551. NTSTATUS _netr_Unused47(struct pipes_struct *p,
  4552. struct netr_Unused47 *r)
  4553. {
  4554. - p->rng_fault_state = true;
  4555. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4556. return NT_STATUS_NOT_IMPLEMENTED;
  4557. }
  4558. @@ -2486,6 +2486,6 @@ NTSTATUS _netr_Unused47(struct pipes_str
  4559. NTSTATUS _netr_DsrUpdateReadOnlyServerDnsRecords(struct pipes_struct *p,
  4560. struct netr_DsrUpdateReadOnlyServerDnsRecords *r)
  4561. {
  4562. - p->rng_fault_state = true;
  4563. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4564. return NT_STATUS_NOT_IMPLEMENTED;
  4565. }
  4566. --- a/source3/rpc_server/ntsvcs/srv_ntsvcs_nt.c
  4567. +++ b/source3/rpc_server/ntsvcs/srv_ntsvcs_nt.c
  4568. @@ -227,7 +227,7 @@ WERROR _PNP_HwProfFlags(struct pipes_str
  4569. WERROR _PNP_Disconnect(struct pipes_struct *p,
  4570. struct PNP_Disconnect *r)
  4571. {
  4572. - p->rng_fault_state = true;
  4573. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4574. return WERR_NOT_SUPPORTED;
  4575. }
  4576. @@ -237,7 +237,7 @@ WERROR _PNP_Disconnect(struct pipes_stru
  4577. WERROR _PNP_Connect(struct pipes_struct *p,
  4578. struct PNP_Connect *r)
  4579. {
  4580. - p->rng_fault_state = true;
  4581. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4582. return WERR_NOT_SUPPORTED;
  4583. }
  4584. @@ -247,7 +247,7 @@ WERROR _PNP_Connect(struct pipes_struct
  4585. WERROR _PNP_GetGlobalState(struct pipes_struct *p,
  4586. struct PNP_GetGlobalState *r)
  4587. {
  4588. - p->rng_fault_state = true;
  4589. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4590. return WERR_NOT_SUPPORTED;
  4591. }
  4592. @@ -257,7 +257,7 @@ WERROR _PNP_GetGlobalState(struct pipes_
  4593. WERROR _PNP_InitDetection(struct pipes_struct *p,
  4594. struct PNP_InitDetection *r)
  4595. {
  4596. - p->rng_fault_state = true;
  4597. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4598. return WERR_NOT_SUPPORTED;
  4599. }
  4600. @@ -267,7 +267,7 @@ WERROR _PNP_InitDetection(struct pipes_s
  4601. WERROR _PNP_ReportLogOn(struct pipes_struct *p,
  4602. struct PNP_ReportLogOn *r)
  4603. {
  4604. - p->rng_fault_state = true;
  4605. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4606. return WERR_NOT_SUPPORTED;
  4607. }
  4608. @@ -277,7 +277,7 @@ WERROR _PNP_ReportLogOn(struct pipes_str
  4609. WERROR _PNP_GetRootDeviceInstance(struct pipes_struct *p,
  4610. struct PNP_GetRootDeviceInstance *r)
  4611. {
  4612. - p->rng_fault_state = true;
  4613. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4614. return WERR_NOT_SUPPORTED;
  4615. }
  4616. @@ -287,7 +287,7 @@ WERROR _PNP_GetRootDeviceInstance(struct
  4617. WERROR _PNP_GetRelatedDeviceInstance(struct pipes_struct *p,
  4618. struct PNP_GetRelatedDeviceInstance *r)
  4619. {
  4620. - p->rng_fault_state = true;
  4621. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4622. return WERR_NOT_SUPPORTED;
  4623. }
  4624. @@ -297,7 +297,7 @@ WERROR _PNP_GetRelatedDeviceInstance(str
  4625. WERROR _PNP_EnumerateSubKeys(struct pipes_struct *p,
  4626. struct PNP_EnumerateSubKeys *r)
  4627. {
  4628. - p->rng_fault_state = true;
  4629. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4630. return WERR_NOT_SUPPORTED;
  4631. }
  4632. @@ -307,7 +307,7 @@ WERROR _PNP_EnumerateSubKeys(struct pipe
  4633. WERROR _PNP_GetDepth(struct pipes_struct *p,
  4634. struct PNP_GetDepth *r)
  4635. {
  4636. - p->rng_fault_state = true;
  4637. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4638. return WERR_NOT_SUPPORTED;
  4639. }
  4640. @@ -317,7 +317,7 @@ WERROR _PNP_GetDepth(struct pipes_struct
  4641. WERROR _PNP_SetDeviceRegProp(struct pipes_struct *p,
  4642. struct PNP_SetDeviceRegProp *r)
  4643. {
  4644. - p->rng_fault_state = true;
  4645. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4646. return WERR_NOT_SUPPORTED;
  4647. }
  4648. @@ -327,7 +327,7 @@ WERROR _PNP_SetDeviceRegProp(struct pipe
  4649. WERROR _PNP_GetClassInstance(struct pipes_struct *p,
  4650. struct PNP_GetClassInstance *r)
  4651. {
  4652. - p->rng_fault_state = true;
  4653. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4654. return WERR_NOT_SUPPORTED;
  4655. }
  4656. @@ -337,7 +337,7 @@ WERROR _PNP_GetClassInstance(struct pipe
  4657. WERROR _PNP_CreateKey(struct pipes_struct *p,
  4658. struct PNP_CreateKey *r)
  4659. {
  4660. - p->rng_fault_state = true;
  4661. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4662. return WERR_NOT_SUPPORTED;
  4663. }
  4664. @@ -347,7 +347,7 @@ WERROR _PNP_CreateKey(struct pipes_struc
  4665. WERROR _PNP_DeleteRegistryKey(struct pipes_struct *p,
  4666. struct PNP_DeleteRegistryKey *r)
  4667. {
  4668. - p->rng_fault_state = true;
  4669. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4670. return WERR_NOT_SUPPORTED;
  4671. }
  4672. @@ -357,7 +357,7 @@ WERROR _PNP_DeleteRegistryKey(struct pip
  4673. WERROR _PNP_GetClassCount(struct pipes_struct *p,
  4674. struct PNP_GetClassCount *r)
  4675. {
  4676. - p->rng_fault_state = true;
  4677. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4678. return WERR_NOT_SUPPORTED;
  4679. }
  4680. @@ -367,7 +367,7 @@ WERROR _PNP_GetClassCount(struct pipes_s
  4681. WERROR _PNP_GetClassName(struct pipes_struct *p,
  4682. struct PNP_GetClassName *r)
  4683. {
  4684. - p->rng_fault_state = true;
  4685. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4686. return WERR_NOT_SUPPORTED;
  4687. }
  4688. @@ -377,7 +377,7 @@ WERROR _PNP_GetClassName(struct pipes_st
  4689. WERROR _PNP_DeleteClassKey(struct pipes_struct *p,
  4690. struct PNP_DeleteClassKey *r)
  4691. {
  4692. - p->rng_fault_state = true;
  4693. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4694. return WERR_NOT_SUPPORTED;
  4695. }
  4696. @@ -387,7 +387,7 @@ WERROR _PNP_DeleteClassKey(struct pipes_
  4697. WERROR _PNP_GetInterfaceDeviceAlias(struct pipes_struct *p,
  4698. struct PNP_GetInterfaceDeviceAlias *r)
  4699. {
  4700. - p->rng_fault_state = true;
  4701. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4702. return WERR_NOT_SUPPORTED;
  4703. }
  4704. @@ -397,7 +397,7 @@ WERROR _PNP_GetInterfaceDeviceAlias(stru
  4705. WERROR _PNP_GetInterfaceDeviceList(struct pipes_struct *p,
  4706. struct PNP_GetInterfaceDeviceList *r)
  4707. {
  4708. - p->rng_fault_state = true;
  4709. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4710. return WERR_NOT_SUPPORTED;
  4711. }
  4712. @@ -407,7 +407,7 @@ WERROR _PNP_GetInterfaceDeviceList(struc
  4713. WERROR _PNP_GetInterfaceDeviceListSize(struct pipes_struct *p,
  4714. struct PNP_GetInterfaceDeviceListSize *r)
  4715. {
  4716. - p->rng_fault_state = true;
  4717. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4718. return WERR_NOT_SUPPORTED;
  4719. }
  4720. @@ -417,7 +417,7 @@ WERROR _PNP_GetInterfaceDeviceListSize(s
  4721. WERROR _PNP_RegisterDeviceClassAssociation(struct pipes_struct *p,
  4722. struct PNP_RegisterDeviceClassAssociation *r)
  4723. {
  4724. - p->rng_fault_state = true;
  4725. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4726. return WERR_NOT_SUPPORTED;
  4727. }
  4728. @@ -427,7 +427,7 @@ WERROR _PNP_RegisterDeviceClassAssociati
  4729. WERROR _PNP_UnregisterDeviceClassAssociation(struct pipes_struct *p,
  4730. struct PNP_UnregisterDeviceClassAssociation *r)
  4731. {
  4732. - p->rng_fault_state = true;
  4733. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4734. return WERR_NOT_SUPPORTED;
  4735. }
  4736. @@ -437,7 +437,7 @@ WERROR _PNP_UnregisterDeviceClassAssocia
  4737. WERROR _PNP_GetClassRegProp(struct pipes_struct *p,
  4738. struct PNP_GetClassRegProp *r)
  4739. {
  4740. - p->rng_fault_state = true;
  4741. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4742. return WERR_NOT_SUPPORTED;
  4743. }
  4744. @@ -447,7 +447,7 @@ WERROR _PNP_GetClassRegProp(struct pipes
  4745. WERROR _PNP_SetClassRegProp(struct pipes_struct *p,
  4746. struct PNP_SetClassRegProp *r)
  4747. {
  4748. - p->rng_fault_state = true;
  4749. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4750. return WERR_NOT_SUPPORTED;
  4751. }
  4752. @@ -457,7 +457,7 @@ WERROR _PNP_SetClassRegProp(struct pipes
  4753. WERROR _PNP_CreateDevInst(struct pipes_struct *p,
  4754. struct PNP_CreateDevInst *r)
  4755. {
  4756. - p->rng_fault_state = true;
  4757. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4758. return WERR_NOT_SUPPORTED;
  4759. }
  4760. @@ -467,7 +467,7 @@ WERROR _PNP_CreateDevInst(struct pipes_s
  4761. WERROR _PNP_DeviceInstanceAction(struct pipes_struct *p,
  4762. struct PNP_DeviceInstanceAction *r)
  4763. {
  4764. - p->rng_fault_state = true;
  4765. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4766. return WERR_NOT_SUPPORTED;
  4767. }
  4768. @@ -477,7 +477,7 @@ WERROR _PNP_DeviceInstanceAction(struct
  4769. WERROR _PNP_GetDeviceStatus(struct pipes_struct *p,
  4770. struct PNP_GetDeviceStatus *r)
  4771. {
  4772. - p->rng_fault_state = true;
  4773. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4774. return WERR_NOT_SUPPORTED;
  4775. }
  4776. @@ -487,7 +487,7 @@ WERROR _PNP_GetDeviceStatus(struct pipes
  4777. WERROR _PNP_SetDeviceProblem(struct pipes_struct *p,
  4778. struct PNP_SetDeviceProblem *r)
  4779. {
  4780. - p->rng_fault_state = true;
  4781. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4782. return WERR_NOT_SUPPORTED;
  4783. }
  4784. @@ -497,7 +497,7 @@ WERROR _PNP_SetDeviceProblem(struct pipe
  4785. WERROR _PNP_DisableDevInst(struct pipes_struct *p,
  4786. struct PNP_DisableDevInst *r)
  4787. {
  4788. - p->rng_fault_state = true;
  4789. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4790. return WERR_NOT_SUPPORTED;
  4791. }
  4792. @@ -507,7 +507,7 @@ WERROR _PNP_DisableDevInst(struct pipes_
  4793. WERROR _PNP_UninstallDevInst(struct pipes_struct *p,
  4794. struct PNP_UninstallDevInst *r)
  4795. {
  4796. - p->rng_fault_state = true;
  4797. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4798. return WERR_NOT_SUPPORTED;
  4799. }
  4800. @@ -517,7 +517,7 @@ WERROR _PNP_UninstallDevInst(struct pipe
  4801. WERROR _PNP_AddID(struct pipes_struct *p,
  4802. struct PNP_AddID *r)
  4803. {
  4804. - p->rng_fault_state = true;
  4805. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4806. return WERR_NOT_SUPPORTED;
  4807. }
  4808. @@ -527,7 +527,7 @@ WERROR _PNP_AddID(struct pipes_struct *p
  4809. WERROR _PNP_RegisterDriver(struct pipes_struct *p,
  4810. struct PNP_RegisterDriver *r)
  4811. {
  4812. - p->rng_fault_state = true;
  4813. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4814. return WERR_NOT_SUPPORTED;
  4815. }
  4816. @@ -537,7 +537,7 @@ WERROR _PNP_RegisterDriver(struct pipes_
  4817. WERROR _PNP_QueryRemove(struct pipes_struct *p,
  4818. struct PNP_QueryRemove *r)
  4819. {
  4820. - p->rng_fault_state = true;
  4821. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4822. return WERR_NOT_SUPPORTED;
  4823. }
  4824. @@ -547,7 +547,7 @@ WERROR _PNP_QueryRemove(struct pipes_str
  4825. WERROR _PNP_RequestDeviceEject(struct pipes_struct *p,
  4826. struct PNP_RequestDeviceEject *r)
  4827. {
  4828. - p->rng_fault_state = true;
  4829. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4830. return WERR_NOT_SUPPORTED;
  4831. }
  4832. @@ -557,7 +557,7 @@ WERROR _PNP_RequestDeviceEject(struct pi
  4833. WERROR _PNP_IsDockStationPresent(struct pipes_struct *p,
  4834. struct PNP_IsDockStationPresent *r)
  4835. {
  4836. - p->rng_fault_state = true;
  4837. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4838. return WERR_NOT_SUPPORTED;
  4839. }
  4840. @@ -567,7 +567,7 @@ WERROR _PNP_IsDockStationPresent(struct
  4841. WERROR _PNP_RequestEjectPC(struct pipes_struct *p,
  4842. struct PNP_RequestEjectPC *r)
  4843. {
  4844. - p->rng_fault_state = true;
  4845. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4846. return WERR_NOT_SUPPORTED;
  4847. }
  4848. @@ -577,7 +577,7 @@ WERROR _PNP_RequestEjectPC(struct pipes_
  4849. WERROR _PNP_AddEmptyLogConf(struct pipes_struct *p,
  4850. struct PNP_AddEmptyLogConf *r)
  4851. {
  4852. - p->rng_fault_state = true;
  4853. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4854. return WERR_NOT_SUPPORTED;
  4855. }
  4856. @@ -587,7 +587,7 @@ WERROR _PNP_AddEmptyLogConf(struct pipes
  4857. WERROR _PNP_FreeLogConf(struct pipes_struct *p,
  4858. struct PNP_FreeLogConf *r)
  4859. {
  4860. - p->rng_fault_state = true;
  4861. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4862. return WERR_NOT_SUPPORTED;
  4863. }
  4864. @@ -597,7 +597,7 @@ WERROR _PNP_FreeLogConf(struct pipes_str
  4865. WERROR _PNP_GetFirstLogConf(struct pipes_struct *p,
  4866. struct PNP_GetFirstLogConf *r)
  4867. {
  4868. - p->rng_fault_state = true;
  4869. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4870. return WERR_NOT_SUPPORTED;
  4871. }
  4872. @@ -607,7 +607,7 @@ WERROR _PNP_GetFirstLogConf(struct pipes
  4873. WERROR _PNP_GetNextLogConf(struct pipes_struct *p,
  4874. struct PNP_GetNextLogConf *r)
  4875. {
  4876. - p->rng_fault_state = true;
  4877. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4878. return WERR_NOT_SUPPORTED;
  4879. }
  4880. @@ -617,7 +617,7 @@ WERROR _PNP_GetNextLogConf(struct pipes_
  4881. WERROR _PNP_GetLogConfPriority(struct pipes_struct *p,
  4882. struct PNP_GetLogConfPriority *r)
  4883. {
  4884. - p->rng_fault_state = true;
  4885. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4886. return WERR_NOT_SUPPORTED;
  4887. }
  4888. @@ -627,7 +627,7 @@ WERROR _PNP_GetLogConfPriority(struct pi
  4889. WERROR _PNP_AddResDes(struct pipes_struct *p,
  4890. struct PNP_AddResDes *r)
  4891. {
  4892. - p->rng_fault_state = true;
  4893. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4894. return WERR_NOT_SUPPORTED;
  4895. }
  4896. @@ -637,7 +637,7 @@ WERROR _PNP_AddResDes(struct pipes_struc
  4897. WERROR _PNP_FreeResDes(struct pipes_struct *p,
  4898. struct PNP_FreeResDes *r)
  4899. {
  4900. - p->rng_fault_state = true;
  4901. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4902. return WERR_NOT_SUPPORTED;
  4903. }
  4904. @@ -647,7 +647,7 @@ WERROR _PNP_FreeResDes(struct pipes_stru
  4905. WERROR _PNP_GetNextResDes(struct pipes_struct *p,
  4906. struct PNP_GetNextResDes *r)
  4907. {
  4908. - p->rng_fault_state = true;
  4909. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4910. return WERR_NOT_SUPPORTED;
  4911. }
  4912. @@ -657,7 +657,7 @@ WERROR _PNP_GetNextResDes(struct pipes_s
  4913. WERROR _PNP_GetResDesData(struct pipes_struct *p,
  4914. struct PNP_GetResDesData *r)
  4915. {
  4916. - p->rng_fault_state = true;
  4917. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4918. return WERR_NOT_SUPPORTED;
  4919. }
  4920. @@ -667,7 +667,7 @@ WERROR _PNP_GetResDesData(struct pipes_s
  4921. WERROR _PNP_GetResDesDataSize(struct pipes_struct *p,
  4922. struct PNP_GetResDesDataSize *r)
  4923. {
  4924. - p->rng_fault_state = true;
  4925. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4926. return WERR_NOT_SUPPORTED;
  4927. }
  4928. @@ -677,7 +677,7 @@ WERROR _PNP_GetResDesDataSize(struct pip
  4929. WERROR _PNP_ModifyResDes(struct pipes_struct *p,
  4930. struct PNP_ModifyResDes *r)
  4931. {
  4932. - p->rng_fault_state = true;
  4933. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4934. return WERR_NOT_SUPPORTED;
  4935. }
  4936. @@ -687,7 +687,7 @@ WERROR _PNP_ModifyResDes(struct pipes_st
  4937. WERROR _PNP_DetectResourceLimit(struct pipes_struct *p,
  4938. struct PNP_DetectResourceLimit *r)
  4939. {
  4940. - p->rng_fault_state = true;
  4941. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4942. return WERR_NOT_SUPPORTED;
  4943. }
  4944. @@ -697,7 +697,7 @@ WERROR _PNP_DetectResourceLimit(struct p
  4945. WERROR _PNP_QueryResConfList(struct pipes_struct *p,
  4946. struct PNP_QueryResConfList *r)
  4947. {
  4948. - p->rng_fault_state = true;
  4949. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4950. return WERR_NOT_SUPPORTED;
  4951. }
  4952. @@ -707,7 +707,7 @@ WERROR _PNP_QueryResConfList(struct pipe
  4953. WERROR _PNP_SetHwProf(struct pipes_struct *p,
  4954. struct PNP_SetHwProf *r)
  4955. {
  4956. - p->rng_fault_state = true;
  4957. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4958. return WERR_NOT_SUPPORTED;
  4959. }
  4960. @@ -717,7 +717,7 @@ WERROR _PNP_SetHwProf(struct pipes_struc
  4961. WERROR _PNP_QueryArbitratorFreeData(struct pipes_struct *p,
  4962. struct PNP_QueryArbitratorFreeData *r)
  4963. {
  4964. - p->rng_fault_state = true;
  4965. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4966. return WERR_NOT_SUPPORTED;
  4967. }
  4968. @@ -727,7 +727,7 @@ WERROR _PNP_QueryArbitratorFreeData(stru
  4969. WERROR _PNP_QueryArbitratorFreeSize(struct pipes_struct *p,
  4970. struct PNP_QueryArbitratorFreeSize *r)
  4971. {
  4972. - p->rng_fault_state = true;
  4973. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4974. return WERR_NOT_SUPPORTED;
  4975. }
  4976. @@ -737,7 +737,7 @@ WERROR _PNP_QueryArbitratorFreeSize(stru
  4977. WERROR _PNP_RunDetection(struct pipes_struct *p,
  4978. struct PNP_RunDetection *r)
  4979. {
  4980. - p->rng_fault_state = true;
  4981. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4982. return WERR_NOT_SUPPORTED;
  4983. }
  4984. @@ -747,7 +747,7 @@ WERROR _PNP_RunDetection(struct pipes_st
  4985. WERROR _PNP_RegisterNotification(struct pipes_struct *p,
  4986. struct PNP_RegisterNotification *r)
  4987. {
  4988. - p->rng_fault_state = true;
  4989. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4990. return WERR_NOT_SUPPORTED;
  4991. }
  4992. @@ -757,7 +757,7 @@ WERROR _PNP_RegisterNotification(struct
  4993. WERROR _PNP_UnregisterNotification(struct pipes_struct *p,
  4994. struct PNP_UnregisterNotification *r)
  4995. {
  4996. - p->rng_fault_state = true;
  4997. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  4998. return WERR_NOT_SUPPORTED;
  4999. }
  5000. @@ -767,7 +767,7 @@ WERROR _PNP_UnregisterNotification(struc
  5001. WERROR _PNP_GetCustomDevProp(struct pipes_struct *p,
  5002. struct PNP_GetCustomDevProp *r)
  5003. {
  5004. - p->rng_fault_state = true;
  5005. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5006. return WERR_NOT_SUPPORTED;
  5007. }
  5008. @@ -777,7 +777,7 @@ WERROR _PNP_GetCustomDevProp(struct pipe
  5009. WERROR _PNP_GetVersionInternal(struct pipes_struct *p,
  5010. struct PNP_GetVersionInternal *r)
  5011. {
  5012. - p->rng_fault_state = true;
  5013. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5014. return WERR_NOT_SUPPORTED;
  5015. }
  5016. @@ -787,7 +787,7 @@ WERROR _PNP_GetVersionInternal(struct pi
  5017. WERROR _PNP_GetBlockedDriverInfo(struct pipes_struct *p,
  5018. struct PNP_GetBlockedDriverInfo *r)
  5019. {
  5020. - p->rng_fault_state = true;
  5021. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5022. return WERR_NOT_SUPPORTED;
  5023. }
  5024. @@ -797,6 +797,6 @@ WERROR _PNP_GetBlockedDriverInfo(struct
  5025. WERROR _PNP_GetServerSideDeviceInstallFlags(struct pipes_struct *p,
  5026. struct PNP_GetServerSideDeviceInstallFlags *r)
  5027. {
  5028. - p->rng_fault_state = true;
  5029. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5030. return WERR_NOT_SUPPORTED;
  5031. }
  5032. --- a/source3/rpc_server/rpc_handles.c
  5033. +++ b/source3/rpc_server/rpc_handles.c
  5034. @@ -242,7 +242,7 @@ static struct dcesrv_handle *find_policy
  5035. DEBUG(4,("Policy not found: "));
  5036. dump_data(4, (uint8_t *)hnd, sizeof(*hnd));
  5037. - p->bad_handle_fault_state = true;
  5038. + p->fault_state = DCERPC_FAULT_CONTEXT_MISMATCH;
  5039. return NULL;
  5040. }
  5041. --- a/source3/rpc_server/rpc_ncacn_np.c
  5042. +++ b/source3/rpc_server/rpc_ncacn_np.c
  5043. @@ -216,24 +216,13 @@ static NTSTATUS rpcint_dispatch(struct p
  5044. }
  5045. if (p->fault_state) {
  5046. - p->fault_state = false;
  5047. - data_blob_free(&p->out_data.rdata);
  5048. - talloc_free_children(p->mem_ctx);
  5049. - return NT_STATUS_RPC_CALL_FAILED;
  5050. - }
  5051. -
  5052. - if (p->bad_handle_fault_state) {
  5053. - p->bad_handle_fault_state = false;
  5054. - data_blob_free(&p->out_data.rdata);
  5055. - talloc_free_children(p->mem_ctx);
  5056. - return NT_STATUS_RPC_SS_CONTEXT_MISMATCH;
  5057. - }
  5058. + NTSTATUS status;
  5059. - if (p->rng_fault_state) {
  5060. - p->rng_fault_state = false;
  5061. + status = NT_STATUS(p->fault_state);
  5062. + p->fault_state = 0;
  5063. data_blob_free(&p->out_data.rdata);
  5064. talloc_free_children(p->mem_ctx);
  5065. - return NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE;
  5066. + return status;
  5067. }
  5068. *out_data = p->out_data.rdata;
  5069. --- a/source3/rpc_server/samr/srv_samr_nt.c
  5070. +++ b/source3/rpc_server/samr/srv_samr_nt.c
  5071. @@ -6682,7 +6682,7 @@ NTSTATUS _samr_ValidatePassword(struct p
  5072. NTSTATUS _samr_Shutdown(struct pipes_struct *p,
  5073. struct samr_Shutdown *r)
  5074. {
  5075. - p->rng_fault_state = true;
  5076. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5077. return NT_STATUS_NOT_IMPLEMENTED;
  5078. }
  5079. @@ -6692,7 +6692,7 @@ NTSTATUS _samr_Shutdown(struct pipes_str
  5080. NTSTATUS _samr_SetMemberAttributesOfGroup(struct pipes_struct *p,
  5081. struct samr_SetMemberAttributesOfGroup *r)
  5082. {
  5083. - p->rng_fault_state = true;
  5084. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5085. return NT_STATUS_NOT_IMPLEMENTED;
  5086. }
  5087. @@ -6702,6 +6702,7 @@ NTSTATUS _samr_SetMemberAttributesOfGrou
  5088. NTSTATUS _samr_TestPrivateFunctionsDomain(struct pipes_struct *p,
  5089. struct samr_TestPrivateFunctionsDomain *r)
  5090. {
  5091. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5092. return NT_STATUS_NOT_IMPLEMENTED;
  5093. }
  5094. @@ -6711,6 +6712,7 @@ NTSTATUS _samr_TestPrivateFunctionsDomai
  5095. NTSTATUS _samr_TestPrivateFunctionsUser(struct pipes_struct *p,
  5096. struct samr_TestPrivateFunctionsUser *r)
  5097. {
  5098. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5099. return NT_STATUS_NOT_IMPLEMENTED;
  5100. }
  5101. @@ -6720,7 +6722,7 @@ NTSTATUS _samr_TestPrivateFunctionsUser(
  5102. NTSTATUS _samr_AddMultipleMembersToAlias(struct pipes_struct *p,
  5103. struct samr_AddMultipleMembersToAlias *r)
  5104. {
  5105. - p->rng_fault_state = true;
  5106. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5107. return NT_STATUS_NOT_IMPLEMENTED;
  5108. }
  5109. @@ -6730,7 +6732,7 @@ NTSTATUS _samr_AddMultipleMembersToAlias
  5110. NTSTATUS _samr_RemoveMultipleMembersFromAlias(struct pipes_struct *p,
  5111. struct samr_RemoveMultipleMembersFromAlias *r)
  5112. {
  5113. - p->rng_fault_state = true;
  5114. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5115. return NT_STATUS_NOT_IMPLEMENTED;
  5116. }
  5117. @@ -6740,7 +6742,7 @@ NTSTATUS _samr_RemoveMultipleMembersFrom
  5118. NTSTATUS _samr_SetBootKeyInformation(struct pipes_struct *p,
  5119. struct samr_SetBootKeyInformation *r)
  5120. {
  5121. - p->rng_fault_state = true;
  5122. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5123. return NT_STATUS_NOT_IMPLEMENTED;
  5124. }
  5125. @@ -6750,7 +6752,7 @@ NTSTATUS _samr_SetBootKeyInformation(str
  5126. NTSTATUS _samr_GetBootKeyInformation(struct pipes_struct *p,
  5127. struct samr_GetBootKeyInformation *r)
  5128. {
  5129. - p->rng_fault_state = true;
  5130. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5131. return NT_STATUS_NOT_IMPLEMENTED;
  5132. }
  5133. @@ -6760,6 +6762,6 @@ NTSTATUS _samr_GetBootKeyInformation(str
  5134. NTSTATUS _samr_SetDsrmPassword(struct pipes_struct *p,
  5135. struct samr_SetDsrmPassword *r)
  5136. {
  5137. - p->rng_fault_state = true;
  5138. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5139. return NT_STATUS_NOT_IMPLEMENTED;
  5140. }
  5141. --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
  5142. +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
  5143. @@ -10156,7 +10156,7 @@ WERROR _spoolss_AddPort(struct pipes_str
  5144. WERROR _spoolss_GetPrinterDriver(struct pipes_struct *p,
  5145. struct spoolss_GetPrinterDriver *r)
  5146. {
  5147. - p->rng_fault_state = true;
  5148. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5149. return WERR_NOT_SUPPORTED;
  5150. }
  5151. @@ -10167,7 +10167,7 @@ WERROR _spoolss_GetPrinterDriver(struct
  5152. WERROR _spoolss_ReadPrinter(struct pipes_struct *p,
  5153. struct spoolss_ReadPrinter *r)
  5154. {
  5155. - p->rng_fault_state = true;
  5156. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5157. return WERR_NOT_SUPPORTED;
  5158. }
  5159. @@ -10178,7 +10178,7 @@ WERROR _spoolss_ReadPrinter(struct pipes
  5160. WERROR _spoolss_WaitForPrinterChange(struct pipes_struct *p,
  5161. struct spoolss_WaitForPrinterChange *r)
  5162. {
  5163. - p->rng_fault_state = true;
  5164. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5165. return WERR_NOT_SUPPORTED;
  5166. }
  5167. @@ -10189,7 +10189,7 @@ WERROR _spoolss_WaitForPrinterChange(str
  5168. WERROR _spoolss_ConfigurePort(struct pipes_struct *p,
  5169. struct spoolss_ConfigurePort *r)
  5170. {
  5171. - p->rng_fault_state = true;
  5172. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5173. return WERR_NOT_SUPPORTED;
  5174. }
  5175. @@ -10200,7 +10200,7 @@ WERROR _spoolss_ConfigurePort(struct pip
  5176. WERROR _spoolss_DeletePort(struct pipes_struct *p,
  5177. struct spoolss_DeletePort *r)
  5178. {
  5179. - p->rng_fault_state = true;
  5180. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5181. return WERR_NOT_SUPPORTED;
  5182. }
  5183. @@ -10211,7 +10211,7 @@ WERROR _spoolss_DeletePort(struct pipes_
  5184. WERROR _spoolss_CreatePrinterIC(struct pipes_struct *p,
  5185. struct spoolss_CreatePrinterIC *r)
  5186. {
  5187. - p->rng_fault_state = true;
  5188. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5189. return WERR_NOT_SUPPORTED;
  5190. }
  5191. @@ -10222,7 +10222,7 @@ WERROR _spoolss_CreatePrinterIC(struct p
  5192. WERROR _spoolss_PlayGDIScriptOnPrinterIC(struct pipes_struct *p,
  5193. struct spoolss_PlayGDIScriptOnPrinterIC *r)
  5194. {
  5195. - p->rng_fault_state = true;
  5196. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5197. return WERR_NOT_SUPPORTED;
  5198. }
  5199. @@ -10233,7 +10233,7 @@ WERROR _spoolss_PlayGDIScriptOnPrinterIC
  5200. WERROR _spoolss_DeletePrinterIC(struct pipes_struct *p,
  5201. struct spoolss_DeletePrinterIC *r)
  5202. {
  5203. - p->rng_fault_state = true;
  5204. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5205. return WERR_NOT_SUPPORTED;
  5206. }
  5207. @@ -10244,7 +10244,7 @@ WERROR _spoolss_DeletePrinterIC(struct p
  5208. WERROR _spoolss_AddPrinterConnection(struct pipes_struct *p,
  5209. struct spoolss_AddPrinterConnection *r)
  5210. {
  5211. - p->rng_fault_state = true;
  5212. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5213. return WERR_NOT_SUPPORTED;
  5214. }
  5215. @@ -10255,7 +10255,7 @@ WERROR _spoolss_AddPrinterConnection(str
  5216. WERROR _spoolss_DeletePrinterConnection(struct pipes_struct *p,
  5217. struct spoolss_DeletePrinterConnection *r)
  5218. {
  5219. - p->rng_fault_state = true;
  5220. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5221. return WERR_NOT_SUPPORTED;
  5222. }
  5223. @@ -10266,7 +10266,7 @@ WERROR _spoolss_DeletePrinterConnection(
  5224. WERROR _spoolss_PrinterMessageBox(struct pipes_struct *p,
  5225. struct spoolss_PrinterMessageBox *r)
  5226. {
  5227. - p->rng_fault_state = true;
  5228. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5229. return WERR_NOT_SUPPORTED;
  5230. }
  5231. @@ -10277,7 +10277,7 @@ WERROR _spoolss_PrinterMessageBox(struct
  5232. WERROR _spoolss_AddMonitor(struct pipes_struct *p,
  5233. struct spoolss_AddMonitor *r)
  5234. {
  5235. - p->rng_fault_state = true;
  5236. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5237. return WERR_NOT_SUPPORTED;
  5238. }
  5239. @@ -10288,7 +10288,7 @@ WERROR _spoolss_AddMonitor(struct pipes_
  5240. WERROR _spoolss_DeleteMonitor(struct pipes_struct *p,
  5241. struct spoolss_DeleteMonitor *r)
  5242. {
  5243. - p->rng_fault_state = true;
  5244. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5245. return WERR_NOT_SUPPORTED;
  5246. }
  5247. @@ -10299,7 +10299,7 @@ WERROR _spoolss_DeleteMonitor(struct pip
  5248. WERROR _spoolss_DeletePrintProcessor(struct pipes_struct *p,
  5249. struct spoolss_DeletePrintProcessor *r)
  5250. {
  5251. - p->rng_fault_state = true;
  5252. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5253. return WERR_NOT_SUPPORTED;
  5254. }
  5255. @@ -10310,7 +10310,7 @@ WERROR _spoolss_DeletePrintProcessor(str
  5256. WERROR _spoolss_AddPrintProvidor(struct pipes_struct *p,
  5257. struct spoolss_AddPrintProvidor *r)
  5258. {
  5259. - p->rng_fault_state = true;
  5260. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5261. return WERR_NOT_SUPPORTED;
  5262. }
  5263. @@ -10321,7 +10321,7 @@ WERROR _spoolss_AddPrintProvidor(struct
  5264. WERROR _spoolss_DeletePrintProvidor(struct pipes_struct *p,
  5265. struct spoolss_DeletePrintProvidor *r)
  5266. {
  5267. - p->rng_fault_state = true;
  5268. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5269. return WERR_NOT_SUPPORTED;
  5270. }
  5271. @@ -10332,7 +10332,7 @@ WERROR _spoolss_DeletePrintProvidor(stru
  5272. WERROR _spoolss_FindFirstPrinterChangeNotification(struct pipes_struct *p,
  5273. struct spoolss_FindFirstPrinterChangeNotification *r)
  5274. {
  5275. - p->rng_fault_state = true;
  5276. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5277. return WERR_NOT_SUPPORTED;
  5278. }
  5279. @@ -10343,7 +10343,7 @@ WERROR _spoolss_FindFirstPrinterChangeNo
  5280. WERROR _spoolss_FindNextPrinterChangeNotification(struct pipes_struct *p,
  5281. struct spoolss_FindNextPrinterChangeNotification *r)
  5282. {
  5283. - p->rng_fault_state = true;
  5284. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5285. return WERR_NOT_SUPPORTED;
  5286. }
  5287. @@ -10354,7 +10354,7 @@ WERROR _spoolss_FindNextPrinterChangeNot
  5288. WERROR _spoolss_RouterFindFirstPrinterChangeNotificationOld(struct pipes_struct *p,
  5289. struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r)
  5290. {
  5291. - p->rng_fault_state = true;
  5292. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5293. return WERR_NOT_SUPPORTED;
  5294. }
  5295. @@ -10365,7 +10365,7 @@ WERROR _spoolss_RouterFindFirstPrinterCh
  5296. WERROR _spoolss_ReplyOpenPrinter(struct pipes_struct *p,
  5297. struct spoolss_ReplyOpenPrinter *r)
  5298. {
  5299. - p->rng_fault_state = true;
  5300. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5301. return WERR_NOT_SUPPORTED;
  5302. }
  5303. @@ -10376,7 +10376,7 @@ WERROR _spoolss_ReplyOpenPrinter(struct
  5304. WERROR _spoolss_RouterReplyPrinter(struct pipes_struct *p,
  5305. struct spoolss_RouterReplyPrinter *r)
  5306. {
  5307. - p->rng_fault_state = true;
  5308. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5309. return WERR_NOT_SUPPORTED;
  5310. }
  5311. @@ -10387,7 +10387,7 @@ WERROR _spoolss_RouterReplyPrinter(struc
  5312. WERROR _spoolss_ReplyClosePrinter(struct pipes_struct *p,
  5313. struct spoolss_ReplyClosePrinter *r)
  5314. {
  5315. - p->rng_fault_state = true;
  5316. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5317. return WERR_NOT_SUPPORTED;
  5318. }
  5319. @@ -10398,7 +10398,7 @@ WERROR _spoolss_ReplyClosePrinter(struct
  5320. WERROR _spoolss_AddPortEx(struct pipes_struct *p,
  5321. struct spoolss_AddPortEx *r)
  5322. {
  5323. - p->rng_fault_state = true;
  5324. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5325. return WERR_NOT_SUPPORTED;
  5326. }
  5327. @@ -10409,7 +10409,7 @@ WERROR _spoolss_AddPortEx(struct pipes_s
  5328. WERROR _spoolss_RouterFindFirstPrinterChangeNotification(struct pipes_struct *p,
  5329. struct spoolss_RouterFindFirstPrinterChangeNotification *r)
  5330. {
  5331. - p->rng_fault_state = true;
  5332. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5333. return WERR_NOT_SUPPORTED;
  5334. }
  5335. @@ -10420,7 +10420,7 @@ WERROR _spoolss_RouterFindFirstPrinterCh
  5336. WERROR _spoolss_SpoolerInit(struct pipes_struct *p,
  5337. struct spoolss_SpoolerInit *r)
  5338. {
  5339. - p->rng_fault_state = true;
  5340. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5341. return WERR_NOT_SUPPORTED;
  5342. }
  5343. @@ -10431,7 +10431,7 @@ WERROR _spoolss_SpoolerInit(struct pipes
  5344. WERROR _spoolss_ResetPrinterEx(struct pipes_struct *p,
  5345. struct spoolss_ResetPrinterEx *r)
  5346. {
  5347. - p->rng_fault_state = true;
  5348. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5349. return WERR_NOT_SUPPORTED;
  5350. }
  5351. @@ -10442,7 +10442,7 @@ WERROR _spoolss_ResetPrinterEx(struct pi
  5352. WERROR _spoolss_RouterReplyPrinterEx(struct pipes_struct *p,
  5353. struct spoolss_RouterReplyPrinterEx *r)
  5354. {
  5355. - p->rng_fault_state = true;
  5356. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5357. return WERR_NOT_SUPPORTED;
  5358. }
  5359. @@ -10453,7 +10453,7 @@ WERROR _spoolss_RouterReplyPrinterEx(str
  5360. WERROR _spoolss_44(struct pipes_struct *p,
  5361. struct spoolss_44 *r)
  5362. {
  5363. - p->rng_fault_state = true;
  5364. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5365. return WERR_NOT_SUPPORTED;
  5366. }
  5367. @@ -10464,7 +10464,7 @@ WERROR _spoolss_44(struct pipes_struct *
  5368. WERROR _spoolss_SetPort(struct pipes_struct *p,
  5369. struct spoolss_SetPort *r)
  5370. {
  5371. - p->rng_fault_state = true;
  5372. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5373. return WERR_NOT_SUPPORTED;
  5374. }
  5375. @@ -10475,7 +10475,7 @@ WERROR _spoolss_SetPort(struct pipes_str
  5376. WERROR _spoolss_4a(struct pipes_struct *p,
  5377. struct spoolss_4a *r)
  5378. {
  5379. - p->rng_fault_state = true;
  5380. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5381. return WERR_NOT_SUPPORTED;
  5382. }
  5383. @@ -10486,7 +10486,7 @@ WERROR _spoolss_4a(struct pipes_struct *
  5384. WERROR _spoolss_4b(struct pipes_struct *p,
  5385. struct spoolss_4b *r)
  5386. {
  5387. - p->rng_fault_state = true;
  5388. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5389. return WERR_NOT_SUPPORTED;
  5390. }
  5391. @@ -10497,7 +10497,7 @@ WERROR _spoolss_4b(struct pipes_struct *
  5392. WERROR _spoolss_4c(struct pipes_struct *p,
  5393. struct spoolss_4c *r)
  5394. {
  5395. - p->rng_fault_state = true;
  5396. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5397. return WERR_NOT_SUPPORTED;
  5398. }
  5399. @@ -10508,7 +10508,7 @@ WERROR _spoolss_4c(struct pipes_struct *
  5400. WERROR _spoolss_53(struct pipes_struct *p,
  5401. struct spoolss_53 *r)
  5402. {
  5403. - p->rng_fault_state = true;
  5404. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5405. return WERR_NOT_SUPPORTED;
  5406. }
  5407. @@ -10519,7 +10519,7 @@ WERROR _spoolss_53(struct pipes_struct *
  5408. WERROR _spoolss_AddPerMachineConnection(struct pipes_struct *p,
  5409. struct spoolss_AddPerMachineConnection *r)
  5410. {
  5411. - p->rng_fault_state = true;
  5412. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5413. return WERR_NOT_SUPPORTED;
  5414. }
  5415. @@ -10530,7 +10530,7 @@ WERROR _spoolss_AddPerMachineConnection(
  5416. WERROR _spoolss_DeletePerMachineConnection(struct pipes_struct *p,
  5417. struct spoolss_DeletePerMachineConnection *r)
  5418. {
  5419. - p->rng_fault_state = true;
  5420. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5421. return WERR_NOT_SUPPORTED;
  5422. }
  5423. @@ -10541,7 +10541,7 @@ WERROR _spoolss_DeletePerMachineConnecti
  5424. WERROR _spoolss_EnumPerMachineConnections(struct pipes_struct *p,
  5425. struct spoolss_EnumPerMachineConnections *r)
  5426. {
  5427. - p->rng_fault_state = true;
  5428. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5429. return WERR_NOT_SUPPORTED;
  5430. }
  5431. @@ -10552,7 +10552,7 @@ WERROR _spoolss_EnumPerMachineConnection
  5432. WERROR _spoolss_5a(struct pipes_struct *p,
  5433. struct spoolss_5a *r)
  5434. {
  5435. - p->rng_fault_state = true;
  5436. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5437. return WERR_NOT_SUPPORTED;
  5438. }
  5439. @@ -10563,7 +10563,7 @@ WERROR _spoolss_5a(struct pipes_struct *
  5440. WERROR _spoolss_5b(struct pipes_struct *p,
  5441. struct spoolss_5b *r)
  5442. {
  5443. - p->rng_fault_state = true;
  5444. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5445. return WERR_NOT_SUPPORTED;
  5446. }
  5447. @@ -10574,7 +10574,7 @@ WERROR _spoolss_5b(struct pipes_struct *
  5448. WERROR _spoolss_5c(struct pipes_struct *p,
  5449. struct spoolss_5c *r)
  5450. {
  5451. - p->rng_fault_state = true;
  5452. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5453. return WERR_NOT_SUPPORTED;
  5454. }
  5455. @@ -10585,7 +10585,7 @@ WERROR _spoolss_5c(struct pipes_struct *
  5456. WERROR _spoolss_5d(struct pipes_struct *p,
  5457. struct spoolss_5d *r)
  5458. {
  5459. - p->rng_fault_state = true;
  5460. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5461. return WERR_NOT_SUPPORTED;
  5462. }
  5463. @@ -10596,7 +10596,7 @@ WERROR _spoolss_5d(struct pipes_struct *
  5464. WERROR _spoolss_5e(struct pipes_struct *p,
  5465. struct spoolss_5e *r)
  5466. {
  5467. - p->rng_fault_state = true;
  5468. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5469. return WERR_NOT_SUPPORTED;
  5470. }
  5471. @@ -10607,7 +10607,7 @@ WERROR _spoolss_5e(struct pipes_struct *
  5472. WERROR _spoolss_5f(struct pipes_struct *p,
  5473. struct spoolss_5f *r)
  5474. {
  5475. - p->rng_fault_state = true;
  5476. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5477. return WERR_NOT_SUPPORTED;
  5478. }
  5479. @@ -10618,7 +10618,7 @@ WERROR _spoolss_5f(struct pipes_struct *
  5480. WERROR _spoolss_60(struct pipes_struct *p,
  5481. struct spoolss_60 *r)
  5482. {
  5483. - p->rng_fault_state = true;
  5484. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5485. return WERR_NOT_SUPPORTED;
  5486. }
  5487. @@ -10629,7 +10629,7 @@ WERROR _spoolss_60(struct pipes_struct *
  5488. WERROR _spoolss_61(struct pipes_struct *p,
  5489. struct spoolss_61 *r)
  5490. {
  5491. - p->rng_fault_state = true;
  5492. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5493. return WERR_NOT_SUPPORTED;
  5494. }
  5495. @@ -10640,7 +10640,7 @@ WERROR _spoolss_61(struct pipes_struct *
  5496. WERROR _spoolss_62(struct pipes_struct *p,
  5497. struct spoolss_62 *r)
  5498. {
  5499. - p->rng_fault_state = true;
  5500. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5501. return WERR_NOT_SUPPORTED;
  5502. }
  5503. @@ -10651,7 +10651,7 @@ WERROR _spoolss_62(struct pipes_struct *
  5504. WERROR _spoolss_63(struct pipes_struct *p,
  5505. struct spoolss_63 *r)
  5506. {
  5507. - p->rng_fault_state = true;
  5508. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5509. return WERR_NOT_SUPPORTED;
  5510. }
  5511. @@ -10662,7 +10662,7 @@ WERROR _spoolss_63(struct pipes_struct *
  5512. WERROR _spoolss_64(struct pipes_struct *p,
  5513. struct spoolss_64 *r)
  5514. {
  5515. - p->rng_fault_state = true;
  5516. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5517. return WERR_NOT_SUPPORTED;
  5518. }
  5519. @@ -10673,7 +10673,7 @@ WERROR _spoolss_64(struct pipes_struct *
  5520. WERROR _spoolss_65(struct pipes_struct *p,
  5521. struct spoolss_65 *r)
  5522. {
  5523. - p->rng_fault_state = true;
  5524. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5525. return WERR_NOT_SUPPORTED;
  5526. }
  5527. @@ -10684,7 +10684,7 @@ WERROR _spoolss_65(struct pipes_struct *
  5528. WERROR _spoolss_GetCorePrinterDrivers(struct pipes_struct *p,
  5529. struct spoolss_GetCorePrinterDrivers *r)
  5530. {
  5531. - p->rng_fault_state = true;
  5532. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5533. return WERR_NOT_SUPPORTED;
  5534. }
  5535. @@ -10695,7 +10695,7 @@ WERROR _spoolss_GetCorePrinterDrivers(st
  5536. WERROR _spoolss_67(struct pipes_struct *p,
  5537. struct spoolss_67 *r)
  5538. {
  5539. - p->rng_fault_state = true;
  5540. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5541. return WERR_NOT_SUPPORTED;
  5542. }
  5543. @@ -10706,7 +10706,7 @@ WERROR _spoolss_67(struct pipes_struct *
  5544. WERROR _spoolss_GetPrinterDriverPackagePath(struct pipes_struct *p,
  5545. struct spoolss_GetPrinterDriverPackagePath *r)
  5546. {
  5547. - p->rng_fault_state = true;
  5548. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5549. return WERR_NOT_SUPPORTED;
  5550. }
  5551. @@ -10717,7 +10717,7 @@ WERROR _spoolss_GetPrinterDriverPackageP
  5552. WERROR _spoolss_69(struct pipes_struct *p,
  5553. struct spoolss_69 *r)
  5554. {
  5555. - p->rng_fault_state = true;
  5556. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5557. return WERR_NOT_SUPPORTED;
  5558. }
  5559. @@ -10728,7 +10728,7 @@ WERROR _spoolss_69(struct pipes_struct *
  5560. WERROR _spoolss_6a(struct pipes_struct *p,
  5561. struct spoolss_6a *r)
  5562. {
  5563. - p->rng_fault_state = true;
  5564. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5565. return WERR_NOT_SUPPORTED;
  5566. }
  5567. @@ -10739,7 +10739,7 @@ WERROR _spoolss_6a(struct pipes_struct *
  5568. WERROR _spoolss_6b(struct pipes_struct *p,
  5569. struct spoolss_6b *r)
  5570. {
  5571. - p->rng_fault_state = true;
  5572. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5573. return WERR_NOT_SUPPORTED;
  5574. }
  5575. @@ -10750,7 +10750,7 @@ WERROR _spoolss_6b(struct pipes_struct *
  5576. WERROR _spoolss_6c(struct pipes_struct *p,
  5577. struct spoolss_6c *r)
  5578. {
  5579. - p->rng_fault_state = true;
  5580. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5581. return WERR_NOT_SUPPORTED;
  5582. }
  5583. @@ -10761,6 +10761,6 @@ WERROR _spoolss_6c(struct pipes_struct *
  5584. WERROR _spoolss_6d(struct pipes_struct *p,
  5585. struct spoolss_6d *r)
  5586. {
  5587. - p->rng_fault_state = true;
  5588. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5589. return WERR_NOT_SUPPORTED;
  5590. }
  5591. --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
  5592. +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
  5593. @@ -2548,244 +2548,244 @@ WERROR _srvsvc_NetFileClose(struct pipes
  5594. WERROR _srvsvc_NetCharDevEnum(struct pipes_struct *p,
  5595. struct srvsvc_NetCharDevEnum *r)
  5596. {
  5597. - p->rng_fault_state = True;
  5598. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5599. return WERR_NOT_SUPPORTED;
  5600. }
  5601. WERROR _srvsvc_NetCharDevGetInfo(struct pipes_struct *p,
  5602. struct srvsvc_NetCharDevGetInfo *r)
  5603. {
  5604. - p->rng_fault_state = True;
  5605. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5606. return WERR_NOT_SUPPORTED;
  5607. }
  5608. WERROR _srvsvc_NetCharDevControl(struct pipes_struct *p,
  5609. struct srvsvc_NetCharDevControl *r)
  5610. {
  5611. - p->rng_fault_state = True;
  5612. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5613. return WERR_NOT_SUPPORTED;
  5614. }
  5615. WERROR _srvsvc_NetCharDevQEnum(struct pipes_struct *p,
  5616. struct srvsvc_NetCharDevQEnum *r)
  5617. {
  5618. - p->rng_fault_state = True;
  5619. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5620. return WERR_NOT_SUPPORTED;
  5621. }
  5622. WERROR _srvsvc_NetCharDevQGetInfo(struct pipes_struct *p,
  5623. struct srvsvc_NetCharDevQGetInfo *r)
  5624. {
  5625. - p->rng_fault_state = True;
  5626. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5627. return WERR_NOT_SUPPORTED;
  5628. }
  5629. WERROR _srvsvc_NetCharDevQSetInfo(struct pipes_struct *p,
  5630. struct srvsvc_NetCharDevQSetInfo *r)
  5631. {
  5632. - p->rng_fault_state = True;
  5633. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5634. return WERR_NOT_SUPPORTED;
  5635. }
  5636. WERROR _srvsvc_NetCharDevQPurge(struct pipes_struct *p,
  5637. struct srvsvc_NetCharDevQPurge *r)
  5638. {
  5639. - p->rng_fault_state = True;
  5640. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5641. return WERR_NOT_SUPPORTED;
  5642. }
  5643. WERROR _srvsvc_NetCharDevQPurgeSelf(struct pipes_struct *p,
  5644. struct srvsvc_NetCharDevQPurgeSelf *r)
  5645. {
  5646. - p->rng_fault_state = True;
  5647. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5648. return WERR_NOT_SUPPORTED;
  5649. }
  5650. WERROR _srvsvc_NetFileGetInfo(struct pipes_struct *p,
  5651. struct srvsvc_NetFileGetInfo *r)
  5652. {
  5653. - p->rng_fault_state = True;
  5654. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5655. return WERR_NOT_SUPPORTED;
  5656. }
  5657. WERROR _srvsvc_NetShareCheck(struct pipes_struct *p,
  5658. struct srvsvc_NetShareCheck *r)
  5659. {
  5660. - p->rng_fault_state = True;
  5661. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5662. return WERR_NOT_SUPPORTED;
  5663. }
  5664. WERROR _srvsvc_NetServerStatisticsGet(struct pipes_struct *p,
  5665. struct srvsvc_NetServerStatisticsGet *r)
  5666. {
  5667. - p->rng_fault_state = True;
  5668. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5669. return WERR_NOT_SUPPORTED;
  5670. }
  5671. WERROR _srvsvc_NetTransportAdd(struct pipes_struct *p,
  5672. struct srvsvc_NetTransportAdd *r)
  5673. {
  5674. - p->rng_fault_state = True;
  5675. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5676. return WERR_NOT_SUPPORTED;
  5677. }
  5678. WERROR _srvsvc_NetTransportEnum(struct pipes_struct *p,
  5679. struct srvsvc_NetTransportEnum *r)
  5680. {
  5681. - p->rng_fault_state = True;
  5682. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5683. return WERR_NOT_SUPPORTED;
  5684. }
  5685. WERROR _srvsvc_NetTransportDel(struct pipes_struct *p,
  5686. struct srvsvc_NetTransportDel *r)
  5687. {
  5688. - p->rng_fault_state = True;
  5689. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5690. return WERR_NOT_SUPPORTED;
  5691. }
  5692. WERROR _srvsvc_NetSetServiceBits(struct pipes_struct *p,
  5693. struct srvsvc_NetSetServiceBits *r)
  5694. {
  5695. - p->rng_fault_state = True;
  5696. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5697. return WERR_NOT_SUPPORTED;
  5698. }
  5699. WERROR _srvsvc_NetPathType(struct pipes_struct *p,
  5700. struct srvsvc_NetPathType *r)
  5701. {
  5702. - p->rng_fault_state = True;
  5703. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5704. return WERR_NOT_SUPPORTED;
  5705. }
  5706. WERROR _srvsvc_NetPathCanonicalize(struct pipes_struct *p,
  5707. struct srvsvc_NetPathCanonicalize *r)
  5708. {
  5709. - p->rng_fault_state = True;
  5710. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5711. return WERR_NOT_SUPPORTED;
  5712. }
  5713. WERROR _srvsvc_NetPathCompare(struct pipes_struct *p,
  5714. struct srvsvc_NetPathCompare *r)
  5715. {
  5716. - p->rng_fault_state = True;
  5717. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5718. return WERR_NOT_SUPPORTED;
  5719. }
  5720. WERROR _srvsvc_NETRPRNAMECANONICALIZE(struct pipes_struct *p,
  5721. struct srvsvc_NETRPRNAMECANONICALIZE *r)
  5722. {
  5723. - p->rng_fault_state = True;
  5724. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5725. return WERR_NOT_SUPPORTED;
  5726. }
  5727. WERROR _srvsvc_NetPRNameCompare(struct pipes_struct *p,
  5728. struct srvsvc_NetPRNameCompare *r)
  5729. {
  5730. - p->rng_fault_state = True;
  5731. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5732. return WERR_NOT_SUPPORTED;
  5733. }
  5734. WERROR _srvsvc_NetShareDelStart(struct pipes_struct *p,
  5735. struct srvsvc_NetShareDelStart *r)
  5736. {
  5737. - p->rng_fault_state = True;
  5738. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5739. return WERR_NOT_SUPPORTED;
  5740. }
  5741. WERROR _srvsvc_NetShareDelCommit(struct pipes_struct *p,
  5742. struct srvsvc_NetShareDelCommit *r)
  5743. {
  5744. - p->rng_fault_state = True;
  5745. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5746. return WERR_NOT_SUPPORTED;
  5747. }
  5748. WERROR _srvsvc_NetServerTransportAddEx(struct pipes_struct *p,
  5749. struct srvsvc_NetServerTransportAddEx *r)
  5750. {
  5751. - p->rng_fault_state = True;
  5752. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5753. return WERR_NOT_SUPPORTED;
  5754. }
  5755. WERROR _srvsvc_NetServerSetServiceBitsEx(struct pipes_struct *p,
  5756. struct srvsvc_NetServerSetServiceBitsEx *r)
  5757. {
  5758. - p->rng_fault_state = True;
  5759. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5760. return WERR_NOT_SUPPORTED;
  5761. }
  5762. WERROR _srvsvc_NETRDFSGETVERSION(struct pipes_struct *p,
  5763. struct srvsvc_NETRDFSGETVERSION *r)
  5764. {
  5765. - p->rng_fault_state = True;
  5766. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5767. return WERR_NOT_SUPPORTED;
  5768. }
  5769. WERROR _srvsvc_NETRDFSCREATELOCALPARTITION(struct pipes_struct *p,
  5770. struct srvsvc_NETRDFSCREATELOCALPARTITION *r)
  5771. {
  5772. - p->rng_fault_state = True;
  5773. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5774. return WERR_NOT_SUPPORTED;
  5775. }
  5776. WERROR _srvsvc_NETRDFSDELETELOCALPARTITION(struct pipes_struct *p,
  5777. struct srvsvc_NETRDFSDELETELOCALPARTITION *r)
  5778. {
  5779. - p->rng_fault_state = True;
  5780. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5781. return WERR_NOT_SUPPORTED;
  5782. }
  5783. WERROR _srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct pipes_struct *p,
  5784. struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r)
  5785. {
  5786. - p->rng_fault_state = True;
  5787. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5788. return WERR_NOT_SUPPORTED;
  5789. }
  5790. WERROR _srvsvc_NETRDFSSETSERVERINFO(struct pipes_struct *p,
  5791. struct srvsvc_NETRDFSSETSERVERINFO *r)
  5792. {
  5793. - p->rng_fault_state = True;
  5794. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5795. return WERR_NOT_SUPPORTED;
  5796. }
  5797. WERROR _srvsvc_NETRDFSCREATEEXITPOINT(struct pipes_struct *p,
  5798. struct srvsvc_NETRDFSCREATEEXITPOINT *r)
  5799. {
  5800. - p->rng_fault_state = True;
  5801. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5802. return WERR_NOT_SUPPORTED;
  5803. }
  5804. WERROR _srvsvc_NETRDFSDELETEEXITPOINT(struct pipes_struct *p,
  5805. struct srvsvc_NETRDFSDELETEEXITPOINT *r)
  5806. {
  5807. - p->rng_fault_state = True;
  5808. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5809. return WERR_NOT_SUPPORTED;
  5810. }
  5811. WERROR _srvsvc_NETRDFSMODIFYPREFIX(struct pipes_struct *p,
  5812. struct srvsvc_NETRDFSMODIFYPREFIX *r)
  5813. {
  5814. - p->rng_fault_state = True;
  5815. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5816. return WERR_NOT_SUPPORTED;
  5817. }
  5818. WERROR _srvsvc_NETRDFSFIXLOCALVOLUME(struct pipes_struct *p,
  5819. struct srvsvc_NETRDFSFIXLOCALVOLUME *r)
  5820. {
  5821. - p->rng_fault_state = True;
  5822. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5823. return WERR_NOT_SUPPORTED;
  5824. }
  5825. WERROR _srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct pipes_struct *p,
  5826. struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r)
  5827. {
  5828. - p->rng_fault_state = True;
  5829. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5830. return WERR_NOT_SUPPORTED;
  5831. }
  5832. WERROR _srvsvc_NETRSERVERTRANSPORTDELEX(struct pipes_struct *p,
  5833. struct srvsvc_NETRSERVERTRANSPORTDELEX *r)
  5834. {
  5835. - p->rng_fault_state = True;
  5836. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5837. return WERR_NOT_SUPPORTED;
  5838. }
  5839. --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
  5840. +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
  5841. @@ -1004,195 +1004,195 @@ WERROR _svcctl_SetServiceObjectSecurity(
  5842. WERROR _svcctl_DeleteService(struct pipes_struct *p,
  5843. struct svcctl_DeleteService *r)
  5844. {
  5845. - p->rng_fault_state = True;
  5846. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5847. return WERR_NOT_SUPPORTED;
  5848. }
  5849. WERROR _svcctl_SetServiceStatus(struct pipes_struct *p,
  5850. struct svcctl_SetServiceStatus *r)
  5851. {
  5852. - p->rng_fault_state = True;
  5853. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5854. return WERR_NOT_SUPPORTED;
  5855. }
  5856. WERROR _svcctl_NotifyBootConfigStatus(struct pipes_struct *p,
  5857. struct svcctl_NotifyBootConfigStatus *r)
  5858. {
  5859. - p->rng_fault_state = True;
  5860. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5861. return WERR_NOT_SUPPORTED;
  5862. }
  5863. WERROR _svcctl_SCSetServiceBitsW(struct pipes_struct *p,
  5864. struct svcctl_SCSetServiceBitsW *r)
  5865. {
  5866. - p->rng_fault_state = True;
  5867. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5868. return WERR_NOT_SUPPORTED;
  5869. }
  5870. WERROR _svcctl_ChangeServiceConfigW(struct pipes_struct *p,
  5871. struct svcctl_ChangeServiceConfigW *r)
  5872. {
  5873. - p->rng_fault_state = True;
  5874. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5875. return WERR_NOT_SUPPORTED;
  5876. }
  5877. WERROR _svcctl_CreateServiceW(struct pipes_struct *p,
  5878. struct svcctl_CreateServiceW *r)
  5879. {
  5880. - p->rng_fault_state = True;
  5881. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5882. return WERR_NOT_SUPPORTED;
  5883. }
  5884. WERROR _svcctl_QueryServiceLockStatusW(struct pipes_struct *p,
  5885. struct svcctl_QueryServiceLockStatusW *r)
  5886. {
  5887. - p->rng_fault_state = True;
  5888. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5889. return WERR_NOT_SUPPORTED;
  5890. }
  5891. WERROR _svcctl_GetServiceKeyNameW(struct pipes_struct *p,
  5892. struct svcctl_GetServiceKeyNameW *r)
  5893. {
  5894. - p->rng_fault_state = True;
  5895. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5896. return WERR_NOT_SUPPORTED;
  5897. }
  5898. WERROR _svcctl_SCSetServiceBitsA(struct pipes_struct *p,
  5899. struct svcctl_SCSetServiceBitsA *r)
  5900. {
  5901. - p->rng_fault_state = True;
  5902. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5903. return WERR_NOT_SUPPORTED;
  5904. }
  5905. WERROR _svcctl_ChangeServiceConfigA(struct pipes_struct *p,
  5906. struct svcctl_ChangeServiceConfigA *r)
  5907. {
  5908. - p->rng_fault_state = True;
  5909. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5910. return WERR_NOT_SUPPORTED;
  5911. }
  5912. WERROR _svcctl_CreateServiceA(struct pipes_struct *p,
  5913. struct svcctl_CreateServiceA *r)
  5914. {
  5915. - p->rng_fault_state = True;
  5916. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5917. return WERR_NOT_SUPPORTED;
  5918. }
  5919. WERROR _svcctl_EnumDependentServicesA(struct pipes_struct *p,
  5920. struct svcctl_EnumDependentServicesA *r)
  5921. {
  5922. - p->rng_fault_state = True;
  5923. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5924. return WERR_NOT_SUPPORTED;
  5925. }
  5926. WERROR _svcctl_EnumServicesStatusA(struct pipes_struct *p,
  5927. struct svcctl_EnumServicesStatusA *r)
  5928. {
  5929. - p->rng_fault_state = True;
  5930. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5931. return WERR_NOT_SUPPORTED;
  5932. }
  5933. WERROR _svcctl_OpenSCManagerA(struct pipes_struct *p,
  5934. struct svcctl_OpenSCManagerA *r)
  5935. {
  5936. - p->rng_fault_state = True;
  5937. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5938. return WERR_NOT_SUPPORTED;
  5939. }
  5940. WERROR _svcctl_OpenServiceA(struct pipes_struct *p,
  5941. struct svcctl_OpenServiceA *r)
  5942. {
  5943. - p->rng_fault_state = True;
  5944. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5945. return WERR_NOT_SUPPORTED;
  5946. }
  5947. WERROR _svcctl_QueryServiceConfigA(struct pipes_struct *p,
  5948. struct svcctl_QueryServiceConfigA *r)
  5949. {
  5950. - p->rng_fault_state = True;
  5951. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5952. return WERR_NOT_SUPPORTED;
  5953. }
  5954. WERROR _svcctl_QueryServiceLockStatusA(struct pipes_struct *p,
  5955. struct svcctl_QueryServiceLockStatusA *r)
  5956. {
  5957. - p->rng_fault_state = True;
  5958. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5959. return WERR_NOT_SUPPORTED;
  5960. }
  5961. WERROR _svcctl_StartServiceA(struct pipes_struct *p,
  5962. struct svcctl_StartServiceA *r)
  5963. {
  5964. - p->rng_fault_state = True;
  5965. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5966. return WERR_NOT_SUPPORTED;
  5967. }
  5968. WERROR _svcctl_GetServiceDisplayNameA(struct pipes_struct *p,
  5969. struct svcctl_GetServiceDisplayNameA *r)
  5970. {
  5971. - p->rng_fault_state = True;
  5972. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5973. return WERR_NOT_SUPPORTED;
  5974. }
  5975. WERROR _svcctl_GetServiceKeyNameA(struct pipes_struct *p,
  5976. struct svcctl_GetServiceKeyNameA *r)
  5977. {
  5978. - p->rng_fault_state = True;
  5979. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5980. return WERR_NOT_SUPPORTED;
  5981. }
  5982. WERROR _svcctl_GetCurrentGroupeStateW(struct pipes_struct *p,
  5983. struct svcctl_GetCurrentGroupeStateW *r)
  5984. {
  5985. - p->rng_fault_state = True;
  5986. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5987. return WERR_NOT_SUPPORTED;
  5988. }
  5989. WERROR _svcctl_EnumServiceGroupW(struct pipes_struct *p,
  5990. struct svcctl_EnumServiceGroupW *r)
  5991. {
  5992. - p->rng_fault_state = True;
  5993. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  5994. return WERR_NOT_SUPPORTED;
  5995. }
  5996. WERROR _svcctl_ChangeServiceConfig2A(struct pipes_struct *p,
  5997. struct svcctl_ChangeServiceConfig2A *r)
  5998. {
  5999. - p->rng_fault_state = True;
  6000. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6001. return WERR_NOT_SUPPORTED;
  6002. }
  6003. WERROR _svcctl_ChangeServiceConfig2W(struct pipes_struct *p,
  6004. struct svcctl_ChangeServiceConfig2W *r)
  6005. {
  6006. - p->rng_fault_state = True;
  6007. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6008. return WERR_NOT_SUPPORTED;
  6009. }
  6010. WERROR _svcctl_QueryServiceConfig2A(struct pipes_struct *p,
  6011. struct svcctl_QueryServiceConfig2A *r)
  6012. {
  6013. - p->rng_fault_state = True;
  6014. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6015. return WERR_NOT_SUPPORTED;
  6016. }
  6017. WERROR _EnumServicesStatusExA(struct pipes_struct *p,
  6018. struct EnumServicesStatusExA *r)
  6019. {
  6020. - p->rng_fault_state = True;
  6021. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6022. return WERR_NOT_SUPPORTED;
  6023. }
  6024. WERROR _EnumServicesStatusExW(struct pipes_struct *p,
  6025. struct EnumServicesStatusExW *r)
  6026. {
  6027. - p->rng_fault_state = True;
  6028. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6029. return WERR_NOT_SUPPORTED;
  6030. }
  6031. WERROR _svcctl_SCSendTSMessage(struct pipes_struct *p,
  6032. struct svcctl_SCSendTSMessage *r)
  6033. {
  6034. - p->rng_fault_state = True;
  6035. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6036. return WERR_NOT_SUPPORTED;
  6037. }
  6038. --- a/source3/rpc_server/winreg/srv_winreg_nt.c
  6039. +++ b/source3/rpc_server/winreg/srv_winreg_nt.c
  6040. @@ -760,7 +760,7 @@ WERROR _winreg_SaveKeyEx(struct pipes_st
  6041. /* fill in your code here if you think this call should
  6042. do anything */
  6043. - p->rng_fault_state = True;
  6044. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6045. return WERR_NOT_SUPPORTED;
  6046. }
  6047. @@ -948,7 +948,7 @@ WERROR _winreg_UnLoadKey(struct pipes_st
  6048. /* fill in your code here if you think this call should
  6049. do anything */
  6050. - p->rng_fault_state = True;
  6051. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6052. return WERR_NOT_SUPPORTED;
  6053. }
  6054. @@ -962,7 +962,7 @@ WERROR _winreg_ReplaceKey(struct pipes_s
  6055. /* fill in your code here if you think this call should
  6056. do anything */
  6057. - p->rng_fault_state = True;
  6058. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6059. return WERR_NOT_SUPPORTED;
  6060. }
  6061. @@ -976,7 +976,7 @@ WERROR _winreg_LoadKey(struct pipes_stru
  6062. /* fill in your code here if you think this call should
  6063. do anything */
  6064. - p->rng_fault_state = True;
  6065. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6066. return WERR_NOT_SUPPORTED;
  6067. }
  6068. @@ -1139,6 +1139,6 @@ WERROR _winreg_DeleteKeyEx(struct pipes_
  6069. /* fill in your code here if you think this call should
  6070. do anything */
  6071. - p->rng_fault_state = True;
  6072. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6073. return WERR_NOT_SUPPORTED;
  6074. }
  6075. --- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
  6076. +++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
  6077. @@ -405,7 +405,7 @@ WERROR _wkssvc_NetWkstaSetInfo(struct pi
  6078. struct wkssvc_NetWkstaSetInfo *r)
  6079. {
  6080. /* FIXME: Add implementation code here */
  6081. - p->rng_fault_state = True;
  6082. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6083. return WERR_NOT_SUPPORTED;
  6084. }
  6085. @@ -608,7 +608,7 @@ WERROR _wkssvc_NetrWkstaUserGetInfo(stru
  6086. struct wkssvc_NetrWkstaUserGetInfo *r)
  6087. {
  6088. /* FIXME: Add implementation code here */
  6089. - p->rng_fault_state = True;
  6090. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6091. return WERR_NOT_SUPPORTED;
  6092. }
  6093. @@ -619,7 +619,7 @@ WERROR _wkssvc_NetrWkstaUserSetInfo(stru
  6094. struct wkssvc_NetrWkstaUserSetInfo *r)
  6095. {
  6096. /* FIXME: Add implementation code here */
  6097. - p->rng_fault_state = True;
  6098. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6099. return WERR_NOT_SUPPORTED;
  6100. }
  6101. @@ -630,7 +630,7 @@ WERROR _wkssvc_NetWkstaTransportEnum(str
  6102. struct wkssvc_NetWkstaTransportEnum *r)
  6103. {
  6104. /* FIXME: Add implementation code here */
  6105. - p->rng_fault_state = True;
  6106. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6107. return WERR_NOT_SUPPORTED;
  6108. }
  6109. @@ -641,7 +641,7 @@ WERROR _wkssvc_NetrWkstaTransportAdd(str
  6110. struct wkssvc_NetrWkstaTransportAdd *r)
  6111. {
  6112. /* FIXME: Add implementation code here */
  6113. - p->rng_fault_state = True;
  6114. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6115. return WERR_NOT_SUPPORTED;
  6116. }
  6117. @@ -652,7 +652,7 @@ WERROR _wkssvc_NetrWkstaTransportDel(str
  6118. struct wkssvc_NetrWkstaTransportDel *r)
  6119. {
  6120. /* FIXME: Add implementation code here */
  6121. - p->rng_fault_state = True;
  6122. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6123. return WERR_NOT_SUPPORTED;
  6124. }
  6125. @@ -663,7 +663,7 @@ WERROR _wkssvc_NetrUseAdd(struct pipes_s
  6126. struct wkssvc_NetrUseAdd *r)
  6127. {
  6128. /* FIXME: Add implementation code here */
  6129. - p->rng_fault_state = True;
  6130. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6131. return WERR_NOT_SUPPORTED;
  6132. }
  6133. @@ -674,7 +674,7 @@ WERROR _wkssvc_NetrUseGetInfo(struct pip
  6134. struct wkssvc_NetrUseGetInfo *r)
  6135. {
  6136. /* FIXME: Add implementation code here */
  6137. - p->rng_fault_state = True;
  6138. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6139. return WERR_NOT_SUPPORTED;
  6140. }
  6141. @@ -685,7 +685,7 @@ WERROR _wkssvc_NetrUseDel(struct pipes_s
  6142. struct wkssvc_NetrUseDel *r)
  6143. {
  6144. /* FIXME: Add implementation code here */
  6145. - p->rng_fault_state = True;
  6146. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6147. return WERR_NOT_SUPPORTED;
  6148. }
  6149. @@ -696,7 +696,7 @@ WERROR _wkssvc_NetrUseEnum(struct pipes_
  6150. struct wkssvc_NetrUseEnum *r)
  6151. {
  6152. /* FIXME: Add implementation code here */
  6153. - p->rng_fault_state = True;
  6154. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6155. return WERR_NOT_SUPPORTED;
  6156. }
  6157. @@ -707,7 +707,7 @@ WERROR _wkssvc_NetrMessageBufferSend(str
  6158. struct wkssvc_NetrMessageBufferSend *r)
  6159. {
  6160. /* FIXME: Add implementation code here */
  6161. - p->rng_fault_state = True;
  6162. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6163. return WERR_NOT_SUPPORTED;
  6164. }
  6165. @@ -718,7 +718,7 @@ WERROR _wkssvc_NetrWorkstationStatistics
  6166. struct wkssvc_NetrWorkstationStatisticsGet *r)
  6167. {
  6168. /* FIXME: Add implementation code here */
  6169. - p->rng_fault_state = True;
  6170. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6171. return WERR_NOT_SUPPORTED;
  6172. }
  6173. @@ -729,7 +729,7 @@ WERROR _wkssvc_NetrLogonDomainNameAdd(st
  6174. struct wkssvc_NetrLogonDomainNameAdd *r)
  6175. {
  6176. /* FIXME: Add implementation code here */
  6177. - p->rng_fault_state = True;
  6178. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6179. return WERR_NOT_SUPPORTED;
  6180. }
  6181. @@ -740,7 +740,7 @@ WERROR _wkssvc_NetrLogonDomainNameDel(st
  6182. struct wkssvc_NetrLogonDomainNameDel *r)
  6183. {
  6184. /* FIXME: Add implementation code here */
  6185. - p->rng_fault_state = True;
  6186. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6187. return WERR_NOT_SUPPORTED;
  6188. }
  6189. @@ -751,7 +751,7 @@ WERROR _wkssvc_NetrJoinDomain(struct pip
  6190. struct wkssvc_NetrJoinDomain *r)
  6191. {
  6192. /* FIXME: Add implementation code here */
  6193. - p->rng_fault_state = True;
  6194. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6195. return WERR_NOT_SUPPORTED;
  6196. }
  6197. @@ -762,7 +762,7 @@ WERROR _wkssvc_NetrUnjoinDomain(struct p
  6198. struct wkssvc_NetrUnjoinDomain *r)
  6199. {
  6200. /* FIXME: Add implementation code here */
  6201. - p->rng_fault_state = True;
  6202. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6203. return WERR_NOT_SUPPORTED;
  6204. }
  6205. @@ -773,7 +773,7 @@ WERROR _wkssvc_NetrRenameMachineInDomain
  6206. struct wkssvc_NetrRenameMachineInDomain *r)
  6207. {
  6208. /* FIXME: Add implementation code here */
  6209. - p->rng_fault_state = True;
  6210. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6211. return WERR_NOT_SUPPORTED;
  6212. }
  6213. @@ -784,7 +784,7 @@ WERROR _wkssvc_NetrValidateName(struct p
  6214. struct wkssvc_NetrValidateName *r)
  6215. {
  6216. /* FIXME: Add implementation code here */
  6217. - p->rng_fault_state = True;
  6218. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6219. return WERR_NOT_SUPPORTED;
  6220. }
  6221. @@ -795,7 +795,7 @@ WERROR _wkssvc_NetrGetJoinInformation(st
  6222. struct wkssvc_NetrGetJoinInformation *r)
  6223. {
  6224. /* FIXME: Add implementation code here */
  6225. - p->rng_fault_state = True;
  6226. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6227. return WERR_NOT_SUPPORTED;
  6228. }
  6229. @@ -806,7 +806,7 @@ WERROR _wkssvc_NetrGetJoinableOus(struct
  6230. struct wkssvc_NetrGetJoinableOus *r)
  6231. {
  6232. /* FIXME: Add implementation code here */
  6233. - p->rng_fault_state = True;
  6234. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6235. return WERR_NOT_SUPPORTED;
  6236. }
  6237. @@ -962,6 +962,7 @@ WERROR _wkssvc_NetrRenameMachineInDomain
  6238. struct wkssvc_NetrRenameMachineInDomain2 *r)
  6239. {
  6240. /* for now just return not supported */
  6241. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6242. return WERR_NOT_SUPPORTED;
  6243. }
  6244. @@ -972,7 +973,7 @@ WERROR _wkssvc_NetrValidateName2(struct
  6245. struct wkssvc_NetrValidateName2 *r)
  6246. {
  6247. /* FIXME: Add implementation code here */
  6248. - p->rng_fault_state = True;
  6249. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6250. return WERR_NOT_SUPPORTED;
  6251. }
  6252. @@ -983,7 +984,7 @@ WERROR _wkssvc_NetrGetJoinableOus2(struc
  6253. struct wkssvc_NetrGetJoinableOus2 *r)
  6254. {
  6255. /* FIXME: Add implementation code here */
  6256. - p->rng_fault_state = True;
  6257. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6258. return WERR_NOT_SUPPORTED;
  6259. }
  6260. @@ -994,7 +995,7 @@ WERROR _wkssvc_NetrAddAlternateComputerN
  6261. struct wkssvc_NetrAddAlternateComputerName *r)
  6262. {
  6263. /* FIXME: Add implementation code here */
  6264. - p->rng_fault_state = True;
  6265. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6266. return WERR_NOT_SUPPORTED;
  6267. }
  6268. @@ -1005,7 +1006,7 @@ WERROR _wkssvc_NetrRemoveAlternateComput
  6269. struct wkssvc_NetrRemoveAlternateComputerName *r)
  6270. {
  6271. /* FIXME: Add implementation code here */
  6272. - p->rng_fault_state = True;
  6273. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6274. return WERR_NOT_SUPPORTED;
  6275. }
  6276. @@ -1016,7 +1017,7 @@ WERROR _wkssvc_NetrSetPrimaryComputernam
  6277. struct wkssvc_NetrSetPrimaryComputername *r)
  6278. {
  6279. /* FIXME: Add implementation code here */
  6280. - p->rng_fault_state = True;
  6281. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6282. return WERR_NOT_SUPPORTED;
  6283. }
  6284. @@ -1027,6 +1028,6 @@ WERROR _wkssvc_NetrEnumerateComputerName
  6285. struct wkssvc_NetrEnumerateComputerNames *r)
  6286. {
  6287. /* FIXME: Add implementation code here */
  6288. - p->rng_fault_state = True;
  6289. + p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
  6290. return WERR_NOT_SUPPORTED;
  6291. }
  6292. --- a/libcli/auth/smbencrypt.c
  6293. +++ b/libcli/auth/smbencrypt.c
  6294. @@ -355,11 +355,18 @@ DATA_BLOB NTLMv2_generate_names_blob(TAL
  6295. DATA_BLOB names_blob = data_blob_talloc(mem_ctx, NULL, 0);
  6296. /* Deliberately ignore return here.. */
  6297. - (void)msrpc_gen(mem_ctx, &names_blob,
  6298. - "aaa",
  6299. - MsvAvNbDomainName, domain,
  6300. - MsvAvNbComputerName, hostname,
  6301. - MsvAvEOL, "");
  6302. + if (hostname != NULL) {
  6303. + (void)msrpc_gen(mem_ctx, &names_blob,
  6304. + "aaa",
  6305. + MsvAvNbDomainName, domain,
  6306. + MsvAvNbComputerName, hostname,
  6307. + MsvAvEOL, "");
  6308. + } else {
  6309. + (void)msrpc_gen(mem_ctx, &names_blob,
  6310. + "aa",
  6311. + MsvAvNbDomainName, domain,
  6312. + MsvAvEOL, "");
  6313. + }
  6314. return names_blob;
  6315. }