summaryrefslogtreecommitdiffstats
path: root/docs/htmldocs/using_samba/figs/sam.0201.gif
blob: e6f97f63015c9fbaf793eaecd8209ae4ede3049c (plain)
ofshex dumpascii
0000 47 49 46 38 37 61 f6 01 bc 00 c6 00 00 00 00 00 b1 b1 b1 a9 a9 a9 a7 a7 a7 a3 a3 a3 9d 9d 9d 8d GIF87a..........................
0020 8d 8d 7d 7d 7d 6d 6d 6d 5f 5f 5f 5b 5b 5b 51 51 51 fa fa fa f4 f4 f4 3f 3f 3f ee ee ee 37 37 37 ..}}}mmm___[[[QQQ......???...777
0040 e8 e8 e8 e2 e2 e2 2f 2f 2f e0 e0 e0 de de de 29 29 29 d8 d8 d8 d4 d4 d4 d2 d2 d2 1f 1f 1f d0 d0 ......///......)))..............
0060 d0 ce ce ce 1b 1b 1b cc cc cc ca ca ca 17 17 17 c8 c8 c8 c6 c6 c6 c4 c4 c4 c0 c0 c0 be be be bc ................................
0080 bc bc b6 b6 b6 b2 b2 b2 b0 b0 b0 ac ac ac a2 a2 a2 a0 a0 a0 9c 9c 9c 88 88 88 80 80 80 7e 7e 7e .............................~~~
00a0 7a 7a 7a 6e 6e 6e 5e 5e 5e 52 52 52 ff ff ff f9 f9 f9 40 40 40 f1 f1 f1 ed ed ed eb eb eb 38 38 zzznnn^^^RRR......@@@.........88
00c0 38 e9 e9 e9 36 36 36 e7 e7 e7 e5 e5 e5 30 30 30 e1 e1 e1 2e 2e 2e df df df dd dd dd db db db d9 8...666......000................
00e0 d9 d9 d5 d5 d5 20 20 20 d1 d1 d1 cf cf cf cb cb cb c7 c7 c7 c5 c5 c5 c1 c1 c1 0e 0e 0e bf bf bf ................................
0100 b7 b7 b7 b5 b5 b5 48 00 00 48 00 bc 00 00 b0 02 00 98 00 00 00 84 00 00 04 00 34 5b 00 64 00 00 ......H..H................4[.d..
0120 08 00 00 10 68 00 fc 48 00 75 74 00 6c b8 00 ff c8 00 00 c0 00 00 10 00 5c b0 00 00 d4 00 c0 44 ....h..H.ut.l...........\......D
0140 c0 84 f0 00 bc c0 00 40 00 00 20 18 00 00 00 00 00 b0 00 00 44 00 5c 00 00 00 00 00 00 30 00 00 .......@............D.\......0..
0160 04 00 2d 04 00 2d 00 00 00 00 00 00 c0 00 c4 01 00 00 00 00 00 ff 00 00 d4 00 00 5b 00 00 10 01 ..-..-.....................[....
0180 00 00 00 00 00 00 00 00 00 00 00 cc 00 2c 00 00 00 00 f6 01 bc 00 00 07 fe 80 4a 50 83 84 85 86 .............,............JP....
01a0 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 85 35 37 2f a5 a6 ...........................57/..
01c0 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 a6 48 a3 35 .............................H.5
01e0 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 c8 37 ...............................7
0200 c6 e5 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 c9 e7 e7 f5 f9 fa fb fc fd fe ff 00 03 9a 43 27 b0 a0 ............................C'..
0220 c1 83 08 13 2a 5c 28 ee 1e c3 87 10 23 4a 9c 48 b1 9d c3 8a 18 33 6a dc c8 91 e1 c5 8e 20 43 8a ....*\(.....#J.H.....3j.......C.
0240 1c 49 f2 db c7 92 28 53 aa 5c d9 f1 24 cb 97 30 63 ca ec e7 72 a6 cd 9b 38 73 76 ab a9 b3 a7 cf .I....(S.\..$..0c...r...8sv.....
0260 9f 3e 79 02 1d 4a b4 68 49 a1 46 93 2a 5d 0a 11 29 d3 a7 50 a3 ee 73 2a b5 aa d5 ab e4 a8 06 b4 .>y..J.hI.F.*]..)..P..s*........
0280 11 a1 ab d7 af 60 c3 8a 1d 4b b6 ac d9 b3 68 d3 aa 5d cb b6 ad db b7 fe 70 e3 ca 9d 4b b7 ee da .....`...K....h..]......p...K...
02a0 06 4d 09 2e 8c a0 02 45 8a bf 80 03 0b 1e 4c b8 b0 e1 c3 88 13 2b 5e cc b8 b1 e3 c7 90 23 4b 9e .M.....E......L......+^......#K.
02c0 4c b9 b2 e5 cb 8a 05 24 c9 8b 8f 61 84 0f 43 8c 88 1e 4d ba b4 e9 d3 a8 53 ab 5e cd ba b5 eb d7 L......$...a..C...M.....S.^.....
02e0 b0 63 cb 9e 4d bb b6 ed db b8 73 eb 6e 5d 62 f3 43 ad 00 3f 87 de 4d bc b8 f1 e3 c8 93 2b 5f ce .c..M.....s.n]b.C..?..M......+_.
0300 bc f9 ea de 9c 21 0a 77 4e bd ba f5 eb d8 b3 6b 47 0e fd b7 5e 85 d3 b7 8b 1f 4f be bc f9 f3 b4 .....!.wN......kG...^.....O.....
0320 bb 7b fc 9e 30 3c fa f7 f0 e3 cb 9f 5f 5c fd 42 e0 ff dc d3 df cf bf bf ff f8 f6 29 84 9f 3f fa .{..0<......_\.B...........)..?.
0340 fd 67 e0 81 08 26 68 5c 80 09 0d d8 4f 81 0a 46 28 e1 84 14 92 c6 20 42 0e f2 03 61 85 1c 76 e8 .g...&h\....O..F(......B...a..v.
0360 21 80 be ad d7 d9 5e a0 c5 d6 c3 89 28 9e f8 e1 8a 2c b6 58 db 85 07 65 b8 cf 86 a9 9d 48 00 02 !.....^.....(....,.X...e.....H..
0380 3d 18 d1 03 02 04 00 e0 e2 8f 40 06 69 61 88 f7 b1 87 10 8d a6 95 fe 40 83 05 2e 2c 40 43 0c 00 =.........@.ia.........@...,@C..
03a0 c4 40 c3 02 04 2c 50 82 90 58 66 c9 21 8c 06 c9 a8 0f 92 a5 21 00 01 02 08 d0 00 c0 99 67 d2 40 .@...,P..Xf.!.......!........g.@
03c0 26 02 57 6a e9 e6 9b ff 71 59 90 97 f9 80 49 1a 02 1d b8 60 01 9a 7c f6 e0 02 02 1e c0 29 e8 a0 &.Wj....qY....I....`..|......)..
03e0 20 46 f7 90 9d a3 95 b9 00 94 51 36 0a 40 95 08 a4 60 5b 8a 09 9c 56 e9 7e 3d 5c aa 9a 0b 27 5e .F........Q6.@...`[...V.~=\...'^
0400 7a a9 0b 92 a6 e0 c2 68 a0 8a c6 69 8a 92 a2 a6 e9 68 ab 9e 38 aa 11 29 a8 58 5a a9 a2 25 90 e9 z......h...i.....h..8..).XZ..%..
0420 68 ae 96 96 2b ac b2 1a 61 eb aa b5 92 b6 6b ac 39 92 46 6c aa 9c 6a 9a 02 b0 42 ca 29 10 9d f5 h...+...a.....k.9.Fl..j...B.)...
0440 20 2a 1a 9e 7a 9e 69 01 01 7b 02 e0 27 02 0b bc 3a 5b b1 a3 05 e0 01 01 57 06 60 41 b9 04 04 20 .*..z.i..{..'...:[......W.`A....
0460 9a b8 6d 1a 51 42 a0 1e b4 49 ae 68 e3 12 00 6f 09 e2 06 50 02 01 e1 a6 bb 6e bc 46 a8 bb ae bf ..m.QB...I.h...o...P.....n.F....
0480 a3 95 70 ad bb 04 f0 1b b0 07 02 1b 71 a3 68 cb ea 38 2d bf 0f fe 3b 8c a3 c2 a2 81 4b 5a c2 57 ..p.........q.h..8-...;.....KZ.W
04a0 62 db 2e a7 4f e0 3a 71 c4 12 e3 da 81 c2 3c c2 3a 6a b1 29 07 6b 44 ca 97 fa 98 72 c5 46 80 2c b...O.:q......<.:j.).kD....r.F.,
04c0 f2 cb fc 16 eb e3 cd 39 92 e9 70 8e 09 58 a0 31 96 ce 06 04 2d 3d d2 be 3c 66 99 4b 9b 09 c0 9a .......9..p..X.1....-=..<f.K....
04e0 64 7a 6b a2 ae 6a f2 e8 c2 c9 37 92 c9 6f 07 2d e3 6c 71 cd 5a bf bc a6 c3 63 12 c0 b5 cf 59 a7 dzk..j....7..o.-.lq.Z....c....Y.
0500 bc e3 9a a3 a6 8d b1 d9 6c b2 ad 23 0d de 96 40 e6 c7 a3 a6 dc b2 d5 08 08 6b da 9f 77 e3 89 71 ........l..#...@.........k..w..q
0520 c6 37 77 ed 82 d4 5e e3 7c b8 a9 6b b6 2b 9a dd 1f f7 3d 73 df 7e 13 ee b5 ce 0e 5f 59 6c cf 7d .7w...^.|..k.+....=s.~....._Yl.}
0540 13 50 ac e7 a4 12 4d a4 80 46 1e 94 b4 98 50 93 89 e6 9a 1d d0 30 f4 6b 67 23 b0 32 0d 62 4b 3c .P....M..F....P......0.kg#.2.bK<
0560 b9 11 79 de 49 71 df 39 26 5c 72 ef 10 ec 7b b2 11 3e ce fb f0 b6 c1 f7 bc bb df 15 e7 d8 03 ed ..y.Iq.9&\r...{..>..............
0580 1b 47 8d ab dd bc f3 5c 39 69 af aa 6d 1a b8 80 43 a0 30 cd fe 89 a2 5c 35 bf 80 b3 69 61 d7 15 .G.....\9i..m...C.0....\5...ia..
05a0 df 7e 3d cb 39 8b 56 fc 95 ac d7 0e fa cf a1 37 3b 7a 83 a5 1b 74 7a 9e dd 72 0b c0 ff 31 d8 56 .~=.9.V........7;z...tz..r...1.V
05c0 c2 1a 16 9b 6b 0d 50 47 fc f2 59 cf 84 66 81 ea e9 ee 6b 01 f0 93 68 9e 70 a2 90 3d 6c 7e 3b b3 ....k.PG..Y..f....k...h.p..=l~;.
05e0 55 03 6d 57 3d 04 30 90 72 84 6b 1e 02 4f 13 00 17 5c aa 07 37 72 de 68 28 d8 83 90 dd 4c 57 3d U.mW=.0.r.k..O...\..7r.h(....LW=
0600 18 de eb 34 96 30 1a f0 2b 05 80 32 cd de 62 30 2e 07 76 cd 08 0b 68 18 0e 03 e5 35 f0 95 ac 64 ...4.0..+..2..b0..v...h....5...d
0620 da 23 1e 69 ea 65 01 f9 7d ee 75 41 2a 1a 40 8e 36 8f a4 d5 ec 09 4d 42 c0 13 00 f0 04 6e 41 2a .#.i.e..}.uA*.@.6.....MB.....nA*
0640 55 b4 19 1a 0a 6b a7 3c 23 00 6c 68 29 8b 41 df d4 a5 c0 75 7d 0d 83 45 ec 60 07 f9 05 30 91 89 U....k.<#.lh).A....u}..E.`...0..
0660 70 8c a3 a9 d8 fc e0 68 b9 3e ce 70 62 47 7c a1 c0 78 34 3f 1d a2 6c 79 ec 7b 61 1f e3 a8 ab c2 p......h.>.pbG|..x4?..ly.{a.....
0680 b5 4f 89 e1 22 1c da 9e f8 26 29 fe 83 8a f2 b0 62 cd ce fe d6 01 00 c4 ee 87 b3 89 dd ca 12 d8 .O.."....&).....b...............
06a0 37 ac ad e9 91 79 24 93 9a c0 a6 b7 b1 5d 10 73 69 63 13 e7 24 e6 36 bf 51 4f 76 23 2c 18 d4 5e 7....y$......].sic..$.6.QOv#,..^
06c0 c5 c7 40 82 eb 75 e5 2b e5 e0 8e 58 3e e1 49 6f 5e 89 ab 65 31 4b b0 b2 c6 e1 ce 95 a7 ac d9 0b ..@..u.+...X>.Io^..e1K..........
06e0 8b 29 36 b4 c1 0f 9a d2 a3 9f a9 44 67 28 cf 94 08 36 34 e0 9a 38 a1 36 4c d9 ec b2 66 1d 4b 20 .)6........Dg(...64..8.6L...f.K.
0700 f9 70 29 cd 59 b1 e9 90 8f bb 1b c2 dc 95 3d c6 b9 80 5c 6d 23 9f 3d 67 25 9a ac 99 ca 71 16 63 .p).Y.........=...\m#.=g%....q.c
0720 27 3d a7 55 bf 6d 1a 34 4c 56 4b 5c 41 c5 c6 af 5b b6 4d 5e 91 f3 56 d8 98 c9 4a f3 41 6d 9f ed '=.U.m.4LVK\A...[.M^..V...J.Am..
0740 cc 28 43 e3 49 b9 79 51 4f 5e 02 a5 e8 41 81 64 49 7f 60 32 1e 9a 74 58 03 39 f5 27 2a 59 89 50 .(C.I.yQO^...A.dI.`2..tX.9.'*Y.P
0760 30 8d e9 78 4a 4a 93 fc 15 24 a5 04 e8 e2 9e 56 2a d3 9e fa f4 3a 34 e5 c7 49 e1 81 d3 06 6e b1 0..xJJ...$.....V*....:4..I....n.
0780 8b 0b f8 a9 52 97 9a 9c a0 4e c5 a6 02 49 69 38 55 37 fe 36 a6 5a f5 aa b7 71 aa 3e 86 fa 8e 94 ....R....N...Ii8U7.6.Z...q.>....
07a0 32 c9 8b 0b 90 1d 14 b1 4a d6 b2 9e 46 ab f9 e0 aa 3b 52 6a d6 b6 ba d5 35 68 ad 87 5a db c1 d6 2.......J...F....;Rj....5h..Z...
07c0 b7 da f5 ae 43 ea 26 89 86 83 d7 be fa f5 39 f7 c3 10 54 03 52 d7 bf 1a f6 aa 71 a5 c7 5c d9 51 ....C.&.......9...T.R.....q..\.Q
07e0 d8 c3 3a f6 a7 89 9d c7 62 d7 d1 d8 c7 5a 16 a6 91 95 c7 64 d5 51 d9 cb 7a b6 92 81 8d d1 60 83 ..:.....b....Z.....d.Q..z.....`.
0800 f3 cd cf 9a 16 ab 99 8d c7 66 d3 d1 d9 d3 ba d6 45 a9 85 c7 6a cb d1 da d7 da d6 43 b1 7d c7 6c .........f......E...j......C.}.l
0820 c9 51 db db fa 76 42 b9 75 c7 6e c7 d1 db df 1a 17 41 c1 b5 c8 68 f3 53 da e3 3a d7 7e 7a 05 4f .Q...vB.u.n......A...h.S..:.~z.O
0840 73 e5 13 82 13 58 f7 ba d8 cd ae 76 b7 cb dd ee 7a f7 bb e0 0d af 78 c7 4b de f2 9a f7 bc e8 4d s....X.....v....z.....x.K......M
0860 af 7a d7 4b 5e 27 a4 26 b9 ec 18 ae 38 8a ab 9c ea 5e e0 be f8 cd af 7e f7 cb df fe fa f7 bf 00 .z.K^'.&....8....^.....~........
0880 0e b0 80 07 4c e0 02 1b f8 c0 08 4e b0 82 17 cc e0 fe 01 73 80 02 ef 0d 6d 97 96 4b a0 e9 c6 a7 ....L......N.......s....m..K....
08a0 ba 0c c8 b0 86 37 cc e1 0e 7b f8 c3 20 0e b1 88 47 4c e2 12 9b f8 c4 28 4e b1 8a 57 cc e2 16 bb .....7...{......GL.....(N..W....
08c0 b8 c4 3e 80 30 6a e0 bb 0e f9 86 83 be c9 c1 f0 8b 77 cc e3 1e fb f8 c7 40 0e b2 90 87 bc e1 18 ..>.0j...........w......@.......
08e0 47 38 ba ed b1 30 7c 74 4c e4 26 3b f9 c9 50 8e b2 94 7f 6c e4 19 4b 78 4e 14 7e 90 92 df c3 e4 G8...0|tL.&;..P....l..KxN.~.....
0900 16 b7 c0 04 26 98 b2 98 c7 4c e6 32 9b 99 01 55 3e eb 95 9f 95 65 0d 6d 19 3d 5d 66 f1 01 0e 10 ....&....L.2...U>....e.m.=]f....
0920 e6 33 db f9 ce 78 ce f3 89 d3 9c a4 35 1b ad cd 33 7a f3 79 e2 bc 62 1d 14 41 cf 88 4e b4 a2 ef .3...x......5...3z.y..b..A..N...
0940 cc e7 d2 d0 58 1d 36 06 07 8e 91 43 e8 13 cf 99 01 4b 28 c0 a2 37 cd e9 4e 0f b9 d1 79 f5 ce 88 ....X.6....C.....K(..7..N...y...
0960 a4 cb d7 f9 74 59 07 1e 28 82 09 3c 90 61 0f ac 5a c3 60 d6 01 03 74 30 83 19 80 f9 d0 9e ce b5 ....tY..(..<.a..Z.`...t0........
0980 ae 77 bd 67 19 ab 19 c9 47 12 b4 79 ba 5c 84 39 fe 1f a0 05 0c 30 81 b1 c3 dc 02 63 17 a1 08 0e .w.g....G..y.\.9.....0.....c....
09a0 70 c0 9c eb cc eb 6a 5b db da a0 2e 98 9f a7 08 e8 2f 09 7b 35 9a 62 16 6b 2a 45 ac 5b a1 26 ce p.....j[........./.{5.b.k*E.[.&.
09c0 ca d6 30 9d 93 7d 00 06 38 20 c3 0e 08 f3 a5 33 7d ed 7a db bb d3 d9 7e dc b6 2f d9 ed 3a 7d 5b ..0..}..8......3}.z....~../..:}[
09e0 35 bf 5c 57 c3 38 66 c6 12 bc cb 8e 94 1b e2 69 d0 dd ee 0c af 3b dd ef 76 b7 bc db 6d e8 7b 5b 5.\W.8f........i.....;..v...m.{[
0a00 fc e2 78 ce b7 bb f6 6d d2 7e 47 eb df 35 12 59 00 16 f0 d2 08 ee 68 5c 6a 02 63 ef 40 98 32 02 ..x....m.~G..5.Y......h\j.c.@.2.
0a20 1a e1 d4 06 b0 75 86 0b 50 00 13 d0 9c 01 32 00 f3 0c 96 c0 80 02 c0 c0 e6 9a c6 b8 d0 87 2e 65 .....u..P.....2................e
0a40 8d 3f 3a 1d 91 fe 46 65 03 8e c2 7d 21 31 61 de 63 1e cb f5 49 1a 62 1b 5b c3 cd 46 b6 c3 0f 80 .?:...Fe...}!1a.c...I.b.[..F....
0a60 6b 76 af 9b e8 60 0f 7b 90 8d ce f1 9a 8e 3a c9 a5 96 4d c0 47 7e c2 13 99 b2 91 34 03 a5 68 2a kv...`.{......:...M.G~.....4..h*
0a80 9d e2 8a 8b fd ee 78 6f 31 d9 81 6d 3a 90 a3 fe 26 e0 fd 74 60 e0 e1 3e f5 85 9f e0 c5 f1 9e 76 ......xo1..m:...&..t`..>.......v
0aa0 de 17 cf f8 11 ef 5d d4 d2 f1 fb 69 a8 94 b0 4a 25 e0 70 a3 4a 40 c2 22 65 c4 de d9 90 00 8b 0b ......]....i...J%.p.J@."e.......
0ac0 58 69 e8 de f8 d2 9b fe c5 8f 17 51 e4 d3 1e 9b 5b 92 4a a2 29 73 3a f6 dc 25 b7 91 be fc f0 a7 Xi.........Q....[.J.)s:..%......
0ae0 cf bd ee f5 ee eb 3e f3 5d 7f 92 d7 0e e9 77 4f fc e2 73 38 f5 45 3a 7b b0 59 bf 64 dc 1b ff f9 ......>.].....wO..s8.E:{.Y.d....
0b00 d0 d7 30 f2 49 a7 fc be 33 9f cb 25 a0 80 f6 b7 cf fd ee 7b ff fb e0 0f bf f8 c7 4f fe f2 9b ff ..0.I...3..%.......{.......O....
0b20 fc e8 4f bf fa d7 cf fe f6 bb ff fd e8 3f 32 e4 0f 15 fc ec 24 e1 02 44 c8 bf fe f7 cf ff fe fb ..O..........?2.....$..D........
0b40 ff ff 00 18 80 02 38 80 04 58 80 06 78 80 08 98 80 0a b8 80 0c d8 80 0e 78 80 f2 a7 7a f4 77 7d ......8..X..x...........x...z.w}
0b60 cf 55 81 b8 55 76 42 e5 71 48 53 7f d6 51 6e 29 f2 81 20 18 82 22 38 82 24 58 82 26 78 82 28 98 .U..UvB.qHS..Qn)....."8.$X.&x.(.
0b80 82 2a b8 82 2c d8 82 2e f8 82 30 18 83 31 fe 88 38 fa f6 7b 37 c5 81 d5 d1 23 20 20 04 3c d8 83 .*..,.....0..1..8..{7....#...<..
0ba0 3e f8 83 40 18 84 42 38 84 44 58 84 46 78 84 48 98 84 4a b8 84 4c d8 84 4e f8 84 50 18 85 4b f8 >..@..B8.DX.Fx.H..J..L..N..P..K.
0bc0 34 bf 36 7f de 44 81 e5 d1 23 0a c0 5e 5c d8 85 5e f8 85 60 18 86 62 38 86 64 b8 5d 4b 40 85 be 4.6..D...#..^\..^..`..b8.d.]K@..
0be0 67 85 7b 45 1f 5a 78 02 3c f0 86 70 18 87 72 38 87 74 58 87 76 78 87 78 98 87 7a b8 87 7c d8 87 g.{E.Zx.<..p..r8.tX.vx.x..z..|..
0c00 7e f8 87 80 18 88 82 38 88 84 b8 87 45 40 01 68 e8 68 18 f8 54 d5 07 7c 58 48 1e 6d 18 7d 92 f8 ~......8....E@.h.h..T..|XH.m.}..
0c20 7c 31 96 88 a1 26 81 57 c8 86 00 b0 85 93 d8 89 bb 57 89 20 74 89 c9 b7 7a 9a c8 89 9e 78 8a a5 |1...&.W.........W..t...z....x..
0c40 07 8a 55 88 89 6b 38 1f 91 88 8a b0 98 77 aa 98 86 ac 48 6a a5 e8 7c b1 98 8b 44 37 8b 8a 68 83 ..U..k8......w....Hj..|...D7..h.
0c60 51 85 83 d4 f1 8a 1b 56 04 b2 06 6b 1b 66 77 19 46 8c 1b c6 6a 1a 86 8c 0c e0 01 c5 d8 6a ba 38 Q......V...k.fw.F...j........j.8
0c80 8d 3e c6 8b a2 48 7d a4 e8 8a 9b 88 8b fe 0e 47 6d 0c 00 00 1b 96 6e ea e6 8d 11 97 61 e2 08 6f .>...H}........Gm.....n.....a..o
0ca0 e4 48 8d ea 88 7a 88 18 8a da e6 8b 84 05 8c ce 21 8c 0c 50 6c 0e 30 03 c8 a6 6c 00 b0 6e 2d 30 .H...z..........!..Pl.0...l..n-0
0cc0 03 d2 f6 6c 07 70 8f f9 78 00 1a b0 6e 07 e0 8f ed 56 6c 1a 80 8f 0c d0 6c 05 e9 8d eb 18 91 30 ...l.p..x...n....Vl.....l......0
0ce0 d6 8e ab 38 8a 13 78 8b c7 68 02 33 60 00 ac a6 6a 00 60 02 87 e6 01 31 67 02 3a a0 03 1a c9 91 ...8..x..h.3`...j.`....1g.:.....
0d00 f5 68 02 13 00 92 c9 36 92 b3 a6 92 28 e9 6a 2b d9 75 12 59 93 22 66 8d ef a8 86 b6 a8 1a 1e 74 .h.....6....(.j+.u.Y."f........t
0d20 22 39 a4 1c a0 44 8f 98 56 00 32 a0 61 45 59 94 19 26 03 05 c0 73 3d 47 94 46 b9 04 48 09 95 4b "9...D..V.2.aEY..&...s=G.F..H..K
0d40 39 73 50 f9 94 41 67 93 58 09 62 38 59 83 3a 89 76 ab b1 37 74 e4 3b 03 13 2e ea 22 2e ee 72 25 9sP..Ag.X.b8Y.:.v..7t.;...."..r%
0d60 00 13 00 04 63 2f 1d 13 00 41 b9 8d 59 19 97 8a b6 95 1b 07 8f a4 f5 88 60 79 4b 9d 23 3d 80 e3 ....c/...A..Y...........`yK.#=..
0d80 39 a4 64 31 b5 f4 34 a0 47 26 51 e7 fe 2d 42 29 97 88 69 66 74 79 74 e5 90 74 de 60 27 3d 79 72 9.d1..4.G&Q..-B)..iftyt..t.`'=yr
0da0 0c e3 3e 5e a3 2e 28 14 2f 23 57 3b 56 72 3b 00 60 99 66 64 43 a2 d7 4f 70 99 98 a4 a9 98 14 49 ..>^..(./#W;Vr;.`.fdC..Op......I
0dc0 8b 16 99 89 3c 39 4c 3d 02 00 3b d3 03 3b a3 23 9b 43 46 8c f4 9a 80 b4 31 a3 59 9a ba 39 65 8b ....<9L=..;..;.#.CF.....1.Y..9e.
0de0 b9 88 5b a5 81 55 24 6c 3f 04 47 07 97 23 e2 f2 30 97 87 79 95 c2 99 84 e3 01 a0 89 9b a6 b8 9b ..[..U$l?.G..#..0..y............
0e00 d2 f9 64 bd 69 97 cc 85 97 83 a3 97 f7 c4 97 61 f3 3b 81 17 36 3b d3 3d 54 e7 30 b9 39 9d e6 29 ..d.i..........a.;..6;.=T.0.9..)
0e20 64 d5 d9 95 cb f7 1c 44 34 1a f5 22 7a 6a 49 96 91 14 9a 01 b3 96 79 a4 2f 81 32 70 e5 79 9e fc d......D4.."zjI.......y./.2p.y..
0e40 d9 63 e9 59 8b 5e a9 8d d1 d9 9f 04 ca 8e 96 98 93 00 ba 9e 02 7a 02 0d d0 a0 0e fa a0 10 1a a1 .c.Y.^...............z..........
0e60 12 3a a1 14 5a a1 16 7a a1 18 9a a1 1a ba a1 1c da a1 1e fa a1 20 1a a2 22 9a a1 3f 70 9a bd a8 .:..Z..z................"..?p...
0e80 9e d6 57 8a 22 00 7f 2c da a2 2e fe fa a2 30 1a a3 32 3a a3 34 fa 7d 07 ca 95 09 9a a2 da 08 02 ..W."..,......0..2:.4.}.........
0ea0 3d b0 03 3e fa a3 40 1a a4 42 3a a4 44 5a a4 46 7a a4 48 9a a4 4a ba a4 4c da a4 4e fa a4 50 1a =..>..@..B:.DZ.Fz.H..J..L..N..P.
0ec0 a5 52 3a a5 4c 7a a3 75 89 a2 8e a8 89 ae b9 a5 5c da a5 5e fa a5 60 1a a6 62 3a a6 64 5a a6 66 .R:.Lz.u........\..^..`..b:.dZ.f
0ee0 7a a6 68 9a a6 6a ba a6 6c da a6 6e fa a6 6c ea 8e 38 9a 9a ad 68 81 76 ba 22 8c 99 15 c0 99 49 z.h..j..l..n..l..8...h.v.".....I
0f00 f2 78 a7 7e 0a 1f 79 3a 0e 8e d9 0d 93 f6 a7 86 8a 1d 81 da 10 7b 8a 52 7d 7a a8 8e ba 1d 89 1a .x.~..y:.............{.R}z......
0f20 0e 83 ca 0d 85 fa a8 96 aa 1c 91 0a 0e 93 ba 0d 95 7a a9 9e 5a 1f be 99 56 8b 4a 54 8d fa a9 a6 .................z..Z...V.JT....
0f40 da 54 a1 2a 57 a3 da 55 a5 7a aa ae 4a 1c 99 6a 12 ab ba 56 1f d0 04 65 78 ab b8 9a ab ba ba ab .T.*W..U.z..J..j...V...ex.......
0f60 bc da ab be aa 5e 2a 90 aa 8a 35 ab 74 f5 01 39 50 92 c8 9a ac ca ba ac cc da ac ce fa ac d0 1a .....^*...5.t..9P...............
0f80 ad d2 3a ad d4 5a ad d6 7a ad fe d8 9a ad da ba ad dc da ad de fa ad d3 ca 04 c2 2a 59 c4 ca 58 ..:..Z..z..................*Y..X
0fa0 ad fa aa e8 9a 55 e3 aa 59 e5 4a 59 e7 9a ae f0 2a 1b b1 ea 0d 9b aa 0d 9d 1a af f8 6a 65 d6 59 .....U..Y.JY....*...........je.Y
0fc0 61 8f 98 af fe aa 1b f3 ba 13 ed ca 59 ef fa af 06 7b a2 39 9a a5 07 bb b0 b0 ba ae aa 35 b0 ac a...........Y....{.9.........5..
0fe0 55 b0 0c 6b b0 01 cb 0d f5 9a 0d f7 3a b1 f0 5a b1 db 70 b1 d8 90 b1 1a 8b ae 1c ab 0d 1e 7b 0d U..k........:..Z..p...........{.
1000 20 1b b2 ae 3a b2 d9 50 b2 d6 70 b2 28 6b aa 2a 8b 0d 2c 5b 0d 60 52 02 02 80 19 90 21 05 2f fb ....:..P..p.(k.*..,[.`R.....!./.
1020 5a 31 7b 0d 33 4b 0d 35 0b 50 d6 a1 03 3b eb 5a 3d 6b 0d 3f 3b 0d 41 bb 1d 44 5b b4 a6 75 b4 d5 Z1{.3K.5.P...;.Z=k.?;.A..D[..u..
1040 90 b4 d2 b0 b4 15 00 ae d3 ea 03 a2 d1 b4 3d 25 01 56 2b ad 12 c0 54 3e d0 b5 d1 5a 01 70 e5 b0 ..............=%.V+...T>...Z.p..
1060 b2 05 b1 b4 25 68 06 67 04 43 80 03 0f 20 b6 cd 1a 04 a9 a2 b5 32 f5 03 38 70 ac 70 bb ac 1c 20 ....%h.g.C...........2..8p.p....
1080 b4 32 a5 03 38 90 b7 cb 1a fe 01 24 b0 04 65 bb af 5a 86 85 6b db b6 3f e0 1c 7f 91 b5 3f 65 b7 .2..8......$..e..Z..k..?.....?e.
10a0 fd aa 1b 2b c0 b7 31 e5 b7 ce b1 04 2b 40 b8 bc 61 b6 ba 85 b6 bc a5 b6 57 a2 b8 8c 3b b7 8f 8b ...+..1.....+@..a.......W...;...
10c0 03 91 9b 1b 93 cb 54 96 db 1c 98 ab b9 ac 01 b5 d4 20 b5 d1 b0 b4 a2 db 1c 8d 6b 04 74 1b 53 90 ......T...................k.t.S.
10e0 eb 1c a9 bb 54 ab cb 1c ad 5b b8 58 7a 83 88 1b ba 38 b0 b8 b6 4b ba 3e b5 bb cd d1 bb 4a f5 bb ....T....[.Xz....8...K.>.....J..
1100 cb 11 bc 9b 6b b8 6e 56 bc 6c 7b bc ae e1 4c 99 d3 4f 94 6b 2c ca db 53 cc 9b 24 55 85 4c b4 e1 ....k.nV.l{...L..O.k,..S..$U.L..
1120 bc 3f 05 bd 01 45 83 f2 ea 2d d2 fb ba 9c 2b 5c 9e 4b 5c a0 7b bd c8 bb 1a c1 04 48 37 d2 bd a3 .?...E...-....+\.K\.{......H7...
1140 71 bb b9 0b 53 e1 8b 50 63 23 77 b0 61 be 3e 05 bd da 79 1b 85 d4 be 80 45 bd 81 66 bd b5 ab 1a q...S..Pc#w.a.>...y.....E..f....
1160 97 17 2e cb 49 00 38 a4 bf fb fb bd 75 6b ba 96 32 70 5e 73 2c a6 62 6e 09 40 32 a5 41 c0 3d 05 ....I.8.....uk..2p^s,.bn.@2.A.=.
1180 bd 2f 65 46 02 b3 2b 97 fe 07 2e bf 82 2b 12 94 c0 99 2b bc 09 4b bc aa 91 b8 d8 bb 1a 78 24 49 ./eF..+......+....+..K.......x$I
11a0 01 f4 1a fc 5b ba cc f7 3a 49 94 23 8b 73 3c e2 66 04 24 dc b7 38 70 3d ac 02 48 58 a4 44 29 23 ....[...:I.#.s<.f.$..8p=..HX.D)#
11c0 2a 4f 07 c3 ae bb c0 c3 fb 8b 0e 7c c3 00 37 38 0b 74 c2 ac d1 c3 cb ab c1 db 63 48 46 60 40 4d *O.........|..78.t........cHF`@M
11e0 84 30 6a 14 48 23 6c c1 82 02 bd 50 54 43 8f 24 33 5a ec c6 52 2c c3 74 ba 93 33 66 bc f5 5b 23 .0j.H#l....PTC.$3Z..R,.t..3f..[#
1200 5a 8c 33 76 53 4e a7 e1 c5 e0 0b c6 8d 14 26 5b 83 4d ab 34 56 46 ac c6 70 c2 c6 7f 43 98 6f ac Z.3vSN........&[.M.4VF..p...C.o.
1220 50 3a d2 38 73 3c bd 55 1c 8f 57 9c c7 a8 91 99 b5 c2 46 0d 15 29 5d 8c c1 ba 2b c8 a4 11 00 9a P:.8s<.U..W.......F..)]...+.....
1240 52 46 c5 b2 9c 7b 89 c6 a4 71 c4 95 9b c4 af 07 31 95 92 48 98 f3 c4 2b 63 2a 29 30 c9 ee cb c0 RF...{...q......1..H...+c*)0....
1260 de 76 c9 ae 81 22 c8 02 46 45 ec bd 8e fb c5 d7 57 6e b6 cc 2b 3d 80 2c 99 72 38 c1 cc ca 30 85 .v..."..FE......Wn..+=.,.r8...0.
1280 be a7 52 ca 7e 62 79 fe 96 d3 c2 19 23 41 22 ac c0 35 fc be ca d5 88 34 fc 5e 78 3c ba c3 1c c8 ..R.~by.....#A"..5.....4.^x<....
12a0 a7 8b 1b ce 4c 28 e8 9b 1c da 1c 81 75 1c a0 77 4c bf e2 8c bb 3e cc bb 8a fc 26 e9 8c 1c eb ac ....L(......u..wL....>....&.....
12c0 af 95 7c 97 35 1c ce c9 3b ce 19 5c ce b7 71 ce 83 72 cf c7 91 cf 15 89 8d 17 09 ce f0 fc cf f2 ..|.5...;..\..q..r..............
12e0 4c cc f4 ac ba ae 0c bc 31 4c c9 33 6c c5 fd dc d0 cc 01 c8 01 1d d1 be 3b d1 d1 5b d1 b9 bc cf L.......1L.3l...........;..[....
1300 d7 99 d1 6d 7b 01 06 97 d2 2a bd d2 2c dd d2 2e 9d d2 37 0b d0 a1 bc 04 2f 5d d3 36 ed d2 04 bd ...m{....*..,.....7...../].6....
1320 c6 38 70 d3 3c cd d3 51 20 d2 54 7c d1 96 6c d2 18 a0 02 2b 70 d4 48 9d d4 4a bd d4 4c dd d4 48 .8p.<..Q..T|..l....+p.H..J..L..H
1340 0d ca fe 8b 01 03 e0 d4 54 5d d5 4e 5d cf 6e a2 03 4d 60 d5 5c dd d5 40 bd cd ba ec 6f d6 ab 1d ........T].N].n..M`.\..@....o...
1360 fd eb b4 8e 05 bb d3 20 bb d0 b0 b4 64 6d d6 9f 85 d6 d2 a0 d6 cf 50 b3 23 f0 03 76 7d d7 78 9d ............dm........P.#..v}.x.
1380 d7 7a bd d7 7c dd fe d7 3f f0 00 6e ed 59 70 1d 0d 72 ed 0c 60 92 01 47 30 04 8a bd d8 8c dd d8 .z..|...?..n.Yp..r..`..G0.......
13a0 8e fd d8 90 1d d9 8a 1d d8 97 35 d8 d0 50 d8 cd e0 b2 94 fd a7 96 fd 0c 98 cd 0c 9a bd d9 77 da ..........5..P................w.
13c0 d9 ce f0 d9 cb 10 da a2 6d 81 a4 dd 0c a6 ad 0c a8 9d da cf b5 da cc d0 da c9 f0 da b0 7d 5c b2 ........m....................}\.
13e0 bd 0c b4 8d 0c b6 7d db bf 95 db ca b0 db c7 d0 db be 7d 5b c0 6d 0f f1 3b 5f 12 5b dc 86 7a dc ......}...........}[.m..;_.[..z.
1400 03 e1 cd 18 cd dc 2f eb dc c7 20 dc 35 40 dc d2 7d 5a d4 6d 0c d0 4d 58 24 b0 01 4b 10 de e2 3d ....../.....5@..}Z.m..MX$..K...=
1420 de e4 5d de e6 7d de e8 9d de ea bd de ec dd de ee fd de f0 1d df f2 3d df f4 5d df f6 7d df f8 ..]..}.................=..]..}..
1440 9d df ec 1d 05 dc 1c 5f c9 1d 0e 0d 90 04 02 3e e0 04 5e e0 06 7e e0 08 9e e0 0a be e0 0c de e0 ......._.......>..^..~..........
1460 0e fe e0 10 1e e1 12 3e e1 14 5e e1 16 7e e1 18 9e e1 1a 0e e1 11 10 d6 58 f1 e1 20 1e e2 c1 fd .......>..^..~..........X.......
1480 df 22 5e e2 26 91 8e 13 d6 7d e2 2a be e2 82 d5 dd 2c fe e2 30 4e 14 29 1e e3 34 5e e3 67 eb e2 ."^.&....}.*.....,..0N.)..4^.g..
14a0 36 9e e3 3a 9e 12 33 be e3 3e fe e3 24 4b e2 40 3e e4 44 7e e3 45 7e e4 48 5e 11 3d 9e e4 4c 3e 6..:..3..>..$K.@>.D~.E~.H^.=..L>
14c0 e4 4b de e4 50 ae e3 4f 1e e5 54 1e e3 53 5e e5 58 ae e2 57 9e e5 5c 1e e2 5b de e5 60 6e 15 f7 .K..P..O..T..S^.X..W..\..[..`n..
14e0 10 0a 64 5e e6 66 7e e6 68 9e e6 6a be e6 6c de e6 6e fe e6 86 00 04 35 c0 02 c3 50 e7 76 7e e7 ..d^.f~.h..j..l..n.....5...P.v~.
1500 78 9e e7 7a be e7 7c de e7 7e fe e7 80 9e 0a 61 3e e8 84 2e 0e 81 00 00 3b x..z..|..~.....a>.......;
8 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581
/* 
   Unix SMB/CIFS implementation.
   Samba system utilities
   Copyright (C) Andrew Tridgell 1992-1998
   Copyright (C) Jeremy Allison  1998-2005
   Copyright (C) Timur Bakeyev        2005
   Copyright (C) Bjoern Jacke    2006-2007

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "includes.h"

#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#endif

/*
   The idea is that this file will eventually have wrappers around all
   important system calls in samba. The aims are:

   - to enable easier porting by putting OS dependent stuff in here

   - to allow for hooks into other "pseudo-filesystems"

   - to allow easier integration of things like the japanese extensions

   - to support the philosophy of Samba to expose the features of
     the OS within the SMB model. In general whatever file/printer/variable
     expansions/etc make sense to the OS should be acceptable to Samba.
*/



/*******************************************************************
 A wrapper for memalign
********************************************************************/

void *sys_memalign( size_t align, size_t size )
{
#if defined(HAVE_POSIX_MEMALIGN)
	void *p = NULL;
	int ret = posix_memalign( &p, align, size );
	if ( ret == 0 )
		return p;

	return NULL;
#elif defined(HAVE_MEMALIGN)
	return memalign( align, size );
#else
	/* On *BSD systems memaligns doesn't exist, but memory will
	 * be aligned on allocations of > pagesize. */
#if defined(SYSCONF_SC_PAGESIZE)
	size_t pagesize = (size_t)sysconf(_SC_PAGESIZE);
#elif defined(HAVE_GETPAGESIZE)
	size_t pagesize = (size_t)getpagesize();
#else
	size_t pagesize = (size_t)-1;
#endif
	if (pagesize == (size_t)-1) {
		DEBUG(0,("memalign functionalaity not available on this platform!\n"));
		return NULL;
	}
	if (size < pagesize) {
		size = pagesize;
	}
	return SMB_MALLOC(size);
#endif
}

/*******************************************************************
 A wrapper for usleep in case we don't have one.
********************************************************************/

int sys_usleep(long usecs)
{
#ifndef HAVE_USLEEP
	struct timeval tval;
#endif

	/*
	 * We need this braindamage as the glibc usleep
	 * is not SPEC1170 complient... grumble... JRA.
	 */

	if(usecs < 0 || usecs > 999999) {
		errno = EINVAL;
		return -1;
	}

#if HAVE_USLEEP
	usleep(usecs);
	return 0;
#else /* HAVE_USLEEP */
	/*
	 * Fake it with select...
	 */
	tval.tv_sec = 0;
	tval.tv_usec = usecs/1000;
	select(0,NULL,NULL,NULL,&tval);
	return 0;
#endif /* HAVE_USLEEP */
}

/*******************************************************************
A read wrapper that will deal with EINTR.
********************************************************************/

ssize_t sys_read(int fd, void *buf, size_t count)
{
	ssize_t ret;

	do {
		ret = read(fd, buf, count);
	} while (ret == -1 && errno == EINTR);
	return ret;
}

/*******************************************************************
A write wrapper that will deal with EINTR.
********************************************************************/

ssize_t sys_write(int fd, const void *buf, size_t count)
{
	ssize_t ret;

	do {
		ret = write(fd, buf, count);
	} while (ret == -1 && errno == EINTR);
	return ret;
}

/*******************************************************************
A writev wrapper that will deal with EINTR.
********************************************************************/

ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt)
{
	ssize_t ret;

#if 0
	/* Try to confuse write_data_iov a bit */
	if ((random() % 5) == 0) {
		return sys_write(fd, iov[0].iov_base, iov[0].iov_len);
	}
	if (iov[0].iov_len > 1) {
		return sys_write(fd, iov[0].iov_base,
				 (random() % (iov[0].iov_len-1)) + 1);
	}
#endif

	do {
		ret = writev(fd, iov, iovcnt);
	} while (ret == -1 && errno == EINTR);
	return ret;
}

/*******************************************************************
A pread wrapper that will deal with EINTR and 64-bit file offsets.
********************************************************************/

#if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off)
{
	ssize_t ret;

	do {
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_PREAD64)
		ret = pread64(fd, buf, count, off);
#else
		ret = pread(fd, buf, count, off);
#endif
	} while (ret == -1 && errno == EINTR);
	return ret;
}
#endif

/*******************************************************************
A write wrapper that will deal with EINTR and 64-bit file offsets.
********************************************************************/

#if defined(HAVE_PWRITE) || defined(HAVE_PWRITE64)
ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off)
{
	ssize_t ret;

	do {
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_PWRITE64)
		ret = pwrite64(fd, buf, count, off);
#else
		ret = pwrite(fd, buf, count, off);
#endif
	} while (ret == -1 && errno == EINTR);
	return ret;
}
#endif

/*******************************************************************
A send wrapper that will deal with EINTR.
********************************************************************/

ssize_t sys_send(int s, const void *msg, size_t len, int flags)
{
	ssize_t ret;

	do {
		ret = send(s, msg, len, flags);
	} while (ret == -1 && errno == EINTR);
	return ret;
}

/*******************************************************************
A sendto wrapper that will deal with EINTR.
********************************************************************/

ssize_t sys_sendto(int s,  const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
{
	ssize_t ret;

	do {
		ret = sendto(s, msg, len, flags, to, tolen);
	} while (ret == -1 && errno == EINTR);
	return ret;
}

/*******************************************************************
A recv wrapper that will deal with EINTR.
********************************************************************/

ssize_t sys_recv(int fd, void *buf, size_t count, int flags)
{
	ssize_t ret;

	do {
		ret = recv(fd, buf, count, flags);
	} while (ret == -1 && errno == EINTR);
	return ret;
}

/*******************************************************************
A recvfrom wrapper that will deal with EINTR.
********************************************************************/

ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
{
	ssize_t ret;

	do {
		ret = recvfrom(s, buf, len, flags, from, fromlen);
	} while (ret == -1 && errno == EINTR);
	return ret;
}

/*******************************************************************
A fcntl wrapper that will deal with EINTR.
********************************************************************/

int sys_fcntl_ptr(int fd, int cmd, void *arg)
{
	int ret;

	do {
		ret = fcntl(fd, cmd, arg);
	} while (ret == -1 && errno == EINTR);
	return ret;
}

/*******************************************************************
A fcntl wrapper that will deal with EINTR.
********************************************************************/

int sys_fcntl_long(int fd, int cmd, long arg)
{
	int ret;

	do {
		ret = fcntl(fd, cmd, arg);
	} while (ret == -1 && errno == EINTR);
	return ret;
}

/****************************************************************************
 Get/Set all the possible time fields from a stat struct as a timespec.
****************************************************************************/

static struct timespec get_atimespec(const struct stat *pst)
{
#if !defined(HAVE_STAT_HIRES_TIMESTAMPS)
	struct timespec ret;

	/* Old system - no ns timestamp. */
	ret.tv_sec = pst->st_atime;
	ret.tv_nsec = 0;
	return ret;
#else
#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
	return pst->st_atim;
#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC)
	struct timespec ret;
	ret.tv_sec = pst->st_atime;
	ret.tv_nsec = pst->st_atimensec;
	return ret;
#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N)
	struct timespec ret;
	ret.tv_sec = pst->st_atime;
	ret.tv_nsec = pst->st_atime_n;
	return ret;
#elif defined(HAVE_STRUCT_STAT_ST_UMTIME)
	struct timespec ret;
	ret.tv_sec = pst->st_atime;
	ret.tv_nsec = pst->st_uatime * 1000;
	return ret;
#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
	return pst->st_atimespec;
#else
#error	CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT
#endif
#endif
}

static struct timespec get_mtimespec(const struct stat *pst)
{
#if !defined(HAVE_STAT_HIRES_TIMESTAMPS)
	struct timespec ret;

	/* Old system - no ns timestamp. */
	ret.tv_sec = pst->st_mtime;
	ret.tv_nsec = 0;
	return ret;
#else
#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
	return pst->st_mtim;
#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC)
	struct timespec ret;
	ret.tv_sec = pst->st_mtime;
	ret.tv_nsec = pst->st_mtimensec;
	return ret;
#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N)
	struct timespec ret;
	ret.tv_sec = pst->st_mtime;
	ret.tv_nsec = pst->st_mtime_n;
	return ret;
#elif defined(HAVE_STRUCT_STAT_ST_UMTIME)
	struct timespec ret;
	ret.tv_sec = pst->st_mtime;
	ret.tv_nsec = pst->st_umtime * 1000;
	return ret;
#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
	return pst->st_mtimespec;
#else
#error	CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT
#endif
#endif
}

static struct timespec get_ctimespec(const struct stat *pst)
{
#if !defined(HAVE_STAT_HIRES_TIMESTAMPS)
	struct timespec ret;

	/* Old system - no ns timestamp. */
	ret.tv_sec = pst->st_ctime;
	ret.tv_nsec = 0;
	return ret;
#else
#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
	return pst->st_ctim;
#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC)
	struct timespec ret;
	ret.tv_sec = pst->st_ctime;
	ret.tv_nsec = pst->st_ctimensec;
	return ret;
#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N)
	struct timespec ret;
	ret.tv_sec = pst->st_ctime;
	ret.tv_nsec = pst->st_ctime_n;
	return ret;
#elif defined(HAVE_STRUCT_STAT_ST_UMTIME)
	struct timespec ret;
	ret.tv_sec = pst->st_ctime;
	ret.tv_nsec = pst->st_uctime * 1000;
	return ret;
#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
	return pst->st_ctimespec;
#else
#error	CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT
#endif
#endif
}

/****************************************************************************
 Return the best approximation to a 'create time' under UNIX from a stat
 structure.
****************************************************************************/

static struct timespec calc_create_time_stat(const struct stat *st)
{
	struct timespec ret, ret1;
	struct timespec c_time = get_ctimespec(st);
	struct timespec m_time = get_mtimespec(st);
	struct timespec a_time = get_atimespec(st);

	ret = timespec_compare(&c_time, &m_time) < 0 ? c_time : m_time;
	ret1 = timespec_compare(&ret, &a_time) < 0 ? ret : a_time;

	if(!null_timespec(ret1)) {
		return ret1;
	}

	/*
	 * One of ctime, mtime or atime was zero (probably atime).
	 * Just return MIN(ctime, mtime).
	 */
	return ret;
}

/****************************************************************************
 Return the best approximation to a 'create time' under UNIX from a stat_ex
 structure.
****************************************************************************/

static struct timespec calc_create_time_stat_ex(const struct stat_ex *st)
{
	struct timespec ret, ret1;
	struct timespec c_time = st->st_ex_ctime;
	struct timespec m_time = st->st_ex_mtime;
	struct timespec a_time = st->st_ex_atime;

	ret = timespec_compare(&c_time, &m_time) < 0 ? c_time : m_time;
	ret1 = timespec_compare(&ret, &a_time) < 0 ? ret : a_time;

	if(!null_timespec(ret1)) {
		return ret1;
	}

	/*
	 * One of ctime, mtime or atime was zero (probably atime).
	 * Just return MIN(ctime, mtime).
	 */
	return ret;
}

/****************************************************************************
 Return the 'create time' from a stat struct if it exists (birthtime) or else
 use the best approximation.
****************************************************************************/

static void make_create_timespec(const struct stat *pst, struct stat_ex *dst)
{
	if (S_ISDIR(pst->st_mode) && lp_fake_dir_create_times()) {
		dst->st_ex_btime.tv_sec = 315493200L;          /* 1/1/1980 */
		dst->st_ex_btime.tv_nsec = 0;
	}

	dst->st_ex_calculated_birthtime = false;

#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC)
	dst->st_ex_btime = pst->st_birthtimespec;
#elif defined(HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC)
	dst->st_ex_btime.tv_sec = pst->st_birthtime;
	dst->st_ex_btime.tv_nsec = pst->st_birthtimenspec;
#elif defined(HAVE_STRUCT_STAT_ST_BIRTHTIME)
	dst->st_ex_btime.tv_sec = pst->st_birthtime;
	dst->st_ex_btime.tv_nsec = 0;
#else
	dst->st_ex_btime = calc_create_time_stat(pst);
	dst->st_ex_calculated_birthtime = true;
#endif

	/* Deal with systems that don't initialize birthtime correctly.
	 * Pointed out by SATOH Fumiyasu <fumiyas@osstech.jp>.
	 */
	if (null_timespec(dst->st_ex_btime)) {
		dst->st_ex_btime = calc_create_time_stat(pst);
		dst->st_ex_calculated_birthtime = true;
	}
}

/****************************************************************************
 If we update a timestamp in a stat_ex struct we may have to recalculate
 the birthtime. For now only implement this for write time, but we may
 also need to do it for atime and ctime. JRA.
****************************************************************************/

void update_stat_ex_mtime(struct stat_ex *dst,
				struct timespec write_ts)
{
	dst->st_ex_mtime = write_ts;

	/* We may have to recalculate btime. */
	if (dst->st_ex_calculated_birthtime) {
		dst->st_ex_btime = calc_create_time_stat_ex(dst);
	}
}

static void init_stat_ex_from_stat (struct stat_ex *dst,
				    const struct stat *src)
{
	dst->st_ex_dev = src->st_dev;
	dst->st_ex_ino = src->st_ino;
	dst->st_ex_mode = src->st_mode;
	dst->st_ex_nlink = src->st_nlink;
	dst->st_ex_uid = src->st_uid;
	dst->st_ex_gid = src->st_gid;
	dst->st_ex_rdev = src->st_rdev;
	dst->st_ex_size = src->st_size;
	dst->st_ex_atime = get_atimespec(src);
	dst->st_ex_mtime = get_mtimespec(src);
	dst->st_ex_ctime = get_ctimespec(src);
	make_create_timespec(src, dst);
	dst->st_ex_blksize = src->st_blksize;
	dst->st_ex_blocks = src->st_blocks;

#ifdef HAVE_STAT_ST_FLAGS
	dst->st_ex_flags = src->st_flags;
#else
	dst->st_ex_flags = 0;
#endif
}

/*******************************************************************
A stat() wrapper that will deal with 64 bit filesizes.
********************************************************************/

int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
{
	int ret;
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_STAT64)
	ret = stat64(fname, sbuf);
#else
	struct stat statbuf;
	ret = stat(fname, &statbuf);
#endif
	if (ret == 0) {
		/* we always want directories to appear zero size */
		if (S_ISDIR(statbuf.st_mode)) {
			statbuf.st_size = 0;
		}
		init_stat_ex_from_stat(sbuf, &statbuf);
	}
	return ret;
}

/*******************************************************************
 An fstat() wrapper that will deal with 64 bit filesizes.
********************************************************************/

int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf)
{
	int ret;
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FSTAT64)
	ret = fstat64(fd, sbuf);
#else
	struct stat statbuf;
	ret = fstat(fd, &statbuf);
#endif
	if (ret == 0) {
		/* we always want directories to appear zero size */
		if (S_ISDIR(statbuf.st_mode)) {
			statbuf.st_size = 0;
		}
		init_stat_ex_from_stat(sbuf, &statbuf);
	}
	return ret;
}

/*******************************************************************
 An lstat() wrapper that will deal with 64 bit filesizes.
********************************************************************/

int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf)
{
	int ret;
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_LSTAT64)
	ret = lstat64(fname, sbuf);
#else
	struct stat statbuf;
	ret = lstat(fname, &statbuf);
#endif
	if (ret == 0) {
		/* we always want directories to appear zero size */
		if (S_ISDIR(statbuf.st_mode)) {
			statbuf.st_size = 0;
		}
		init_stat_ex_from_stat(sbuf, &statbuf);
	}
	return ret;
}

/*******************************************************************
 An ftruncate() wrapper that will deal with 64 bit filesizes.
********************************************************************/

int sys_ftruncate(int fd, SMB_OFF_T offset)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FTRUNCATE64)
	return ftruncate64(fd, offset);
#else
	return ftruncate(fd, offset);
#endif
}

/*******************************************************************
 An lseek() wrapper that will deal with 64 bit filesizes.
********************************************************************/

SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_LSEEK64)
	return lseek64(fd, offset, whence);
#else
	return lseek(fd, offset, whence);
#endif
}

/*******************************************************************
 An fseek() wrapper that will deal with 64 bit filesizes.
********************************************************************/

int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEK64)
	return fseek64(fp, offset, whence);
