Hex Artifact Content

Not logged in

Artifact 4ba5ee97ba871a5e4451f2f3ebecc413896af2a5:


0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  /***************
0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0a 2a 20 20 20 20 20  ********\.*     
0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0060: 20 20 20 20 20 20 20 20 20 20 20 77 69 6e 62 65             winbe
0070: 72 2e 64 20 20 20 20 20 20 20 20 20 20 20 20 20  r.d             
0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0090: 20 20 2a 0a 2a 20 20 20 20 20 20 20 20 20 20 20    *.*           
00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00d0: 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a 2a 20              *.* 
00e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00f0: 20 20 20 20 20 20 57 69 6e 64 6f 77 73 20 41 50        Windows AP
0100: 49 20 68 65 61 64 65 72 20 6d 6f 64 75 6c 65 20  I header module 
0110: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0120: 20 20 20 20 20 20 2a 0a 2a 20 20 20 20 20 20 20        *.*       
0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0170: 2a 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20  *.*             
0180: 20 20 20 20 54 72 61 6e 73 6c 61 74 65 64 20 66      Translated f
0190: 72 6f 6d 20 4d 69 6e 47 57 20 57 69 6e 64 6f 77  rom MinGW Window
01a0: 73 20 68 65 61 64 65 72 73 20 20 20 20 20 20 20  s headers       
01b0: 20 20 20 20 20 20 20 20 20 20 2a 0a 2a 20 20 20            *.*   
01c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
01d0: 20 20 20 20 20 20 20 20 62 79 20 53 74 65 77 61          by Stewa
01e0: 72 74 20 47 6f 72 64 6f 6e 20 20 20 20 20 20 20  rt Gordon       
01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0200: 20 20 20 20 2a 0a 2a 20 20 20 20 20 20 20 20 20      *.*         
0210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0230: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a                *.
0250: 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  *               
0260: 20 20 20 20 20 20 20 20 50 6c 61 63 65 64 20 69          Placed i
0270: 6e 74 6f 20 70 75 62 6c 69 63 20 64 6f 6d 61 69  nto public domai
0280: 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  n               
0290: 20 20 20 20 20 20 20 20 2a 0a 5c 2a 2a 2a 2a 2a          *.\*****
02a0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02b0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02c0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02d0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02e0: 2a 2a 2f 0a 6d 6f 64 75 6c 65 20 77 69 6e 33 32  **/.module win32
02f0: 2e 77 69 6e 62 65 72 3b 0a 0a 2f 2a 20 43 6f 6d  .winber;../* Com
0300: 6d 65 6e 74 20 66 72 6f 6d 20 4d 69 6e 47 57 0a  ment from MinGW.
0310: 20 20 77 69 6e 62 65 72 2e 68 20 2d 20 48 65 61    winber.h - Hea
0320: 64 65 72 20 66 69 6c 65 20 66 6f 72 20 74 68 65  der file for the
0330: 20 57 69 6e 64 6f 77 73 20 4c 44 41 50 20 42 61   Windows LDAP Ba
0340: 73 69 63 20 45 6e 63 6f 64 69 6e 67 20 52 75 6c  sic Encoding Rul
0350: 65 73 20 41 50 49 0a 0a 20 20 57 72 69 74 74 65  es API..  Writte
0360: 6e 20 62 79 20 46 69 6c 69 70 20 4e 61 76 61 72  n by Filip Navar
0370: 61 20 3c 78 6e 61 76 61 72 61 40 76 6f 6c 6e 79  a <xnavara@volny
0380: 2e 63 7a 3e 0a 0a 20 20 52 65 66 65 72 65 6e 63  .cz>..  Referenc
0390: 65 73 3a 0a 20 20 20 20 54 68 65 20 43 20 4c 44  es:.    The C LD
03a0: 41 50 20 41 70 70 6c 69 63 61 74 69 6f 6e 20 50  AP Application P
03b0: 72 6f 67 72 61 6d 20 49 6e 74 65 72 66 61 63 65  rogram Interface
03c0: 0a 20 20 20 20 68 74 74 70 3a 2f 2f 77 77 77 2e  .    http://www.
03d0: 77 61 74 65 72 73 70 72 69 6e 67 73 2e 6f 72 67  watersprings.org
03e0: 2f 70 75 62 2f 69 64 2f 64 72 61 66 74 2d 69 65  /pub/id/draft-ie
03f0: 74 66 2d 6c 64 61 70 65 78 74 2d 6c 64 61 70 2d  tf-ldapext-ldap-
0400: 63 2d 61 70 69 2d 30 35 2e 74 78 74 0a 0a 20 20  c-api-05.txt..  
0410: 20 20 4c 69 67 68 74 77 65 69 67 68 74 20 44 69    Lightweight Di
0420: 72 65 63 74 6f 72 79 20 41 63 63 65 73 73 20 50  rectory Access P
0430: 72 6f 74 6f 63 6f 6c 20 52 65 66 65 72 65 6e 63  rotocol Referenc
0440: 65 0a 20 20 20 20 68 74 74 70 3a 2f 2f 6d 73 64  e.    http://msd
0450: 6e 2e 6d 69 63 72 6f 73 6f 66 74 2e 63 6f 6d 2f  n.microsoft.com/
0460: 6c 69 62 72 61 72 79 2f 65 6e 2d 75 73 2f 6e 65  library/en-us/ne
0470: 74 64 69 72 2f 6c 64 61 70 2f 6c 64 61 70 5f 72  tdir/ldap/ldap_r
0480: 65 66 65 72 65 6e 63 65 2e 61 73 70 0a 0a 20 20  eference.asp..  
0490: 54 68 69 73 20 6c 69 62 72 61 72 79 20 69 73 20  This library is 
04a0: 64 69 73 74 72 69 62 75 74 65 64 20 69 6e 20 74  distributed in t
04b0: 68 65 20 68 6f 70 65 20 74 68 61 74 20 69 74 20  he hope that it 
04c0: 77 69 6c 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a  will be useful,.
04d0: 20 20 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e    but WITHOUT AN
04e0: 59 20 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68  Y WARRANTY; with
04f0: 6f 75 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70  out even the imp
0500: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66  lied warranty of
0510: 0a 20 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49  .  MERCHANTABILI
0520: 54 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f  TY or FITNESS FO
0530: 52 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50  R A PARTICULAR P
0540: 55 52 50 4f 53 45 2e 0a 20 2a 2f 0a 0a 20 69 6d  URPOSE.. */.. im
0550: 70 6f 72 74 20 77 69 6e 33 32 2e 62 61 73 65 74  port win32.baset
0560: 73 64 3b 0a 20 0a 2f 2a 20 4f 70 61 71 75 65 20  sd;. ./* Opaque 
0570: 73 74 72 75 63 74 75 72 65 0a 20 2a 09 68 74 74  structure. *.htt
0580: 70 3a 2f 2f 6d 73 64 6e 2e 6d 69 63 72 6f 73 6f  p://msdn.microso
0590: 66 74 2e 63 6f 6d 2f 6c 69 62 72 61 72 79 2f 65  ft.com/library/e
05a0: 6e 2d 75 73 2f 6c 64 61 70 2f 6c 64 61 70 2f 62  n-us/ldap/ldap/b
05b0: 65 72 65 6c 65 6d 65 6e 74 2e 61 73 70 0a 20 2a  erelement.asp. *
05c0: 2f 0a 73 74 72 75 63 74 20 42 65 72 45 6c 65 6d  /.struct BerElem
05d0: 65 6e 74 3b 0a 0a 61 6c 69 61 73 20 69 6e 74 20  ent;..alias int 
05e0: 62 65 72 5f 69 6e 74 5f 74 2c 20 62 65 72 5f 73  ber_int_t, ber_s
05f0: 6c 65 6e 5f 74 3b 0a 61 6c 69 61 73 20 75 69 6e  len_t;.alias uin
0600: 74 20 62 65 72 5f 75 69 6e 74 5f 74 2c 20 62 65  t ber_uint_t, be
0610: 72 5f 6c 65 6e 5f 74 2c 20 62 65 72 5f 74 61 67  r_len_t, ber_tag
0620: 5f 74 3b 0a 0a 61 6c 69 67 6e 28 34 29 3a 0a 73  _t;..align(4):.s
0630: 74 72 75 63 74 20 42 65 72 56 61 6c 75 65 20 7b  truct BerValue {
0640: 0a 09 62 65 72 5f 6c 65 6e 5f 74 20 62 76 5f 6c  ..ber_len_t bv_l
0650: 65 6e 3b 0a 09 63 68 61 72 2a 20 20 20 20 20 62  en;..char*     b
0660: 76 5f 76 61 6c 3b 0a 7d 0a 61 6c 69 61 73 20 42  v_val;.}.alias B
0670: 65 72 56 61 6c 75 65 20 4c 44 41 50 5f 42 45 52  erValue LDAP_BER
0680: 56 41 4c 2c 20 42 45 52 56 41 4c 3b 0a 61 6c 69  VAL, BERVAL;.ali
0690: 61 73 20 42 65 72 56 61 6c 75 65 2a 20 50 4c 44  as BerValue* PLD
06a0: 41 50 5f 42 45 52 56 41 4c 2c 20 50 42 45 52 56  AP_BERVAL, PBERV
06b0: 41 4c 3b 0a 0a 63 6f 6e 73 74 20 62 65 72 5f 74  AL;..const ber_t
06c0: 61 67 5f 74 0a 09 4c 42 45 52 5f 45 52 52 4f 52  ag_t..LBER_ERROR
06d0: 20 20 20 3d 20 2d 31 2c 0a 09 4c 42 45 52 5f 44     = -1,..LBER_D
06e0: 45 46 41 55 4c 54 20 3d 20 2d 31 2c 0a 09 4c 42  EFAULT = -1,..LB
06f0: 45 52 5f 55 53 45 5f 44 45 52 20 3d 20 20 31 3b  ER_USE_DER =  1;
0700: 0a 0a 2f 2a 09 46 49 58 4d 45 3a 20 49 6e 20 4d  ../*.FIXME: In M
0710: 69 6e 47 57 2c 20 74 68 65 73 65 20 61 72 65 20  inGW, these are 
0720: 57 49 4e 42 45 52 41 50 49 20 3d 3d 20 44 45 43  WINBERAPI == DEC
0730: 4c 53 50 45 43 5f 49 4d 50 4f 52 54 2e 20 20 4c  LSPEC_IMPORT.  L
0740: 69 6e 6b 61 67 65 0a 20 2a 09 61 74 74 72 69 62  inkage. *.attrib
0750: 75 74 65 3f 0a 20 2a 2f 0a 65 78 74 65 72 6e 20  ute?. */.extern 
0760: 28 43 29 20 7b 0a 09 42 65 72 45 6c 65 6d 65 6e  (C) {..BerElemen
0770: 74 2a 20 62 65 72 5f 69 6e 69 74 28 43 50 74 72  t* ber_init(CPtr
0780: 21 28 42 65 72 56 61 6c 75 65 29 29 3b 0a 09 69  !(BerValue));..i
0790: 6e 74 20 62 65 72 5f 70 72 69 6e 74 66 28 42 65  nt ber_printf(Be
07a0: 72 45 6c 65 6d 65 6e 74 2a 2c 20 43 50 74 72 21  rElement*, CPtr!
07b0: 28 63 68 61 72 29 2c 20 2e 2e 2e 29 3b 0a 09 69  (char), ...);..i
07c0: 6e 74 20 62 65 72 5f 66 6c 61 74 74 65 6e 28 42  nt ber_flatten(B
07d0: 65 72 45 6c 65 6d 65 6e 74 2a 2c 20 42 65 72 56  erElement*, BerV
07e0: 61 6c 75 65 2a 2a 29 3b 0a 09 62 65 72 5f 74 61  alue**);..ber_ta
07f0: 67 5f 74 20 62 65 72 5f 73 63 61 6e 66 28 42 65  g_t ber_scanf(Be
0800: 72 45 6c 65 6d 65 6e 74 2a 2c 20 43 50 74 72 21  rElement*, CPtr!
0810: 28 63 68 61 72 29 2c 20 2e 2e 2e 29 3b 0a 09 62  (char), ...);..b
0820: 65 72 5f 74 61 67 5f 74 20 62 65 72 5f 70 65 65  er_tag_t ber_pee
0830: 6b 5f 74 61 67 28 42 65 72 45 6c 65 6d 65 6e 74  k_tag(BerElement
0840: 2a 2c 20 62 65 72 5f 6c 65 6e 5f 74 2a 29 3b 0a  *, ber_len_t*);.
0850: 09 62 65 72 5f 74 61 67 5f 74 20 62 65 72 5f 73  .ber_tag_t ber_s
0860: 6b 69 70 5f 74 61 67 28 42 65 72 45 6c 65 6d 65  kip_tag(BerEleme
0870: 6e 74 2a 2c 20 62 65 72 5f 6c 65 6e 5f 74 2a 29  nt*, ber_len_t*)
0880: 3b 0a 09 62 65 72 5f 74 61 67 5f 74 20 62 65 72  ;..ber_tag_t ber
0890: 5f 66 69 72 73 74 5f 65 6c 65 6d 65 6e 74 28 42  _first_element(B
08a0: 65 72 45 6c 65 6d 65 6e 74 2a 2c 20 62 65 72 5f  erElement*, ber_
08b0: 6c 65 6e 5f 74 2a 2c 20 63 68 61 72 2a 2a 29 3b  len_t*, char**);
08c0: 0a 09 62 65 72 5f 74 61 67 5f 74 20 62 65 72 5f  ..ber_tag_t ber_
08d0: 6e 65 78 74 5f 65 6c 65 6d 65 6e 74 28 42 65 72  next_element(Ber
08e0: 45 6c 65 6d 65 6e 74 2a 2c 20 62 65 72 5f 6c 65  Element*, ber_le
08f0: 6e 5f 74 2a 2c 20 63 68 61 72 2a 29 3b 0a 09 76  n_t*, char*);..v
0900: 6f 69 64 20 62 65 72 5f 62 76 66 72 65 65 28 42  oid ber_bvfree(B
0910: 65 72 56 61 6c 75 65 2a 29 3b 0a 09 76 6f 69 64  erValue*);..void
0920: 20 62 65 72 5f 62 76 65 63 66 72 65 65 28 42 65   ber_bvecfree(Be
0930: 72 56 61 6c 75 65 2a 2a 29 3b 0a 09 76 6f 69 64  rValue**);..void
0940: 20 62 65 72 5f 66 72 65 65 28 42 65 72 45 6c 65   ber_free(BerEle
0950: 6d 65 6e 74 2a 2c 20 69 6e 74 29 3b 0a 09 42 65  ment*, int);..Be
0960: 72 56 61 6c 75 65 2a 20 62 65 72 5f 62 76 64 75  rValue* ber_bvdu
0970: 70 28 42 65 72 56 61 6c 75 65 2a 29 3b 0a 09 42  p(BerValue*);..B
0980: 65 72 45 6c 65 6d 65 6e 74 2a 20 62 65 72 5f 61  erElement* ber_a
0990: 6c 6c 6f 63 5f 74 28 69 6e 74 29 3b 0a 7d 0a     lloc_t(int);.}.