%!PS-Adobe-2.0 %%Creator: dvips(k) 5.95a Copyright 2005 Radical Eye Software %%Title: portability.dvi %%Pages: 13 %%PageOrder: Ascend %%BoundingBox: 0 0 595 842 %%DocumentFonts: Times-Roman Times-Bold Times-Italic Symbol Courier %%DocumentPaperSizes: a4 %%EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o portability.ps portability.dvi %DVIPSParameters: dpi=600 %DVIPSSource: TeX output 2005.10.27:2133 %%BeginProcSet: tex.pro 0 0 %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr 1 add N}if}B/CharBuilder{save 3 1 roll S A/base get 2 index get S /BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]{Ci}imagemask restore}B/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) (LaserWriter 16/600)]{A length product length le{A length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet %%BeginProcSet: 8r.enc 0 0 % File 8r.enc TeX Base 1 Encoding Revision 2.0 2002-10-30 % % @@psencodingfile@{ % author = "S. Rahtz, P. MacKay, Alan Jeffrey, B. Horn, K. Berry, % W. Schmidt, P. Lehman", % version = "2.0", % date = "30 October 2002", % filename = "8r.enc", % email = "tex-fonts@@tug.org", % docstring = "This is the encoding vector for Type1 and TrueType % fonts to be used with TeX. This file is part of the % PSNFSS bundle, version 9" % @} % % The idea is to have all the characters normally included in Type 1 fonts % available for typesetting. This is effectively the characters in Adobe % Standard encoding, ISO Latin 1, Windows ANSI including the euro symbol, % MacRoman, and some extra characters from Lucida. % % Character code assignments were made as follows: % % (1) the Windows ANSI characters are almost all in their Windows ANSI % positions, because some Windows users cannot easily reencode the % fonts, and it makes no difference on other systems. The only Windows % ANSI characters not available are those that make no sense for % typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen % (173). quotesingle and grave are moved just because it's such an % irritation not having them in TeX positions. % % (2) Remaining characters are assigned arbitrarily to the lower part % of the range, avoiding 0, 10 and 13 in case we meet dumb software. % % (3) Y&Y Lucida Bright includes some extra text characters; in the % hopes that other PostScript fonts, perhaps created for public % consumption, will include them, they are included starting at 0x12. % These are /dotlessj /ff /ffi /ffl. % % (4) hyphen appears twice for compatibility with both ASCII and Windows. % % (5) /Euro was assigned to 128, as in Windows ANSI % % (6) Missing characters from MacRoman encoding incorporated as follows: % % PostScript MacRoman TeXBase1 % -------------- -------------- -------------- % /notequal 173 0x16 % /infinity 176 0x17 % /lessequal 178 0x18 % /greaterequal 179 0x19 % /partialdiff 182 0x1A % /summation 183 0x1B % /product 184 0x1C % /pi 185 0x1D % /integral 186 0x81 % /Omega 189 0x8D % /radical 195 0x8E % /approxequal 197 0x8F % /Delta 198 0x9D % /lozenge 215 0x9E % /TeXBase1Encoding [ % 0x00 /.notdef /dotaccent /fi /fl /fraction /hungarumlaut /Lslash /lslash /ogonek /ring /.notdef /breve /minus /.notdef /Zcaron /zcaron % 0x10 /caron /dotlessi /dotlessj /ff /ffi /ffl /notequal /infinity /lessequal /greaterequal /partialdiff /summation /product /pi /grave /quotesingle % 0x20 /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash % 0x30 /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question % 0x40 /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O % 0x50 /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore % 0x60 /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o % 0x70 /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef % 0x80 /Euro /integral /quotesinglbase /florin /quotedblbase /ellipsis /dagger /daggerdbl /circumflex /perthousand /Scaron /guilsinglleft /OE /Omega /radical /approxequal % 0x90 /.notdef /.notdef /.notdef /quotedblleft /quotedblright /bullet /endash /emdash /tilde /trademark /scaron /guilsinglright /oe /Delta /lozenge /Ydieresis % 0xA0 /.notdef /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron % 0xD0 /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown % 0xC0 /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis % 0xD0 /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls % 0xE0 /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis % 0xF0 /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis ] def %%EndProcSet %%BeginProcSet: texps.pro 0 0 %! TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2 index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]FontType 0 ne{/Metrics exch def dict begin Encoding{exch dup type/integertype ne{ pop pop 1 sub dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def}ifelse}forall Metrics/Metrics currentdict end def}{{1 index type /nametype eq{exit}if exch pop}loop}ifelse[2 index currentdict end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def dup[ exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}if} forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}def end %%EndProcSet %%BeginProcSet: special.pro 0 0 %! TeXDict begin/SDict 200 dict N SDict begin/@SpecialDefaults{/hs 612 N /vs 792 N/ho 0 N/vo 0 N/hsc 1 N/vsc 1 N/ang 0 N/CLIP 0 N/rwiSeen false N /rhiSeen false N/letter{}N/note{}N/a4{}N/legal{}N}B/@scaleunit 100 N /@hscale{@scaleunit div/hsc X}B/@vscale{@scaleunit div/vsc X}B/@hsize{ /hs X/CLIP 1 N}B/@vsize{/vs X/CLIP 1 N}B/@clip{/CLIP 2 N}B/@hoffset{/ho X}B/@voffset{/vo X}B/@angle{/ang X}B/@rwi{10 div/rwi X/rwiSeen true N}B /@rhi{10 div/rhi X/rhiSeen true N}B/@llx{/llx X}B/@lly{/lly X}B/@urx{ /urx X}B/@ury{/ury X}B/magscale true def end/@MacSetUp{userdict/md known {userdict/md get type/dicttype eq{userdict begin md length 10 add md maxlength ge{/md md dup length 20 add dict copy def}if end md begin /letter{}N/note{}N/legal{}N/od{txpose 1 0 mtx defaultmatrix dtransform S atan/pa X newpath clippath mark{transform{itransform moveto}}{transform{ itransform lineto}}{6 -2 roll transform 6 -2 roll transform 6 -2 roll transform{itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll curveto}}{{closepath}}pathforall newpath counttomark array astore/gc xdf pop ct 39 0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack} if}N/txpose{pxs pys scale ppr aload pop por{noflips{pop S neg S TR pop 1 -1 scale}if xflip yflip and{pop S neg S TR 180 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip yflip not and{pop S neg S TR pop 180 rotate ppr 3 get ppr 1 get neg sub neg 0 TR}if yflip xflip not and{ppr 1 get neg ppr 0 get neg TR}if}{ noflips{TR pop pop 270 rotate 1 -1 scale}if xflip yflip and{TR pop pop 90 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip yflip not and{TR pop pop 90 rotate ppr 3 get ppr 1 get neg sub neg 0 TR}if yflip xflip not and{TR pop pop 270 rotate ppr 2 get ppr 0 get neg sub neg 0 S TR}if}ifelse scaleby96{ppr aload pop 4 -1 roll add 2 div 3 1 roll add 2 div 2 copy TR .96 dup scale neg S neg S TR}if}N/cp{pop pop showpage pm restore}N end}if}if}N/normalscale{ Resolution 72 div VResolution 72 div neg scale magscale{DVImag dup scale }if 0 setgray}N/psfts{S 65781.76 div N}N/startTexFig{/psf$SavedState save N userdict maxlength dict begin/magscale true def normalscale currentpoint TR/psf$ury psfts/psf$urx psfts/psf$lly psfts/psf$llx psfts /psf$y psfts/psf$x psfts currentpoint/psf$cy X/psf$cx X/psf$sx psf$x psf$urx psf$llx sub div N/psf$sy psf$y psf$ury psf$lly sub div N psf$sx psf$sy scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub TR/showpage{}N/erasepage{}N/setpagedevice{pop}N/copypage{}N/p 3 def @MacSetUp}N/doclip{psf$llx psf$lly psf$urx psf$ury currentpoint 6 2 roll newpath 4 copy 4 2 roll moveto 6 -1 roll S lineto S lineto S lineto closepath clip newpath moveto}N/endTexFig{end psf$SavedState restore}N /@beginspecial{SDict begin/SpecialSave save N gsave normalscale currentpoint TR @SpecialDefaults count/ocount X/dcount countdictstack N} N/@setspecial{CLIP 1 eq{newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto closepath clip}if ho vo TR hsc vsc scale ang rotate rwiSeen{rwi urx llx sub div rhiSeen{rhi ury lly sub div}{dup}ifelse scale llx neg lly neg TR}{rhiSeen{rhi ury lly sub div dup scale llx neg lly neg TR}if}ifelse CLIP 2 eq{newpath llx lly moveto urx lly lineto urx ury lineto llx ury lineto closepath clip}if/showpage{}N/erasepage{}N /setpagedevice{pop}N/copypage{}N newpath}N/@endspecial{count ocount sub{ pop}repeat countdictstack dcount sub{end}repeat grestore SpecialSave restore end}N/@defspecial{SDict begin}N/@fedspecial{end}B/li{lineto}B /rl{rlineto}B/rc{rcurveto}B/np{/SaveX currentpoint/SaveY X N 1 setlinecap newpath}N/st{stroke SaveX SaveY moveto}N/fil{fill SaveX SaveY moveto}N/ellipse{/endangle X/startangle X/yrad X/xrad X/savematrix matrix currentmatrix N TR xrad yrad scale 0 0 1 startangle endangle arc savematrix setmatrix}N end %%EndProcSet %%BeginProcSet: color.pro 0 0 %! TeXDict begin/setcmykcolor where{pop}{/setcmykcolor{dup 10 eq{pop setrgbcolor}{1 sub 4 1 roll 3{3 index add neg dup 0 lt{pop 0}if 3 1 roll }repeat setrgbcolor pop}ifelse}B}ifelse/TeXcolorcmyk{setcmykcolor}def /TeXcolorrgb{setrgbcolor}def/TeXcolorgrey{setgray}def/TeXcolorgray{ setgray}def/TeXcolorhsb{sethsbcolor}def/currentcmykcolor where{pop}{ /currentcmykcolor{currentrgbcolor 10}B}ifelse/DC{exch dup userdict exch known{pop pop}{X}ifelse}B/GreenYellow{0.15 0 0.69 0 setcmykcolor}DC /Yellow{0 0 1 0 setcmykcolor}DC/Goldenrod{0 0.10 0.84 0 setcmykcolor}DC /Dandelion{0 0.29 0.84 0 setcmykcolor}DC/Apricot{0 0.32 0.52 0 setcmykcolor}DC/Peach{0 0.50 0.70 0 setcmykcolor}DC/Melon{0 0.46 0.50 0 setcmykcolor}DC/YellowOrange{0 0.42 1 0 setcmykcolor}DC/Orange{0 0.61 0.87 0 setcmykcolor}DC/BurntOrange{0 0.51 1 0 setcmykcolor}DC /Bittersweet{0 0.75 1 0.24 setcmykcolor}DC/RedOrange{0 0.77 0.87 0 setcmykcolor}DC/Mahogany{0 0.85 0.87 0.35 setcmykcolor}DC/Maroon{0 0.87 0.68 0.32 setcmykcolor}DC/BrickRed{0 0.89 0.94 0.28 setcmykcolor}DC/Red{ 0 1 1 0 setcmykcolor}DC/OrangeRed{0 1 0.50 0 setcmykcolor}DC/RubineRed{ 0 1 0.13 0 setcmykcolor}DC/WildStrawberry{0 0.96 0.39 0 setcmykcolor}DC /Salmon{0 0.53 0.38 0 setcmykcolor}DC/CarnationPink{0 0.63 0 0 setcmykcolor}DC/Magenta{0 1 0 0 setcmykcolor}DC/VioletRed{0 0.81 0 0 setcmykcolor}DC/Rhodamine{0 0.82 0 0 setcmykcolor}DC/Mulberry{0.34 0.90 0 0.02 setcmykcolor}DC/RedViolet{0.07 0.90 0 0.34 setcmykcolor}DC /Fuchsia{0.47 0.91 0 0.08 setcmykcolor}DC/Lavender{0 0.48 0 0 setcmykcolor}DC/Thistle{0.12 0.59 0 0 setcmykcolor}DC/Orchid{0.32 0.64 0 0 setcmykcolor}DC/DarkOrchid{0.40 0.80 0.20 0 setcmykcolor}DC/Purple{ 0.45 0.86 0 0 setcmykcolor}DC/Plum{0.50 1 0 0 setcmykcolor}DC/Violet{ 0.79 0.88 0 0 setcmykcolor}DC/RoyalPurple{0.75 0.90 0 0 setcmykcolor}DC /BlueViolet{0.86 0.91 0 0.04 setcmykcolor}DC/Periwinkle{0.57 0.55 0 0 setcmykcolor}DC/CadetBlue{0.62 0.57 0.23 0 setcmykcolor}DC /CornflowerBlue{0.65 0.13 0 0 setcmykcolor}DC/MidnightBlue{0.98 0.13 0 0.43 setcmykcolor}DC/NavyBlue{0.94 0.54 0 0 setcmykcolor}DC/RoyalBlue{1 0.50 0 0 setcmykcolor}DC/Blue{1 1 0 0 setcmykcolor}DC/Cerulean{0.94 0.11 0 0 setcmykcolor}DC/Cyan{1 0 0 0 setcmykcolor}DC/ProcessBlue{0.96 0 0 0 setcmykcolor}DC/SkyBlue{0.62 0 0.12 0 setcmykcolor}DC/Turquoise{0.85 0 0.20 0 setcmykcolor}DC/TealBlue{0.86 0 0.34 0.02 setcmykcolor}DC /Aquamarine{0.82 0 0.30 0 setcmykcolor}DC/BlueGreen{0.85 0 0.33 0 setcmykcolor}DC/Emerald{1 0 0.50 0 setcmykcolor}DC/JungleGreen{0.99 0 0.52 0 setcmykcolor}DC/SeaGreen{0.69 0 0.50 0 setcmykcolor}DC/Green{1 0 1 0 setcmykcolor}DC/ForestGreen{0.91 0 0.88 0.12 setcmykcolor}DC /PineGreen{0.92 0 0.59 0.25 setcmykcolor}DC/LimeGreen{0.50 0 1 0 setcmykcolor}DC/YellowGreen{0.44 0 0.74 0 setcmykcolor}DC/SpringGreen{ 0.26 0 0.76 0 setcmykcolor}DC/OliveGreen{0.64 0 0.95 0.40 setcmykcolor} DC/RawSienna{0 0.72 1 0.45 setcmykcolor}DC/Sepia{0 0.83 1 0.70 setcmykcolor}DC/Brown{0 0.81 1 0.60 setcmykcolor}DC/Tan{0.14 0.42 0.56 0 setcmykcolor}DC/Gray{0 0 0 0.50 setcmykcolor}DC/Black{0 0 0 1 setcmykcolor}DC/White{0 0 0 0 setcmykcolor}DC end %%EndProcSet TeXDict begin @defspecial /DvipsToPDF { 72.27 mul Resolution div } def /PDFToDvips { 72.27 div Resolution mul } def /HyperBorder { 1 PDFToDvips } def /H.V {pdf@hoff pdf@voff null} def /H.B {/Rect[pdf@llx pdf@lly pdf@urx pdf@ury]} def /H.S { currentpoint HyperBorder add /pdf@lly exch def dup DvipsToPDF /pdf@hoff exch def HyperBorder sub /pdf@llx exch def } def /H.L { 2 sub dup /HyperBasePt exch def PDFToDvips /HyperBaseDvips exch def currentpoint HyperBaseDvips sub /pdf@ury exch def /pdf@urx exch def } def /H.A { H.L currentpoint exch pop vsize 72 sub exch DvipsToPDF HyperBasePt sub sub /pdf@voff exch def } def /H.R { currentpoint HyperBorder sub /pdf@ury exch def HyperBorder add /pdf@urx exch def currentpoint exch pop vsize 72 sub exch DvipsToPDF sub /pdf@voff exch def } def systemdict /pdfmark known not {userdict /pdfmark systemdict /cleartomark get put} if @fedspecial end TeXDict begin 39158280 55380996 1000 600 600 (portability.dvi) @start /Fa 139[21 11[37 104[{TeXBase1Encoding ReEncodeFont}2 74.7198 /Times-Italic rf /Fc 143[51 1[51 4[51 2[51 51 51 16[51 3[51 10[51 1[51 24[51 51 4[51 35[{ .85 ExtendFont TeXBase1Encoding ReEncodeFont}13 99.6264 /Courier rf /Fe 130[34 34 34 34 34 34 34 34 34 34 34 34 1[34 34 34 34 34 34 1[34 34 34 34 34 34 34 34 34 1[34 1[34 1[34 34 34 34 34 34 34 34 34 34 1[34 34 34 34 34 2[34 34 34 34 34 34 34 34 34 1[34 34 34 34 34 34 34 1[34 34 1[34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 1[34 34 34 33[{.85 ExtendFont TeXBase1Encoding ReEncodeFont}81 66.4176 /Courier rf /Fg 105[50 28[44 44 66 44 50 28 39 39 1[50 50 50 72 28 44 1[28 50 50 28 44 50 44 50 50 8[61 83 1[72 1[50 61 1[61 72 66 83 55 2[33 72 72 1[61 72 66 61 61 6[33 3[50 50 50 50 50 50 50 28 25 33 25 2[33 33 4[50 32[50 2[{TeXBase1Encoding ReEncodeFont}58 99.6264 /Times-Italic rf /Fh 138[45 25 35 35 2[45 45 66 25 2[25 45 2[40 45 1[45 14[45 2[56 28[45 45 50[{TeXBase1Encoding ReEncodeFont} 17 90.9091 /Times-Italic rf /Fi 137[50 1[33 39 44 1[55 50 55 83 28 2[28 55 50 33 44 1[44 1[50 11[72 8[66 8[72 1[72 6[33 3[50 50 50 50 50 50 2[25 46[{TeXBase1Encoding ReEncodeFont}28 99.6264 /Times-Bold rf /Fj 134[60 60 86 60 66 40 47 53 1[66 60 66 100 33 2[33 66 1[40 53 66 53 1[60 12[80 15[86 86 14[60 60 60 60 2[30 46[{TeXBase1Encoding ReEncodeFont}28 119.552 /Times-Bold rf /Fk 87[33 19[44 44 24[44 50 50 72 50 50 28 39 33 50 50 50 50 78 28 50 28 28 50 50 33 44 50 44 50 44 3[33 1[33 1[72 72 94 72 72 61 55 66 1[55 72 72 89 61 72 39 33 72 72 55 61 72 66 66 72 1[44 3[28 28 50 50 50 50 50 50 50 50 50 50 28 25 33 25 2[33 33 33 8[33 26[55 55 2[{TeXBase1Encoding ReEncodeFont}78 99.6264 /Times-Roman rf /Fl 134[72 3[80 48 56 64 1[80 72 80 120 40 2[40 80 72 48 64 80 64 80 72 14[104 1[88 6[56 5[104 1[104 12[72 72 72 72 49[{TeXBase1Encoding ReEncodeFont}28 143.462 /Times-Bold rf /Fm 133[40 45 45 66 45 45 25 35 30 45 45 45 45 71 25 45 1[25 45 45 30 40 45 40 45 40 8[66 1[66 66 56 51 61 66 51 66 66 81 56 2[30 66 66 51 56 66 61 61 66 7[45 45 45 45 45 45 45 45 45 45 25 23 30 23 2[30 30 36[51 51 2[{TeXBase1Encoding ReEncodeFont}64 90.9091 /Times-Roman rf /Fn 139[30 35 40 14[40 51 45 31[66 65[{TeXBase1Encoding ReEncodeFont}7 90.9091 /Times-Bold rf /Fo 139[33 1[40 2[60 60 93 33 1[33 33 1[60 1[53 60 53 60 53 17[86 1[106 8[86 3[110 10[60 2[60 1[60 1[30 4[40 40 40[{TeXBase1Encoding ReEncodeFont}24 119.552 /Times-Roman rf /Fp 134[86 3[86 48 1[57 2[86 2[48 2[48 3[76 1[76 86 76 13[96 2[96 80[{TeXBase1Encoding ReEncodeFont}13 172.188 /Times-Roman rf end %%EndProlog %%BeginSetup %%Feature: *Resolution 600dpi TeXDict begin %%PaperSize: A4 end %%EndSetup %%Page: 1 1 TeXDict begin 1 0 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a 0 0 a SDict begin [ /Title () /Subject () /Creator (LaTeX with hyperref package) /Author () /Producer (dvips + Distiller) /Keywords () /DOCINFO pdfmark end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.1) cvn H.B /DEST pdfmark end 0 100 a Black Black 0 307 a SDict begin [ /Count -0 /Dest (section.1) cvn /Title (Introduction) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Count -0 /Dest (section.2) cvn /Title (Approaching Portability) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Count -3 /Dest (section.3) cvn /Title (Platform differences) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Count -2 /Dest (subsection.3.1) cvn /Title (Trivial differences) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Count -0 /Dest (subsubsection.3.1.1) cvn /Title (Use of the C preprocessor) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Count -0 /Dest (subsubsection.3.1.2) cvn /Title (Activating replacements) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Count -0 /Dest (subsection.3.2) cvn /Title (Complex differences) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Count -0 /Dest (subsection.3.3) cvn /Title (Differences with security implications) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Count -1 /Dest (section.4) cvn /Title (Choosing the right API) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Count -0 /Dest (subsection.4.1) cvn /Title (Conclusion) /OUT pdfmark end 0 307 a 0 307 a SDict begin [ /Page 1 /View [ /FitV ] /PageMode /UseOutlines /DOCVIEW pdfmark end 0 307 a 0 307 a SDict begin [ {Catalog} << >> /PUT pdfmark end 0 307 a 0 307 a SDict begin H.S end 0 307 a 0 307 a SDict begin 14.5 H.A end 0 307 a 0 307 a SDict begin [ /View [/XYZ H.V] /Dest (Doc-Start) cvn H.B /DEST pdfmark end 0 307 a Black Black 1293 814 a Fp(Secure)45 b(Portability)1073 1112 y Fo(Damien)31 b(Miller)f(\(djm@mindrot.or)n(g\))1585 1347 y(October)g(2005)p Black Black 1743 1655 a Fn(Abstract)p Black Black 380 1769 a Fm(This)24 b(paper)h(introduces)i(the)d(issues)h (of)f(portability)j(for)d(C)f(applications)k(between)e(Unix)f(v)n (ariants,)244 1882 y(including)38 b(semantic)g(dif)n(ferences)g(in)e (libraries)i(and)e(system)h(calls,)i(API)34 b(support)k(and)e (reasonable)244 1995 y(minimum)24 b(platform)h(requirements.)34 b(It)24 b(also)h(describes)i(the)d(approach)j(used)e(by)f(Portable)h (OpenSSH)244 2108 y(to)j(the)h(problems)h(of)e(secure)i(portability)i (and)d(points)g(to)g(some)f(areas)i(where)e(more)h(w)o(ork)f(is)h (needed)244 2221 y(by)24 b(platform)g(v)o(endors.)0 2389 y SDict begin H.S end 0 2389 a 0 2389 a SDict begin 14.5 H.A end 0 2389 a 0 2389 a SDict begin [ /View [/XYZ H.V] /Dest (section.1) cvn H.B /DEST pdfmark end 0 2389 a 197 x Fl(1)143 b(Intr)m(oduction)0 2844 y Fk(This)34 b(paper)i(introduces)e (issues)h(of)g(portability)e(for)j(C)g(applications)d(on)i(Unix,)i (GNU/Linux)d(and)h(W)l(in-)0 2965 y(do)n(ws/c)o(ygwin)18 b(platforms,)i(including)f(semantic)h(dif)n(ferences)h(in)f(libraries)g (and)h(system)e(calls,)i(API)g(support)0 3085 y(and)i(reasonable)g (minimum)e(platform)i(requirements.)29 b(It)23 b(also)g(describes)g (the)g(approach)g(used)g(by)g(Portable)0 3206 y(OpenSSH)j([)p 0 0 1 TeXcolorrgb 457 3207 a SDict begin H.S end 457 3207 a 0 0 1 TeXcolorrgb -1 x Fk(16)p 0 0 1 TeXcolorrgb 557 3138 a SDict begin H.R end 557 3138 a 557 3206 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.OpenSSH) cvn H.B /ANN pdfmark end 557 3206 a Black Fk(])g(to)g(the)g(problems)e(of)i(secure)h (portability)-6 b(.)31 b(Finally)26 b(it)f(points)g(to)g(some)g(areas)i (where)f(more)0 3326 y(w)o(ork)f(is)f(needed)h(by)g(platform)f(v)o (endors.)0 3481 y(Softw)o(are)35 b(running)f(on)g(modern)g(Unix-lik)o (e)f(systems)g(must)h(deal)g(with)g(innumerable)g(dif)n(ferences)g(in)g (li-)0 3601 y(braries)g(and)f(in)g(system)g(beha)n(viour)-5 b(.)56 b(Signi\002cant)33 b(dif)n(ferences)h(are)g(e)n(vident)e(e)n(v)o (en)h(between)h(the)f(v)n(arious)0 3721 y(GNU/Linux)h(distrib)n (utions.)60 b(This)34 b(v)n(ariance)i(ranges)f(from)g(the)h(tri)n (vial,)g(such)f(as)h(dif)n(fering)e(\002lesystems)0 3842 y(layouts,)26 b(though)g(to)h(the)f(comple)o(x,)g(such)h(as)g (platform-speci\002c)g(authentication)e(methods)h(or)h(dif)n(ferences)0 3962 y(in)d(system)g(call)h(semantics.)0 4117 y(Coping)i(with)h(these)f (dif)n(ferences)h(adds)g(comple)o(xity)e(to)h(applications,)g(making)g (them)g(more)h(dif)n(\002cult)f(and)0 4237 y(much)g(less)h(enjo)o (yable)f(to)h(de)n(v)o(elop)e(and)i(v)o(erify)-6 b(.)39 b(Some)28 b(of)g(these)g(dif)n(ferences)g(ha)n(v)o(e)g(serious)f (security)h(im-)0 4358 y(plications)22 b(and)h(the)g(additional)f (comple)o(xity)f(required)i(to)g(cope)g(with)f(them)h(also)g(increases) g(the)g(lik)o(elihood)0 4478 y(of)36 b(security)f(problems.)62 b(Another)35 b(confounding)f(f)o(actor)i(is)f(that)g(the)h(best)f(APIs) h(\(from)g(a)f(security)h(per)n(-)0 4599 y(specti)n(v)o(e\))d(do)h(not) g(ha)n(v)o(e)h(wide)f(platform)f(support,)j(indeed)e(some)g(platform)g (maintainers)f(ha)n(v)o(e)i(acti)n(v)o(ely)0 4719 y(militated)23 b(against)h(their)g(adoption.)0 4889 y SDict begin H.S end 0 4889 a 0 4889 a SDict begin 14.5 H.A end 0 4889 a 0 4889 a SDict begin [ /View [/XYZ H.V] /Dest (section.2) cvn H.B /DEST pdfmark end 0 4889 a 196 x Fl(2)143 b(A)l(ppr)m(oaching)34 b(P)m(ortability)0 5342 y Fk(Some)e(projects)f(include)h(portability)e (as)i(an)g(original,)g(e)o(xplicit)f(requirement)g(or)h(goal,)h(b)n(ut) f(the)f(majority)0 5463 y(of)d(softw)o(are)g(packages)g(are)h(not)e (written)g(to)h(be)g(portable.)39 b(Rather)l(,)29 b(the)o(y)e(ha)n(v)o (e)h(portability)e(incrementally)p Black 1888 5712 a(1)p Black eop end %%Page: 2 2 TeXDict begin 2 1 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.2) cvn H.B /DEST pdfmark end 0 100 a Black Black 307 x Fk(added)26 b(after)h(the)f(softw)o(are)g(has)g(been)g(de)n(v)o(eloped)f(on)g(an)i (original)e(\223golden\224)h(platform)f(\(usually)g(either)h(an)0 527 y(e)o(xplicit)d(tar)n(get)i(platform,)e(or)i(whate)n(v)o(er)e(the)i (de)n(v)o(eloper)e(lik)o(es)h(or)g(has)h(a)n(v)n(ailable\).)30 b(This)23 b(is)h(not)g(necessarily)0 648 y(a)30 b(bad)g(thing)f(-)h(it) f(pro)o(vides)g(a)h(reference)i(against)c(which)i(the)f(correct)i (operation)e(of)h(other)g(platforms)f(can)0 768 y(be)c(measured.)0 938 y(In)38 b(the)f(case)h(of)g(OpenSSH,)g(the)f(original)g(platform)f (w)o(as)i(OpenBSD,)g(though)e(some)h(portability)f(code)0 1058 y(from)30 b(the)g(le)o(gac)o(y)f(ssh-1.2.x)f(code-base)j(w)o(as)f (retained.)47 b(OpenSSH)30 b(dif)n(fers)g(from)g(man)o(y)f(other)h (softw)o(are)0 1179 y(projects)i(in)g(its)g(separation)g(into)g (\223core\224)i(and)f(\223portable\224)f(v)o(ersions.)53 b(The)33 b(OpenBSD)g(de)n(v)o(elopers)e(w)o(ant)0 1299 y(a)h(clean)f(code-base,)j(free)e(of)g(portability)d(clutter)i(as)h (the)f(canonical)h(home)e(for)i(OpenSSH)g(is)f(their)g(CVS)0 1419 y(tree.)42 b(The)29 b(portable)f(v)o(ersion)f(of)i(OpenSSH)g(is)f (maintained)f(by)h(a)h(semi-separate)f(team)h(of)f(de)n(v)o(elopers)f (in)0 1540 y(a)h(separate)g(CVS)h(tree.)40 b(This)27 b(arrangement)h(creates)h(some)e(e)o(xtra)h(w)o(ork,)g(as)g(changes)g (to)f(the)h(core)g(v)o(ersion)0 1660 y(must)k(be)i(periodically)e(mer)n (ged,)k(b)n(ut)d(automated)f(tools)g(render)i(this)f(process)g(tri)n (vial)f(and)i(the)f(e)o(xistence)0 1781 y(of)26 b(the)h(OpenBSD)g(v)o (ersion)e(has)h(pro)o(v)o(ed)f(useful)h(man)o(y)f(times)h(in)g (determining)e(whether)j(b)n(ugs)e(in)h(the)h(core)0 1901 y(product,)41 b(the)c(portability)f(code)j(or)f(the)f(ne)n(w)h (tar)n(get)g(platform.)69 b(T)-8 b(able)p 0 0 1 TeXcolorrgb 2650 1901 a SDict begin H.S end 2650 1901 a 0 0 1 TeXcolorrgb Fk(1)p 0 0 1 TeXcolorrgb 2700 1833 a SDict begin H.R end 2700 1833 a 2700 1901 a SDict begin [ /Color [1 0 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (table.1) cvn H.B /ANN pdfmark end 2700 1901 a Black 38 w Fk(lists)36 b(the)i(platforms)f(that)g(are)0 2021 y(supported)24 b(by)g(portable)h(OpenSSH.)p Black Black Black 662 2162 2501 4 v 660 2275 4 113 v 712 2241 a Fm(AIX)p 1371 2275 V 548 w(Dragon\003yBSD)p 2264 2275 V 348 w(QNX)p 3161 2275 V 660 2388 V 712 2354 a(Apple)f(MacOS)e(X)p 1371 2388 V 99 w(HP/UX)g(10.x,)h(11.x)p 2264 2388 V 235 w(SCO)f(OpenServ)o(er)i(5)p 3161 2388 V 660 2501 V 712 2467 a(BSDi)p 1371 2501 V 507 w(Irix)g(5.x,)g(6.x)p 2264 2501 V 466 w(SCO)e(Unixw)o(are)p 3161 2501 V 660 2613 V 712 2580 a(Cray)h(Unicos)p 1371 2613 V 255 w(Linux)p 2264 2613 V 677 w(SNI)f(ReliantUNIX)p 3161 2613 V 660 2726 V 712 2693 a(Cygwin)p 1371 2726 V 423 w(L)-5 b(ynxOS)p 2264 2726 V 590 w(Solaris)24 b(2.6,)g(7,)e(8,)h(9,)g(10)p 3161 2726 V 660 2839 V 712 2805 a(DEC)e(OSF/1)p 1371 2839 V 268 w(NCR)h(SVR4)g(MP-RAS)p 2264 2839 V 98 w(Son)o(y)h(Ne)n (wsOS)f(BSD)p 3161 2839 V 660 2952 V 712 2918 a(DGUX)p 1371 2952 V 446 w(NeXTSTEP)p 2264 2952 V 451 w(SunOS)h(4)p 3161 2952 V 660 3065 V 712 3031 a(Darwin)p 1371 3065 V 438 w(NetBSD)p 2264 3065 V 584 w(Ultrix)p 3161 3065 V 660 3178 V 712 3144 a(FreeBSD)p 1371 3178 V 371 w(OpenBSD)p 2264 3178 V 3161 3178 V 662 3181 2501 4 v 0 3289 a SDict begin H.S end 0 3289 a 0 3289 a SDict begin 14.5 H.A end 0 3289 a 0 3289 a SDict begin [ /View [/XYZ H.V] /Dest (table.1) cvn H.B /DEST pdfmark end 0 3289 a Black 884 3449 a Fk(T)-8 b(able)25 b(1:)p 0 TeXcolorgray 1236 3328 a SDict begin H.S end 1236 3328 a 0 TeXcolorgray 0 TeXcolorgray 1236 3328 a SDict begin H.R end 1236 3328 a 1236 3328 a SDict begin [ /View [/XYZ H.V] /Dest (table.1) cvn H.B /DEST pdfmark end 1236 3328 a Black 121 x Fk(Platforms)g (supported)e(by)i(portable)f(OpenSSH)p Black Black 0 3685 a(Most)37 b(softw)o(are)i(projects,)i(ho)n(we)n(v)o(er)l(,)g (maintain)c(a)i(single)f(v)o(ersion)f(that)h(supports)f(multiple)g (platforms,)0 3805 y(usually)24 b(with)g(some)g(leaning)h(to)n(w)o (ards)f(a)h(f)o(a)n(v)n(ourite)g(\(e.g.)31 b(most)24 b(recent)h(free)h(softw)o(are)f(projects)f(implicitly)0 3925 y(prefer)33 b(GNU/Linux\).)50 b(In)32 b(either)g(case,)i (portability)c(becomes)h(an)h(issue)f(when)h(de)n(v)o(elopers)e (encounter)i(a)0 4046 y(dif)n(ference)25 b(between)g(platforms.)0 4216 y(At)32 b(this)e(point,)j(it)e(is)g(w)o(orthwhile)g(to)h(consider) f(some)g(goals)g(of)h(portability)-6 b(.)50 b(The)32 b(prime)f(objecti)n(v)o(e)f(is)h(to)0 4336 y(ha)n(v)o(e)d(the)g(softw)o (are)g(carry)h(out)f(its)f(desired)h(function\(s\))g(on)f(the)h (desired)g(platforms.)40 b(Ho)n(we)n(v)o(er)l(,)28 b(there)g(are)0 4456 y(se)n(v)o(eral)c(less)g(ob)o(vious)f(goals:)0 4593 y SDict begin H.S end 0 4593 a 0 4593 a SDict begin 14.5 H.A end 0 4593 a 0 4593 a SDict begin [ /View [/XYZ H.V] /Dest (Item.1) cvn H.B /DEST pdfmark end 0 4593 a Black 120 4733 a Fk(1.)p Black 49 w(T)-8 b(o)24 b(retain)h(readability)f(of)h (the)g(code)0 4796 y SDict begin H.S end 0 4796 a 0 4796 a SDict begin 14.5 H.A end 0 4796 a 0 4796 a SDict begin [ /View [/XYZ H.V] /Dest (Item.2) cvn H.B /DEST pdfmark end 0 4796 a Black 120 4936 a Fk(2.)p Black 49 w(T)-8 b(o)32 b(ensure)h(that)e(the)i(softw)o(are)f(beha)n(v)o(es)g(similarly)f(on)h (dif)n(ferent)g(platforms)f(\(including)g(a)n(v)n(oiding)244 5057 y(the)25 b(introduction)d(of)j(platform-speci\002c)g(b)n(ugs\))0 5120 y SDict begin H.S end 0 5120 a 0 5120 a SDict begin 14.5 H.A end 0 5120 a 0 5120 a SDict begin [ /View [/XYZ H.V] /Dest (Item.3) cvn H.B /DEST pdfmark end 0 5120 a Black 120 5260 a Fk(3.)p Black 49 w(T)-8 b(o)24 b(f)o(acilitate)h(the)g (addition)e(of)i(support)f(for)h(ne)n(w)f(platforms)0 5323 y SDict begin H.S end 0 5323 a 0 5323 a SDict begin 14.5 H.A end 0 5323 a 0 5323 a SDict begin [ /View [/XYZ H.V] /Dest (Item.4) cvn H.B /DEST pdfmark end 0 5323 a Black 120 5463 a Fk(4.)p Black 49 w(T)-8 b(o)24 b(minimise)f(maintenance)i (costs)f(for)h(de)n(v)o(elopers)e(of)i(the)g(softw)o(are)p Black 1888 5712 a(2)p Black eop end %%Page: 3 3 TeXDict begin 3 2 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.3) cvn H.B /DEST pdfmark end 0 100 a Black Black 0 307 a SDict begin H.S end 0 307 a 0 307 a SDict begin 14.5 H.A end 0 307 a 0 307 a SDict begin [ /View [/XYZ H.V] /Dest (Item.5) cvn H.B /DEST pdfmark end 0 307 a Black 120 407 a Fk(5.)p Black 49 w(T)-8 b(o)24 b(minimise)f(support)h(costs)g(from)h(users)f (of)h(the)g(softw)o(are)0 666 y(Achie)n(ving)g(one)h(of)h(these)f (goals)g(should)f(not)g(in)l(v)n(olv)o(e)g(trading)h(of)n(f)g(against)f (the)h(others.)35 b(Indeed,)27 b(focusing)0 786 y(on)e(the)g(prime)f (objecti)n(v)o(e)g(generally)h(mak)o(es)g(the)g(others)f(much)h(easier) g(to)g(achie)n(v)o(e,)g(though)e(it)i(may)g(require)0 907 y(a)32 b(little)f(more)h(up-front)f(ef)n(fort.)52 b(In)32 b(addition,)g(porting)f(softw)o(are)h(can)g(e)o(xpose)f(hidden) h(assumptions)d(and)0 1027 y(b)n(ugs)g(that)h(may)f(only)g(occur)i (rarely)f(on)g(the)f(base)h(platform,)h(\002nding)e(and)h(\002xing)f (these)h(issues)f(impro)o(v)o(es)0 1148 y(softw)o(are)c(quality)f(as)g (a)i(whole.)0 1324 y SDict begin H.S end 0 1324 a 0 1324 a SDict begin 14.5 H.A end 0 1324 a 0 1324 a SDict begin [ /View [/XYZ H.V] /Dest (section.3) cvn H.B /DEST pdfmark end 0 1324 a 207 x Fl(3)143 b(Platf)l(orm)34 b(differ)m(ences)0 1801 y Fk(Dif)n(ferences)f(between)g(Unix)f(and)h(Unix-lik)o(e)f (platforms)g(are)h(f)o(ar)h(less)e(painful)g(today)h(than)f(the)o(y)g (were)i(a)0 1921 y(decade,)21 b(or)e(e)n(v)o(en)g(\002)n(v)o(e)g(years) h(ago.)28 b(Be)o(yond)19 b(dif)n(fering)g(endianness)f(and)i(w)o(ord)f (sizes,)h(hardw)o(are)g(dif)n(ferences)0 2041 y(are)36 b(lar)n(gely)f(transparent)g(to)g(the)g(modern)g(de)n(v)o(eloper)-5 b(.)60 b(Lik)o(e)n(wise)34 b(C)i(compilers)e(are)i(generally)f (feature-)0 2162 y(compatible,)28 b(with)g(the)g(major)g(dif)n(ference) h(being)f(the)g(command)f(line)h(options)f(required)i(to)f(compile)f (and)0 2282 y(link)f(a)h(program.)37 b(System)27 b(libraries)f(are)i (lar)n(gely)f(standardised)f(and)h(tend)g(to)f(include)h(popular)f (functions,)0 2403 y(re)o(gardless)e(of)h(the)f(lineage)h(of)g(the)g (particular)f(platform.)0 2569 y(Spare)e(a)f(thought)e(for)i(the)f(bra) n(v)o(e)h(de)n(v)o(elopers)e(of)i(twenty)f(years)h(ago)g(who)f(had)h (to)f(contend)g(with)g(dif)n(ferences)0 2689 y(at)27 b(e)n(v)o(ery)f(le)n(v)o(el)g([)p 0 0 1 TeXcolorrgb 593 2691 a SDict begin H.S end 593 2691 a 0 0 1 TeXcolorrgb -2 x Fk(9)p 0 0 1 TeXcolorrgb 643 2621 a SDict begin H.R end 643 2621 a 643 2689 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.johnson) cvn H.B /ANN pdfmark end 643 2689 a Black Fk(]:)35 b(in)26 b(the)h(C)h(compiler)e(and)h(tool-chain)f (\(still)f(in)i(a)g(state)g(of)g(\003ux\),)g(in)g(the)g(netw)o(ork)f (stack)0 2810 y(\(changing)g(as)g(the)g(TCP/IP)h(protocols)e(were)i (re\002ned\),)g(in)f(an)g(OS)g(still)f(in)h(a)g(stage)g(of)g(rapid)g(e) n(v)n(olution)e(and)0 2930 y(in)30 b(strange)g(\(by)g(today')-5 b(s)29 b(standards\))h(features)h(and)f(limitations)e(of)i(the)h (underlying)e(hardw)o(are)i(that)e(were)0 3050 y(not)24 b(abstracted)h(a)o(w)o(ay)g(by)f(the)h(underlying)e(OS.)0 3217 y(Ho)n(we)n(v)o(er)l(,)k(portability)f(issues)h(remain;)i (platforms)e(are)h(by)g(no)f(means)h(homogenous.)38 b(Deep)28 b(dif)n(ferences,)0 3337 y(including)23 b(subtle)g(b)n(ut)h(critical)g (dif)n(ferences)g(in)g(semantics)f(e)o(xist)g(between)h(some)g (systems.)29 b(Ne)n(w)24 b(APIs)g(are)0 3458 y(being)g(added)h (frequently)f(to)h(both)f(free)i(and)e(proprietary)h(operating)f (systems.)0 3623 y SDict begin H.S end 0 3623 a 0 3623 a SDict begin 14.5 H.A end 0 3623 a 0 3623 a SDict begin [ /View [/XYZ H.V] /Dest (subsection.3.1) cvn H.B /DEST pdfmark end 0 3623 a 174 x Fj(3.1)119 b(T)-9 b(ri)o(vial)30 b(differ)n(ences)0 4030 y Fk(Most)h(platform)g(related)h(dif)n(ferences)g(are)h(tri)n (vial)e(in)g(nature.)52 b(T)-8 b(able)p 0 0 1 TeXcolorrgb 2495 4030 a SDict begin H.S end 2495 4030 a 0 0 1 TeXcolorrgb Fk(2)p 0 0 1 TeXcolorrgb 2545 3962 a SDict begin H.R end 2545 3962 a 2545 4030 a SDict begin [ /Color [1 0 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (table.2) cvn H.B /ANN pdfmark end 2545 4030 a Black 32 w Fk(mentions)31 b(se)n(v)o(eral)g(of)h(this)f(nature)0 4151 y(and)23 b(basic)g(w)o(ays)f(to)h(deal)g(with)f(them.)29 b(While)23 b(these)g(issues)f(do)g(not)h(pose)f(much)h(of)g(a)g (problem)f(to)h(an)g(a)o(w)o(are)0 4271 y(de)n(v)o(eloper)l(,)h(the)o (y)g(can)h(become)g(more)f(trick)o(y)g(to)g(deal)h(with)f(through)g (their)h(composition.)0 4436 y SDict begin H.S end 0 4436 a 0 4436 a SDict begin 14.5 H.A end 0 4436 a 0 4436 a SDict begin [ /View [/XYZ H.V] /Dest (subsubsection.3.1.1) cvn H.B /DEST pdfmark end 0 4436 a 145 x Fi(3.1.1)99 b(Use)25 b(of)g(the)g(C)g(pr)n (epr)n(ocessor)0 4815 y Fk(While)20 b(the)g(tri)n(vial)f(dif)n (ferences)h(are)h(relati)n(v)o(ely)d(easy)j(to)f(w)o(ork)g(around)g (the)o(y)f(can,)i(because)g(of)f(the)g(frequenc)o(y)0 4935 y(of)30 b(their)g(occurrence,)j(also)d(be)h(the)f(ones)g(that)g (pose)g(the)g(greatest)g(threat)h(to)f(readability)f(of)i(source)f (code.)0 5056 y(Despite)38 b(strong)g(recommendations)f(to)h(the)h (contrary)g([)p 0 0 1 TeXcolorrgb 2059 5057 a SDict begin H.S end 2059 5057 a 0 0 1 TeXcolorrgb -1 x Fk(18)p 0 0 1 TeXcolorrgb 2158 4988 a SDict begin H.R end 2158 4988 a 2158 5056 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.spencer) cvn H.B /ANN pdfmark end 2158 5056 a Black Fk(],)k(an)c (all-too-common)d(approach)j(to)f(\002xing)0 5176 y(these)25 b(dif)n(ferences)g(is)f(the)h(liberal)f(use)h(of)g(preprocessor)g (directi)n(v)o(es)e(to)h(create)i(an)f(in-line)f(replacement.)0 5342 y(These)32 b(inline)g(replacements)g(ha)n(v)o(e)g(a)h(tendenc)o(y) f(to)g(multiply)-6 b(,)31 b(leading)h(to)g(a)h(maze)g(of)f (platform-speci\002c)0 5463 y(code)25 b(wrapped)g(up)f(in)g(deeply)h (nested)f(pre-processor)h(logic.)30 b(F)o(or)24 b(e)o(xample,)g (listing)p 0 0 1 TeXcolorrgb 3020 5463 a SDict begin H.S end 3020 5463 a 0 0 1 TeXcolorrgb Fk(1)p 0 0 1 TeXcolorrgb 3070 5395 a SDict begin H.R end 3070 5395 a 3070 5463 a SDict begin [ /Color [1 0 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (clist.1) cvn H.B /ANN pdfmark end 3070 5463 a Black 25 w Fk(sho)n(ws)f(a)i (section)f(of)p Black 1888 5712 a(3)p Black eop end %%Page: 4 4 TeXDict begin 4 3 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.4) cvn H.B /DEST pdfmark end 0 100 a Black Black Black Black Black 159 311 3507 4 v 157 423 4 113 v 209 390 a Fh(Pr)l(oblem)p 1438 423 V 973 w(Solution)p 3664 423 V 159 427 3507 4 v 159 443 V 157 669 4 226 v 209 522 a Fm(Dif)n(fering)22 b(system)g(inte)o(ger)g(byte)g(or)n(-)209 635 y(ders)i(\(endianness\))p 1438 669 V 1490 522 a(Use)f(POSIX)e Fh(ntohl)p Fm(,)k Fh(ntohs)p Fm(,)f Fh(htonl)p Fm(,)g Fh(htons)h Fm(functions)h(to)e(con) l(v)o(ert)p 3664 669 V 159 672 3507 4 v 157 898 4 226 v 209 752 a(Dif)n(ferent)k(w)o(ord)e(sizes)h(\(e.g.)38 b(of)26 b(the)209 864 y Fh(int)g Fm(type\))p 1438 898 V 1490 752 a(Use)d(width)g(speci\002ed)i(types,)f(such)g(as)f Fh(int32)p 2943 752 28 4 v 34 w(t)i Fm(where)e(w)o(ord)g(size)1490 864 y(matters)p 3664 898 4 226 v 159 902 3507 4 v 157 1127 4 226 v 209 981 a(Missing)64 b(type)g(de\002nitions)h(\(e.g.)209 1094 y Fh(u)p 259 1094 28 4 v 33 w(int32)p 477 1094 V 35 w(t)r Fm(\))p 1438 1127 4 226 v 1490 981 a(Include)25 b(replacement)h(de\002nitions)g(in)d(header)i(\002le)p 3664 1127 V 159 1131 3507 4 v 157 1357 4 226 v 209 1210 a(Missing)h(functions)h(\(e.g.)k(daemon,)209 1323 y(strlcp)o(y\))p 1438 1357 V 1490 1210 a(Include)25 b(portable)h(replacements)p 3664 1357 V 159 1360 3507 4 v 157 1699 4 339 v 209 1439 a(Dif)n(ferent)105 b(underlying)h(inte)o(ger)209 1552 y(types)60 b(for)e(OS)f(pro)o(vided)k(types,)209 1665 y(e.g.)29 b Fh(uid)p 489 1665 28 4 v 34 w(t)p 1438 1699 4 339 v 1490 1439 a Fm(Cast)j(to)g(wider)g(type)g(in)g(printf,)j(a)n(v) n(oid)f(direct)f(use)f(as)g(array)h(in-)1490 1552 y(de)o(x)26 b(or)f(in)h(pointer)i(arithmetic)f(\(a)n(v)n(oiding)i(signed)e(vs.)36 b(unsigned)1490 1665 y(b)n(ugs\))p 3664 1699 V 159 1702 3507 4 v 0 1810 a SDict begin H.S end 0 1810 a 0 1810 a SDict begin 14.5 H.A end 0 1810 a 0 1810 a SDict begin [ /View [/XYZ H.V] /Dest (table.2) cvn H.B /DEST pdfmark end 0 1810 a Black 889 1969 a Fk(T)-8 b(able)25 b(2:)p 0 TeXcolorgray 1242 1849 a SDict begin H.S end 1242 1849 a 0 TeXcolorgray 0 TeXcolorgray 1242 1849 a SDict begin H.R end 1242 1849 a 1242 1849 a SDict begin [ /View [/XYZ H.V] /Dest (table.2) cvn H.B /DEST pdfmark end 1242 1849 a Black 120 x Fk(Some)f(common)g(tri)n(vial)f(platform)i(dif)n (ferences)p Black Black 0 2256 a(ntpd')-5 b(s)20 b([)p 0 0 1 TeXcolorrgb 298 2256 a SDict begin H.S end 298 2256 a 0 0 1 TeXcolorrgb Fk(14)p 0 0 1 TeXcolorrgb 398 2188 a SDict begin H.R end 398 2188 a 398 2256 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.ntpd) cvn H.B /ANN pdfmark end 398 2256 a Black Fk(])i(startup)f(code)h(where)h(the)e(simple)g (action)g(of)h(becoming)f(a)h(daemon)f(has)h(been)g(rendered)g(nearly)0 2377 y(unreadable)j(by)f(a)i(maze)f(of)g(compatibility)d(f)o (all-backs.)0 2547 y(A)36 b(f)o(ar)g(better)g(approach)g(for)g (situations)e(lik)o(e)h(this)g(is)h(to)f(pro)o(vide)g(a)h(replacement)g (for)g(the)g(missing)e(API)0 2667 y(\()p Fg(daemon\(\))f Fk(in)g(this)g(case\))h(and)f(to)g(include)g(it)g(in)g(a)g (compatibility)e(library)-6 b(.)56 b(This)32 b(clears)i(the)f(main)g (code)0 2788 y(paths)g(of)g(inessential)f(clutter)l(,)j(thereby)e (making)f(them)h(f)o(ar)h(easier)g(to)f(read)h(and)f(follo)n(w)-6 b(.)54 b(Remo)o(ving)32 b(the)0 2908 y(clutter)24 b(is)h(also)f (conduci)n(v)o(e)g(to)g(better)h(security)f(by)h(making)e(it)i(easier)g (to)f(audit)g(for)i(problems.)0 3078 y(By)40 b(locating)e(the)h (replacement)h(function)e(in)h(a)h(compatibility)c(library)-6 b(,)42 b(it)d(will)g(be)g(a)n(v)n(ailable)g(to)g(e)n(v)o(ery)0 3199 y(discrete)29 b(program)f(in)g(the)h(softw)o(are)f(distrib)n (ution,)g(ob)o(viating)e(the)j(need)g(for)g(each)g(to)f(implement)f (its)h(o)n(wn)0 3319 y(replacement.)70 b(This)37 b(approach)h(should)f (be)h(recursi)n(v)o(ely)f(applied)g(to)h(the)f(compatibility)f (functions)h(too)0 3439 y(-)f(merely)f(ref)o(actoring)h(the)g(pre)n (vious)e(e)o(xample)h(into)g(a)h Fg(daemon\(\))f Fk(function)g(in)g(a)h (separate)g(\002le)g(doesn')n(t)0 3560 y(produce)25 b(the)f(full)h (bene\002t)g(unless)f(the)g(whole)h(tangle)f(is)h(unw)o(ound.)0 3730 y(Of)30 b(course,)h(some)e(preprocessor)g(is)g(almost)g(al)o(w)o (ays)g(required)h(-)g(the)f(goal)g(is)h(to)f(a)n(v)n(oid)g(nesting)f (it,)j(which)0 3850 y(leads)k(to)g(an)g(e)o(xponential)e(gro)n(wth)h (in)h(the)g(number)f(of)h(paths)g(through)f(the)h(code.)62 b(As)35 b(a)g(rule,)i(consider)0 3971 y(breaking)24 b(code)h(out)g (whene)n(v)o(er)f(there)h(is)f(a)h(need)g(for)h(more)e(than)h(one)f(le) n(v)o(el)g(of)h(preprocessor)g(nesting.)0 4141 y(In)k(man)o(y)e(cases,) j(an)f(e)n(v)o(en)e(more)i(simple)e(solution)g(to)h(the)h(issue)f(of)g (replacing)h(missing)d(functions)i(e)o(xists:)0 4261 y(import)j(or)h(adapt)g(code)h(from)f(one)g(of)g(the)g(BSD)h(operating) f(systems.)52 b(The)32 b(BSD)h(code)f(is)g(well)g(written,)0 4382 y(released)g(under)g(a)g(liberal)g(licence)g(intended)f(to)h(f)o (acilitate)f(e)o(xactly)g(this)g(type)h(of)g(reuse)g(and)g(is)f (standard)0 4502 y(\(for)h(man)o(y)e(functions)g(it)h(is)f(the)h (original)g(and)g(canonical)g(implementation\).)48 b(Another)30 b(major)h(bene\002t)h(is)0 4623 y(that)26 b(this)g(code)h(is)f(acti)n (v)o(ely)g(maintained,)g(thus)g(sa)n(ving)g(ef)n(fort)g(for)h (application)f(de)n(v)o(elopers)f(who)i(inte)o(grate)0 4743 y(it.)44 b(Portable)30 b(OpenSSH)g(mak)o(es)f(e)o(xtensi)n(v)o(e)e (use)j(of)f(OpenBSD')-5 b(s)30 b(standard)f(library)g(code)h(to)f (supplement)0 4863 y(missing)23 b(or)i(brok)o(en)f(implementations)f (of)h(functions)g(on)h(other)f(platforms.)0 5033 y(This)h(approach)i (of)f Fg(dir)l(ect)g(r)l(eplacement)i Fk(w)o(orks)d(well)h(for)h (platform)e(functions,)g(types)h(and)g(pre-processor)0 5154 y(de\002nes)36 b(that)f(are)h(missing,)g(b)n(ut)f(it)g(can)h(be)g (dif)n(\002cult)f(to)g(replace)h(a)g(platform)f(supplied)f(function)g (that)i(is)0 5274 y(brok)o(en.)j(Prototypes)27 b(for)h(v)n(arious)e (functions)h(dif)n(fer)g(between)h(systems)e(and,)i(unless)f(the)g (application)g(de-)0 5395 y(v)o(eloper)j(is)g(willing)f(to)h(ship)g (multiple)f(prototypes)g(for)i(the)f(replacement)h(functions,)g(it)f (is)g(impossible)e(to)p Black 1888 5712 a(4)p Black eop end %%Page: 5 5 TeXDict begin 5 4 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.5) cvn H.B /DEST pdfmark end 0 100 a Black Black 307 x Fk(mak)o(e)24 b(them)g(w)o(ork)g(across)h(all)f(the)g(necessary)h(platforms.)30 b(One)24 b(such)g(case)h(is)f(the)h(RFC)h(3493)d([)p 0 0 1 TeXcolorrgb 3385 408 a SDict begin H.S end 3385 408 a 0 0 1 TeXcolorrgb -1 x Fk(6)p 0 0 1 TeXcolorrgb 3435 339 a SDict begin H.R end 3435 339 a 3435 407 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.rfc3493) cvn H.B /ANN pdfmark end 3435 407 a Black Fk(])i(address-)0 527 y(f)o(amily)20 b(independent)f(host)g(and)i(address)f(lookup)f(routines.)28 b(Se)n(v)o(eral)21 b(platforms)e(ha)n(v)o(e)h(shipped)f(incomplete)0 648 y(or)25 b(b)n(uggy)f(implementations)e(of)j(these)f(routines)g (that)g(needed)h(to)f(be)h(w)o(ork)o(ed)g(around,)f(b)n(ut)h(direct)f (replace-)0 768 y(ments)i(ran)h(into)e(the)i(problems)e(described)i (abo)o(v)o(e.)35 b(The)27 b(solution)e(used)h(by)g(portable)h(OpenSSH)g (is)f(to)g(use)0 888 y(the)h(pre-processor)g(to)g(internally)f(rename)h (the)g(functions)f(to)g(point)g(to)h(internal)f(replacements)h(\(as)g (sho)n(wn)0 1009 y(in)g(Listing)p 0 0 1 TeXcolorrgb 415 1009 a SDict begin H.S end 415 1009 a 0 0 1 TeXcolorrgb Fk(2)p 0 0 1 TeXcolorrgb 465 941 a SDict begin H.R end 465 941 a 465 1009 a SDict begin [ /Color [1 0 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (clist.2) cvn H.B /ANN pdfmark end 465 1009 a Black Fk(\).)39 b(This)27 b(approach)h(is)f(slightly)e(ugly)-6 b(,)27 b(in)g(that)g(it)g(renames)h(a)g(system)e(pro)o(vided)g(API.)j(Another) 0 1129 y(solution)e(w)o(ould)g(be)i(to)f(introduce)g(a)h(wrapper)g (API,)f(b)n(ut)g(this)g(w)o(ould)g(sacri\002ce)h(some)f(readability)g (for)g(the)0 1249 y(v)n(ast)c(majority)f(of)i(systems)f(where)h(these)g (functions)e(w)o(ork)i(correctly)-6 b(.)0 1417 y SDict begin H.S end 0 1417 a 0 1417 a SDict begin 14.5 H.A end 0 1417 a 0 1417 a SDict begin [ /View [/XYZ H.V] /Dest (subsubsection.3.1.2) cvn H.B /DEST pdfmark end 0 1417 a 148 x Fi(3.1.2)99 b(Acti)o(v)o(ating)25 b(r)n(eplacements)0 1803 y Fk(Once)39 b(a)g(replacement)f(function)g(has)g(been)g(written)g(or)h(imported,)h (the)f(de)n(v)o(eloper)e(is)h(no)n(w)g(f)o(aced)h(with)0 1923 y(another)33 b(question:)44 b(ho)n(w)32 b(is)g(this)g(replacement) h(triggered?)54 b(There)33 b(are)h(se)n(v)o(eral)e(popular)g (approaches)g(to)p -28 2114 3882 4 v -28 5329 4 3215 v Black Black Black Black Black 0 2182 a Fe(#)101 b(ifdef)34 b(HAVE_DAEMON)271 2261 y(daemon\(0,)f(0\);)0 2340 y(#)101 b(else)34 b(/*)f(not)h(HAVE_DAEMON)e(*/)271 2419 y(if)i(\(fork\(\)\)) 134 b(/*)34 b(HMS:)f(What)g(about)h(a)f(-1?)h(*/)406 2498 y(exit\(0\);)271 2577 y({)0 2655 y(#if)f(!defined\(F_CLOSEM\))406 2734 y(u_long)h(s;)406 2813 y(int)g(max_fd;)0 2892 y(#endif)f(/*)h(not) f(F_CLOSEM)g(*/)0 2971 y(#if)g(defined\(F_CLOSEM\))406 3050 y(/*)440 3129 y(*)h(From)f('Writing)g(Reliable)g(AIX)h(Daemons,')e (SG24-4946-00,)440 3208 y(*)i(by)g(Eric)f(Agar)g(\(saves)h(us)f(from)h (doing)f(32767)g(system)440 3286 y(*)h(calls\))440 3365 y(*/)406 3444 y(if)g(\(fcntl\(0,)f(F_CLOSEM,)g(0\))g(==)h(-1\))542 3523 y(msyslog\(LOG_ERR,)e("ntpd:)h(failed)g(to)h(close)f(open)g (files\(\):)g(\045m"\);)0 3602 y(#else)67 b(/*)34 b(not)f(F_CLOSEM)g (*/)0 3681 y(#)h(if)f(defined\(HAVE_SYSCONF\))f(&&)h (defined\(_SC_OPEN_MAX\))406 3760 y(max_fd)h(=)f (sysconf\(_SC_OPEN_MAX\);)0 3839 y(#)h(else)f(/*)h(HAVE_SYSCONF)e(&&)i (_SC_OPEN_MAX)e(*/)406 3917 y(max_fd)i(=)f(getdtablesize\(\);)0 3996 y(#)h(endif)f(/*)h(HAVE_SYSCONF)e(&&)i(_SC_OPEN_MAX)e(*/)406 4075 y(for)i(\(s)g(=)f(0;)h(s)g(<)f(max_fd;)g(s++\))542 4154 y(\(void\))g(close\(\(int\)s\);)0 4233 y(#endif)g(/*)h(not)f (F_CLOSEM)g(*/)406 4312 y(\(void\))h(open\("/",)e(0\);)406 4391 y(\(void\))i(dup2\(0,)f(1\);)406 4470 y(\(void\))h(dup2\(0,)f (2\);)0 4548 y(#if)g(defined\(HAVE_SETPGID\))f(||)h (defined\(HAVE_SETSID\))0 4627 y(#)h(ifdef)f(HAVE_SETSID)406 4706 y(if)h(\(setsid\(\))f(==)g(\(pid_t\)-1\))542 4785 y(msyslog\(LOG_ERR,)f("ntpd:)h(setsid\(\):)g(\045m"\);)0 4864 y(#)h(else)406 4943 y(if)g(\(setpgid\(0,)f(0\))g(==)h(-1\))542 5022 y(msyslog\(LOG_ERR,)e("ntpd:)h(setpgid\(\):)g(\045m"\);)0 5100 y(#)h(endif)0 5179 y(#else)f(/*)h(HAVE_SETPGID)e(||)i(HAVE_SETSID) e(*/)0 5304 y SDict begin H.S end 0 5304 a 0 5304 a SDict begin 14.5 H.A end 0 5304 a 0 5304 a SDict begin [ /View [/XYZ H.V] /Dest (clist.1) cvn H.B /DEST pdfmark end 0 5304 a Black 3850 5329 4 3215 v -28 5332 3882 4 v 463 5417 a Fi(Listing)25 b(1:)31 b Fk(e)o(xcerpt)24 b(from)h (ntp-stable-4.2.0a-20050303)d(ntpdmain\(\))i(function)p Black 1888 5712 a(5)p Black eop end %%Page: 6 6 TeXDict begin 6 5 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.6) cvn H.B /DEST pdfmark end 0 100 a Black Black -28 311 3882 4 v -28 835 4 525 v Black Black Black 279 x Fe(#ifndef)33 b(HAVE_GETNAMEINFO)0 457 y(#define)g(getnameinfo\(a,b,c,d,e,f,g\))e (\(ssh_getnameinfo\(a,b,c,d,e,f,g\)\))0 536 y(int)i(getnameinfo\(const) f(struct)h(sockaddr)g(*,)h(size_t,)f(char)g(*,)h(size_t,)135 615 y(char)g(*,)f(size_t,)g(int\);)0 694 y(#endif)g(/*)h (!HAVE_GETNAMEINFO)d(*/)0 810 y SDict begin H.S end 0 810 a 0 810 a SDict begin 14.5 H.A end 0 810 a 0 810 a SDict begin [ /View [/XYZ H.V] /Dest (clist.2) cvn H.B /DEST pdfmark end 0 810 a Black 3850 835 4 525 v -28 838 3882 4 v 828 924 a Fi(Listing)25 b(2:)31 b Fk(a)n(v)n(oiding)24 b(a)h(b)n(uggy)f(system-pro)o(vided)e(function)0 1211 y(this,)i(each)h(in)l(v)n(olving)e(some)h(tradeof)n(fs.)0 1381 y(The)d(most)f(simple)h(w)o(ay)g(to)g(trigger)g (platform-speci\002c)g(replacements)g(is)g(to)g(use)g(pre-processor)g (de\002nitions)0 1502 y(set)e(by)g(the)g(user)-5 b(.)28 b(These)20 b(usually)e(appear)i(either)f(in)g(a)g Fg(Mak)o(e\002le)h Fk(or)f(some)g(con\002guration)f(header)-5 b(.)29 b(While)19 b(this)0 1622 y(is)32 b(v)o(ery)f(easy)i(for)f(the)g(de)n(v)o(eloper)l (,)h(it)e(can)i(be)f(confusing)f(for)i(non-technical)e(users)h(and)g (therefore)h(lik)o(ely)0 1742 y(to)j(increase)h(the)g(number)f(of)g (support)g(requests)g(if)h(the)f(softw)o(are)h(is)f(shipped)f(as)i (source)g(code,)i(though)0 1863 y(grouping)23 b(together)h(coherent)g (sets)g(of)g(options)e(by)i(platform)g(can)g(reduce)h(this)e(b)n (urden.)30 b(Another)24 b(problem)0 1983 y(is)j(that)g(it)h(can)g(be)f (dif)n(\002cult)g(to)g(manually)g(maintain)f(the)i(list)e(of)i (de\002nitions)f(as)g(the)h(softw)o(are)g(gro)n(ws)e(more)0 2104 y(comple)o(x.)k(If)25 b(there)h(are)f(only)g(a)g(handful)f(of)h (de\002nes,)h(then)e(this)g(may)h(be)g(a)g(useful)g(solution)e(for)i(v) o(ery)g(small)0 2224 y(softw)o(are)g(packages.)0 2394 y(This)30 b(method)g(can)h(be)g(tri)n(vially)e(automated)h(using)g(the) g(pre-processor)h(de\002nitions)f(set)h(by)f(the)h(compiler)0 2515 y(or)36 b(system)g(include)f(\002les.)66 b(F)o(or)36 b(e)o(xample,)i Fc(#if)50 b(defined\()p 2209 2515 30 4 v 2244 2515 V 70 w(OpenBSD)p 2636 2515 V 2671 2515 V 71 w(\))p Fk(\).)65 b(This)36 b(impro)o(v)o(es)e(o)o(v)o(er)h(the)0 2635 y(pre)n(vious)25 b(technique)g(in)h(that)g(it)f(needs)i(no)e(end)h (user)h(adjustment)d(for)j(the)f(common)e(cases.)35 b(It)27 b(is)e(also)h(easy)0 2755 y(for)20 b(the)g(de)n(v)o(eloper:)26 b(understanding)19 b(which)g(sets)g(of)h(options)f(are)h(set)g(on)f(a)h (platform)f(simpli\002es)f(deb)n(ugging.)0 2876 y(Unfortunately)31 b(this)f(method)h(tends)g(to)g(become)h(unwieldy)e(when)h(man)o(y)g (platforms)g(are)h(added.)51 b(It)32 b(also)0 2996 y(f)o(ails)24 b(to)h(detect)g(v)n(ariants)f(of)g(a)i(single)d(OS,)j(e.g.)k(dif)n (ferences)25 b(between)g(Linux)f(distrib)n(utions.)0 3166 y(A)k(better)f(approach)h(is)f(to)g(pro)o(vide)f(pre-con\002gured) i(sets)f(of)h(consistent)e(options)g(in)h(the)h(b)n(uild)e(infrastruc-) 0 3287 y(ture)i(\(e.g.)41 b Fg(Mak)o(e\002les)p Fk(,)28 b(automatically)f(selected)h(by)g(system)f(architecture,)i(OS)f(and/or) g(the)g(user)-5 b(.)40 b(A)28 b(good)0 3407 y(e)o(xample)k(of)g(this)f (is)h(the)h Fg(imak)o(e)f Fk([)p 0 0 1 TeXcolorrgb 1216 3408 a SDict begin H.S end 1216 3408 a 0 0 1 TeXcolorrgb -1 x Fk(5)p 0 0 1 TeXcolorrgb 1266 3339 a SDict begin H.R end 1266 3339 a 1266 3407 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.imake) cvn H.B /ANN pdfmark end 1266 3407 a Black Fk(])h(system)e(used)h(by)g(X11R6)h(and)f(its)g(set)g(of)g (per)n(-platform)g(de\002nitions)0 3527 y(\002les.)f(Again,)23 b(this)g(is)h(simple)e(for)j(the)f(user)l(,)g(so)g(long)f(as)h(the)o(y) f(f)o(all)h(into)f(the)h(set)g(of)g(pro)o(vided)f(platforms)g(and)0 3648 y(of)n(fers)29 b(determinism)f(for)i(the)f(de)n(v)o(eloper)-5 b(.)43 b(Supporting)28 b(the)h(softw)o(are)h(on)f(a)g(ne)n(w)g (platform,)h(or)f(v)n(ariant)g(of)0 3768 y(an)c(e)o(xisting)e(one)i (does)f(tak)o(e)h(some)f(de)n(v)o(eloper)g(time.)0 3938 y(Perhaps)j(the)g(most)e(common)h(approach)h(today)f(is)g(to)h (automatically)e(detect)i(platform)f(characteristics)g(by)0 4059 y(running)f(compile-time)g(tests,)31 b(\036)-38 b(a)27 b(la)f(GNU)g(autoconf)g([)p 0 0 1 TeXcolorrgb 1942 4059 a SDict begin H.S end 1942 4059 a 0 0 1 TeXcolorrgb Fk(11)p 0 0 1 TeXcolorrgb 2042 3991 a SDict begin H.R end 2042 3991 a 2042 4059 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.autoconf) cvn H.B /ANN pdfmark end 2042 4059 a Black Fk(],)h(though)e(this)g(approach)i(predates)f(autoconf)g (by)0 4179 y(man)o(y)h(years)i([)p 0 0 1 TeXcolorrgb 520 4180 a SDict begin H.S end 520 4180 a 0 0 1 TeXcolorrgb -1 x Fk(18)p 0 0 1 TeXcolorrgb 620 4111 a SDict begin H.R end 620 4111 a 620 4179 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.spencer) cvn H.B /ANN pdfmark end 620 4179 a Black Fk(].)42 b(This)28 b(is)g(simple)f(and)i(automatic)e(for)i (the)f(user)l(,)i(and)e(the)h(same)f(system)f(can)i(pro)o(vide)f(a)0 4299 y(standard)g(and)g(user)n(-friendly)g(w)o(ay)g(of)g(making)f (other)h(compile-time)f(customisations,)f(such)i(as)g(selecting)0 4420 y(installation)34 b(paths.)63 b(This)35 b(approach)h(also)g(of)n (fers)g(a)g(reasonable)g(chance)g(that)g(the)f(softw)o(are)h(will)f(w)o (ork)0 4540 y(unmodi\002ed)k(on)g(ne)n(w)g(platforms)g(or)h(on)f(v)n (ariants)g(of)g(e)o(xisting)f(platforms,)k(thereby)e(reducing)f (support)0 4661 y(requirements.)56 b(The)33 b(big)g(problem)g(with)f (this)h(method)f(is)h(that)g(it)g(mak)o(es)g(it)g(dif)n(\002cult)f(for) i(the)f(de)n(v)o(eloper)0 4781 y(to)h(ascertain)h(the)f(e)o(xact)g (con\002guration)g(parameters)h(selected)f(on)h(a)f(gi)n(v)o(en)f (system,)j(if)f(the)o(y)e(don')n(t)h(ha)n(v)o(e)0 4901 y(direct)24 b(access)h(to)e(it.)30 b(This)24 b(mak)o(es)f(deb)n(ugging) g(quite)h(a)g(bit)f(more)h(dif)n(\002cult)g(in)f(these)h(cases.)31 b(Also,)23 b(the)h(most)0 5022 y(popular)f(tool)g(\(GNU)h(autoconf\))g (is)f(some)n(what)g(fragile)h(and)g(therefore)g(can)h(be)f(a)g(source)g (of)g(comple)o(xity)d(in)0 5142 y(itself,)j(though)g(this)g(is)g(not)g (an)h(inherent)g(problem)e(of)i(the)g(approach.)0 5312 y(Most)20 b(free)i(softw)o(are)g(projects)f(use)g(either)g(of)h(the)f (last)g(tw)o(o)f(methods,)h(or)h(a)f(combination)f(of)h(both.)29 b(Portable)0 5433 y(OpenSSH)20 b(uses)g(a)g(combination,)e(by)i(w)o(ay) g(of)f(GNU)h(autoconf:)27 b(compile-time)19 b(tests)f(where)j (possible,)e(with)p Black 1888 5712 a(6)p Black eop end %%Page: 7 7 TeXDict begin 7 6 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.7) cvn H.B /DEST pdfmark end 0 100 a Black Black 307 x Fk(some)21 b(per)n(-platform)g(de\002nitions.)28 b(The)22 b(per)n(-platform)f (de\002nitions)f(are)j(required)e(because)h(some)f(things)f(are)0 527 y(dif)n(\002cult)29 b(to)g(test.)45 b(It)30 b(is)f(impractical)h (to)f(test)g(for)h(b)n(ugs)f(in)h(the)f(netw)o(orking)g(functions)g(in) g(a)h(general)g(sense)0 648 y(\(what)37 b(happens)f(if)h(the)g(user)g (is)f(not)h(connected)g(to)f(a)h(netw)o(ork)g(when)f(running)g(the)h (tests?\))67 b(and)37 b(some)0 768 y(other)22 b(feature)i(tests)e(w)o (ould)f(require)i(root)g(to)f(function.)29 b(In)23 b(portable)f (OpenSSH,)h(per)n(-platform)f(de\002nes)h(are)0 888 y(usually)f(used)i (to)f(mark)g(certain)h(platform)e(features)i(as)g(\223brok)o(en\224)g (and)f(to)g(enable)h(platform)f(authentication)0 1009 y(code.)0 1156 y SDict begin H.S end 0 1156 a 0 1156 a SDict begin 14.5 H.A end 0 1156 a 0 1156 a SDict begin [ /View [/XYZ H.V] /Dest (subsection.3.2) cvn H.B /DEST pdfmark end 0 1156 a 198 x Fj(3.2)119 b(Complex)30 b(differ)n(ences)0 1591 y Fk(Comple)o(x)d(dif)n(ferences)i(can)f(be)h(frustrating)e(for)i (the)f(de)n(v)o(eloper)-5 b(.)39 b(One)29 b(of)f(these)g(is)g(a)g (collection)g(of)g(essen-)0 1711 y(tially)33 b(tri)n(vial)f(dif)n (ferences:)48 b(the)34 b(wild)f(v)n(ariation)f(between)i(platforms)e (in)i(ho)n(w)f(login)f(records)i(are)h(main-)0 1832 y(tained.)59 b(Most)33 b(systems)g(maintain)g(some)h(form)g(of)h Fg(utmp)f Fk(\(logged)f(in)h(users,)j(inde)o(x)o(ed)c(by)h(TTY\),)g Fg(wtmp)0 1952 y Fk(\(record)28 b(of)g(login)f(and)g(logout)f(e)n(v)o (ents\),)h Fg(btmp)g Fk(\(record)i(of)e(f)o(ailed)h(login)e(attempts\)) h(and)g Fg(lastlo)o(g)f Fk(\(per)n(-UID)0 2073 y(record)g(of)f(most)f (recent)h(login)g(acti)n(vity\))e(\002les)j(b)n(ut)e(the)h(\002elds)g (present)g(in)g(the)g(\002les,)g(their)g(contents)f(and)h(the)0 2193 y(w)o(ay)33 b(that)f(login)f(applications)g(are)i(e)o(xpected)g (to)f(write)g(to)g(them)g(frequently)g(dif)n(fer)h(between)f (platforms.)0 2313 y(Some)f(platforms)f(ha)n(v)o(e)h(adopted)g(the)g (POSIX)h Fg(utmpx)f Fk(format)f(and)i(associated)e(functions,)i(b)n(ut) e(this)g(sup-)0 2434 y(port)24 b(is)h(not)f(uni)n(v)o(ersal)f(e)n(v)o (en)h(among)g(acti)n(v)o(ely)g(maintained)f(operating)h(systems.)0 2604 y(OpenSSH)33 b(introduced)e(the)h Fg(lo)o(gicr)l(ec)g Fk(API)h(\(contrib)n(uted)e(by)h(Andre)h(Lucas\))f(to)g(deal)g(with)g (this)f(morass.)0 2724 y Fg(lo)o(gicr)l(ec)j Fk(presents)f(a)h(high-le) n(v)o(el)e(API)i(that)g(hides)f(the)h(gory)f(details)g(of)h(updating)f (the)g(appropriate)h(\002les)0 2845 y(from)26 b(the)g(main)f (application)g(behind)h(simple)e(functions)h(to)h(record)h(a)f(login)f (or)h(logout)f(e)n(v)o(ent.)34 b(T)-8 b(o)26 b(achie)n(v)o(e)0 2965 y(this,)i(the)g Fg(lo)o(ginr)l(ec.c)g Fk(code)h(needs)f(to)g (present)g(a)g(superset)g(of)h(the)f(\002elds)g(present)g(in)g (supported)f(platforms)0 3086 y Fg(utmp)22 b Fk(\002les.)31 b(Compare)23 b(\002gures)p 0 0 1 TeXcolorrgb 1127 3087 a SDict begin H.S end 1127 3087 a 0 0 1 TeXcolorrgb -1 x Fk(3)p 0 0 1 TeXcolorrgb 1176 3018 a SDict begin H.R end 1176 3018 a 1176 3086 a SDict begin [ /Color [1 0 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (clist.3) cvn H.B /ANN pdfmark end 1176 3086 a Black 24 w Fk(and)p 0 0 1 TeXcolorrgb 1367 3086 a SDict begin H.S end 1367 3086 a 0 0 1 TeXcolorrgb Fk(4)p 0 0 1 TeXcolorrgb 1417 3018 a SDict begin H.R end 1417 3018 a 1417 3086 a SDict begin [ /Color [1 0 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (clist.4) cvn H.B /ANN pdfmark end 1417 3086 a Black Fk(.)30 b(GNU/Linux)22 b(possesses)g(a)h(f)o(airly)g(complete)g(utmp)f(structure)h(that)0 3206 y(closely)28 b(matches)g(the)h Fg(lo)o(ginr)l(ec)f Fk(API,)h(whereas)g(other)g(platforms)f(often)g(omit)g(one)g(or)h(more) g(\002elds,)g(often)0 3326 y(the)24 b(IPv6)h(address.)30 b(This)23 b(API)i(has)f(greatly)g(simpli\002ed)f(the)h(task)g(of)h (supporting)d(ne)n(w)i(systems)f(in)h(portable)0 3447 y(OpenSSH)h(and)g(has)g(subsequently)e(been)i(adopted)f(by)h(at)g (least)f(one)h(other)g(free)g(softw)o(are)g(project)g([)p 0 0 1 TeXcolorrgb 3557 3448 a SDict begin H.S end 3557 3448 a 0 0 1 TeXcolorrgb -1 x Fk(10)p 0 0 1 TeXcolorrgb 3657 3379 a SDict begin H.R end 3657 3379 a 3657 3447 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.dropbear) cvn H.B /ANN pdfmark end 3657 3447 a Black Fk(].)p -28 3588 3882 4 v -28 4982 4 1395 v Black Black Black 0 3656 a Fe(struct)33 b(logininfo)g({)102 3735 y(char)236 b(progname[LINFO_PROGSIZE];)31 b(/*)j(name)f(of)h(program)e(\(for)i(PAM\))f(*/)102 3814 y(int)270 b(progname_null;)102 3893 y(short)33 b(int)67 b(type;)711 b(/*)34 b(type)f(of)h(login)f(\(LTYPE_*\))f(*/)102 3971 y(int)270 b(pid;)745 b(/*)34 b(PID)f(of)h(login)f(process)g(*/)102 4050 y(int)270 b(uid;)745 b(/*)34 b(UID)f(of)h(this)f(user)g(*/)102 4129 y(char)236 b(line[LINFO_LINESIZE];)167 b(/*)34 b(tty/pty)f(name)g (*/)102 4208 y(char)236 b(username[LINFO_NAMESIZE];)31 b(/*)j(login)f(username)g(*/)102 4287 y(char)236 b (hostname[LINFO_HOSTSIZE];)31 b(/*)j(remote)f(hostname)f(*/)102 4366 y(/*)h('exit_status')f(structure)h(components)g(*/)102 4445 y(int)270 b(exit;)711 b(/*)34 b(process)f(exit)g(status)g(*/)102 4523 y(int)270 b(termination;)473 b(/*)34 b(process)f(termination)f (status)h(*/)102 4602 y(unsigned)f(int)i(tv_sec;)102 4681 y(unsigned)e(int)i(tv_usec;)102 4760 y(union)f(login_netinfo)f (hostaddr;)270 b(/*)34 b(caller's)e(host)i(address\(es\))e(*/)0 4839 y(};)i(/*)f(struct)g(logininfo)g(*/)0 4957 y SDict begin H.S end 0 4957 a 0 4957 a SDict begin 14.5 H.A end 0 4957 a 0 4957 a SDict begin [ /View [/XYZ H.V] /Dest (clist.3) cvn H.B /DEST pdfmark end 0 4957 a Black 3850 4982 4 1395 v -28 4985 3882 4 v 1197 5071 a Fi(Listing)25 b(3:)31 b Fk(main)24 b(loginrec.c)g(structure)0 5307 y(A)29 b(related)f(approach)h(is)f(used)g(in)g(portable)g(OpenSSH')-5 b(s)29 b(audit)f(system)f(\(designed)h(and)h(implemented)d(by)0 5428 y(Darren)34 b(T)l(uck)o(er\).)57 b(If)34 b(the)g(platform)f (supports)f(login)h(e)n(v)o(ent)f(auditing,)i(a)g(simple)f(bridge)g (can)h(be)g(written)p Black 1888 5712 a(7)p Black eop end %%Page: 8 8 TeXDict begin 8 7 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.8) cvn H.B /DEST pdfmark end 0 100 a Black Black -28 311 3882 4 v -28 1617 4 1307 v Black Black Black 272 x Fe(struct)33 b(utmpx)0 451 y({)68 530 y(short)g(int)g(ut_type;)406 b(/*)34 b(Type)f(of)h(login.)67 b(*/)68 609 y(__pid_t)33 b(ut_pid;)507 b(/*)34 b(Process)f(ID)g(of)h(login)f(process.)67 b(*/)68 688 y(char)33 b(ut_line[__UT_LINESIZE];)65 b(/*)34 b(Devicename.)66 b(*/)68 767 y(char)33 b(ut_id[4];)541 b(/*)34 b(Inittab)f(ID.)g(*/)68 845 y(char)g(ut_user[__UT_NAMESIZE];)65 b(/*)34 b(Username.)66 b(*/)68 924 y(char)33 b(ut_host[__UT_HOSTSIZE];) 65 b(/*)34 b(Hostname)e(for)i(remote)f(login.)67 b(*/)68 1003 y(struct)33 b(__exit_status)f(ut_exit;)h(/*)h(Exit)f(status)g(of)h (a)f(process)g(marked)1186 1082 y(as)g(DEAD_PROCESS.)66 b(*/)68 1161 y(long)33 b(int)h(ut_session;)337 b(/*)34 b(Session)f(ID,)g(used)g(for)h(windowing.)66 b(*/)68 1240 y(struct)33 b(timeval)g(ut_tv;)304 b(/*)34 b(Time)f(entry)g(was)h (made.)67 b(*/)68 1319 y(__int32_t)32 b(ut_addr_v6[4];)202 b(/*)34 b(Internet)e(address)h(of)h(remote)f(host.)67 b(*/)68 1398 y(char)33 b(__unused[20];)405 b(/*)34 b(Reserved)e(for)i (future)f(use.)67 b(*/)0 1476 y(};)0 1592 y SDict begin H.S end 0 1592 a 0 1592 a SDict begin 14.5 H.A end 0 1592 a 0 1592 a SDict begin [ /View [/XYZ H.V] /Dest (clist.4) cvn H.B /DEST pdfmark end 0 1592 a Black 3850 1617 4 1307 v -28 1620 3882 4 v 1028 1705 a Fi(Listing)25 b(4:)31 b Fk(Linux)24 b(utmpx)f(structure)i(\(abridged\))0 1982 y(between)k(its)f(nati)n(v)o(e)g(API)h(and)g(portable)g(OpenSSH')-5 b(s)29 b(abstract)f(audit)h(e)n(v)o(ent)f(API.)h(At)g(present,)g(BSM)h (au-)0 2103 y(diting)22 b(is)g(supported)g(as)h(used)g(by)f(Sun)h(and)g (Mac)g(OS)h(X/OpenBSM,)f(b)n(ut)f(other)h(schemes)f(w)o(ould)g(be)h (tri)n(vial)0 2223 y(to)k(add.)39 b(Similarly)-6 b(,)26 b(the)i(passw)o(ord)e(authentication)g(/)i(encryption)e(code)i(has)f (per)n(-platform)g(hooks)g(for)h(OS)0 2343 y(v)o(endors)e(who)h(ha)n(v) o(e)g(decided)g(that)g(the)o(y)f(should)g(mak)o(e)i(things)e (complicated)g(for)h(application)f(de)n(v)o(elopers)0 2464 y(by)f(using)e(a)i(function)f(other)h(than)g Fg(crypt\(\))g Fk(to)f(perform)h(passw)o(ord)f(encryption.)0 2629 y(Some)h(inter)n (-platform)e(dif)n(ferences)i(are)g(more)f(subtle,)g(an)h(e)o(xample)e (of)i(this)e(is)h(the)h(dif)n(fering)e(semantics)h(of)0 2749 y(signal)19 b(deli)n(v)o(ery:)27 b(whether)20 b(system)f(calls)g (are)i(restarted)f(after)h(deli)n(v)o(ery)d(of)i(a)h(signal)e(or)h (whether)g(the)o(y)f(return)0 2870 y(with)25 b(an)h(EINTR)g(and)f (whether)h(or)f(not)g(signal)g(handlers)g(are)i(reinstalled)d(after)j (the)o(y)d(are)j(used.)32 b(OpenSSH)0 2990 y(uses)24 b(a)h(wrapper)g(function)f Fg(mysignal\(\))g Fk(to)g(pro)o(vide)g (BSD-lik)o(e)h(semantics,)e(follo)n(wing)g(the)i(technique)f(pre-)0 3111 y(sented)g(by)h(Ste)n(v)o(ens[)p 0 0 1 TeXcolorrgb 744 3113 a SDict begin H.S end 744 3113 a 0 0 1 TeXcolorrgb -2 x Fk(19)p 0 0 1 TeXcolorrgb 843 3043 a SDict begin H.R end 843 3043 a 843 3111 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.stevens) cvn H.B /ANN pdfmark end 843 3111 a Black Fk(].)p -28 3242 3882 4 v -28 5027 4 1786 v Black Black Black 0 3310 a Fe(mysig_t)0 3389 y(mysignal\(int)32 b(sig,)i(mysig_t)f(act\))0 3467 y({)135 3546 y(struct)h(sigaction)e (sa,)i(osa;)135 3704 y(if)g(\(sigaction\(sig,)e(NULL,)h(&osa\))h(==)f (-1\))271 3783 y(return)g(\(mysig_t\))g(-1;)135 3862 y(if)h(\(osa.sa_handler)e(!=)i(act\))f({)271 3941 y(memset\(&sa,)f(0,)i (sizeof\(sa\)\);)271 4020 y(sigemptyset\(&sa.sa_mask\);)271 4098 y(sa.sa_flags)e(=)i(0;)0 4177 y(#ifdef)f(SA_INTERRUPT)271 4256 y(if)h(\(sig)f(==)h(SIGALRM\))406 4335 y(sa.sa_flags)f(|=)h (SA_INTERRUPT;)0 4414 y(#endif)271 4493 y(sa.sa_handler)e(=)i(act;)271 4572 y(if)g(\(sigaction\(sig,)e(&sa,)h(NULL\))g(==)h(-1\))406 4651 y(return)g(\(mysig_t\))e(-1;)135 4729 y(})135 4808 y(return)i(\(osa.sa_handler\);)0 4887 y(})0 5002 y SDict begin H.S end 0 5002 a 0 5002 a SDict begin 14.5 H.A end 0 5002 a 0 5002 a SDict begin [ /View [/XYZ H.V] /Dest (clist.5) cvn H.B /DEST pdfmark end 0 5002 a Black 3850 5027 4 1786 v -28 5030 3882 4 v 696 5116 a Fi(Listing)25 b(5:)31 b Fk(Replacement)25 b(for)g(signal\(\))g(using)e(POSIX)j (sigaction\(\))0 5342 y(Astute)32 b(readers)i(may)e(note)h(that)f(the)h (OpenSSH)g Fg(mysignal\(\))f Fk(function)g(is)h(not)f(e)o(xactly)g(lik) o(e)g(Ste)n(v)o(ens')g(in)0 5463 y(that)23 b(it)f(does)h(not)f(acti)n (v)n(ate)g(the)h(restart)g(of)h(system)d(calls)i(after)h(receipt)f(of)g (a)h(signal.)29 b(This)22 b(is)h(because)g(setting)p Black 1888 5712 a(8)p Black eop end %%Page: 9 9 TeXDict begin 9 8 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.9) cvn H.B /DEST pdfmark end 0 100 a Black Black 307 x Fk(the)30 b(POSIX)h(SA)p 603 407 30 4 v 36 w(REST)-9 b(AR)j(T)31 b(\003ag)g(is)e(not)h(suf)n (\002cient)f(to)h(ensure)g(that)g(a)g(system)f(call)h(will)f(fully)h (complete)0 527 y(upon)c(receipt)g(of)h(a)g(signal,)f(for)h(instance)f (a)g Fg(r)l(ead\(\))h Fk(may)f(return)h(fe)n(wer)g(bytes)f(than)g(were) h(requested)f(when)0 648 y(it)g(is)g(interrupted.)35 b(OpenSSH)28 b(needs)e(to)g(be)h(careful)g(here,)h(as)f(a)f(SIGCHLD)i (or)e(other)h(signal)f(could)g(arri)n(v)o(e)0 768 y(at)38 b(an)o(y)f(time)g(during)g(its)g(e)o(x)o(ecution,)i(and)e(it)h(cannot)f (af)n(ford)h(to)f(assume)g(that)g(a)h Fg(r)l(ead\(\))g Fk(or)g Fg(write\(\))g Fk(will)0 888 y(continue)22 b(to)g(completion.) 29 b(Instead,)23 b(OpenSSH)g(deals)g(with)f(interrupted)g(or)h(short)f (reads)h(and)g(writes)f(using)0 1009 y(a)33 b(wrapper)f(function)g Fg(atomicio\(\))p Fk(.)52 b(This)32 b(function)f(will)h(try)g(to)g (read)h(or)f(write)g(the)h(speci\002ed)f(number)g(of)0 1129 y(bytes,)c(restarting)g(if)g(the)g(system)f(call)h(returns)g(a)h (short)e(transfer)i(or)f(an)g(EINTR)h(error)-5 b(.)41 b Fg(atomicio)27 b Fk(will)g(run)0 1249 y(until)d(either)g(all)h(the)g (requested)f(bytes)g(are)i(mo)o(v)o(ed)d(or)i(an)g(error)g(or)g(EOF)g (condition)f(has)g(occurred.)0 1410 y SDict begin H.S end 0 1410 a 0 1410 a SDict begin 14.5 H.A end 0 1410 a 0 1410 a SDict begin [ /View [/XYZ H.V] /Dest (subsection.3.3) cvn H.B /DEST pdfmark end 0 1410 a 166 x Fj(3.3)119 b(Differ)n(ences)30 b(with)h(security)f(implications)0 1802 y Fk(Most)19 b(of)h(the)g(time)f(inter)n(-platform)g(dif)n(ferences)h(will)f(cause)h (ob)o(vious)f(f)o(ailures)g(when)h(the)o(y)f(are)i(not)e(properly)0 1922 y(dealt)38 b(with.)69 b(Ho)n(we)n(v)o(er)l(,)40 b(some)d(dif)n(ferences)h(are)h(subtle)e(and)h(ha)n(v)o(e)f(ef)n(fects) h(that)g(can)g(seriously)f(impact)0 2042 y(security)-6 b(.)0 2201 y(One)35 b(e)o(xample)f(of)h(this)f(is)g(the)g(P)-9 b(AM)35 b(library)g([)p 0 0 1 TeXcolorrgb 1702 2202 a SDict begin H.S end 1702 2202 a 0 0 1 TeXcolorrgb -1 x Fk(17)p 0 0 1 TeXcolorrgb 1801 2133 a SDict begin H.R end 1801 2133 a 1801 2201 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.PAM) cvn H.B /ANN pdfmark end 1801 2201 a Black Fk(].)61 b(P)-9 b(AM)35 b(pro)o(vides)e(a)i(standard)g(API)g(for)g (programs)f(to)0 2321 y(perform)k(user)g(authentication,)i (authorisation)d(and)h(session)f(setup.)69 b(Ho)n(we)n(v)o(er)37 b(and)h(ambiguity)f(in)g(the)0 2441 y(speci\002cation)29 b(leads)h(to)f(a)h(nasty)f(b)n(ug.)44 b(P)-9 b(AM)30 b(is)f(a)h(challenge/response)e(API,)i(pro)o(viding)e(the)h (application)0 2562 y(a)35 b(set)g(of)g Fg(pam)p 521 2562 30 4 v 36 w(messa)o(g)o(e)f Fk(structures)h(which)f(can)i (instruct)d(it)i(to)g(display)e(messages)i(or)g(prompt)f(for)h(user)0 2682 y(input)24 b(with)h(character)i(echo)e(enabled)h(\(for)f (non-sensiti)n(v)o(e)e(questions\))h(or)i(disabled)e(\(e.g.)33 b(for)26 b(passw)o(ords\).)0 2803 y(De)n(v)o(elopers)c(of)h(some)g (Sun-deri)n(v)o(ed)f(P)-9 b(AM)23 b(implementations)d(interpreted)j (this)f(set)h(of)g(messages)f(as)i(being)0 2923 y(passed)h(as)g(a)h Fg(pointer)e(to)h(an)g(arr)o(ay)f(of)h(struct)g(pam)p 1789 2923 V 35 w(messa)o(g)o(e)p Fk(,)g(whereas)h(the)f(Linux-P)-9 b(AM)24 b([)p 0 0 1 TeXcolorrgb 3239 2924 a SDict begin H.S end 3239 2924 a 0 0 1 TeXcolorrgb -1 x Fk(15)p 0 0 1 TeXcolorrgb 3339 2855 a SDict begin H.R end 3339 2855 a 3339 2923 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.Linux-PAM) cvn H.B /ANN pdfmark end 3339 2923 a Black Fk(])h(de)n(v)o (elopers)0 3043 y(took)31 b(the)g(vie)n(w)g(that)g(it)g(is)g(passed)g (as)g Fg(An)h(arr)o(ay)e(of)h(pointer)o(s)f(to)h(struct)g(pam)p 2768 3043 30 4 v 35 w(messa)o(g)o(e)p Fk(.)50 b(In)32 b(the)f(common)0 3164 y(case)j(where)h(only)e(a)h(single)f(message)g (is)g(present,)j(the)e(tw)o(o)f(are)i(equi)n(v)n(alent.)56 b(Ho)n(we)n(v)o(er)32 b(when)i(multiple)0 3284 y(messages)26 b(are)g(present,)h(an)f(application)f(e)o(xpecting)g(the)h(wrong)g (beha)n(viour)f(could)h(read)g(to)g(or)g(write)g(from)0 3404 y(an)35 b(incorrect)g(address,)i(a)e(beha)n(viour)f(that)g(is)h (potentially)e(e)o(xploitable)g(by)h(an)h(attack)o(er)g(to)g(gain)f (control)0 3525 y(of)j(the)g(process.)68 b(W)-8 b(orse,)40 b(because)e(it)e(is)h(responsible)f(for)i(authentication,)g(the)f (application)f(code)i(that)0 3645 y(deals)25 b(with)g(P)-9 b(AM)25 b(must)f(run)i(with)e(super)n(-user)i(pri)n(vile)o(ges,)d (which)i(a)h(successful)f(e)o(xploit)e(w)o(ould)i(gleefully)0 3766 y(inherit.)0 3924 y(T)-8 b(o)31 b(tackle)h(this,)g(portable)g (OpenSSH)g(implemented)e(the)h(accessor)h(macro)g(sho)n(wn)e(in)i (Listing)p 0 0 1 TeXcolorrgb 3463 3925 a SDict begin H.S end 3463 3925 a 0 0 1 TeXcolorrgb -1 x Fk(6)p 0 0 1 TeXcolorrgb 3512 3856 a SDict begin H.R end 3512 3856 a 3512 3924 a SDict begin [ /Color [1 0 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (clist.6) cvn H.B /ANN pdfmark end 3512 3924 a Black 32 w Fk(to)f(hide)0 4044 y(the)25 b(P)-9 b(AM)24 b(implementation')-5 b(s)22 b Fg(pam)p 1273 4044 30 4 v 36 w(messa)o(g)o(e)i Fk(passing)g(con)l(v)o(ention.)p -28 4161 3882 4 v -28 4680 4 519 v Black Black Black 0 4230 a Fe(#ifdef)33 b(PAM_SUN_CODEBASE)0 4308 y(#)h(define)f(PAM_MSG_MEMBER\(msg,)e(n,)j (member\))f(\(\(*\(msg\)\)[\(n\)].member\))0 4387 y(#else)0 4466 y(#)h(define)f(PAM_MSG_MEMBER\(msg,)e(n,)j(member\))f (\(\(msg\)[\(n\)]->member\))0 4545 y(#endif)0 4655 y SDict begin H.S end 0 4655 a 0 4655 a SDict begin 14.5 H.A end 0 4655 a 0 4655 a SDict begin [ /View [/XYZ H.V] /Dest (clist.6) cvn H.B /DEST pdfmark end 0 4655 a Black 3850 4680 4 519 v -28 4683 3882 4 v 862 4769 a Fi(Listing)25 b(6:)31 b Fk(W)-8 b(orking)24 b(around)h(dif)n(ferent)f(P)-9 b(AM)25 b(semantics)0 4981 y(Another)j(platform)g(dif)n(ference)g(of)h (concern)f(is)g(in)g(the)h(semantics)e(of)h(the)h Fg(setuid)h Fk(f)o(amily)d(of)i(calls:)37 b Fg(setuid)p Fk(,)0 5102 y Fg(setr)l(euid)p Fk(,)e Fg(setr)l(esuid)p Fk(,)g(and)f(their)f(group) g(ID)h(manipulation)d(counterparts.)57 b(Chen)34 b(and)f(W)-8 b(agner)35 b([)p 0 0 1 TeXcolorrgb 3524 5103 a SDict begin H.S end 3524 5103 a 0 0 1 TeXcolorrgb -1 x Fk(3)p 0 0 1 TeXcolorrgb 3574 5034 a SDict begin H.R end 3574 5034 a 3574 5102 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.chen) cvn H.B /ANN pdfmark end 3574 5102 a Black Fk(])e(ha)n(v)o(e)0 5222 y(found)21 b(that)h(se)n(v)o(eral)f(nai)n(v)o(e)g(usage)g (patterns)h(of)g(these)f(system)g(calls)h(can)g(lead)g(to)f(an)h (incomplete)f(re)n(v)n(ocation)0 5342 y(of)37 b(pri)n(vile)o(ge.)66 b(Portable)37 b(OpenSSH)h(adopts)e(their)h(recommendations,)i(and)e (implements)e(a)j(some)n(what)0 5463 y(paranoid)24 b(approach)i(when)e (permanently)g(discarding)g(pri)n(vile)o(ge:)p Black 1888 5712 a(9)p Black eop end %%Page: 10 10 TeXDict begin 10 9 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.10) cvn H.B /DEST pdfmark end 0 100 a Black Black 0 307 a SDict begin H.S end 0 307 a 0 307 a SDict begin 14.5 H.A end 0 307 a 0 307 a SDict begin [ /View [/XYZ H.V] /Dest (Item.6) cvn H.B /DEST pdfmark end 0 307 a Black 120 407 a Fk(1.)p Black 49 w(Drop)25 b(group)f(pri)n(vile)o(ges:)k Fg(setgr)l(oups)p Fk(,)23 b Fg(sete)l(gid)k Fk(and)e Fg(setgid)0 470 y SDict begin H.S end 0 470 a 0 470 a SDict begin 14.5 H.A end 0 470 a 0 470 a SDict begin [ /View [/XYZ H.V] /Dest (Item.7) cvn H.B /DEST pdfmark end 0 470 a Black 120 610 a Fk(2.)p Black 49 w(Drop)g(user)f(pri)n(vile)o(ges:)29 b Fg(seteuid)e Fk(and)e Fg(setuid)0 673 y SDict begin H.S end 0 673 a 0 673 a SDict begin 14.5 H.A end 0 673 a 0 673 a SDict begin [ /View [/XYZ H.V] /Dest (Item.8) cvn H.B /DEST pdfmark end 0 673 a Black 120 814 a Fk(3.)p Black 49 w(T)m(ry)f(to)h(restore)g(group)f(pri)n(vile)o(ges)f(and)h(raise)h (a)h(f)o(atal)f(error)g(if)g(successful)0 877 y SDict begin H.S end 0 877 a 0 877 a SDict begin 14.5 H.A end 0 877 a 0 877 a SDict begin [ /View [/XYZ H.V] /Dest (Item.9) cvn H.B /DEST pdfmark end 0 877 a Black 120 1017 a Fk(4.)p Black 49 w(T)m(ry)f(to)h(restore)g(user)f(pri)n(vile)o(ges)f(and)i (raise)g(a)g(f)o(atal)g(error)h(if)e(successful)0 1295 y(Where)i(possible,)e(the)h Fg(setr)l(esuid)i Fk(and)e Fg(setr)l(esgid)i Fk(API)f(is)f(used)g(in)g(f)o(a)n(v)n(our)g(of)h (separate)g(calls)f(to)f(set)i(the)f(real)0 1416 y(and)e(ef)n(fecti)n (v)o(e)f(IDs.)31 b(These)23 b(functions)f(of)n(fers)h(the)g(most)f (unambiguous)f(semantics)h(and)i(ensure)f(that)g(sa)n(v)o(ed)0 1536 y(IDs)28 b(are)h(set)f(correctly)g([)p 0 0 1 TeXcolorrgb 876 1537 a SDict begin H.S end 876 1537 a 0 0 1 TeXcolorrgb -1 x Fk(3)p 0 0 1 TeXcolorrgb 926 1468 a SDict begin H.R end 926 1468 a 926 1536 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.chen) cvn H.B /ANN pdfmark end 926 1536 a Black Fk(].)41 b(As)28 b(a)h(result,)f(OpenBSD)h(is)f(replacing)g (all)f(uses)h(of)g(these)g(older)g(functions)f(to)0 1656 y(permanently)d(drop)g(pri)n(vile)o(ges)f(with)h(calls)h(to)f Fg(setr)l(esuid)j Fk(and)e Fg(setr)l(esgid)h Fk(throughout)e(its)g (code-base.)0 1835 y SDict begin H.S end 0 1835 a 0 1835 a SDict begin 14.5 H.A end 0 1835 a 0 1835 a SDict begin [ /View [/XYZ H.V] /Dest (section.4) cvn H.B /DEST pdfmark end 0 1835 a 211 x Fl(4)143 b(Choosing)34 b(the)h(right)g(API)0 2319 y Fk(A)30 b(popular)l(,)h(b)n(ut)e(nai)n(v)o(e)g(vie)n(w)h(of)g (portability)e(is)i(that)g(it)f(consists)g(of)h(\223a)n(v)n(oiding)f (unportable)h(APIs\224.)47 b(This)0 2439 y(may)24 b(ease)h(some)f(of)g (the)g(more)g(tri)n(vial)f(portability)g(problems)g(encountered)h(by)g (de)n(v)o(elopers,)f(b)n(ut)h(it)g(has)g(the)0 2560 y(ne)o(gati)n(v)o (e)f(ef)n(fect)j(of)g(dumbing)e(softw)o(are)h(do)n(wn)g(to)g(the)h(lo)n (west)e(common)g(denominator)-5 b(.)32 b(Nearly)25 b(all)h(of)f(the)0 2680 y(best)j(APIs)h(from)f(a)h(security)f(perspecti)n(v)o(e)f(are)j (incompletely)d(portable.)41 b(Ho)n(we)n(v)o(er)27 b(the)i(bene\002t)f (for)h(using)0 2800 y(these)d(APIs)g(in)g(f)o(a)n(v)n(our)g(of)g(more)f (portable,)h(b)n(ut)g(less)f(secure)i(ones)e(greatly)h(outweighs)e(the) i(cost)g(of)g(ha)n(ving)0 2921 y(to)34 b(include)f(portable)h (replacements,)i(especially)d(when)h(one)h(considers)e(that)h(the)g (better)g(APIs)g(are)h(only)0 3041 y(going)24 b(to)g(become)h(more)g (common)e(with)h(time.)0 3211 y(One)g(concrete)h(e)o(xample)e(of)h (this)f(is)g(the)h Fg(closefr)l(om)f Fk(system)g(call)h(\(atomically)e (close)i(all)g(open)g(\002le)g(descrip-)0 3332 y(tors)29 b(numbered)g(abo)o(v)o(e)f(a)h(certain)h(bound\))e(-)i(it)f(w)o(as)g (\002rst)g(introduced)g(in)g(Sun)g(Solaris,)h(b)n(ut)f(subsequently)0 3452 y(added)23 b(to)f(OpenBSD)h(and)f(then)g(NetBSD.)i(An)e (application)f(that)h(used)h(the)f(lo)n(west)f(common)g(denominator)0 3573 y(approach)27 b(of)g(manually)f(closing)g(\002le)i(descriptors)e (w)o(ould)h(ne)n(v)o(er)f(bene\002t)h(from)g(the)g(impro)o(v)o(ed)e (API,)j(e)n(v)o(en)0 3693 y(if)d(it)f(w)o(as)h(introduced)f(to)g(the)h (application')-5 b(s)23 b(nati)n(v)o(e)g(platform.)0 3863 y(A)34 b(system)f(interf)o(ace)h(that)g(went)g(the)g(other)g(w)o (ay)g(is)f(the)h Fg(/de)o(v/r)o(andom)e Fk(cryptographic)h(random)h (number)0 3984 y(de)n(vice)28 b([)p 0 0 1 TeXcolorrgb 319 3985 a SDict begin H.S end 319 3985 a 0 0 1 TeXcolorrgb -1 x Fk(20)p 0 0 1 TeXcolorrgb 419 3916 a SDict begin H.R end 419 3916 a 419 3984 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.ts'o) cvn H.B /ANN pdfmark end 419 3984 a Black Fk(];)i(\002rst)e(implemented)f(on)h(Linux)f(and)h(the)g (BSDs,)i(b)n(ut)e(e)n(v)o(entually)e(added)i(to)g(Solaris.)41 b(This)28 b(is)0 4104 y(a)f(k)o(ernel)g(f)o(acility)f(that)h(pro)o (vides)e(a)i(central)g(pool)f(of)h(cryptographically)f(unguessable)g (random)g(numbers,)0 4224 y(made)d(a)n(v)n(ailable)f(to)h(user)g (applications)f(via)h(the)g Fg(/de)o(v/r)o(andom)d Fk(de)n(vice)j (node.)30 b(Unguessable)22 b(random)h(num-)0 4345 y(bers)c(are)i (critically)d(important)g(for)i(cryptographic)f(applications)e(such)j (as)f(k)o(e)o(y)g(generation)g(and)g(agreement.)0 4465 y(The)27 b(pro)o(vision)f(of)h(a)h(central)g(and)f(strong)g(API)h(remo) o(v)o(ed)e(the)i(temptation)d(for)j(application)e(de)n(v)o(elopers)g (to)0 4585 y(\223roll)31 b(their)g(o)n(wn\224)g(random)f(pooling)g(and) h(seeding)g(code,)i(often)e(with)g(insecure)g(results)f([)p 0 0 1 TeXcolorrgb 3233 4586 a SDict begin H.S end 3233 4586 a 0 0 1 TeXcolorrgb -1 x Fk(7)p 0 0 1 TeXcolorrgb 3283 4519 a SDict begin H.R end 3283 4519 a 3283 4585 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.goldberg) cvn H.B /ANN pdfmark end 3283 4585 a Black Fk(].)51 b(The)31 b(use)g(of)0 4706 y(such)d(k)o(ernel)g(f)o(acilities)g(where)h(a)n(v)n(ailable,)f (or)g(a)h(good)f(user)n(-le)n(v)o(el)f(replacement)h(\(such)g(as)h (PRNGd)g([)p 0 0 1 TeXcolorrgb 3614 4707 a SDict begin H.S end 3614 4707 a 0 0 1 TeXcolorrgb -1 x Fk(8)p 0 0 1 TeXcolorrgb 3664 4638 a SDict begin H.R end 3664 4638 a 3664 4706 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.janicke) cvn H.B /ANN pdfmark end 3664 4706 a Black Fk(]\))g(is)0 4826 y(strongly)23 b(recommended.)0 4996 y(Sadly)-6 b(,)34 b(sometimes)d(better)i(APIs)f(aren')n(t)i(al)o(w)o(ays)e(uni)n(v)o (ersally)f(adopted.)53 b(F)o(or)33 b(instance,)h(the)e Fg(strlcpy)g Fk(and)0 5117 y Fg(strlcat)f Fk(functions)f([)p 0 0 1 TeXcolorrgb 722 5118 a SDict begin H.S end 722 5118 a 0 0 1 TeXcolorrgb -1 x Fk(13)p 0 0 1 TeXcolorrgb 822 5049 a SDict begin H.R end 822 5049 a 822 5117 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.millert) cvn H.B /ANN pdfmark end 822 5117 a Black Fk(].)48 b(These)31 b(are)g(designed)f(to)g (replace)i Fg(str)l(cpy)p Fk(,)g Fg(str)l(cat)p Fk(,)f Fg(strncpy)f Fk(and)h Fg(strncat)p Fk(.)47 b(These)0 5237 y(latter)37 b(functions)g(are)h(standard)f(POSIX,)h(b)n(ut)f(suf)n (fer)g(serious)g(de\002ciencies:)56 b Fg(str)l(cpy)38 b Fk(and)f Fg(str)l(cat)i Fk(do)e(not)0 5358 y(check)i(the)g (boundaries)e(of)i(the)g(tar)n(get)f(b)n(uf)n(fer)h(and)g(therefore)g (can)g(easily)f(o)o(v)o(errun)g(it)g(if)g(used)h(without)p Black 1863 5712 a(10)p Black eop end %%Page: 11 11 TeXDict begin 11 10 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.11) cvn H.B /DEST pdfmark end 0 100 a Black Black 307 x Fk(the)32 b(highest)g(de)o (gree)h(of)f(care)i(\(gi)n(ving)d(rise)i(to)f(the)g(f)o(amous)g (stack-smashing)f(attack)i([)p 0 0 1 TeXcolorrgb 3121 407 a SDict begin H.S end 3121 407 a 0 0 1 TeXcolorrgb Fk(2)p 0 0 1 TeXcolorrgb 3171 339 a SDict begin H.R end 3171 339 a 3171 407 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.aleph) cvn H.B /ANN pdfmark end 3171 407 a Black Fk(]\).)54 b(The)33 b(bounds-)0 527 y(check)o(ed)25 b Fg(strncpy)e Fk(and)h Fg(strncat)h Fk(are)f(not)g(much)f(better;)h(the)o(y)g(f)o (ail)g(to)f(nul-terminate)g(the)h(tar)n(get)g(string)f(if)h(the)0 648 y(source)30 b(string)e(is)h(equal)g(or)h(longer)f(in)g(length)g (than)g(the)g(tar)n(get)h(b)n(uf)n(fer)f(\(thereby)g(opening)g(a)h (related)f(class)0 768 y(of)h(security)f(b)n(ugs\))g(and)g(the)o(y)g (do)g(not)g(return)h(enough)f(information)f(to)h(allo)n(w)f(the)i (application)e(de)n(v)o(eloper)0 888 y(to)c(detect)h(cases)g(where)h(a) f(string)f(truncation)g(has)g(occurred.)0 1059 y(The)j Fg(strlcpy)f Fk(and)h Fg(strlcat)h Fk(API)f(properly)g(check)g(the)g (tar)n(get)g(b)n(uf)n(fer')-5 b(s)26 b(bounds,)h(nul-terminate)f(in)g (all)h(cases)0 1179 y(and)j(return)h(the)f(length)f(of)h(the)h(source)f (string,)h(allo)n(wing)d(detection)i(of)g(truncation.)46 b(This)30 b(API)h(has)f(been)0 1299 y(adopted)f(by)f(most)g(modern)h (operating)f(systems)g(and)h(man)o(y)f(standalone)g(softw)o(are)h (packages,)i(including)0 1420 y(OpenBSD)k(\(where)f(it)f(originated\),) j(Sun)e(Solaris,)h(FreeBSD,)h(NetBSD,)f(the)e(Linux)g(k)o(ernel,)j (rsync)e(and)0 1540 y(the)d(GNOME)g(project.)51 b(The)31 b(notable)g(e)o(xception)g(is)g(the)g(GNU)h(standard)f(C)h(library)-6 b(,)32 b(glibc)f([)p 0 0 1 TeXcolorrgb 3379 1540 a SDict begin H.S end 3379 1540 a 0 0 1 TeXcolorrgb Fk(12)p 0 0 1 TeXcolorrgb 3479 1472 a SDict begin H.R end 3479 1472 a 3479 1540 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.glibc) cvn H.B /ANN pdfmark end 3479 1540 a Black Fk(],)i(whose)0 1660 y(maintainer)f(steadf)o(astly)f(refuses)i(to)f(include)f(these)i (impro)o(v)o(ed)d(APIs,)k(labelling)e(them)f(\223horribly)h(inef)n (\002-)0 1781 y(cient)27 b(BSD)g(crap\224)h([)p 0 0 1 TeXcolorrgb 717 1781 a SDict begin H.S end 717 1781 a 0 0 1 TeXcolorrgb Fk(4)p 0 0 1 TeXcolorrgb 767 1713 a SDict begin H.R end 767 1713 a 767 1781 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.drepper) cvn H.B /ANN pdfmark end 767 1781 a Black Fk(],)g(despite)e(prior)g(e)n(vidence)h(that)f(the)o(y)g (are)i(f)o(aster)f(is)g(most)e(cases)j(than)e(the)h(APIs)g(the)o(y)0 1901 y(replace)i([)p 0 0 1 TeXcolorrgb 349 1902 a SDict begin H.S end 349 1902 a 0 0 1 TeXcolorrgb -1 x Fk(13)p 0 0 1 TeXcolorrgb 449 1833 a SDict begin H.R end 449 1833 a 449 1901 a SDict begin [ /Color [0 1 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (cite.millert) cvn H.B /ANN pdfmark end 449 1901 a Black Fk(].)41 b(As)27 b(a)i(result,)f(o)o(v)o(er)f(100)h(of)g(the)g(softw)o(are)g (packages)h(present)f(in)f(the)h(OpenBSD)h(ports)f(tree)0 2022 y(maintain)e(their)h(o)n(wn)g Fg(strlcpy)f Fk(and/or)h Fg(strlcat)h Fk(replacements)f(or)g(equi)n(v)n(alent)f(APIs)h(-)h(not)f (an)g(ideal)g(state)g(of)0 2142 y(af)n(f)o(airs.)0 2312 y(Finding)d(replacements)g(for)h(good)f(APIs)h(isn')n(t)f(hard)h(-)g (it)g(is)f(highly)f(probable)i(that)f(a)h(free)h(softw)o(are)e(project) 0 2433 y(has)29 b(already)h(solv)o(ed)e(the)i(problem)e(and)i(has)f (made)g(a)h(licence-compatible)f(replacement)g(a)n(v)n(ailable.)44 b(Nor)0 2553 y(should)26 b(the)i(task)f(result)g(in)g(a)h(dramatic)f (increase)h(in)g(a)g(project')-5 b(s)26 b(size,)j(most)d(of)i(these)f (APIs)h(are)g(tri)n(vial)e(to)0 2673 y(replace.)31 b(T)-8 b(able)p 0 0 1 TeXcolorrgb 586 2674 a SDict begin H.S end 586 2674 a 0 0 1 TeXcolorrgb -1 x Fk(3)p 0 0 1 TeXcolorrgb 636 2605 a SDict begin H.R end 636 2605 a 636 2673 a SDict begin [ /Color [1 0 0] /H /I /Border [0 0 0] /Subtype /Link /Dest (table.3) cvn H.B /ANN pdfmark end 636 2673 a Black 24 w Fk(sho)n(ws)23 b(the)h(sizes)g(of)g(the)g(lar)n(gest)g(replacement)g(functions)f(used) h(in)g(portable)g(OpenSSH.)0 2794 y(In)38 b(almost)g(all)g(of)g(these)g (cases,)k(the)d(code)f(w)o(as)h(obtained)e(or)i(adapted)f(from)g (OpenBSD')-5 b(s)39 b(standard)f(C)0 2914 y(library)-6 b(.)72 b(A)39 b(good)f(long-term)g(approach)h(in)g(this)f(age)h(of)g (open)g(source)g(operating)f(systems)g(is)g(to)h(also)0 3034 y(contrib)n(ute)24 b(this)g(support)g(code)h(to)f(their)g (libraries)h(or)g(k)o(ernels.)p Black Black Black 1180 3176 1465 4 v 1178 3288 4 113 v 1230 3255 a Fm(Function)p 1947 3288 V 549 w(Lines)f(of)f(code)p 2643 3288 V 1178 3401 V 1947 3401 V 1999 3368 a(\(inc.)29 b(comments\))p 2643 3401 V 1180 3405 1465 4 v 1180 3421 V 1178 3534 4 113 v 1230 3500 a(glob\(\))p 1947 3534 V 1009 w(914)p 2643 3534 V 1180 3538 1465 4 v 1178 3650 4 113 v 1230 3617 a(snprintf\(\))p 1947 3650 V 889 w(652)p 2643 3650 V 1180 3654 1465 4 v 1178 3767 4 113 v 1230 3733 a(getrrsetbyname\(\))p 1947 3767 V 613 w(585)p 2643 3767 V 1180 3770 1465 4 v 1178 3883 4 113 v 1230 3849 a(base64)p 1485 3849 28 4 v 35 w(ntop\(\))c(and)p 1947 3883 4 113 v 2643 3883 V 1178 3996 V 1230 3962 a(base64)p 1485 3962 28 4 v 35 w(pton\(\))p 1947 3996 4 113 v 724 w(324)p 2643 3996 V 1180 3999 1465 4 v 1178 4112 4 113 v 1230 4078 a(getcwd\(\))p 1947 4112 V 908 w(242)p 2643 4112 V 1180 4115 1465 4 v 1178 4228 4 113 v 1230 4194 a(vis\(\))p 1947 4228 V 1064 w(239)p 2643 4228 V 1180 4232 1465 4 v 1178 4345 4 113 v 1230 4311 a(inet)p 1370 4311 28 4 v 34 w(ntop\(\))p 1947 4345 4 113 v 840 w(229)p 2643 4345 V 1180 4348 1465 4 v 1178 4461 4 113 v 1230 4427 a(getaddrinfo\(\),)p 1947 4461 V 2643 4461 V 1178 4574 V 1230 4540 a(getnameinfo\(\))i(and)p 1947 4574 V 2643 4574 V 1178 4687 V 1230 4653 a(support)f(functions)p 1947 4687 V 598 w(224)p 2643 4687 V 1180 4690 1465 4 v 1178 4803 4 113 v 1230 4769 a(openpty\(\))p 1947 4803 V 879 w(201)p 2643 4803 V 1180 4806 1465 4 v 1178 4919 4 113 v 1230 4885 a(realpath\(\))p 1947 4919 V 879 w(196)p 2643 4919 V 1180 4922 1465 4 v 0 5030 a SDict begin H.S end 0 5030 a 0 5030 a SDict begin 14.5 H.A end 0 5030 a 0 5030 a SDict begin [ /View [/XYZ H.V] /Dest (table.3) cvn H.B /DEST pdfmark end 0 5030 a Black 709 5190 a Fk(T)-8 b(able)25 b(3:)p 0 TeXcolorgray 1062 5069 a SDict begin H.S end 1062 5069 a 0 TeXcolorgray 0 TeXcolorgray 1062 5069 a SDict begin H.R end 1062 5069 a 1062 5069 a SDict begin [ /View [/XYZ H.V] /Dest (table.3) cvn H.B /DEST pdfmark end 1062 5069 a Black 121 x Fk(lar)n(gest)f(replacement)h (functions)f(in)g(Portable)h(OpenSSH)p Black Black Black 1863 5712 a(11)p Black eop end %%Page: 12 12 TeXDict begin 12 11 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.12) cvn H.B /DEST pdfmark end 0 100 a Black Black 0 307 a SDict begin H.S end 0 307 a 0 307 a SDict begin 14.5 H.A end 0 307 a 0 307 a SDict begin [ /View [/XYZ H.V] /Dest (subsection.4.1) cvn H.B /DEST pdfmark end 0 307 a 100 x Fj(4.1)119 b(Conclusion)0 644 y Fk(The)25 b(main)f(recommendations)f(of)i(this)f(paper)h(may)g (be)g(brie\003y)g(summarised)e(into)h(six)g(simple)g(rules:)0 782 y SDict begin H.S end 0 782 a 0 782 a SDict begin 14.5 H.A end 0 782 a 0 782 a SDict begin [ /View [/XYZ H.V] /Dest (Item.10) cvn H.B /DEST pdfmark end 0 782 a Black 120 922 a Fk(1.)p Black 49 w(A)-7 b(v)n(oid)39 b(cluttering)g(main)h(code)g (paths)g(with)g(portability)e(code,)44 b(especially)c(that)g(wrapped)g (up)g(in)244 1043 y(nested)24 b(preprocessor)0 1106 y SDict begin H.S end 0 1106 a 0 1106 a SDict begin 14.5 H.A end 0 1106 a 0 1106 a SDict begin [ /View [/XYZ H.V] /Dest (Item.11) cvn H.B /DEST pdfmark end 0 1106 a Black 120 1246 a Fk(2.)p Black 49 w(Pick)i(the)g(best)f(possible)g(API)h(a)n(v)n (ailable,)g(e)n(v)o(en)f(if)h(it)f(isn')n(t)h(a)n(v)n(ailable)f(on)h(e) n(v)o(ery)f(platform)g(-)h(it)g(can)g(be)244 1367 y(replaced)f(or)g (imported)f(if)h(it)f(doesn')n(t)g(e)o(xist)g(some)n(where)0 1430 y SDict begin H.S end 0 1430 a 0 1430 a SDict begin 14.5 H.A end 0 1430 a 0 1430 a SDict begin [ /View [/XYZ H.V] /Dest (Item.12) cvn H.B /DEST pdfmark end 0 1430 a Black 120 1570 a Fk(3.)p Black 49 w(Replace)c(missing)d(or)i(brok)o(en)f (functions)g(in)g(a)i(separate)f(library)f(rather)i(than)e(performing)g (the)h(sur)n(gery)244 1690 y(inline)0 1733 y SDict begin H.S end 0 1733 a 0 1733 a SDict begin 14.5 H.A end 0 1733 a 0 1733 a SDict begin [ /View [/XYZ H.V] /Dest (Item.13) cvn H.B /DEST pdfmark end 0 1733 a Black 120 1894 a Fk(4.)p Black 49 w(Where)33 b(possible,)f(obtain)g(an)g(e)o(xisting,)g (kno)n(wn-good)e(replacement)j(instead)e(of)h(de)n(v)o(eloping)f(ne)n (w)244 2014 y(code)25 b(\(e.g.)31 b(from)24 b(OpenBSD')-5 b(s)25 b(libc\))0 2077 y SDict begin H.S end 0 2077 a 0 2077 a SDict begin 14.5 H.A end 0 2077 a 0 2077 a SDict begin [ /View [/XYZ H.V] /Dest (Item.14) cvn H.B /DEST pdfmark end 0 2077 a Black 120 2218 a Fk(5.)p Black 49 w(When)j(dealing)f (with)f(areas)j(of)f(great)f(platform)g(v)n(ariability)-6 b(,)26 b(abstract)i(the)f(API)h(back)g(to)g(a)g(superset)244 2338 y(of)d(the)f(platforms')g(features)0 2401 y SDict begin H.S end 0 2401 a 0 2401 a SDict begin 14.5 H.A end 0 2401 a 0 2401 a SDict begin [ /View [/XYZ H.V] /Dest (Item.15) cvn H.B /DEST pdfmark end 0 2401 a Black 120 2541 a Fk(6.)p Black 49 w(Be)35 b(alert)g(for)g(subtle)f(dif)n(ferences)g (or)h(b)n(ugs)f(between)h(platforms,)g(and)g(doubly)e(so)i(in)f(areas)h (of)g(an)244 2662 y(application)24 b(that)g(wield)g(pri)n(vile)o(ge)0 2940 y(This)e(paper)h(has)f(detailed)h(some)f(common)f(portability)g (problems,)h(ranging)g(from)h(the)f(simple)f(to)i(the)f(com-)0 3060 y(ple)o(x,)e(and)f(approaches)h(to)g(solv)o(e)e(them.)29 b(These)19 b(approaches)h(may)g(not)f(be)h(optimum)d(for)j(e)n(v)o(ery) f(application,)0 3181 y(b)n(ut)24 b(the)o(y)g(ha)n(v)o(e)h(serv)o(ed)f (portable)h(OpenSSH)g(well)g(in)f(allo)n(wing)g(it)g(to)g(function)g (on)h(o)o(v)o(er)f(twenty)g(platforms)0 3301 y(while)g(retaining)g (maintainability)f(of)h(the)h(code-base.)0 3690 y Fl(Refer)m(ences)0 3795 y SDict begin H.S end 0 3795 a 0 3795 a SDict begin 14.5 H.A end 0 3795 a 0 3795 a SDict begin [ /View [/XYZ H.V] /Dest (section*.1) cvn H.B /DEST pdfmark end 0 3795 a 0 3795 a SDict begin H.S end 0 3795 a 0 3795 a SDict begin 14.5 H.A end 0 3795 a 0 3795 a SDict begin [ /View [/XYZ H.V] /Dest (cite.IEEE) cvn H.B /DEST pdfmark end 0 3795 a Black 50 3955 a Fk([1])p Black 49 w Fg(IEEE)j(Std)h(1003.1,)f(2004:)38 b(IEEE)29 b(standar)l(d)e(portable)h(oper)o(ating)f(system)h(Interface) h(for)f(computer)215 4076 y(en)l(vir)l(onments)p Fk(,)23 b(Institute)g(of)i(Electrical)g(and)g(Electronics)f(Engineers,)g(2004)0 4139 y SDict begin H.S end 0 4139 a 0 4139 a SDict begin 14.5 H.A end 0 4139 a 0 4139 a SDict begin [ /View [/XYZ H.V] /Dest (cite.aleph) cvn H.B /DEST pdfmark end 0 4139 a Black 50 4279 a Fk([2])p Black 49 w(Aleph)g(One,)h Fg(Smashing)e(the)i(stac)n (k)g(for)f(fun)g(and)g(pr)l(o\002t)p Fk(,)g(Phrack)h(Magazine,)f(V)-13 b(ol.)25 b(7,)f(Issue)h(49)0 4342 y SDict begin H.S end 0 4342 a 0 4342 a SDict begin 14.5 H.A end 0 4342 a 0 4342 a SDict begin [ /View [/XYZ H.V] /Dest (cite.chen) cvn H.B /DEST pdfmark end 0 4342 a Black 50 4483 a Fk([3])p Black 49 w(H.)32 b(Chen,)j(D.)e(W)-8 b(agner)33 b(and)g(D.)f(Dean,)j Fg(Setuid)d(Demysti\002ed)p Fk(,)i(Proceedings)f(of)f(the)h(11)3360 4446 y Fa(t)5 b(h)3460 4483 y Fk(USENIX)215 4603 y(Security)25 b(Symposium)0 4666 y SDict begin H.S end 0 4666 a 0 4666 a SDict begin 14.5 H.A end 0 4666 a 0 4666 a SDict begin [ /View [/XYZ H.V] /Dest (cite.drepper) cvn H.B /DEST pdfmark end 0 4666 a Black 50 4806 a Fk([4])p Black 49 w(U.)172 b(Drepper)l(,)209 b(,)g(post)171 b(to)h(libc-alphasources.redhat.com)f (mailing)f(list,)p 0 0 1 TeXcolorrgb 215 4948 a SDict begin H.S end 215 4948 a 0 0 1 TeXcolorrgb -21 x Fk (http://sources.redhat.com/ml/libc-alpha/2000-08/)o(msg)o(00053.)o(htm) o(l)p 0 0 1 TeXcolorrgb 2791 4859 a SDict begin H.R end 2791 4859 a 2791 4927 a SDict begin [ /H /I /Border [0 0 0] /Color [0 1 1] /Action << /Subtype /URI /URI (http://sources.redhat.com/ml/libc-alpha/2000-08/msg00053.html) >> /Subtype /Link H.B /ANN pdfmark end 2791 4927 a Black Fk(,)25 b(August)f(2000)0 4990 y SDict begin H.S end 0 4990 a 0 4990 a SDict begin 14.5 H.A end 0 4990 a 0 4990 a SDict begin [ /View [/XYZ H.V] /Dest (cite.imake) cvn H.B /DEST pdfmark end 0 4990 a Black 50 5130 a Fk([5])p Black 49 w(J.)h(Fulton,)g Fg(Con\002gur)o(ation)e (mana)o(g)o(ement)h(in)h(the)g(X)h(W)-5 b(indow)24 b(system)p Fk(,)h(T)-7 b(echnical)25 b(report,)h(MIT)f(Lab-)215 5250 y(oratory)f(for)h(Computer)g(Science,)h(1989)0 5314 y SDict begin H.S end 0 5314 a 0 5314 a SDict begin 14.5 H.A end 0 5314 a 0 5314 a SDict begin [ /View [/XYZ H.V] /Dest (cite.rfc3493) cvn H.B /DEST pdfmark end 0 5314 a Black 50 5454 a Fk([6])p Black 49 w(R.)f(Gilligan,)p Fg(Basic)d(Soc)n(k)o(et) j(Interface)g(Extensions)e(for)i(IPv6)p Fk(,)f(RFC)j(3493,)d(February)h (2003)p Black 1863 5712 a(12)p Black eop end %%Page: 13 13 TeXDict begin 13 12 bop 0 0 a SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end 0 0 a Black 0 TeXcolorgray 0 100 a SDict begin H.S end 0 100 a 0 TeXcolorgray 0 TeXcolorgray 0 100 a SDict begin H.R end 0 100 a 0 100 a SDict begin [ /View [/XYZ H.V] /Dest (page.13) cvn H.B /DEST pdfmark end 0 100 a Black Black 0 307 a SDict begin H.S end 0 307 a 0 307 a SDict begin 14.5 H.A end 0 307 a 0 307 a SDict begin [ /View [/XYZ H.V] /Dest (cite.goldberg) cvn H.B /DEST pdfmark end 0 307 a Black 50 407 a Fk([7])p Black 49 w(I.)25 b(Goldber)n(g,)f(D.)h(W)-8 b(agner)l(,)25 b Fg(Randomness)e(and)i(the)f(Netscape)i(Br)l(owser)p Fk(,)e(Dr)-5 b(.)24 b(Dobb')-5 b(s)24 b(Journal,)g(1996)0 470 y SDict begin H.S end 0 470 a 0 470 a SDict begin 14.5 H.A end 0 470 a 0 470 a SDict begin [ /View [/XYZ H.V] /Dest (cite.janicke) cvn H.B /DEST pdfmark end 0 470 a Black 50 610 a Fk([8])p Black 49 w(L.)135 b(J)6 b(\250)-39 b(anick)o(e,)164 b Fg(PRNGD)135 b(-)h(Pseudo)f(Random)g(Number)h(Gener)o(ator)f(Daemon)p Fk(,)p 0 0 1 TeXcolorrgb 215 752 a SDict begin H.S end 215 752 a 0 0 1 TeXcolorrgb -21 x Fk(http://www)-6 b(.aet.tu-cottb)n(us.de/personen/jaenick)o (e/post)o(\002x)p 2400 731 30 4 v 30 w(tls/prngd.html)p 0 0 1 TeXcolorrgb 2986 663 a SDict begin H.R end 2986 663 a 2986 731 a SDict begin [ /H /I /Border [0 0 0] /Color [0 1 1] /Action << /Subtype /URI /URI (http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html) >> /Subtype /Link H.B /ANN pdfmark end 2986 731 a Black 0 794 a SDict begin H.S end 0 794 a 0 794 a SDict begin 14.5 H.A end 0 794 a 0 794 a SDict begin [ /View [/XYZ H.V] /Dest (cite.johnson) cvn H.B /DEST pdfmark end 0 794 a Black 50 934 a Fk([9])p Black 49 w(S.)32 b(C.)g(Johnson,)f(D.)h (M.)f(Ritchie,)i Fg(P)-8 b(ortability)29 b(of)i(C)h(Pr)l(o)o(gr)o(ams)d (and)i(the)h(UNIX)g(System)p Fk(,)g(The)g(Bell)215 1054 y(System)24 b(T)-7 b(echnical)25 b(Journal,)f(V)-13 b(ol.)24 b(57,)h(No.)f(6,)h(P)o(art)g(2,)f(July-August)f(1978)0 1117 y SDict begin H.S end 0 1117 a 0 1117 a SDict begin 14.5 H.A end 0 1117 a 0 1117 a SDict begin [ /View [/XYZ H.V] /Dest (cite.dropbear) cvn H.B /DEST pdfmark end 0 1117 a Black 141 x Fk([10])p Black 49 w(M.)18 b(Johnston,)g Fg(Dr)l(opbear)g(SSH)g (server)h(and)g(client)p Fk(,)p 0 0 1 TeXcolorrgb 2047 1279 a SDict begin H.S end 2047 1279 a 0 0 1 TeXcolorrgb -21 x Fk (http://matt.ucc.asn.au/dropbear/dropbear)-5 b(.html)p 0 0 1 TeXcolorrgb 3868 1190 a SDict begin H.R end 3868 1190 a 3868 1258 a SDict begin [ /H /I /Border [0 0 0] /Color [0 1 1] /Action << /Subtype /URI /URI (http://matt.ucc.asn.au/dropbear/dropbear.html) >> /Subtype /Link H.B /ANN pdfmark end 3868 1258 a Black 0 1321 a SDict begin H.S end 0 1321 a 0 1321 a SDict begin 14.5 H.A end 0 1321 a 0 1321 a SDict begin [ /View [/XYZ H.V] /Dest (cite.autoconf) cvn H.B /DEST pdfmark end 0 1321 a Black 140 x Fk([11])p Black 49 w(D.)24 b(MacK)n(enzie,)h(et.)g(al.,)f Fg(GNU)i(A)n(utoconf)p Fk(,)p 0 0 1 TeXcolorrgb 1754 1483 a SDict begin H.S end 1754 1483 a 0 0 1 TeXcolorrgb -22 x Fk(http://www)-6 b(.gnu.or)n(g/softw)o(are/autoconf/) p 0 0 1 TeXcolorrgb 3306 1393 a SDict begin H.R end 3306 1393 a 3306 1461 a SDict begin [ /H /I /Border [0 0 0] /Color [0 1 1] /Action << /Subtype /URI /URI (http://www.gnu.org/software/autoconf/) >> /Subtype /Link H.B /ANN pdfmark end 3306 1461 a Black 0 1524 a SDict begin H.S end 0 1524 a 0 1524 a SDict begin 14.5 H.A end 0 1524 a 0 1524 a SDict begin [ /View [/XYZ H.V] /Dest (cite.glibc) cvn H.B /DEST pdfmark end 0 1524 a Black 141 x Fk([12])p Black 49 w(R.)25 b(McGrath,)f(et.)h(al.,)g Fg(GNU)g(C)g(Libr)o(ary)p Fk(,)p 0 0 1 TeXcolorrgb 1688 1686 a SDict begin H.S end 1688 1686 a 0 0 1 TeXcolorrgb -21 x Fk(http://www)-6 b(.gnu.or)n(g/softw)o(are/libc/libc.html)p 0 0 1 TeXcolorrgb 3397 1597 a SDict begin H.R end 3397 1597 a 3397 1665 a SDict begin [ /H /I /Border [0 0 0] /Color [0 1 1] /Action << /Subtype /URI /URI (http://www.gnu.org/software/libc/libc.html) >> /Subtype /Link H.B /ANN pdfmark end 3397 1665 a Black 0 1728 a SDict begin H.S end 0 1728 a 0 1728 a SDict begin 14.5 H.A end 0 1728 a 0 1728 a SDict begin [ /View [/XYZ H.V] /Dest (cite.millert) cvn H.B /DEST pdfmark end 0 1728 a Black 140 x Fk([13])p Black 49 w(T)f(.)27 b(Miller)l(,)h(T)-7 b(.)28 b(de)g(Raadt,)h Fg(strlcpy)f(and)f(strlcat)g (\226)h(Consistent,)g(Safe)o(,)g(String)f(Copy)i(and)e(Concatena-)215 1988 y(tion)p Fk(,)d(Proceedings)g(of)h(the)g(1999)f(USENIX)h(Security) g(Symposium)0 2051 y SDict begin H.S end 0 2051 a 0 2051 a SDict begin 14.5 H.A end 0 2051 a 0 2051 a SDict begin [ /View [/XYZ H.V] /Dest (cite.ntpd) cvn H.B /DEST pdfmark end 0 2051 a Black 141 x Fk([14])p Black 49 w(D.)f(Mills,)g(et.)g(al.,)h Fg(ntp-stable-4.2.0a-20050303)c(softwar)l(e)k(distrib)n(ution)p Fk(,)p 0 0 1 TeXcolorrgb 2880 2213 a SDict begin H.S end 2880 2213 a 0 0 1 TeXcolorrgb -21 x Fk(http://www)-6 b(.ntp.or)n(g/)p 0 0 1 TeXcolorrgb 3663 2124 a SDict begin H.R end 3663 2124 a 3663 2192 a SDict begin [ /H /I /Border [0 0 0] /Color [0 1 1] /Action << /Subtype /URI /URI (http://www.ntp.org/) >> /Subtype /Link H.B /ANN pdfmark end 3663 2192 a Black 0 2255 a SDict begin H.S end 0 2255 a 0 2255 a SDict begin 14.5 H.A end 0 2255 a 0 2255 a SDict begin [ /View [/XYZ H.V] /Dest (cite.Linux-PAM) cvn H.B /DEST pdfmark end 0 2255 a Black 140 x Fk([15])p Black 49 w(A.)24 b(G.)h(Mor)n(gan,)f Fg(Linux-P)-9 b(AM)p Fk(,)p 0 0 1 TeXcolorrgb 1327 2417 a SDict begin H.S end 1327 2417 a 0 0 1 TeXcolorrgb -22 x Fk(http://www)j(.k)o(ernel.or)n (g/pub/linux/libs)o(/pam/)p 0 0 1 TeXcolorrgb 3011 2327 a SDict begin H.R end 3011 2327 a 3011 2395 a SDict begin [ /H /I /Border [0 0 0] /Color [0 1 1] /Action << /Subtype /URI /URI (http://www.kernel.org/pub/linux/libs/pam/) >> /Subtype /Link H.B /ANN pdfmark end 3011 2395 a Black 0 2458 a SDict begin H.S end 0 2458 a 0 2458 a SDict begin 14.5 H.A end 0 2458 a 0 2458 a SDict begin [ /View [/XYZ H.V] /Dest (cite.OpenSSH) cvn H.B /DEST pdfmark end 0 2458 a Black 141 x Fk([16])p Black 49 w(OpenSSH)25 b(project,)g Fg(OpenSSH)p Fk(,)p 0 0 1 TeXcolorrgb 1402 2620 a SDict begin H.S end 1402 2620 a 0 0 1 TeXcolorrgb -21 x Fk(http://www)-6 b(.openssh.or)n(g/)p 0 0 1 TeXcolorrgb 2379 2531 a SDict begin H.R end 2379 2531 a 2379 2599 a SDict begin [ /H /I /Border [0 0 0] /Color [0 1 1] /Action << /Subtype /URI /URI (http://www.openssh.org/) >> /Subtype /Link H.B /ANN pdfmark end 2379 2599 a Black 0 2662 a SDict begin H.S end 0 2662 a 0 2662 a SDict begin 14.5 H.A end 0 2662 a 0 2662 a SDict begin [ /View [/XYZ H.V] /Dest (cite.PAM) cvn H.B /DEST pdfmark end 0 2662 a Black 140 x Fk([17])p Black 49 w(V)-13 b(.)24 b(Samar)l(,)h(R.)g(Schemers,)g Fg(Uni\002ed)f(lo)o(gin)f(with)i (plug)o(gable)e(authentication)f(modules)i(\(P)-9 b(AM\))p Fk(,)24 b(Open)215 2922 y(Softw)o(are)h(F)o(oundations,)e(Request)i (for)g(comments)f(86.0,)g(October)h(1995)0 2985 y SDict begin H.S end 0 2985 a 0 2985 a SDict begin 14.5 H.A end 0 2985 a 0 2985 a SDict begin [ /View [/XYZ H.V] /Dest (cite.spencer) cvn H.B /DEST pdfmark end 0 2985 a Black 141 x Fk([18])p Black 49 w(H.)31 b(Spencer)l(,)j Fg(#ifdef)c(Consider)l(ed)h(Harmful,)h (or)f(P)-8 b(ortability)29 b(Experience)j(with)f(C)h(Ne)o(ws)p Fk(,)h(Summer)215 3246 y(USENIX)25 b(1992)0 3290 y SDict begin H.S end 0 3290 a 0 3290 a SDict begin 14.5 H.A end 0 3290 a 0 3290 a SDict begin [ /View [/XYZ H.V] /Dest (cite.stevens) cvn H.B /DEST pdfmark end 0 3290 a Black 160 x Fk([19])p Black 49 w(W)-9 b(.)31 b(Richard)h(Ste)n(v)o(ens,)g Fg(Advanced)g(Pr)l(o)o(gr)o(amming)c(in)k(the)f(UNIX)h(En)l(vir)l (onment)p Fk(,)f(Addison)g(W)-8 b(esle)o(y)215 3570 y(Publishing)23 b(Compan)o(y)-6 b(,)23 b(1992,)h(ISBN)i(0-201-56317-7)0 3633 y SDict begin H.S end 0 3633 a 0 3633 a SDict begin 14.5 H.A end 0 3633 a 0 3633 a SDict begin [ /View [/XYZ H.V] /Dest (cite.ts'o) cvn H.B /DEST pdfmark end 0 3633 a Black 140 x Fk([20])p Black 49 w(T)-7 b(.)24 b(Ts'o,)g Fg(r)o(andom.c)g(\226) h(A)f(str)l(ong)g(r)o(andom)f(number)h(g)o(ener)o(ator)p Fk(,)f(Linux)h(k)o(ernel,)h(1994)p Black 1863 5712 a(13)p Black eop end %%Trailer userdict /end-hook known{end-hook}if %%EOF