#elif defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEKO64)
	return fseeko64(fp, offset, whence);
#else
	return fseek(fp, offset, whence);
#endif
}

/*******************************************************************
 An ftell() wrapper that will deal with 64 bit filesizes.
********************************************************************/

SMB_OFF_T sys_ftell(FILE *fp)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELL64)
	return (SMB_OFF_T)ftell64(fp);
#elif defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELLO64)
	return (SMB_OFF_T)ftello64(fp);
#else
	return (SMB_OFF_T)ftell(fp);
#endif
}

/*******************************************************************
 A creat() wrapper that will deal with 64 bit filesizes.
********************************************************************/

int sys_creat(const char *path, mode_t mode)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_CREAT64)
	return creat64(path, mode);
#else
	/*
	 * If creat64 isn't defined then ensure we call a potential open64.
	 * JRA.
	 */
	return sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
#endif
}

/*******************************************************************
 An open() wrapper that will deal with 64 bit filesizes.
********************************************************************/

int sys_open(const char *path, int oflag, mode_t mode)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OPEN64)
	return open64(path, oflag, mode);
#else
	return open(path, oflag, mode);
#endif
}

/*******************************************************************
 An fopen() wrapper that will deal with 64 bit filesizes.
********************************************************************/

FILE *sys_fopen(const char *path, const char *type)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_FOPEN64)
	return fopen64(path, type);
#else
	return fopen(path, type);
#endif
}


/*******************************************************************
 A flock() wrapper that will perform the kernel flock.
********************************************************************/

void kernel_flock(int fd, uint32 share_mode, uint32 access_mask)
{
#if HAVE_KERNEL_SHARE_MODES
	int kernel_mode = 0;
	if (share_mode == FILE_SHARE_WRITE) {
		kernel_mode = LOCK_MAND|LOCK_WRITE;
	} else if (share_mode == FILE_SHARE_READ) {
		kernel_mode = LOCK_MAND|LOCK_READ;
	} else if (share_mode == FILE_SHARE_NONE) {
		kernel_mode = LOCK_MAND;
	}
	if (kernel_mode) {
		flock(fd, kernel_mode);
	}
#endif
	;
}



/*******************************************************************
 An opendir wrapper that will deal with 64 bit filesizes.
********************************************************************/

SMB_STRUCT_DIR *sys_opendir(const char *name)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OPENDIR64)
	return opendir64(name);
#else
	return opendir(name);
#endif
}

/*******************************************************************
 A readdir wrapper that will deal with 64 bit filesizes.
********************************************************************/

SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_READDIR64)
	return readdir64(dirp);
#else
	return readdir(dirp);
#endif
}

/*******************************************************************
 A seekdir wrapper that will deal with 64 bit filesizes.
********************************************************************/

void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_SEEKDIR64)
	seekdir64(dirp, offset);
#else
	seekdir(dirp, offset);
#endif
}

/*******************************************************************
 A telldir wrapper that will deal with 64 bit filesizes.
********************************************************************/

long sys_telldir(SMB_STRUCT_DIR *dirp)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_TELLDIR64)
	return (long)telldir64(dirp);
#else
	return (long)telldir(dirp);
#endif
}

/*******************************************************************
 A rewinddir wrapper that will deal with 64 bit filesizes.
********************************************************************/

void sys_rewinddir(SMB_STRUCT_DIR *dirp)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_REWINDDIR64)
	rewinddir64(dirp);
#else
	rewinddir(dirp);
#endif
}

/*******************************************************************
 A close wrapper that will deal with 64 bit filesizes.
********************************************************************/

int sys_closedir(SMB_STRUCT_DIR *dirp)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_CLOSEDIR64)
	return closedir64(dirp);
#else
	return closedir(dirp);
#endif
}

/*******************************************************************
 An mknod() wrapper that will deal with 64 bit filesizes.
********************************************************************/

int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev)
{
#if defined(HAVE_MKNOD) || defined(HAVE_MKNOD64)
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_MKNOD64) && defined(HAVE_DEV64_T)
	return mknod64(path, mode, dev);
#else
	return mknod(path, mode, dev);
#endif
#else
	/* No mknod system call. */
	errno = ENOSYS;
	return -1;
#endif
}

/*******************************************************************
The wait() calls vary between systems
********************************************************************/

int sys_waitpid(pid_t pid,int *status,int options)
{
#ifdef HAVE_WAITPID
	return waitpid(pid,status,options);
#else /* HAVE_WAITPID */
	return wait4(pid, status, options, NULL);
#endif /* HAVE_WAITPID */
}

/*******************************************************************
 System wrapper for getwd
********************************************************************/

char *sys_getwd(char *s)
{
	char *wd;
#ifdef HAVE_GETCWD
	wd = (char *)getcwd(s, PATH_MAX);
#else
	wd = (char *)getwd(s);
#endif
	return wd;
}

#if defined(HAVE_POSIX_CAPABILITIES)

/**************************************************************************
 Try and abstract process capabilities (for systems that have them).
****************************************************************************/

/* Set the POSIX capabilities needed for the given purpose into the effective
 * capability set of the current process. Make sure they are always removed
 * from the inheritable set, because there is no circumstance in which our
 * children should inherit our elevated privileges.
 */
static bool set_process_capability(enum smbd_capability capability,
				   bool enable)
{
	cap_value_t cap_vals[2] = {0};
	int num_cap_vals = 0;

	cap_t cap;

#if defined(HAVE_PRCTL) && defined(PR_GET_KEEPCAPS) && defined(PR_SET_KEEPCAPS)
	/* On Linux, make sure that any capabilities we grab are sticky
	 * across UID changes. We expect that this would allow us to keep both
	 * the effective and permitted capability sets, but as of circa 2.6.16,
	 * only the permitted set is kept. It is a bug (which we work around)
	 * that the effective set is lost, but we still require the effective
	 * set to be kept.
	 */
	if (!prctl(PR_GET_KEEPCAPS)) {
		prctl(PR_SET_KEEPCAPS, 1);
	}
#endif

	cap = cap_get_proc();
	if (cap == NULL) {
		DEBUG(0,("set_process_capability: cap_get_proc failed: %s\n",
			strerror(errno)));
		return False;
	}

	switch (capability) {
		case KERNEL_OPLOCK_CAPABILITY:
#ifdef CAP_NETWORK_MGT
			/* IRIX has CAP_NETWORK_MGT for oplocks. */
			cap_vals[num_cap_vals++] = CAP_NETWORK_MGT;
#endif
			break;
		case DMAPI_ACCESS_CAPABILITY:
#ifdef CAP_DEVICE_MGT
			/* IRIX has CAP_DEVICE_MGT for DMAPI access. */
			cap_vals[num_cap_vals++] = CAP_DEVICE_MGT;
#elif CAP_MKNOD
			/* Linux has CAP_MKNOD for DMAPI access. */
			cap_vals[num_cap_vals++] = CAP_MKNOD;
#endif
			break;
		case LEASE_CAPABILITY:
#ifdef CAP_LEASE
			cap_vals[num_cap_vals++] = CAP_LEASE;
#endif
			break;
	}

	SMB_ASSERT(num_cap_vals <= ARRAY_SIZE(cap_vals));

	if (num_cap_vals == 0) {
		cap_free(cap);
		return True;
	}

	cap_set_flag(cap, CAP_EFFECTIVE, num_cap_vals, cap_vals,
		enable ? CAP_SET : CAP_CLEAR);

	/* We never want to pass capabilities down to our children, so make
	 * sure they are not inherited.
	 */
	cap_set_flag(cap, CAP_INHERITABLE, num_cap_vals, cap_vals, CAP_CLEAR);

	if (cap_set_proc(cap) == -1) {
		DEBUG(0, ("set_process_capability: cap_set_proc failed: %s\n",
			strerror(errno)));
		cap_free(cap);
		return False;
	}

	cap_free(cap);
	return True;
}

#endif /* HAVE_POSIX_CAPABILITIES */

/****************************************************************************
 Gain the oplock capability from the kernel if possible.
****************************************************************************/

void set_effective_capability(enum smbd_capability capability)
{
#if defined(HAVE_POSIX_CAPABILITIES)
	set_process_capability(capability, True);
#endif /* HAVE_POSIX_CAPABILITIES */
}

void drop_effective_capability(enum smbd_capability capability)
{
#if defined(HAVE_POSIX_CAPABILITIES)
	set_process_capability(capability, False);
#endif /* HAVE_POSIX_CAPABILITIES */
}

/**************************************************************************
 Wrapper for random().
****************************************************************************/

long sys_random(void)
{
#if defined(HAVE_RANDOM)
	return (long)random();
#elif defined(HAVE_RAND)
	return (long)rand();
#else
	DEBUG(0,("Error - no random function available !\n"));
	exit(1);
#endif
}

/**************************************************************************
 Wrapper for srandom().
****************************************************************************/

void sys_srandom(unsigned int seed)
{
#if defined(HAVE_SRANDOM)
	srandom(seed);
#elif defined(HAVE_SRAND)
	srand(seed);
#else
	DEBUG(0,("Error - no srandom function available !\n"));
	exit(1);
#endif
}

/**************************************************************************
 Returns equivalent to NGROUPS_MAX - using sysconf if needed.
****************************************************************************/

int groups_max(void)
{
#if defined(SYSCONF_SC_NGROUPS_MAX)
	int ret = sysconf(_SC_NGROUPS_MAX);
	return (ret == -1) ? NGROUPS_MAX : ret;
#else
	return NGROUPS_MAX;
#endif
}

/**************************************************************************
 Wrap setgroups and getgroups for systems that declare getgroups() as
 returning an array of gid_t, but actuall return an array of int.
****************************************************************************/

#if defined(HAVE_BROKEN_GETGROUPS)
static int sys_broken_getgroups(int setlen, gid_t *gidset)
{
	GID_T gid;
	GID_T *group_list;
	int i, ngroups;

	if(setlen == 0) {
		return getgroups(setlen, &gid);
	}

	/*
	 * Broken case. We need to allocate a
	 * GID_T array of size setlen.
	 */

	if(setlen < 0) {
		errno = EINVAL; 
		return -1;
	} 

	if (setlen == 0)
		setlen = groups_max();

	if((group_list = SMB_MALLOC_ARRAY(GID_T, setlen)) == NULL) {
		DEBUG(0,("sys_getgroups: Malloc fail.\n"));
		return -1;
	}

	if((ngroups = getgroups(setlen, group_list)) < 0) {
		int saved_errno = errno;
		SAFE_FREE(group_list);
		errno = saved_errno;
		return -1;
	}

	for(i = 0; i < ngroups; i++)
		gidset[i] = (gid_t)group_list[i];

	SAFE_FREE(group_list);
	return ngroups;
}

static int sys_broken_setgroups(int setlen, gid_t *gidset)
{
	GID_T *group_list;
	int i ; 

	if (setlen == 0)
		return 0 ;

	if (setlen < 0 || setlen > groups_max()) {
		errno = EINVAL; 
		return -1;   
	}

	/*
	 * Broken case. We need to allocate a
	 * GID_T array of size setlen.
	 */

	if((group_list = SMB_MALLOC_ARRAY(GID_T, setlen)) == NULL) {
		DEBUG(0,("sys_setgroups: Malloc fail.\n"));
		return -1;    
	}

	for(i = 0; i < setlen; i++) 
		group_list[i] = (GID_T) gidset[i]; 

	if(setgroups(setlen, group_list) != 0) {
		int saved_errno = errno;
		SAFE_FREE(group_list);
		errno = saved_errno;
		return -1;
	}

	SAFE_FREE(group_list);
	return 0 ;
}

#endif /* HAVE_BROKEN_GETGROUPS */

/* This is a list of systems that require the first GID passed to setgroups(2)
 * to be the effective GID. If your system is one of these, add it here.
 */
#if defined (FREEBSD) || defined (DARWINOS)
#define USE_BSD_SETGROUPS
#endif

#if defined(USE_BSD_SETGROUPS)
/* Depending on the particular BSD implementation, the first GID that is
 * passed to setgroups(2) will either be ignored or will set the credential's
 * effective GID. In either case, the right thing to do is to guarantee that
 * gidset[0] is the effective GID.
 */
static int sys_bsd_setgroups(gid_t primary_gid, int setlen, const gid_t *gidset)
{
	gid_t *new_gidset = NULL;
	int max;
	int ret;

	/* setgroups(2) will fail with EINVAL if we pass too many groups. */
	max = groups_max();

	/* No group list, just make sure we are setting the efective GID. */
	if (setlen == 0) {
		return setgroups(1, &primary_gid);
	}

	/* If the primary gid is not the first array element, grow the array
	 * and insert it at the front.
	 */
	if (gidset[0] != primary_gid) {
	        new_gidset = SMB_MALLOC_ARRAY(gid_t, setlen + 1);
	        if (new_gidset == NULL) {
			return -1;
	        }

		memcpy(new_gidset + 1, gidset, (setlen * sizeof(gid_t)));
		new_gidset[0] = primary_gid;
		setlen++;
	}

	if (setlen > max) {
		DEBUG(3, ("forced to truncate group list from %d to %d\n",
			setlen, max));
		setlen = max;
	}

#if defined(HAVE_BROKEN_GETGROUPS)
	ret = sys_broken_setgroups(setlen, new_gidset ? new_gidset : gidset);
#else
	ret = setgroups(setlen, new_gidset ? new_gidset : gidset);
#endif

	if (new_gidset) {
		int errsav = errno;
		SAFE_FREE(new_gidset);
		errno = errsav;
	}

	return ret;
}

#endif /* USE_BSD_SETGROUPS */

/**************************************************************************
 Wrapper for getgroups. Deals with broken (int) case.
****************************************************************************/

int sys_getgroups(int setlen, gid_t *gidset)
{
#if defined(HAVE_BROKEN_GETGROUPS)
	return sys_broken_getgroups(setlen, gidset);
#else
	return getgroups(setlen, gidset);
#endif
}

/**************************************************************************
 Wrapper for setgroups. Deals with broken (int) case and BSD case.
****************************************************************************/

int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset)
{
#if !defined(HAVE_SETGROUPS)
	errno = ENOSYS;
	return -1;
#endif /* HAVE_SETGROUPS */

#if defined(USE_BSD_SETGROUPS)
	return sys_bsd_setgroups(primary_gid, setlen, gidset);
#elif defined(HAVE_BROKEN_GETGROUPS)
	return sys_broken_setgroups(setlen, gidset);
#else
	return setgroups(setlen, gidset);
#endif
}

/**************************************************************************
 Wrappers for setpwent(), getpwent() and endpwent()
****************************************************************************/

void sys_setpwent(void)
{
	setpwent();
}

struct passwd *sys_getpwent(void)
{
	return getpwent();
}

void sys_endpwent(void)
{
	endpwent();
}

/**************************************************************************
 Wrappers for getpwnam(), getpwuid(), getgrnam(), getgrgid()
****************************************************************************/


struct passwd *sys_getpwnam(const char *name)
{
	return getpwnam(name);
}

struct passwd *sys_getpwuid(uid_t uid)
{
	return getpwuid(uid);
}

struct group *sys_getgrnam(const char *name)
{
	return getgrnam(name);
}

struct group *sys_getgrgid(gid_t gid)
{
	return getgrgid(gid);
}

/**************************************************************************
 Extract a command into an arg list.
****************************************************************************/

static char **extract_args(TALLOC_CTX *mem_ctx, const char *command)
{
	char *trunc_cmd;
	char *saveptr;
	char *ptr;
	int argcl;
	char **argl = NULL;
	int i;

	if (!(trunc_cmd = talloc_strdup(mem_ctx, command))) {
		DEBUG(0, ("talloc failed\n"));
		goto nomem;
	}

	if(!(ptr = strtok_r(trunc_cmd, " \t", &saveptr))) {
		TALLOC_FREE(trunc_cmd);
		errno = EINVAL;
		return NULL;
	}

	/*
	 * Count the args.
	 */

	for( argcl = 1; ptr; ptr = strtok_r(NULL, " \t", &saveptr))
		argcl++;

	TALLOC_FREE(trunc_cmd);

	if (!(argl = TALLOC_ARRAY(mem_ctx, char *, argcl + 1))) {
		goto nomem;
	}

	/*
	 * Now do the extraction.
	 */

	if (!(trunc_cmd = talloc_strdup(mem_ctx, command))) {
		goto nomem;
	}

	ptr = strtok_r(trunc_cmd, " \t", &saveptr);
	i = 0;

	if (!(argl[i++] = talloc_strdup(argl, ptr))) {
		goto nomem;
	}

	while((ptr = strtok_r(NULL, " \t", &saveptr)) != NULL) {

		if (!(argl[i++] = talloc_strdup(argl, ptr))) {
			goto nomem;
		}
	}

	argl[i++] = NULL;
	return argl;

 nomem:
	DEBUG(0, ("talloc failed\n"));
	TALLOC_FREE(trunc_cmd);
	TALLOC_FREE(argl);
	errno = ENOMEM;
	return NULL;
}

/**************************************************************************
 Wrapper for popen. Safer as it doesn't search a path.
 Modified from the glibc sources.
 modified by tridge to return a file descriptor. We must kick our FILE* habit
****************************************************************************/

typedef struct _popen_list
{
	int fd;
	pid_t child_pid;
	struct _popen_list *next;
} popen_list;

static popen_list *popen_chain;

int sys_popen(const char *command)
{
	int parent_end, child_end;
	int pipe_fds[2];
	popen_list *entry = NULL;
	char **argl = NULL;

	if (pipe(pipe_fds) < 0)
		return -1;

	parent_end = pipe_fds[0];
	child_end = pipe_fds[1];

	if (!*command) {
		errno = EINVAL;
		goto err_exit;
	}

	if((entry = SMB_MALLOC_P(popen_list)) == NULL)
		goto err_exit;

	ZERO_STRUCTP(entry);

	/*
	 * Extract the command and args into a NULL terminated array.
	 */

	if(!(argl = extract_args(NULL, command)))
		goto err_exit;

	entry->child_pid = sys_fork();

	if (entry->child_pid == -1) {
		goto err_exit;
	}

	if (entry->child_pid == 0) {

		/*
		 * Child !
		 */

		int child_std_end = STDOUT_FILENO;
		popen_list *p;

		close(parent_end);
		if (child_end != child_std_end) {
			dup2 (child_end, child_std_end);
			close (child_end);
		}

		/*
		 * POSIX.2:  "popen() shall ensure that any streams from previous
		 * popen() calls that remain open in the parent process are closed
		 * in the new child process."
		 */

		for (p = popen_chain; p; p = p->next)
			close(p->fd);

		execv(argl[0], argl);
		_exit (127);
	}

	/*
	 * Parent.
	 */

	close (child_end);
	TALLOC_FREE(argl);

	/* Link into popen_chain. */
	entry->next = popen_chain;
	popen_chain = entry;
	entry->fd = parent_end;

	return entry->fd;

err_exit:

	SAFE_FREE(entry);
	SAFE_FREE(argl);
	close(pipe_fds[0]);
	close(pipe_fds[1]);
	return -1;
}

/**************************************************************************
 Wrapper for pclose. Modified from the glibc sources.
****************************************************************************/

int sys_pclose(int fd)
{
	int wstatus;
	popen_list **ptr = &popen_chain;
	popen_list *entry = NULL;
	pid_t wait_pid;
	int status = -1;

	/* Unlink from popen_chain. */
	for ( ; *ptr != NULL; ptr = &(*ptr)->next) {
		if ((*ptr)->fd == fd) {
			entry = *ptr;
			*ptr = (*ptr)->next;
			status = 0;
			break;
		}
	}

	if (status < 0 || close(entry->fd) < 0)
		return -1;

	/*
	 * As Samba is catching and eating child process
	 * exits we don't really care about the child exit
	 * code, a -1 with errno = ECHILD will do fine for us.
	 */

	do {
		wait_pid = sys_waitpid (entry->child_pid, &wstatus, 0);
	} while (wait_pid == -1 && errno == EINTR);

	SAFE_FREE(entry);

	if (wait_pid == -1)
		return -1;
	return wstatus;
}

/**************************************************************************
 Wrapper for Admin Logs.
****************************************************************************/

 void sys_adminlog(int priority, const char *format_str, ...) 
{
	va_list ap;
	int ret;
	char *msgbuf = NULL;

	va_start( ap, format_str );
	ret = vasprintf( &msgbuf, format_str, ap );
	va_end( ap );

	if (ret == -1)
		return;

#if defined(HAVE_SYSLOG)
	syslog( priority, "%s", msgbuf );
#else
	DEBUG(0,("%s", msgbuf ));
#endif
	SAFE_FREE(msgbuf);
}

/******** Solaris EA helper function prototypes ********/
#ifdef HAVE_ATTROPEN
#define SOLARIS_ATTRMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP
static int solaris_write_xattr(int attrfd, const char *value, size_t size);
static ssize_t solaris_read_xattr(int attrfd, void *value, size_t size);
static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size);
static int solaris_unlinkat(int attrdirfd, const char *name);
static int solaris_attropen(const char *path, const char *attrpath, int oflag, mode_t mode);
static int solaris_openat(int fildes, const char *path, int oflag, mode_t mode);
#endif

/**************************************************************************
 Wrappers for extented attribute calls. Based on the Linux package with
 support for IRIX and (Net|Free)BSD also. Expand as other systems have them.
****************************************************************************/

ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size)
{
#if defined(HAVE_GETXATTR)
#ifndef XATTR_ADD_OPT
	return getxattr(path, name, value, size);
#else
	int options = 0;
	return getxattr(path, name, value, size, 0, options);
#endif
#elif defined(HAVE_GETEA)
	return getea(path, name, value, size);
#elif defined(HAVE_EXTATTR_GET_FILE)
	char *s;
	ssize_t retval;
	int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
		EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
	const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
	/*
	 * The BSD implementation has a nasty habit of silently truncating
	 * the returned value to the size of the buffer, so we have to check
	 * that the buffer is large enough to fit the returned value.
	 */
	if((retval=extattr_get_file(path, attrnamespace, attrname, NULL, 0)) >= 0) {
		if(retval > size) {
			errno = ERANGE;
			return -1;
		}
		if((retval=extattr_get_file(path, attrnamespace, attrname, value, size)) >= 0)
			return retval;
	}

	DEBUG(10,("sys_getxattr: extattr_get_file() failed with: %s\n", strerror(errno)));
	return -1;
#elif defined(HAVE_ATTR_GET)
	int retval, flags = 0;
	int valuelength = (int)size;
	char *attrname = strchr(name,'.') + 1;

	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;

	retval = attr_get(path, attrname, (char *)value, &valuelength, flags);

	return retval ? retval : valuelength;
#elif defined(HAVE_ATTROPEN)
	ssize_t ret = -1;
	int attrfd = solaris_attropen(path, name, O_RDONLY, 0);
	if (attrfd >= 0) {
		ret = solaris_read_xattr(attrfd, value, size);
		close(attrfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}

ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size)
{
#if defined(HAVE_LGETXATTR)
	return lgetxattr(path, name, value, size);
#elif defined(HAVE_GETXATTR) && defined(XATTR_ADD_OPT)
	int options = XATTR_NOFOLLOW;
	return getxattr(path, name, value, size, 0, options);
#elif defined(HAVE_LGETEA)
	return lgetea(path, name, value, size);
#elif defined(HAVE_EXTATTR_GET_LINK)
	char *s;
	ssize_t retval;
	int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
		EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
	const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;

	if((retval=extattr_get_link(path, attrnamespace, attrname, NULL, 0)) >= 0) {
		if(retval > size) {
			errno = ERANGE;
			return -1;
		}
		if((retval=extattr_get_link(path, attrnamespace, attrname, value, size)) >= 0)
			return retval;
	}

	DEBUG(10,("sys_lgetxattr: extattr_get_link() failed with: %s\n", strerror(errno)));
	return -1;
#elif defined(HAVE_ATTR_GET)
	int retval, flags = ATTR_DONTFOLLOW;
	int valuelength = (int)size;
	char *attrname = strchr(name,'.') + 1;

	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;

	retval = attr_get(path, attrname, (char *)value, &valuelength, flags);

	return retval ? retval : valuelength;
#elif defined(HAVE_ATTROPEN)
	ssize_t ret = -1;
	int attrfd = solaris_attropen(path, name, O_RDONLY|AT_SYMLINK_NOFOLLOW, 0);
	if (attrfd >= 0) {
		ret = solaris_read_xattr(attrfd, value, size);
		close(attrfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}

ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size)
{
#if defined(HAVE_FGETXATTR)
#ifndef XATTR_ADD_OPT
	return fgetxattr(filedes, name, value, size);
#else
	int options = 0;
	return fgetxattr(filedes, name, value, size, 0, options);
#endif
#elif defined(HAVE_FGETEA)
	return fgetea(filedes, name, value, size);
#elif defined(HAVE_EXTATTR_GET_FD)
	char *s;
	ssize_t retval;
	int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
		EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
	const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;

	if((retval=extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0)) >= 0) {
		if(retval > size) {
			errno = ERANGE;
			return -1;
		}
		if((retval=extattr_get_fd(filedes, attrnamespace, attrname, value, size)) >= 0)
			return retval;
	}

	DEBUG(10,("sys_fgetxattr: extattr_get_fd() failed with: %s\n", strerror(errno)));
	return -1;
#elif defined(HAVE_ATTR_GETF)
	int retval, flags = 0;
	int valuelength = (int)size;
	char *attrname = strchr(name,'.') + 1;

	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;

	retval = attr_getf(filedes, attrname, (char *)value, &valuelength, flags);

	return retval ? retval : valuelength;
#elif defined(HAVE_ATTROPEN)
	ssize_t ret = -1;
	int attrfd = solaris_openat(filedes, name, O_RDONLY|O_XATTR, 0);
	if (attrfd >= 0) {
		ret = solaris_read_xattr(attrfd, value, size);
		close(attrfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}

#if defined(HAVE_EXTATTR_LIST_FILE)

#define EXTATTR_PREFIX(s)	(s), (sizeof((s))-1)

static struct {
        int space;
	const char *name;
	size_t len;
} 
extattr[] = {
	{ EXTATTR_NAMESPACE_SYSTEM, EXTATTR_PREFIX("system.") },
        { EXTATTR_NAMESPACE_USER, EXTATTR_PREFIX("user.") },
};

typedef union {
	const char *path;
	int filedes;
} extattr_arg;

static ssize_t bsd_attr_list (int type, extattr_arg arg, char *list, size_t size)
{
	ssize_t list_size, total_size = 0;
	int i, t, len;
	char *buf;
	/* Iterate through extattr(2) namespaces */
	for(t = 0; t < (sizeof(extattr)/sizeof(extattr[0])); t++) {
		switch(type) {
#if defined(HAVE_EXTATTR_LIST_FILE)
			case 0:
				list_size = extattr_list_file(arg.path, extattr[t].space, list, size);
				break;
#endif
#if defined(HAVE_EXTATTR_LIST_LINK)
			case 1:
				list_size = extattr_list_link(arg.path, extattr[t].space, list, size);
				break;
#endif
#if defined(HAVE_EXTATTR_LIST_FD)
			case 2:
				list_size = extattr_list_fd(arg.filedes, extattr[t].space, list, size);
				break;
#endif
			default:
				errno = ENOSYS;
				return -1;
		}
		/* Some error happend. Errno should be set by the previous call */
		if(list_size < 0)
			return -1;
		/* No attributes */
		if(list_size == 0)
			continue;
		/* XXX: Call with an empty buffer may be used to calculate
		   necessary buffer size. Unfortunately, we can't say, how
		   many attributes were returned, so here is the potential
		   problem with the emulation.
		*/
		if(list == NULL) {
			/* Take the worse case of one char attribute names - 
			   two bytes per name plus one more for sanity.
			*/
			total_size += list_size + (list_size/2 + 1)*extattr[t].len;
			continue;
		}
		/* Count necessary offset to fit namespace prefixes */
		len = 0;
		for(i = 0; i < list_size; i += list[i] + 1)
			len += extattr[t].len;

		total_size += list_size + len;
		/* Buffer is too small to fit the results */
		if(total_size > size) {
			errno = ERANGE;
			return -1;
		}
		/* Shift results back, so we can prepend prefixes */
		buf = memmove(list + len, list, list_size);

		for(i = 0; i < list_size; i += len + 1) {
			len = buf[i];
			strncpy(list, extattr[t].name, extattr[t].len + 1);
			list += extattr[t].len;
			strncpy(list, buf + i + 1, len);
			list[len] = '\0';
			list += len + 1;
		}
		size -= total_size;
	}
	return total_size;
}

#endif

#if defined(HAVE_ATTR_LIST) && defined(HAVE_SYS_ATTRIBUTES_H)
static char attr_buffer[ATTR_MAX_VALUELEN];

static ssize_t irix_attr_list(const char *path, int filedes, char *list, size_t size, int flags)
{
	int retval = 0, index;
	attrlist_cursor_t *cursor = 0;
	int total_size = 0;
	attrlist_t * al = (attrlist_t *)attr_buffer;
	attrlist_ent_t *ae;
	size_t ent_size, left = size;
	char *bp = list;

	while (True) {
	    if (filedes)
		retval = attr_listf(filedes, attr_buffer, ATTR_MAX_VALUELEN, flags, cursor);
	    else
		retval = attr_list(path, attr_buffer, ATTR_MAX_VALUELEN, flags, cursor);
	    if (retval) break;
	    for (index = 0; index < al->al_count; index++) {
		ae = ATTR_ENTRY(attr_buffer, index);
		ent_size = strlen(ae->a_name) + sizeof("user.");
		if (left >= ent_size) {
		    strncpy(bp, "user.", sizeof("user."));
		    strncat(bp, ae->a_name, ent_size - sizeof("user."));
		    bp += ent_size;
		    left -= ent_size;
		} else if (size) {
		    errno = ERANGE;
		    retval = -1;
		    break;
		}
		total_size += ent_size;
	    }
	    if (al->al_more == 0) break;
	}
	if (retval == 0) {
	    flags |= ATTR_ROOT;
	    cursor = 0;
	    while (True) {
		if (filedes)
		    retval = attr_listf(filedes, attr_buffer, ATTR_MAX_VALUELEN, flags, cursor);
		else
		    retval = attr_list(path, attr_buffer, ATTR_MAX_VALUELEN, flags, cursor);
		if (retval) break;
		for (index = 0; index < al->al_count; index++) {
		    ae = ATTR_ENTRY(attr_buffer, index);
		    ent_size = strlen(ae->a_name) + sizeof("system.");
		    if (left >= ent_size) {
			strncpy(bp, "system.", sizeof("system."));
			strncat(bp, ae->a_name, ent_size - sizeof("system."));
			bp += ent_size;
			left -= ent_size;
		    } else if (size) {
			errno = ERANGE;
			retval = -1;
			break;
		    }
		    total_size += ent_size;
		}
		if (al->al_more == 0) break;
	    }
	}
	return (ssize_t)(retval ? retval : total_size);
}

#endif

ssize_t sys_listxattr (const char *path, char *list, size_t size)
{
#if defined(HAVE_LISTXATTR)
#ifndef XATTR_ADD_OPT
	return listxattr(path, list, size);
#else
	int options = 0;
	return listxattr(path, list, size, options);
#endif
#elif defined(HAVE_LISTEA)
	return listea(path, list, size);
#elif defined(HAVE_EXTATTR_LIST_FILE)
	extattr_arg arg;
	arg.path = path;
	return bsd_attr_list(0, arg, list, size);
#elif defined(HAVE_ATTR_LIST) && defined(HAVE_SYS_ATTRIBUTES_H)
	return irix_attr_list(path, 0, list, size, 0);
#elif defined(HAVE_ATTROPEN)
	ssize_t ret = -1;
	int attrdirfd = solaris_attropen(path, ".", O_RDONLY, 0);
	if (attrdirfd >= 0) {
		ret = solaris_list_xattr(attrdirfd, list, size);
		close(attrdirfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}

ssize_t sys_llistxattr (const char *path, char *list, size_t size)
{
#if defined(HAVE_LLISTXATTR)
	return llistxattr(path, list, size);
#elif defined(HAVE_LISTXATTR) && defined(XATTR_ADD_OPT)
	int options = XATTR_NOFOLLOW;
	return listxattr(path, list, size, options);
#elif defined(HAVE_LLISTEA)
	return llistea(path, list, size);
#elif defined(HAVE_EXTATTR_LIST_LINK)
	extattr_arg arg;
	arg.path = path;
	return bsd_attr_list(1, arg, list, size);
#elif defined(HAVE_ATTR_LIST) && defined(HAVE_SYS_ATTRIBUTES_H)
	return irix_attr_list(path, 0, list, size, ATTR_DONTFOLLOW);
#elif defined(HAVE_ATTROPEN)
	ssize_t ret = -1;
	int attrdirfd = solaris_attropen(path, ".", O_RDONLY|AT_SYMLINK_NOFOLLOW, 0);
	if (attrdirfd >= 0) {
		ret = solaris_list_xattr(attrdirfd, list, size);
		close(attrdirfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}

ssize_t sys_flistxattr (int filedes, char *list, size_t size)
{
#if defined(HAVE_FLISTXATTR)
#ifndef XATTR_ADD_OPT
	return flistxattr(filedes, list, size);
#else
	int options = 0;
	return flistxattr(filedes, list, size, options);
#endif
#elif defined(HAVE_FLISTEA)
	return flistea(filedes, list, size);
#elif defined(HAVE_EXTATTR_LIST_FD)
	extattr_arg arg;
	arg.filedes = filedes;
	return bsd_attr_list(2, arg, list, size);
#elif defined(HAVE_ATTR_LISTF)
	return irix_attr_list(NULL, filedes, list, size, 0);
#elif defined(HAVE_ATTROPEN)
	ssize_t ret = -1;
	int attrdirfd = solaris_openat(filedes, ".", O_RDONLY|O_XATTR, 0);
	if (attrdirfd >= 0) {
		ret = solaris_list_xattr(attrdirfd, list, size);
		close(attrdirfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}

int sys_removexattr (const char *path, const char *name)
{
#if defined(HAVE_REMOVEXATTR)
#ifndef XATTR_ADD_OPT
	return removexattr(path, name);
#else
	int options = 0;
	return removexattr(path, name, options);
#endif
#elif defined(HAVE_REMOVEEA)
	return removeea(path, name);
#elif defined(HAVE_EXTATTR_DELETE_FILE)
	char *s;
	int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
		EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
	const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;

	return extattr_delete_file(path, attrnamespace, attrname);
#elif defined(HAVE_ATTR_REMOVE)
	int flags = 0;
	char *attrname = strchr(name,'.') + 1;

	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;

	return attr_remove(path, attrname, flags);
#elif defined(HAVE_ATTROPEN)
	int ret = -1;
	int attrdirfd = solaris_attropen(path, ".", O_RDONLY, 0);
	if (attrdirfd >= 0) {
		ret = solaris_unlinkat(attrdirfd, name);
		close(attrdirfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}

int sys_lremovexattr (const char *path, const char *name)
{
#if defined(HAVE_LREMOVEXATTR)
	return lremovexattr(path, name);
#elif defined(HAVE_REMOVEXATTR) && defined(XATTR_ADD_OPT)
	int options = XATTR_NOFOLLOW;
	return removexattr(path, name, options);
#elif defined(HAVE_LREMOVEEA)
	return lremoveea(path, name);
#elif defined(HAVE_EXTATTR_DELETE_LINK)
	char *s;
	int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
		EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
	const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;

	return extattr_delete_link(path, attrnamespace, attrname);
#elif defined(HAVE_ATTR_REMOVE)
	int flags = ATTR_DONTFOLLOW;
	char *attrname = strchr(name,'.') + 1;

	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;

	return attr_remove(path, attrname, flags);
#elif defined(HAVE_ATTROPEN)
	int ret = -1;
	int attrdirfd = solaris_attropen(path, ".", O_RDONLY|AT_SYMLINK_NOFOLLOW, 0);
	if (attrdirfd >= 0) {
		ret = solaris_unlinkat(attrdirfd, name);
		close(attrdirfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}

int sys_fremovexattr (int filedes, const char *name)
{
#if defined(HAVE_FREMOVEXATTR)
#ifndef XATTR_ADD_OPT
	return fremovexattr(filedes, name);
#else
	int options = 0;
	return fremovexattr(filedes, name, options);
#endif
#elif defined(HAVE_FREMOVEEA)
	return fremoveea(filedes, name);
#elif defined(HAVE_EXTATTR_DELETE_FD)
	char *s;
	int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
		EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
	const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;

	return extattr_delete_fd(filedes, attrnamespace, attrname);
#elif defined(HAVE_ATTR_REMOVEF)
	int flags = 0;
	char *attrname = strchr(name,'.') + 1;

	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;

	return attr_removef(filedes, attrname, flags);
#elif defined(HAVE_ATTROPEN)
	int ret = -1;
	int attrdirfd = solaris_openat(filedes, ".", O_RDONLY|O_XATTR, 0);
	if (attrdirfd >= 0) {
		ret = solaris_unlinkat(attrdirfd, name);
		close(attrdirfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}

int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags)
{
#if defined(HAVE_SETXATTR)
#ifndef XATTR_ADD_OPT
	return setxattr(path, name, value, size, flags);
#else
	int options = 0;
	return setxattr(path, name, value, size, 0, options);
#endif
#elif defined(HAVE_SETEA)
	return setea(path, name, value, size, flags);
#elif defined(HAVE_EXTATTR_SET_FILE)
	char *s;
	int retval = 0;
	int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
		EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
	const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
	if (flags) {
		/* Check attribute existence */
		retval = extattr_get_file(path, attrnamespace, attrname, NULL, 0);
		if (retval < 0) {
			/* REPLACE attribute, that doesn't exist */
			if (flags & XATTR_REPLACE && errno == ENOATTR) {
				errno = ENOATTR;
				return -1;
			}
			/* Ignore other errors */
		}
		else {
			/* CREATE attribute, that already exists */
			if (flags & XATTR_CREATE) {
				errno = EEXIST;
				return -1;
			}
		}
	}
	retval = extattr_set_file(path, attrnamespace, attrname, value, size);
	return (retval < 0) ? -1 : 0;
#elif defined(HAVE_ATTR_SET)
	int myflags = 0;
	char *attrname = strchr(name,'.') + 1;

	if (strncmp(name, "system", 6) == 0) myflags |= ATTR_ROOT;
	if (flags & XATTR_CREATE) myflags |= ATTR_CREATE;
	if (flags & XATTR_REPLACE) myflags |= ATTR_REPLACE;

	return attr_set(path, attrname, (const char *)value, size, myflags);
#elif defined(HAVE_ATTROPEN)
	int ret = -1;
	int myflags = O_RDWR;
	int attrfd;
	if (flags & XATTR_CREATE) myflags |= O_EXCL;
	if (!(flags & XATTR_REPLACE)) myflags |= O_CREAT;
	attrfd = solaris_attropen(path, name, myflags, (mode_t) SOLARIS_ATTRMODE);
	if (attrfd >= 0) {
		ret = solaris_write_xattr(attrfd, value, size);
		close(attrfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}